我正在尝试让视频循环播放。我想检查它是否到达了视频的结尾,以便我可以重新实例化它;我如何让它循环?
VideoStream::VideoStream(Filters* f, char* fileNam):
filter(f),
fileName(fileNam){
TestON = true;
cap = new VideoCapture(fileNam);
};
void VideoStream::readFrame(){
if(!cap->isOpened()) // check if we succeeded
cerr<<"cannot open video file";
if(cap->get(CV_CAP_PROP_POS_AVI_RATIO==1)){
cap = new VideoCapture(fileName);
}
Mat image;
cap->read(image);
if(!image.empty())
imshow("haha", image);
waitKey(1);
image.release();
};