Reputation: 48966
In the Learning OpenCV
book, it the following is mentioned about this statement:
CvCapture* capture = cvCreateFileCapture(argv[1]);
The function
cvCreateFileCapture()
takes as its argument the name of the AVI file to be loaded and then returns a pointer to aCvCapture
structure.
Can you just explain the sentence: "then returns a pointer to a CvCapture
structure"?
Upvotes: 0
Views: 3894
Reputation: 45968
It just allocates a new CvCapture
structure and returns a pointer to this structure. You don't really access the fields of this structure but pass the pointer to other functions that work on the file capture, like cvQueryFrame
or cvSetCaptureProperty
. And don't forget to free the resources with cvReleaseCapture
when you're done with the file.
This shouldn't be too hard to understand with some basic C-knowledge, especially with respect that many OpenCV function work this way.
By the way, as your question is tagged C++, consider using the C++-interface of OpenCV, which abstracts many of those things away. Although there is no real book for it, only for the C-interface.
Upvotes: 2