0x0000000066E5377F (opencv_ffmpeg2410_64.dll) (ConsoleApplication3.exe 中)處有未經(jīng)處理的異常: 0xC0000005: 讀取位置 0x0000000000000000 時發(fā)生訪問沖突。#include "highgui.h"int main(int argc, char** argv){cvNamedWindow("Example2", CV_WINDOW_AUTOSIZE);CvCapture* capture = cvCreateFileCapture(argv[1]);IplImage* frame;while (1){frame = cvQueryFrame(capture);if (!frame) break;cvShowImage("Example2", frame);char c = cvWaitKey(33);if (c == 27) break;}cvReleaseCapture(&capture);cvDestroyWindow("Example2");}
1 回答

莫回?zé)o
TA貢獻1865條經(jīng)驗 獲得超7個贊
CvCapture* capture = cvCreateFileCapture(argv[1]);表示從命令行執(zhí)行函數(shù)并要輸入一個參數(shù)來指定視頻所在的位置及名稱。
出現(xiàn)這種錯誤應(yīng)該是沒在命令行下執(zhí)行函數(shù),導(dǎo)致capture 為一個空指針,后面才出現(xiàn)了訪問NULL指針的錯誤。
一般情況下要做出錯處理檢查capture是否為一個有效指針。
if(!capture )
{
printf("loading video failed!\n");
return -1;
}
- 1 回答
- 0 關(guān)注
- 1644 瀏覽
添加回答
舉報
0/150
提交
取消