Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Descriptions - lenscalib.exe

LensCalib.exe finds register settings for the lens correction block on Aptina image sensors given an input image of a flat field. It can also simulate the corrected image if given register settings and an uncorrected image.

Command line parameters

Integer parameters can be given in decimal or hex with 0x prefix.

-input <filename>
The file name of the input image.
For SOC devices this file can be a YCbCr image taken with linear gamma and no color correction, but it is highly recommended to use the Bayer Bypass mode for lens calibration if possible. If the input is not YCbCr then for the sensor A-2010-SOCJ (MT9D111) this must be a 24-bit RGB BMP file taken with linear gamma and no color correction. For all other sensors it must be a Bayer image. Image dimensions should be the full size of the sensor. For an SOC with a lens-corrected Bayer bypass mode, should be the output image size when the sensor is in that bypass mode. If the input image is YCbCr then it is required to also specify the byte order with one of -CbYCrY, -YCbYCr, -CrYCbY or -YCrYCb.

 

-bayer <pattern>
Bayer pattern:

  • GR - Gr R
  • B Gb
  • RG - R Gr
  • Gb B
  • BG - B Gb
  • Gr R
  • GB - Gb B
  • R Gr

If the input file contains this information, the command line option supercedes the data from the file. Default is GR if the pattern is not specified in the file or on the command line.

 

-black <integer>
Black pedestal. This value is subtracted from all input Bayer pixels and added to all output Bayer pixels. If the input is YCbCr then this sets what value of Y corresponds to black. If the input file contains this information, the command line option supercedes the data from the file. If the black level is not specified in the file or on the command line the default depends on bits per pixel:


Default = 10 - if bpp = 8

42 - if bpp = 10

     168 - if bpp = 12

         0 - if YCbCr

 

-white <integer>
For YCbCr input files, this sets what value of Y corresponds to white. Default = 255.

 

-CbYCrY
Sets the YCbCr byte order to Cb-Y-Cr-Y and tells LensCalib that the input image is YCbCr data instead of Bayer.

 

-CrYCbY
Sets the YCbCr byte order to Cr-Y-Cb-Y and tells LensCalib that the input image is YCbCr data instead of Bayer.

 

-YCbYCr
Sets the YCbCr byte order to Y-Cb-Y-Cr and tells LensCalib that the input image is YCbCr data instead of Bayer.

 

-YCrYCb
Sets the YCbCr byte order to Y-Cr-Y-Cb and tells LensCalib that the input image is YCbCr data instead of Bayer.

 

-sRGB
Sets the YCbCr to RGB conversion to use sRGB coefficients. If this parameter is omitted then CCIR-601 coefficents are used.

 

-cropleft <integer>
If the image is oversized, how many pixels to crop from the left. If not specified, crops half the excess from the left (and half from the right).

 

-croptop <integer>
If the image is oversized, how many rows to crop from the top. If not specified, crops half the excess from the top (and half from the bottom).

 

-xcenter <integer>

-xcenter <integer> <integer>
Sets the x (horizontal) coordinate of the lens center to a specific value or sets a range of allowed values. The values are specified relative to the sensor array, not the input image which may be sub-sampled.

 

-ycenter <integer>

 

-ycenter <integer> <integer>
Sets the y (vertical) coordinate of the lens center to a specific value or sets a range of allowed values. The values are specified relative to the sensor array, not the input image which may be sub-sampled.

 

-for <sensor>
The model number of the sensor to calibrate for. Not case-sensitive.

 

-rev <integer>
The revision number of the sensor.

 

-inini <filename>
Use this option to simulate the registers settings for an existing ini file. If this option is used then the calibration procedure will be skipped. Instead the given register settings will be applied to the input image. Use -outbmp to specify the output file for the simulated corrected image.

 

-basisini <filename>
Use this option to make sure the LC register settings generated from the input image will be compatible with the given settings. The zones and global multipliers will be matched. Thus, the individual color channel settings can be mixed.

 

-xform <filename> <width> <height>
File name for an image transform. A transform file is a binary file containing single-precision floating point values, one for each pixel in the input image. Each pixel in the input image will be multiplied by the corresponding value from the file prior to calibration. It only applies to Bayer images. The purpose of this feature is to simulate multiple illuminant responses from a single flat field image. Any number of transforms may be specified, and a calibration will be done for each. The width and height of the transform must match exactly the input image dimensions.

 

-falloff <integer>
The image brightness at the edge, as a percentage of the center brightness. In some cases using a value below 100 may give a better result. Default = 100

 

-iter <integer>
How many times to iterate the lens calibration algorithm. Default = 24
Increasing this number may give a better result. Applies to non-polynomial algorithm only.

 

-centerbands
Analyze the image though the center only. In some cases this may give a better result. Applies to non-polynomial algorithm only.

 

-analysisbands <filename>
For complete control over the analysis band positions and weights put the data in a text file and use this parameter. In the file, for each analysis band put 'H' for a horizontal band or 'V' for a vertical band, followed by the position of the band as a fraction of the image size and the weight in arbitrary units. Up to three horizontal bands and three vertical bands may be specified. Example:

  • H 0.333 1
  • H 0.667 1
  • V 0.25 1
  • V 0.50 2
  • V 0.75 1

Defines two horizontal bands a 1/3rd and 2/3rd of the image height, at equal weight, and three vertical bands at 1/4 1/2 and 3/4 of the image width, with the center band having greater weight. The default is:

  • H 0.25 1
  • H 0.50 1
  • H 0.75 1
  • V 0.25 1
  • V 0.50 1
  • V 0.75 1

And the -centerbands switch is equivalent to:

  • H 0.50 1
  • V 0.50 1

Applies to non-polynomial algorithm only.

 

-polygrid <integer>x<integer>
Specifies the dimensions of the pixel grid used to sample the input image for analysis purposes. Applies to polynomial algorithm only.
Minimum allowed = 16x8.

 

-margin <float>
Specifies some additional gain you want the LC block to apply to the image. Should be >= 1.0. Default is 1.0. Applies to polynomial algorithm only.

 

-mingain <float>
Specifies the gain from the LC block should never be less than the given value. If set to 0.0, then there is no guaranteed minimum gain, but it will likely be about 1.0. Default is 1.0.
Applies to polynomial algorithm only.

 

-coeffprec <integer>
Specifies the precision of the resulting coefficient values. Default is 16 bits.
Applies to polynomial algorithm only.

 

-wideangle <integer>
If you are using a wide angle lens that does not illuminate the active area of the sensor all the way to the corners then try using a value of 1. Otherwise use 0. Default is 0. Applies to polynomial algorithm only.
-outini <filename>
File name for register settings. If not specified, register settings are written to stdout.

 

-outiniformat <format>
Specify the register output format.
<format> can be one of:

  • ini - DevWare .ini file format with REG= commands.
  • fieldwr - DevWare .ini file format with FIELD_WR= commands.
  • c - C/C++ array, "{ <reg>, <data> }," or "{ <page>, <reg>, <data> },". Use -header and -footer to create the array declaration and close }.

 

-header "string"
String to put at top of register output file.

 

-footer "string"
String to put at end of register output file.

 

-outbmp <filename>
Filename of the simulated output image. If not specified, no output image will be generated.

 

-outbmpformat <format>
Specify the output bitmap raw format. You only need this if you want to override the default based on the -outbmp file extension.
<format> can be one of:
binary - Binary data, one byte per pixel if bpp=8, otherwise two bytes per pixel, low byte first.
dec - Text file with decimal numbers.
hex - Text file with hex numbers.
itx - Text file with header and decimal numbers. If not specified the format is implied from the file extension:

  • .bmp - Windows BMP file.
  • .csv - Text file with decimal numbers.
  • .dng - DNG (digital negative) file.
  • .itx - ITX file.
  • .png - PNG file.
  • .raw - Binary.
  • .tab - Text file with decimal numbers.
  • .txt - Text file with decimal numbers.

The bits per pixel of the output file will be the same as the input image, except BMP is 8 bits, DNG is 12 bits and PNG is 16 bits.

 

-sbl <filename>
Filename to receive SBL (shading balance) values.

 

-ratios
Add corrected image color ratios to the output ini file.

  • No labels

0 Comments

You are not logged in. Any changes you make will be marked as anonymous. You may want to Log In if you already have an account.