How can I access the pixels of a JPEG image as a 3D array like in MATLAB?

I want to process an image in C ++. How can I access a 3D array representing a JPEG image as done in MATLAB?

+2


source to share


2 answers


I would suggest using OpenCV for the task; The C ++ documentation is available here . The appropriate (I suppose) data structure you should be using is the Point3_ class , which represents a 3D point in the image.



+5


source


Well, I've never used MATLAB for such a task, but in C ++ you will need a JPEG loader library like OpenIL or FreeImage . They will allow you to access the image as arrays of bytes.

The FreeImage function FreeImage_GetBits

has a detailed example in the documentation on how to access data per channel per channel.



By the way, if you are planning on processing images in C / C ++, I would suggest you check the Insight Segmentation and Registration Toolkit and OpenCV .

+3


source







All Articles