darktable-org / darktable

darktable is an open source photography workflow application and raw developer
https://www.darktable.org
GNU General Public License v3.0
9.52k stars 1.12k forks source link

Raspberry Pi HQ Camera RAW Support #6998

Open dustinkerstein opened 3 years ago

dustinkerstein commented 3 years ago

It'd be great to see Darktable support the new Raspberry Pi HQ camera's hybrid JPEG/RAW format. For the first time Raspberry included an interchangeable C/CS mount, and the Sony IMX477 is a significant step-up compared to their previous cameras. Darktable already does a great job with the converted DNG from PyDNG - which converts the RAW embedded in the somewhat unique hybrid JPEG/RAW captured by raspistill and picamera (note that picamera's documentation about the bayer data doesn't include info pertinent to the IMX477). While the PyDng -> Darktable workflow is quite solid, it would be awesome if Darktable could directly use the hybrid JPEG/RAW file.

I've uploaded both the original hybrid JPEG/RAW and a resulting DNG that was converted via PyDNG to https://raw.pixls.us, and will also be creating a noise profile / feature request later tonight based on the converted PyDNG files. Let me know if you need any further photos or details. Thanks!

X-Ref: https://github.com/darktable-org/darktable/issues/6998 https://github.com/schoolpost/PyDNG/issues/30 https://github.com/waveform80/picamera/issues/657 https://github.com/raspberrypi/documentation/issues/1741 X-Ref: https://www.raspberrypi.org/forums/viewtopic.php?f=43&t=291913

LebedevRI commented 3 years ago

Thank you for the samples, verified RPU uploads.

Is that the only possible camera for Pi that can produce raws? If not, it would be good to have samples from others.

LebedevRI commented 3 years ago

I.e. we'd need samples for each one of https://github.com/schoolpost/PyDNG/blob/master/src/pydng/core.py#L44-L58

dustinkerstein commented 3 years ago

I believe all of the Pi cameras can produce raw files, but I personally only have access to the latest HQ IMX477 camera. I can ask some other folks on the Pi forum to upload samples, but is it possible to start with the IMX477 and add the additional ones as people upload? I could ask folks to post in this ticket (with the title renamed) after uploading the other camera files. Would that be helpful, or should they create new tickets?

LebedevRI commented 3 years ago

In this case, i'd highly prefer to have every sample available beforehand.

LebedevRI commented 3 years ago

@dustinkerstein it might be helpful if you would post a similar request to the appropriate forums.

dustinkerstein commented 3 years ago

K, I'll do that now.

dustinkerstein commented 3 years ago

I've gone ahead and created a post on the Pi forums asking for RAW uploads for the V1 and V2 cameras.

I also uploaded a new set of photos to https://raw.pixls.us which contain hybrid JPEG/RAW and converted DNG from both raspistill and picamera using the same exposure settings. The previous upload only had raspistill. Interestingly the JPEG preview of raspistill and picamera have slightly different exposure/color, even though the converted DNG's appear to be equivalent. I wasn't sure if Darktable needs output from both programs as it's possible they are doing something slightly different with the hybrid JPEG/RAW file format.

I'll post an update here once anyone adds an upload via the Pi forum post.

PS - I made a small error in the comment field of the upload for pi_hq_picamera.raw - The comment should read Pi HQ Camera captured via picamera and renamed from .jpg to .raw. You may also want to remove the original pi.raw and pi.dng files as the new uploads are more comprehensive and were taken during the same session (framing, exposure, etc.)

dustinkerstein commented 3 years ago

FYI, the new shots above are about 0.5 stops overexposed (but no clipping) based on the sRGB values of the white and black swatches. Let me know if you need a more exact exposure.

dustinkerstein commented 3 years ago

I managed to get ahold of Pi v1.3 and v2.1 cameras and have now uploaded their respective hybrid JPEG/RAW files to https://raw.pixls.us - Let me know if you need anything else. Thanks!

LebedevRI commented 3 years ago

Thank you. Validated all the uploads to RPU with Make=RaspberryPi.

From https://github.com/schoolpost/PyDNG/blob/master/src/pydng/core.py#L47, we seem to be missing "RP_testc": "Raspberry Pi High Quality Camera", and "imx477": "Raspberry Pi High Quality Camera",. Is the latter different from "RP_imx477": "Raspberry Pi High Quality Camera",? Is former a placeholder?

dustinkerstein commented 3 years ago

@LebedevRI I believe those both were early internal test versions of the Pi HQ camera. It's probably safe to assume they are both identical to "RP_imx477": "Raspberry Pi High Quality Camera"

dustinkerstein commented 3 years ago

FYI, I just uploaded 2 additional hybrid JPEG/RAW photos, both captured with picamera. The original v1 and v2 uploads are from raspistill. Apologies for the different cropping, exposure, and white balance. I hope that's ok. Note that the file sizes differ between the picamera and raspisitll uploads. I believe that is probably due to JPEG embed. I don't think you'll need to handle picamera/raspistill differently, but I figured it would be worth having the sample files just in case.

github-actions[bot] commented 3 years ago

This issue did not get any activity in the past 30 days and will be closed in 365 days if no update occurs. Please check if the master branch has fixed it and report again or close the issue.