Leaper WaferScan Toolkit
中文 / English 2.x
Public Member Functions | Properties
ILCalibPinHole Interface Reference

This interface provide functionalities of the pinhole camera model. More...

Inheritance diagram for ILCalibPinHole:
ILCalib ILObject LCalibNPoints LCalibPinHole

Public Member Functions

LPVErrorCode AddMVPoints (ILCalibPointPairs *pointPairs)
 
void SetCameraProps (double cellSize, double focusLength, double viewDistance)
 
- Public Member Functions inherited from ILCalib
LPVErrorCode AddPoint (double imagePointX, double imagePointY, double worldPointX, double worldPointY)
 
LPVErrorCode AddPoints (ILCalibPointPairs *pointPairs)
 
LPVErrorCode Calibrate ()
 
LPVErrorCode FixImage (ILImage *image, ILImage *fixedImage)
 
LPVErrorCode GenPostTransformMatrix (ILCalibPointPairs *pointPairs)
 
void ImageToWorld (double imagePointX, double imagePointY, double *worldPointX, double *worldPointY)
 
BOOL IsCalibrated ()
 
void SetImageSize (int w, int h)
 
void SetPostTransform (double offsetX, double offsetY, double deltaAngle)
 
void SetPostTransformMatrix (ILTransform *tf)
 
void SetPostTransformMatrix23 (LMatrix23 *data)
 
void SetPostTransformMatrix33 (LMatrix33 *data)
 
void WorldToImage (double worldPointX, double worldPointY, double *imagePointX, double *imagePointY)
 
- Public Member Functions inherited from ILObject
ILObjectCopy ()
 
LPVErrorCode Load (LString filename)
 
void Reset ()
 
LPVErrorCode Save (LString filename)
 
BOOL Valid ()
 

Properties

LPVDistortionModel DistortionModel [get, set]
 The distortion model.
 
- Properties inherited from ILCalib
double CalibError [get]
 The overall RMS re-projection error for the calibration, calculated based on the distances between the image points and the projected (using the optimized calibration matrices) world points. It's defined as:
\( \sqrt{ \frac{1}{n} \sum_{i=0}^{n} distance(p^{image}_i, p^{proj}_i)^2 } \).
 
LPVFixImageMode FixImageMode [get, set]
 The mode to fix image used in FixImage(). More...
 
double FixImageOffsetX [get, set]
 The x-coordinate offset (in pixel unit) of the fixed image used in FixImage(), used together with FixImageOffsetY.
By default, it's 0, means no offset in x-coordinate. You may change the offset to translate the fixed image, for example move the inspect region to the center of the fixed image.
 
double FixImageOffsetY [get, set]
 The y-coordinate offset (in pixel unit) of the fixed image used in FixImage(), used together with FixImageOffsetX.
By default, it's 0, means no offset in y-coordinate. You may change the offset to translate the fixed image, for example move the inspect region to the center of the fixed image.
 
double FixImageScale [get, set]
 The scale of the fixed image used in FixImage().
By default, it's 1, means no scale. You may change the scale factor to zoom in/out the fixed image.
 
LPVInterpolationMethod InterpolationMethod [get, set]
 The interpolation method used in fix the image for undistortion (and untilt). By default, it's LPVInterCubic.
 
LPVCalibModel Model [get]
 The calibration model.
 
BOOL UseCache [get, set]
 Whether to make use of cache which is used to speed-up the process of the image undistortion (and untilt), but consume more memory. By default, it's off.
 

Detailed Description

This interface provide functionalities of the pinhole camera model.

In the pinhole camera model, a scene view is formed by projecting 3D points into the image plane using a perspective transformation, defined as:

\[ s \; m' = K \; [R | t] \; M \]

where \( m' \) are the image points in pixels, \( M \) are the world points in physical units, \( K \) is the intrinsic camera array involves camera's principal point and focus lengths in pixel units, \( [R | t] \) is the extrinsic camera array describes the camera's relative position to the view planar, \( s \) is the scale factor for the whole system.
Intrinsic parameters are independent to the viewed scene while extrinsic parameters do, which means if we move the camera other places without changing the focusing, the intrinsic parameters stay unchanged but extrinsic parameters should be re-calibrated.
This model support radial distortion estimation, see DistortionModel for more details.

The accuracy of the calibration result is affected by many factors:

  1. The number of point pairs and their distribution. Usually, it's better to have the point pairs distributed evenly and as many as possible throughout the image.
  2. The chosen distortion model that better fit to the reality.
  3. Calibrated with multi-view point pairs help estimate more accurate intrinsic parameters, then more accurate extrinsic parameters are derived. Moreover, with multi-view calibration, the system is able to eliminate the re-projection error by the thickness of the calibration board.

To use this interface, you should create a LCalibPinHole object.

Example Code

Member Function Documentation

◆ AddMVPoints()

LPVErrorCode AddMVPoints ( ILCalibPointPairs pointPairs)

Add point pairs for multi-view calibration.

Parameters
[in]pointPairsThe collection of point pairs from assistant view.
Return values
errorReturn error code if anything is wrong.

◆ SetCameraProps()

void SetCameraProps ( double  cellSize,
double  focusLength,
double  viewDistance 
)

Set some property of the camera or the viewed scene, which is used in setting up initial value for calibration.

Parameters
[in]cellSizeThe cell size of camera sensor(in μm), should be available in datasheet of the camera device. We use same cell size for both x and y coordinate as in most cases they are same.
[in]focusLengthThe focus length of camera sensor(in mm), should be available in datasheet of the camera device.
[in]viewDistanceThe approximate distance from viewed plane to camera(in mm).