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

Source Code Change

In the target file system on the EVM, go to /opt/edgeai-gst-plugins/ext/tiovx/gsttiovxisp.c, and add the sensor's name to the list (IMX219 shown below as an example):

g_object_class_install_property (gobject_class, PROP_SENSOR_NAME,
    g_param_spec_string ("sensor-name", "Sensor name", 
        "TIOVX camera sensor string ID. Below are the supported sensors\n" 
        "SENSOR_SONY_IMX219_RPI\n"

Then add a function to configure the auto exposure parameters for the sensor. For example, IMX219 has the following function.

staticint32_tget_imx219_ae_dyn_params (IssAeDynamicParams*p_ae_dynPrms)
{
    int32_t status = -1;
    uint8_t count = 0;

    g_return_val_if_fail (p_ae_dynPrms, status);

    p_ae_dynPrms->targetBrightnessRange.min = 40; // min brightness on 0~255 scale
    p_ae_dynPrms->targetBrightnessRange.max = 50; // max brightness on 0~255 scale
    p_ae_dynPrms->targetBrightness = 45;          // target brightness
    p_ae_dynPrms->threshold = 5;                  // difference between target and min/max
    p_ae_dynPrms->enableBlc = 0;                  // not used

    p_ae_dynPrms->exposureTimeStepSize = 1; // step size for adjusting exposure time in microseconds
    p_ae_dynPrms->exposureTimeRange[count].min = 100;   // min exposure time in microseconds
    p_ae_dynPrms->exposureTimeRange[count].max = 33333; // max exposure time in microseconds

    p_ae_dynPrms->analogGainRange[count].min = 1024;    // min analog gain (1024 is for 1.0x gain)
    p_ae_dynPrms->analogGainRange[count].max = 8192;    // max analog gain (8192 is for 8.0x gain)
    p_ae_dynPrms->digitalGainRange[count].min = 256;    // digital gain is not used
    p_ae_dynPrms->digitalGainRange[count].max = 256;    // digital gain is not used
    count++;

    p_ae_dynPrms->numAeDynParams = count; 
    status = 0;
    return status;
}

Finally, add the exposure time and analog gain mappings. For example, IMX219 has the following mapping:

if (g_strcmp0 (self->sensor_name, "SENSOR_SONY_IMX219_RPI") == 0) 
{
    double multiplier = 0;
    // map AE output exposure time in microseconds to the exposure register value 
    *exposure_time_mapped = (1080 * exposure_time / 33); 

    // map AE output analog gain in Q10 integer format to the analog gain register value
    multiplier = analog_gain / 1024.0; 
    *analog_gain_mapped = 256.0 - 256.0 / multiplier; 
}