您的位置:首页 > 大数据 > 人工智能

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

2013-09-26 13:07 363 查看
在使用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;
}


能通过的结果图





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


     


这两图就是不能通过
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  opencv PyrSegmentation