1

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.

1
  • 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? Commented Jul 4, 2015 at 23:06

1 Answer 1

0

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you for the response. I do have the .raw files but was concerned that there might still be some processing done by the camera even though they are .raw. Do you happen to know if that is the case?
I believe raw captures all of the raw sensor data that a DSLR has. It's practically undeveloped film that you can tweak and modify to your desires. You may want to confirm that with the spec sheet of your brand or an expert on DSLR technology, however!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.