I have a basic question in regards to cvQueryFrame() in OpenCV.
I have the following code:
IplImage *frame1,*frame2;
frame1 = cvQueryFrame(capture
ok following from Laurent's answer: I believe the key is cvCloneImage(). cvCloneImage creates a new copy of the original image including the header, ROI, imageData etc. and then points frame2 to this new data.
Since cvQueryFrame is a wrapper for cvGrabFrame & cvRetrieveFrame together I didn't want to split up the functions, so with a small modification I can still use cvQueryFrame.
Below is my modified solution.
IplImage *frame = cvQueryFrame(capture); //to read properties of frame.
IplImage *frame2 = NULL;
while (1){
if(frame2)
frame = cvCloneImage(frame2); // copy image to allow grabbing next frame
frame2 = cvQueryFrame(capture); //read next frame
if(!frame2) break; //if frame cannot be read, EOF so break from loop
}
I hope you understand what I've done here. Feel free to ask any more questions.