Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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;}