2 qq 25379149 qq_25379149 于 2016.03.28 14:35 提问

opencv调用函数进行阈值二值化为什么会出现中断错误

#include "cv.h"
#include
#include "highgui.h"

IplImage Thres(IplImage src);

int main(int argc, char** argv)
{

IplImage* i; 
IplImage* ii;

i=cvLoadImage("D:\\ceshi.jpg");

ii = Thres(i);

cvNamedWindow("1",CV_WINDOW_AUTOSIZE);
cvNamedWindow("2",CV_WINDOW_AUTOSIZE);
cvShowImage("1",i );
cvShowImage("2",ii);
cvWaitKey(0);

cvDestroyWindow( "1" );
cvDestroyWindow( "2" );
cvReleaseImage( &i); 
cvReleaseImage( &ii);
return 0;

}

IplImage Thres(IplImage src)
{
IplImage* dst;
IplImage* dst = cvCreateImage(cvGetSize(src),src->depth,1);
IplImage* gray;
cvCvtColor(src,dst,CV_RGB2GRAY);
cvThreshold(dst,gray,100,255,CV_THRESH_BINARY);

return gray;

}

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!