关于” Assertion failed:src_picture->width%2== 0 && src——picture-》height%2== 0”的问题(还未决解)

在使用PyrSegmentation领域分割函数时出现的问题出现Assertionfailed:src_picture->width%2== 0 && src——picture-height%2== 0…….

还有提示:Thisapplication has requested the Runtime to terminate it in an lead the way. BothPlease contact the application 's support team for more information. (PressRetry to debug the application)

 

经过多次尝试,发现输入的图像有些可以通过,有些却不能通过。(求高手解释,谢谢)


#include "stdafx.h"
#include"opencv2/opencv.hpp"
#include "legacy.hpp"

int _tmain(int argc, _TCHAR* argv[])
{
    cvNamedWindow("src");
    cvNamedWindow("PyrSegmentation");
	//加载图像
	IplImage* src_picture= cvLoadImage("F://Opencv_picture//2.jpg");
    IplImage* dst_picture= cvCreateImage(cvGetSize(src_picture), src_picture->depth, src_picture->nChannels);
	
     
	assert(src_picture->width%2 == 0 && src_picture->height%2 == 0);
	//分配内存
	CvMemStorage* storage= cvCreateMemStorage(0);
	if(!storage)
	{
	     printf("Storage Errors!\n");
	}

	 //分割部件的输出序列的指针
	CvSeq* comp= NULL;   
	 //建立金字塔的最大层数
	int levels =2;
	 //建立连接的错误阈值
	double threshold1= 150;
	 //分割簇的错误阈值
	double threshold2= 30;
     //金字塔图像分割
	cvPyrSegmentation(src_picture, dst_picture, storage, &comp, levels, threshold1, threshold2);

	cvShowImage("src", src_picture);
	cvShowImage("PyrSegmentation", dst_picture);

	cvWaitKey(0);
    
	cvReleaseImage(&src_picture);
	cvReleaseImage(&dst_picture);

	cvDestroyWindow("src");
	cvDestroyWindow("PyrSegMentation");
	return 0;
}

能通过的结果图



希望大牛们告诉我为什么有些图片(如下面的)不能通过?在这先谢谢啦^_^

     

这两图就是不能通过

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值