简体   繁体   中英

OpenCV: Convert Mat to 3D Image Array

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM