Skip to content

Oscar Software Framework Manual Calibration Module

scs edited this page Jul 16, 2012 · 3 revisions

Table of Contents

Calibration Module (clb)

Target Hardware Resource

Flash partition /calib to read calibration data.

Description

The calibration module provides functionality to correct image sensor data from non-uniformities. No correction is applied for host compilation.

Image sensors suffer from multiple noise/mismatch impacts. A common approach is to calibrate each individual sensor in terms of fixed-pattern-nosise (FPN), photo response non-uniformity (FPNU) and hotpixel effects. The accquired parameter set is stored persistent memory.

The calibration module supports the mentioned image correction methods. The calibration data is loaded from a dedicated flash partition /calib.

Host: No correction is applied for host compilation.

Slope correction

The slope correction assumes linear relation between illumination and pixel response. Two non-uniformities are observed. The blacklevel response of all pixels has a gaussian distribution. Once this property is corrected also the greylevel (3/4 of max illumination) response is distributen.

The image from the sensor is processed according to this equation: img' = (img - offset) · gain

With offset is FPN correction data and gain is PRNU factors. In order to get the a undistorted gaussian response for the blacklevel the sensor must be configured.

Hot pixel correction

Hot pixel correction is applied after the slop correction. Affected pixels are replaced by the linear interpolation result of the four neighbour pixels, as shown below.

Calibration file specification

The calibration file has followings sections:

  • magic word, used as identification for the flash update application (imgupd)
  • fpn data, 5bit per Pixel
  • prnu data, 11bit per Pixel
  • hotpixel: number of hotpixels, coordinate pair for each hotpixel
The calibration file structure is shown in the figure. For a sensor size of 752x480 pixel the total length is in the range of 721926 to 725926 bytes, depending on the number of hotpixels. For the pixel coordinate, index 0 represents the first pixel. The FPN/PRNU info for each pixel is starts with the top-left pixel and reads down to the bottom.

The 5bit FPN allows to compensate for fixed pattern in the range of [0, 32). For optimal calibration results the gaussian response of the sensor is inside this area.

The 11 Bit PRNU data is interpreted as gain factor in fixed point format xxx.yyyyyyyy. This allows to encode gain correction: [0, 16). This wide range of gain corrections is usefull for calibration of normal scenes instead of a homogenous grey image.

Hotpixel coordinates must be sorted so that pixels on lines at the top come before pixels at the bottom an that pixels at the left of a line come before pixels at the right of the same line.

Calibration File Specification:

Encoding of FPN and PRNU values:

Dependencies

Usage

Following code segment demonstrates the usage of the bmp module. For the sake of simplicity, error checking is neglected.

 OscClbSetupCalibrate(OSC_CLB_CALIBRATE_FPN_PRNU, FALSE); /* (2) */
 
 OscCamReadPicture(..) /* (3) */
 
 /* optional */
 OscCamSetupCorrectionCallback( myOwnCorrectionFxn) /* (4) */
  1. Load the module. Do not load module, in case no image correction is required. This save boot time and memory resources.
  2. Setup the prefered image correction method.
    • slope correction: offset only (OSC_CLB_CALIBRATE_FPN), gain only (OSC_CLB_CALIBRATE_PRNU), offset and gain (OSC_CLB_CALIBRATE_FPN_PRNU)
    • hotpixel correction
  3. Read a next picture from the camera. Image correction is automatically applied as configured.
  4. Optionally a own correction function can to supplied. It is called instead of the build in functions and configured methods.
Clone this wiki locally