Reputation: 1573
I am capturing frames from a video source and want to output them as files in, for example, BMP format.
What I would like to know is a) is there built in functionality for this, and b) if not, how do I get the RGB values for each of the pixels in each frame represented by a Mat object?
Thanks in advance for your help.
Upvotes: 0
Views: 1827
Reputation: 56905
a) See imwrite
(on the same page of the documentation as the video capture stuff)
b) If you do want to get RGB values from a Mat object, see the Mat documentation, which discusses element access in detail - in summary, M.at<datatype>(i,j)
or M.data[ M.step[0]*i + M.step[1]*j ]
-- the latter may differ depending on your version of OpenCV, consult the corresponding documentation page.
Upvotes: 2