How to convert the SBGGR10_CSI2P raw from the 64MP Hawkeye camera to jpg or png?

I am trying to build a Raspberry Pi camera setup in which a program can be run that, when certain conditions are met, will take a burst of photos. I got this program working with Arducam’s 5MP autofocus camera, but that camera didn’t have nearly enough resolution for me, so when I heard of the 64MP Hawkeye camera, I jumped on the pre-order.

Then I got it and found out that the picamera module doesn’t support it and that I can only use it through the libcamera-apps programs. I quickly found out that libcamera-still will immediately save after taking the picture, which takes a couple seconds on the Pi 4, so that makes it unsuitable for taking a quick burst of images. I found that libcamera-raw could take a burst of photos, albeit unpredictably (the “–frames” argument appears to be ignored; either that or I somehow figured out how to override it by accident), but after spending about a week trying to figure out how to convert the resulting raw photos to jpg and not getting anywhere, this command isn’t helping either. It’s close, but if I can’t convert the raw files, it’s useless and I’ll need another approach.

I really need help. See “4. Instructions you have followed” below for what I’ve tried.

Help would be appreciated. Preferably in the form of tried and tested tools (no use reinventing the wheel), but I’ll take source code in a pinch (provided it works; everything I’ve tried hasn’t).

Q/A:

  1. Where did you get the camera module(s)?
    Arducam website (pre-order)

  2. Model number of the product(s)?
    This guy: Pi Hawk-eye: 64MP Ultra High-Res Camera for Raspberry Pi - Arducam
    Model number not on the web page or on the box it came in.

  3. What hardware/platform were you working on?
    Raspberry Pi 4B. I have a 2GB model and a 4GB model.

  4. Instructions you have followed. (link/manual/etc.)
    a. Online tools to convert RAW photos to jpg or png.
    b. Following online tutorials and experimenting with stackoverflow code in an attempt to de-mosaic the raw file.
    c. Experimenting with the code in the libcamera-apps repository for 6-8 hours before realizing that the compiled version doesn’t have the “–autofocus” option, which tells me that Arducam must have a private fork of the repository that I don’t have access to.
    d. The rawpy module. Note: Pip could not install via pypi, so I had to compile it from source. And in the end it didn’t recognize the raw format.
    e. Arducam’s own converter (github, ArduCAM/MIPI_Camera/blob/master/RPI/utils/mipi_raw10_to_jpg.py), which needed a little fixing in order to work with python3, but the jpg that it put out was heavily green tinted or purple tinted (depending on the bayer format option selected). I’m getting the impression that this tool (or maybe the opencv demosaicing) was not designed to work with the Quad Bayer Coding that’s used by the Hawkeye’s image sensor.

  5. Problems you were having?
    Can’t convert the SBGGR10_CSI2P raw file to a white-balanced jpg.

  6. The dmesg log from your hardware?
    No errors.

  7. Troubleshooting attempts you’ve made?
    See 4. Instructions you have followed

  8. What help do you need?
    Need a tool to convert the SBGGR10_CSI2P raw file produced by the 64MP Hawkeye camera to jpg or png. It would be especially fantastic if this tool also added exif data for the Hawkeye camera. In a pinch, I’ll take code and build it myself, but I’ve been at this for a week and really need help.

Hi, @amdreallyfast

Sorry, this is not within our scope of work. You can refer to mipi_raw10_to_jpg.py program for modification.

In addition, you can also refer to the image conversion method in libcamera-apps: