How to read all frame in a video without use VideoCapture function in opencv?
hi.I'm beginner in OpenCV and c++.I use below code for video capturing and read a video Which is received from my webcam .I want to use a for loop for read all frame in video(use imread function and for loop ).but I have no idea.can you help me to do this?thanks a lot...
int main(int argc, char* argv[])
{
VideoCapture cap(0);
if (!cap.isOpened())
{
cout << "Cannot open the video cam" << endl;
return 0;
}
while (1)
{
bool bSuccess = cap.read(frame); // read a new frame from video
if (!bSuccess)
{
cout << "Cannot read a frame from video stream" << endl;
break;
}
GaussianBlur(frame, frame, Size(5, 5), 0);
imshow("Image", frame);}
return o;}
what is your question? maybe have a look at: http://answers.opencv.org/question/1/...
can it be, you don't want to get images from you webcam now, but from a video file (like an .avi, or a sequence of images on disk) ?
@berak I want to get image from my webcam .can I use a LOOP for display all frame One by one؟
sorry, no idea. what you're trying to say ;(
@berak can i display all frame with another way(except video capture)?
@berak can i display all frame with another way(except video capture)?
the VideoCapture class is the tool to get images from the webcam. so why do you want to avoid it ?
(it does not make any sense)
if you would like to step frame by frame through a video you can use cv::waitKey(0)
if cv::waitKey(0) & 0xEFFFFF) == 27) break; else read next frame