opencv程序错误:Microsoft C++ 异常: 内存位置 0x00d4f440 处的 cv::Exception。
#include"cv.h"#include"highgui.h"#include"ctype.h"#include"stdio.h"intmain(){IplImage...
#include"cv.h"
#include"highgui.h"
#include"ctype.h"
#include"stdio.h"
int main()
{
IplImage* laplace = 0;
IplImage* colorlaplace = 0;
IplImage* planes[3] = {0,0,0};
CvCapture* capture = 0;
capture = cvCaptureFromAVI("a.avi");
if(!capture)
{
fprintf(stderr,"Could not initialize capturing...\n");
return -1;
}
cvNamedWindow("Laplacian",0);
for(;;)
{
IplImage * frame = 0;
int i;
frame = cvQueryFrame(capture);
if(!frame)
break;
if(!laplace)
{
for(i=0;i<3;i++)
planes[i] = cvCreateImage(cvSize(frame->width,frame->height),8,1);
laplace = cvCreateImage(cvSize(frame->width,frame->height),IPL_DEPTH_16S,1);
colorlaplace = cvCreateImage(cvSize(frame->width,frame->height),8,3);
}
cvCvtPixToPlane(planes[0],planes[1],planes[2],0,colorlaplace);
colorlaplace->origin=frame->origin;
cvShowImage("Laplacian",colorlaplace);
if(cvWaitKey(10)>=0)
break;
}
cvReleaseCapture(&capture);
cvDestroyWindow("Laplacian");
return 0;
}
程序有什么问题?求大神解释 展开
#include"highgui.h"
#include"ctype.h"
#include"stdio.h"
int main()
{
IplImage* laplace = 0;
IplImage* colorlaplace = 0;
IplImage* planes[3] = {0,0,0};
CvCapture* capture = 0;
capture = cvCaptureFromAVI("a.avi");
if(!capture)
{
fprintf(stderr,"Could not initialize capturing...\n");
return -1;
}
cvNamedWindow("Laplacian",0);
for(;;)
{
IplImage * frame = 0;
int i;
frame = cvQueryFrame(capture);
if(!frame)
break;
if(!laplace)
{
for(i=0;i<3;i++)
planes[i] = cvCreateImage(cvSize(frame->width,frame->height),8,1);
laplace = cvCreateImage(cvSize(frame->width,frame->height),IPL_DEPTH_16S,1);
colorlaplace = cvCreateImage(cvSize(frame->width,frame->height),8,3);
}
cvCvtPixToPlane(planes[0],planes[1],planes[2],0,colorlaplace);
colorlaplace->origin=frame->origin;
cvShowImage("Laplacian",colorlaplace);
if(cvWaitKey(10)>=0)
break;
}
cvReleaseCapture(&capture);
cvDestroyWindow("Laplacian");
return 0;
}
程序有什么问题?求大神解释 展开
3个回答
展开全部
你看看你的图片和工程是不是在同一个文件夹里
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
若没进前面的if(!laplace)
colorlaplace->origin这个可能没分配到内存。
colorlaplace->origin这个可能没分配到内存。
更多追问追答
追问
没听明白!
追答
colorlaplace这个指针没分配内存吧
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询