Gaurav Kalra
Gaurav Kalra

Reputation: 281

cvRetrieveFrame intricacies - openCV

The Documentation of OpenCV mentions that "the returned image (by cvRetrieveFrame) should not be released or modified by the user" ... Link: http://opencv.willowgarage.com/documentation/c/highgui_reading_and_writing_images_and_video.html#retrieveframe

I am trying to debug my code, which involves the following steps:

  1. Retrieve frame from video using cvRetrieveFrame()
  2. Do some processing on the frame
  3. output results

My instinct says that something is wrong with cvRetrieveFrame() because if I manually input frames using cvLoadImage, the program works fine. But I am not getting same results while using cvRetrieveFrame().

Since the documentation mentions such a restriction, any reason for such a restriction ? And, any alternatives ?

Have a great day

Upvotes: 2

Views: 1283

Answers (1)

Mario
Mario

Reputation: 1469

Before you call this function, you should have used another function which is cvGrabFrame() in order to be able to use the mentioned function, which you can use it for doing any necessary processing on the frame (such as the decompression stage in the codec) and then return an IplImage* pointer that points to another internal buff er (so do not rely on this image, because it will be overwritten the next time you call cvGrabFrame()).

Upvotes: 1

Related Questions