Adaptive PGA

 

The Positional Gain Adjustment (PGA) corrects for lens shading and color shading artifacts across the sensor image area. If the Adaptive PGA tab in SensorTune is active then this device features Adaptive PGA (APGA). APGA adjusts the PGA dynamically according to the scene illuminant color temperature to further correct the illuminant-dependent color shading artifacts.

To calibrate the APGA requires capturing three raw images of a uniform gray lens shading calibration target under three different illuminants.

Acquire Three Calibration Images

The images must be raw Bayer or YCbCr data, and can be loaded from files or acquired directly from DevWare if DevWare is running concurrently. Using Bayer data is highly recommended, but it is not always possible to collect Bayer data from the target camera system. In that case YCbCr data can be used, but the green channel calibration will be somewhat compromised. The Bayer data should be collected with the sensor in the SOC Bypass mode, not the Processed Bayer, which has been through the SOC color processing. If YCbCr data is being used, then all color enhancement should be disabled, especially color correction matrix and gamma correction.

Select or enter the color temperature of each illuminant in the boxes.

Image Data Details

Select whether the data is Bayer or YCbCr, and click More Details... to enter additional image data information needed by the calibration calculations. Files of type .RAW have no header information, so this information has to be entered manually. If the images were captured directly from a concurrently running DevWare then most of these will be filled in automatically.

It is expected that the calibration image dimensions will be the nominal full size sensor output. For example 1280x960 for MT9M114 (SOC1040). If the image is larger then it will be automatically cropped equally on all sides. If that is not correct, then override the cropping on the More Details... dialog.

For Bayer images, More Details... button brings up a dialog with the following fields:

    • Bayer Pattern: Select the Bayer pattern of the image, after cropping, if different from the default.
    • Black Level: Enter the black level if different from the default.
    • Crop at Left Edge: Enter the column coordinate of the upper left corner of the active area of the image.
    • Crop at Top Edge: Enter the row coordinate of the upper left corner of the active area of the image.

For YCbCr images, More Details... button brings up a dialog with the following fields:

    • Luma Black: The value of Y (luma) that corresponds to black. Normally either 0 or 16.
    • Luma White: The value of Y (luma) that corresponds to white. Normally either 235 or 255.
    • Chroma Range: The range of Cb/Cr, normally either 224 (16 to 240) or 255 (0 to 255).
    • Chroma Encoding: Whether the Cb/Cr values are signed or unsigned. Usually unsigned.
    • Color Space: The conversion from YCbCr to RGB, either Standard or sRGB.
    • Pixel Data Order: The byte order of the data. Usually Cb, Y, Cr, Y.
    • Crop at Left Edge: Enter the column coordinate of the upper left corner of the active area of the image.
    • Crop at Top Edge: Enter the row coordinate of the upper left corner of the active area of the image.

The Full Range and CCIR-601 buttons select the two most common sets of values for these fields.

Output File

Enter or browse for the name of the output file. The output will be a plain text file in the DevWare .ini file format.

Calibration Parameters

Select or enter the desired brightness falloff parameter in the box. The falloff is the brightness at the left and right edges of the image after correction, as a percentage of the peak brightness.

Optionally, click More Calibration Parameters... to change other parameters to the calibration calculation. Normally these can be left at their default values. The button brings up a dialog with the following fields:

    • Guaranteed Minimum Gain: The PGA will not be less than this at any pixel.
    • Margin: Fudge factor for use if the minimum gain calculation is found to be inaccurate. Otherwise use 0.
    • Center X Minimum: This and the next three set limits for the value of the optical center coordinate, which serves as the origin of the PGA function. For use in case a hardware limitation is discovered. Set the minimum and maximum to the same value to force a particular center coordinate.
    • Center X Maximum: See above.
    • Center Y Minimum: See above.
    • Center Y Maximum: See above.
    • Coefficient Precision: The number of bits in the PGA coefficient values. The maximum is 16.
    • Sampling Grid Width: To save time, not every pixel in the image is used in the calculation. This setting and the next set the minimum number of pixels to use.
    • Sampling Grid Height: See above.

Calibration

Click Calculate button to run the calibration calculation. The results will be written to the output file.

Â