Strange encounter in the red channel/RPi HQ Camera

Continuing with the RPi HQ red channel…

As Rolf @cpixit pointed out, these unusual encounters appear in very different setups.
Being able to create the banding in the above experiment, my next step was trying to determine the source.

To frame the experiment, I have been working with the HQ in what I would call raw-raw-binned, meaning that I use the picamera2 function

raw_frame_16[:]= (self.pihqcam.capture_array("raw").view(np.uint16)) #LS12BIT

The resulting array is 4064 x 3040, in the form of provided by the raw format SRGGB12, and it is not affected by the color processing pipeline of the picamera2. In other words, the setting Red and Blue Digital gains “ColourGains” have no effect in the output data.

The raw Bayer color pixels are then binned into a 2032x1520x3 RGB image, where G = Bayer G1 + Bayer G2. The image is saved to a 16-bit TIFF using python tifffile library.

Unlike the DNG, there is no color information other than the raw quantization binned into the array. Another important differentiation is that there is no subtraction or removal of the black offset present at the sensor, and also that it is a linear image, there is no gamma correction.

Another component of the experiment is that the white LED power is a constant-current source driven by a 16bit DAC. That component was key to adjust the light to only slightly lift the level of the sensor above the clipping.

Experiment
Set the light and exposure for the banding demonstrated above with the normal libcamera2 DNG pipeline, and capture a DNG with the banding.
Then, using the same light and exposure, capture a 16bit TIFF via the raw-raw-binned processing pipeline, and completely disregard the picamera2 color processing.

Results
It was possible to reproduce issue in the DNG file.


Using the same light and exposure, the raw-raw-binned TIFF is remarkably flat.

Almost too flat, and with dramatically less noise (see waveform) than the DNG. In both files the black slider was left at zero.

I also would like to see how these would be in Resolve. The project setup is as follows:


In the Color Tab, Maximum Gain (16.0) and Minimum Lift (-1.0) in all channels, and adjust the offset to bring all three channels to dark levels.


Voilá! bands! Very faint, but there.

What follows is a bit surprising to me. If one adjust the saturation to 100.00, they would be a bit more visible.


Lastly, if one adjusts the Color Boost, we get the familiar look.

I would point out that the amount of gain necessary to bring these up is massive, compared to what we see in the DNG.

I did notice that the amount of light is so little that one cannot see the light/lens defects, it is almost like a bias level to the sensor. To test what would it look with a slightly higher light input, here is another capture with raw-raw-binned TIFF.


With slightly more light, the lens defects are visible, and the color levels are not equal (as expected from the binning). It is safe to say that we are -slightly- above the black clipping level. Notice that the black slider had to be adjusted to bring the levels down.
Now the same above file to Resolve.

Notice that to obtain the image, I set lift and Offset to minimums, and adjusted gain to bring the levels within the range. On this one, I could not touch the Color Boost, doing so would result in a flat green.

Conclusions
The results are consistent with the banding pattern source being the mechanism for black-clipping at the sensor.
The banding obtained using the alternative processing path of raw-raw-binned 16bit tiff required extreme settings of gain in Resolve and produced quantifiably less intense banding.
One hint was that, under these extreme gain-lift-offset settings, a slight use of the ColorBoost setting would burst the TIFF color banding similarly to the typical results with the DNG.

Unsolved
While this appears to confirm that the root cause of the banding is the sensor, it left unclear why/how the picamera2 processing pipeline makes it so much worst. The gain settings of the picamera2 (ColourGains) are an order of magnitude lower than the experimented setup with the color-tab gains in Resolve.

The files used above, and the reference screen-shots were uploaded here, in the event that someone wishes to experiment. The LXXXX corresponds to the DAC LED setup for the capture.

4 Likes