SPRAD86 March   2023 AM62A3 , AM62A3-Q1 , AM62A7 , AM62A7-Q1 , AM68A , AM69A

 

  1.   Abstract
  2.   Trademarks
  3. 1Introduction
  4. 2Tuning Overview
  5. 3Hardware Requirement
  6. 4Software Requirement
    1. 4.1 Processor SDK Linux
    2. 4.2 TI's Reference Imaging Software
    3. 4.3 ISP Tuning Tool
  7. 5Sensor Software Development and Integration
    1. 5.1 Adding Sensor Driver to SDK
    2. 5.2 Updating GStreamer Plugins to Support the Sensor
      1. 5.2.1 Update TIOVX Modules
        1. 5.2.1.1 Source Code Change
        2. 5.2.1.2 Rebuild Modules
      2. 5.2.2 Update GStreamer Plugins
        1. 5.2.2.1 Source Code Change
        2. 5.2.2.2 Rebuild Plugins
        3. 5.2.2.3 Verify New Sensor in GStreamer Plugin
  8. 6Tuning Procedure
    1. 6.1 Verify Functional Operation of Camera Capturing
    2. 6.2 Enable Camera Streaming with Initial VPAC Configuration
      1. 6.2.1 Generate Configuration Files
      2. 6.2.2 Generate DCC Binary Files
      3. 6.2.3 Stream Video with the Initial Configuration
    3. 6.3 Adjust Camera Mounting
    4. 6.4 Capture Raw Images and Perform Basic Tuning
      1. 6.4.1 Launch the Tuning Tool and Create a Project
      2. 6.4.2 Tuning Order
      3. 6.4.3 Black Level Subtraction
      4. 6.4.4 Hardware 3A (H3A)
      5. 6.4.5 Auto White Balance (AWB)
        1. 6.4.5.1 Capture Raw Images for Different Lighting Conditions
        2. 6.4.5.2 Tuning AWB
      6. 6.4.6 Color Correction
    5. 6.5 Perform Fine Tuning
  9. 7Summary

Black Level Subtraction

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:

  1. Completely cover the camera lens and capture a black RAW image.
  2. Choose Black Level Subtraction from the "Plug-ins" drop down menu.
  3. Select the RAW image in the "Browse" window and the image should appear black in the "Preview" window.
  4. Provide the raw image in the "RAW file" window and click "Process Plugin" as shown below.
  5. The measured black level will be displayed in the "Advanced params" tab of the upper right window.
GUID-20230224-SS0I-98L4-18KK-PLSJDDPL9D8P-low.png Figure 6-4 Black Level Subtraction Tuning

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).

GUID-20230224-SS0I-3BNZ-XPST-QQ4HNQRG6JTL-low.jpgFigure 6-5 Image Before Black Level Subtraction
GUID-20230224-SS0I-V56W-HKV5-RNHWBPQBKZHB-low.jpgFigure 6-6 Image After Black Level Subtraction