嘿,我想當前幀以前,(附代碼)的代碼之間做減法運行,但我得到沒有結果,我在命令提示符下得到了錯誤的錯誤和灰色窗口:減法幀OpenCV的
編譯器沒有調整堆棧變量。 Libavcodec已被編譯錯誤,可能非常緩慢或崩潰。這不是libavcodec中的錯誤,而是編譯器中的錯誤。您可以嘗試使用gcc> = 4.2進行重新編譯。不要向FFmpeg開發人員報告崩潰。 OpenCV錯誤:斷言失敗(src1.size()== dst.size()& & src1.type()== dst。type())in unknown function,file ........ \ ocv \ opencv \ src \ cxcore \ cxarithm.cpp,行1563.
有人有想法嗎?請你的幫助!謝謝
int main()
{
int key = 0;
CvCapture* capture = cvCaptureFromAVI("macroblock.mpg");
IplImage* frame = cvQueryFrame(capture);
IplImage* currframe = cvCreateImage(cvGetSize(frame),IPL_DEPTH_8U,1);
IplImage* destframe = cvCreateImage(cvGetSize(frame),IPL_DEPTH_8U,1);
if (!capture)
{
fprintf(stderr, "Cannot open AVI!\n");
return 1;
}
int fps = (int)cvGetCaptureProperty(capture, CV_CAP_PROP_FPS);
cvNamedWindow("dest", CV_WINDOW_AUTOSIZE);
while(key != 'x')
{
frame = cvQueryFrame(capture);
currframe = cvCloneImage(frame);// copy frame to current
frame = cvQueryFrame(capture);// grab frame
cvSub(frame,currframe,destframe);// subtraction between the last frame to cur
if(key==27)break;
cvShowImage("dest",destframe);
key = cvWaitKey(1000/fps);
}
cvDestroyWindow("dest");
cvReleaseCapture(&capture);
return 0;
}
非常感謝你! – 2012-04-05 11:57:35