SPRAD86 March 2023 AM62A3 , AM62A3-Q1 , AM62A7 , AM62A7-Q1 , AM68A , AM69A
For linear sensors including the IMX219, the black level or pedestal shall be subtracted from the raw image pixels before applying any gains (for example, gains for white balance) later in the ISP. Even though the pedestal value is coded in the sensor driver, it is always good to measure its actual value for each sensor working mode supported by the sensor driver. For example, the IMX219 camera has a measured black level around 63 in 10-bit mode (shown in the figure below) and 16 in 8-bit mode.
Follow these steps to tune Black Level Subtraction for the target sensor:
For WDR sensors, the black level subtraction is usually combined with WDR decompanding and re-compression to generate a single lookup table (LUT). This can be achieved by the "CFA + WDR" plugin in the tuning tool. Please refer to the user guide of the plugin for more details in case of a WDR sensor.
Once tuning for a plug-in is done, click the "Export DCC profile binary" button to generate the output XML files for this plugin. The XML files are located in folder ".plugoutdir\XML" under the project folder created in GUID-0FD88660-942A-4A74-AFD6-8A6A7A35D8D7.html. For Black Level Subtraction, there is only one output XML file: imx219_viss_blc.xml. Replace the same XML file generated from initial configuration. Then rerun the Python script to generate new DCC binary files as described in Generate DCC Binary Files. Use the newly generated DCC binaries to improve streaming quality in next step. This should be done after tuning each plug-in in the following sections.
To see the image quality improvement after tuning each plug-in, capture ISP-processed still images with newly generated DCC binary files. For example, use the following GStreamer pipeline with new binary files after tuning the Black Level Subtraction plug-in for IMX219:
gst-launch-1.0 -v v4l2src num-buffers=5 device=/dev/video2 io-mode=dmabuf-import ! \
video/x-bayer, width=1920, height=1080, framerate=30/1, format=rggb10 ! \
tiovxisp sink_0::device=/dev/v4l-subdev2 \
sensor-name="SENSOR_SONY_IMX219_RPI" \
dcc-isp-file=/opt/imaging/imx219/dcc_viss_10b.bin \
sink_0::dcc-2a-file=/opt/imaging/imx219/dcc_2a_10b.bin format-msb=9 ! \
video/x-raw, format=NV12, width=1920, height=1080, framerate=30/1 ! \
jpegenc ! multifilesink location="imx219-image-%d.jpg"
#GUID-8D0FBC22-C85D-4443-9AFE-ECD503815494 shows an example of the captured images before Black Level Subtraction tuning (using the initial configuration) and #GUID-309615E9-46DC-4756-9AC5-469323B28326 shows the image after Black Level Subtraction tuning (compare the appearance of black).