I want to process an image in C++. How can I access the 3D array representing the JPEG image as is done in MATLAB?
views:
157answers:
2
+3
A:
Well, I've never used MATLAB for such a task, but in C++ you will need some JPEG loader library like OpenIL or FreeImage. These will allow you to access the picture as byte arrays.
FreeImage's FreeImage_GetBits
function has a detailed example in the documentation on how to access per pixel per channel data.
BTW, if you plan to do image processing in C/C++, I'd suggest you to check out the Insight Segmentation and Registration Toolkit and OpenCV.
shinjin
2010-04-10 18:41:55
+4
A:
I'd suggest using OpenCV for the task; C++ documentation is available here. The relevant (I believe) data structure which you'd have to use is the Point3_ class, which represents a 3D point in the image.
welp
2010-04-10 18:47:31
I... don't think he's looking for computer vision. Or is OpenCV a good library just for decoding JPEG?
Matti Virkkunen
2010-04-10 18:54:25
OpenCV's a perfectly good library for decoding various image formats. I believe its cvLoadImage function is capable of opening the following image formats: BMP, DIB, JPEG, JPG, JPE, PNG, PBM, PGM, PPM, SR, RAS, TIFF, TIF.For what it's worth, Wikipedia states that OpenCV "focuses mainly on real-time image processing."
welp
2010-04-10 19:02:38
All right, it seems OpenCV comes up with a good set of image format decoders :)
Matti Virkkunen
2010-04-10 19:08:14