Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Capturing a frame in a double while loop

Hi! I have a problem with something like this. The case is that if i > a && i < b (it is just an example, the whole thing is a bit more complex) I need my function to still capture frames but use static variables from //do something1. Unfortunately, whenever this second while loop starts, I get an error saying that the frame object is empty - nothing has been captured. Any idea how to solve it? Cheers.

int i = 0;    
while(cap.isOpened())
    {
        cap >> frame;
        //do something1

        while (i > a && i < b) //for a < b
            {
                 cap >> frame;
                //do something
            }
    ++i;
    }