Strange encounter in the red channel/RPi HQ Camera

Thanks @cpixip @npiegdon

There is a key difference.
In a RGB led (narrow band leds) with monochrome sensor, the spectrum collected by each channel is set by the led.
In the RGB sensor and white LED, using different light settings for each RGB sensor channel, the spectrum collected by each channel is set by the sensor-channel filter (bayer filter).
Without opening the can of worms of the Backlight, there are some advantages/disadvantages to each.

The best of both worlds would be to have the library limit the range of the values to keep all generated colors within a standard gamut. he Picamera2 Library manual references “colour_space”. It indicates:

create_preview_configuration() and create_still_configuration() both
default to Sycc(). create_video_configuration() chooses Sycc() if the
main stream is using an RGB format. For YUV formats it will default to
Smpte170m() if the resolution is smaller than 1280x720, otherwise
Rec709().
For any raw stream, the colour space will always implicitly be the
image sensor’s native colour space.

Unarguably the dng file and the capture_raw may include non-valid colors.
However, I tried setting the main color space to Rec709, which according to libcamera:

const ColorSpace ColorSpace::Rec709 = {
	Primaries::Rec709,
	TransferFunction::Rec709,
	YcbcrEncoding::Rec709,
	Range::Limited
};

My expectation would be that having a limited range would avoid passing non-valid colors in the main stream. To test

# ColorSpace is not in picamera2, import from libcamera
from libcamera import ColorSpace

capture_config = pihqcam.create_preview_configuration(
    colour_space = ColorSpace.Rec709(),
    queue=False,
    main={"size": global_shape_main, "format": "RGB888"},
    buffer_count=1,
    raw={"format": "SRGGB12"},
    transform=Transform(hflip=True),
    )
pihqcam.configure(self.capture_config)

Libcamera allows for creating a combination of primaries, transfer fuction, YcBcR Enconding, and range, but my limited python knowhow could not come up with the syntax to do with libcamera2.

In summary, the DNG and raw captures would always have non-compliant colors. If/when color space is set, in theory, the main stream (and derived files like PNG or JPEG) should comply with the color space. Further test needed to see if the red anomalies can be addressed with a colour_space configuration.

Exactly. Additionally, every image pixel has -at the cost of resolution- has true component values.

With the startup color components predefined by the IR-and bayer filter.

Thanks for the tip on how to do something similar with the combination of DNG files and Resolve.

Agree. For me the next step is to do a waveform monitor of the raw capture.

1 Like