c++ - How to tell if video reached end in opencv? -


i trying video play in loop. want check if reached end of video can reinstantiate it; how make loop?

 videostream::videostream(filters* f, char* filenam):             filter(f),             filename(filenam){     teston = true;     cap = new videocapture(filenam); };   void videostream::readframe(){     if(!cap->isopened())  // check if 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(); }; 

videocapture::read() returns boolean. if false means camera has been disconnected or there no more frames in video file.


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -