我现在正在 OpenCV 中尝试 BackgroundSubtractorMOG 和 BackgroundSubtractorMOG2,我想尝试 jpg 图像序列作为我的帧源
frame = imread("C:\images\001-capture.jpg");
if(!frame.data){
//error in opening the first image
cerr << "Unable to open first image frame: " << fistFrameFilename << endl;
//exit(EXIT_FAILURE);
}
还因为当我使用 VideoCapture 访问我的 .avi 视频剪辑时出现错误。
VideoCapture capture("C:\movie1.avi");
if(!capture.isOpened()){
//error in opening the video input
cerr << "Unable to open video file: " << videoFilename << endl;
exit(EXIT_FAILURE);
}
//read input data. ESC or 'q' for quitting
while( (char)keyboard != 'q' && (char)keyboard != 27 ){
//read the current frame
if(!capture.read(frame)) {
cerr << "Unable to read next frame." << endl;
cerr << "Exiting..." << endl;
exit(EXIT_FAILURE);
}