I am interested in reading the rgb data of a raw image using python. I would like to analyze the rgb of the RAW image with NO filtering and processing done by the DSLR. How would you recommend proceeding? What library etc.? Storing as a numpy array, if possible would be advantageous, I believe. Using openCV was my initial idea, do you recommend anything else? Like I said, I want to analyze the image as RAW as possible, hence pre-color filter if possible. Thank you.
-
Note that if you're trying to get the image "as RAW as possible" then you won't be getting an RGB data. You'd be getting a pre-bayer-moire RGBG stream. Is that what you want, or do you want the RGB data (post demosaicing, but before anything like White Balance has been calculated)? Also, do you want the "dead pixels" which many cameras include but clip off? Or the single-component bayer image?user1087001– user10870012015-07-04 23:06:14 +00:00Commented Jul 4, 2015 at 23:06
1 Answer
If you have the raw image ("my_picture.raw")? You could totally use OpenCV-Python to look at it.
raw_data = imread('my_picture.raw')
This should give you a numpy array of the pixels that your raw file contains.
Then, you can do some basic operations on the data (accessing pixels, doing object/feature recognition, etc.). There's a ton of detail on their website: https://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_core/py_basic_ops/py_basic_ops.html#basic-ops
If you don't have the raw image, then I'm not sure how to "undo" the processing of the DSLR, or if you can!
You don't have to use OpenCV, necessarily. If you have access to a Matlab license, you should check it out (easier to use IMO). Matlab has a very powerful set of image processing tools.