1

I acquired a set of images with the command raspistill -r -ss 100000 -o image.jpg, and I'd like to process the 'JPEG+RAW' images, which I already obtained, with OpenCV on python. I am aware of discussions such as this one, but I was wandering if there is a simple script to get the image in numpy array form in a direct way.

1

My team just released a library for this:

https://github.com/OsmoSystems/picamraw/

Example usage:

from picamraw import PiRawBayer, PiCameraVersion

raw_bayer = PiRawBayer(
    filepath='/path/to/image.jpeg',  # your JPEG+RAW file
    camera_version=PiCameraVersion.V2,
)

raw_bayer.to_rgb()  # Numpy array that you can feed to OpenCV, pyplot.imshow(), etc.

Note: the conversion from RAW to RGB is actually not trivial. Our implementation is as straightforward as possible (with the aim of being true to the RAW data as much as possible) but there are much more complex demosaicing algorithms which may be what you want depending on your use case.

  • Thank you, in the end I did use 6by9's modified dcraw to extract tiffs (github.com/6by9/dcraw), this seems simpler and faster, I will try it out. – Eggman Dec 6 '18 at 8:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.