Export of convenience calibration functions. More...
Enumerations | |
enum | TCalibrationPatternContrast { CPC_Black_On_White , CPC_White_On_Black } |
enum | TCalibrationPatternStyle { CPS_Uniform_Dots , CPS_Asymmetric_Dots } |
Functions | |
cvbres_t | ApplyInverseNLTransform (NLTRANSFORMATION Transformation, double &X, double &Y) |
Calculates the inverse of a transformed single point using a non-linear transformation. More... | |
cvbres_t | ApplyInverseNLTransformPixelList (NLTRANSFORMATION Transformation, PIXELLIST List) |
Calculates the inverse of a tranformed PIXELLIST using a non-linear transformation. More... | |
cvbres_t | ApplyNLTransform (NLTRANSFORMATION Transformation, double &X, double &Y) |
Transforms a single point using a non-linear transformation. More... | |
cvbres_t | ApplyNLTransformPixelList (NLTRANSFORMATION Transformation, PIXELLIST List) |
Transforms a PIXELLIST using a non-linear transformation. More... | |
cvbres_t | CreateCalibrationPattern (cvbdim_t width, cvbdim_t height, cvbval_t numColumns, cvbval_t numRows, TCalibrationPatternStyle style, TCalibrationPatternContrast contrast, IMG &imgOut) |
Create a user-definable calibration pattern. More... | |
cvbres_t | CreateCalibrationPatternA4 (cvbval_t numColumns, cvbval_t numRows, double borderH, double borderV, cvbval_t dpi, cvbbool_t landscape, TCalibrationPatternStyle style, TCalibrationPatternContrast contrast, IMG &imgOut) |
Create a user-definable calibration pattern suitable for printing on an A4 sheet of paper. More... | |
cvbres_t | CreateCalibrationPatternLetter (cvbval_t numColumns, cvbval_t numRows, double borderH, double borderV, cvbval_t dpi, cvbbool_t landscape, TCalibrationPatternStyle style, TCalibrationPatternContrast contrast, IMG &imgOut) |
Create a user-definable calibration pattern suitable for printing on an sheet of letter-sized paper. More... | |
cvbres_t | CreateInverseNLTransformedImage (IMG Image, NLTRANSFORMATION Transformation, cvbdim_t TargetWidth, cvbdim_t TargetHeight, cvbdim_t XTargetOffset, cvbdim_t YTargetOffset, IMG &Out) |
Computes the inverse of a transformed image (or a part of the image) using a non-linear transformation. More... | |
cvbres_t | CreateNLTransform (PIXELLIST OriginalPixels, PIXELLIST TransformedPixels, cvbval_t Order, TFProgress Callback, void *PrivateData, NLTRANSFORMATION &Transformation, double &Quality) |
Calculates a non linear transformation. More... | |
cvbres_t | CreateNLTransformedImage (IMG Image, NLTRANSFORMATION Transformation, cvbdim_t TargetWidth, cvbdim_t TargetHeight, cvbdim_t XTargetOffset, cvbdim_t YTargetOffset, IMG &Out) |
Transforms a complete image (or a part of the image) using a non-linear transformation. More... | |
cvbres_t | GetCalibrationLists (IMG img, cvbdim_t index, TCalibrationPatternStyle style, TCalibrationPatternContrast contrast, TArea aoi, cvbdim_t gridSpacing, cvbval_t minContrast, double maxRatio, PIXELLIST &originalPixels, PIXELLIST &transformedPixels) |
Automatically extracts the pixel lists required for a call to CreateNLTransform from an image. More... | |
BOOL | IsNLTransform (NLTRANSFORMATION Transformation) |
Verifies whether the passed object describes a non-linear transformation object. More... | |
cvbbool_t | LoadNLTransformFile (const char *FileName, NLTRANSFORMATION &Transformation) |
Loads a non-linear transformation object that has previously been stored in a file. More... | |
cvbbool_t | LoadNLTransformFileW (const wchar_t *FileName, NLTRANSFORMATION &Transformation) |
Loads a non-linear transformation object that has previously been stored in a file. More... | |
cvbbool_t | NLTransformCoefficients (NLTRANSFORMATION Transformation, double *CoeffsTransX, double *CoeffsTransY, double *CoeffsInvTransX, double *CoeffsInvTransY) |
Retrieves the coefficients determining a non-linear transformation. More... | |
cvbres_t | NLTransformNumCoefficients (NLTRANSFORMATION Transformation) |
Determines the number of coefficients a non-linear transformation object is using. More... | |
cvbres_t | NLTransformOrder (NLTRANSFORMATION Transformation) |
Determines the order of a non-linear transformation. More... | |
cvbbool_t | WriteNLTransformFile (NLTRANSFORMATION Transformation, const char *FileName) |
Stores a non-linear transformation object in a file. More... | |
cvbbool_t | WriteNLTransformFileW (NLTRANSFORMATION Transformation, const wchar_t *FileName) |
Stores a non-linear transformation object in a file. More... | |
Export of convenience calibration functions.
cvbres_t ApplyInverseNLTransform | ( | NLTRANSFORMATION | Transformation, |
double & | X, | ||
double & | Y | ||
) |
Calculates the inverse of a transformed single point using a non-linear transformation.
[in] | Transformation | Handle of transformation object. |
[in,out] | X | X-coordinate to be transformed (will also receive the transformation result). |
[in,out] | Y | Y-coordinate to be transformed (will also receive the transformation result). |
cvbres_t ApplyInverseNLTransformPixelList | ( | NLTRANSFORMATION | Transformation, |
PIXELLIST | List | ||
) |
Calculates the inverse of a tranformed PIXELLIST using a non-linear transformation.
[in] | Transformation | Handle of transformation object. |
[in,out] | List | Pixellist to be transformed. |
cvbres_t ApplyNLTransform | ( | NLTRANSFORMATION | Transformation, |
double & | X, | ||
double & | Y | ||
) |
Transforms a single point using a non-linear transformation.
[in] | Transformation | Handle of transformation object. |
[in,out] | X | X-coordinate to be transformed (will also receive the transformation result). |
[in,out] | Y | Y-coordinate to be transformed (will also receive the transformation result). |
cvbres_t ApplyNLTransformPixelList | ( | NLTRANSFORMATION | Transformation, |
PIXELLIST | List | ||
) |
Transforms a PIXELLIST using a non-linear transformation.
[in] | Transformation | Handle of transformation object. |
[in,out] | List | Pixellist to be transformed. |
cvbres_t CreateCalibrationPattern | ( | cvbdim_t | width, |
cvbdim_t | height, | ||
cvbval_t | numColumns, | ||
cvbval_t | numRows, | ||
TCalibrationPatternStyle | style, | ||
TCalibrationPatternContrast | contrast, | ||
IMG & | imgOut | ||
) |
Create a user-definable calibration pattern.
The calibration pattern will consist of a regular spaced matrix of dots, the size of which will be determined by the input parameters.
The calibration pattern will consist of a regular rectangular grid of dots. The distance between the dots in x and y direction will be 2.5 times the diameter of the dots. If an asymmetric pattern was selected, the bigger dots will have 2.5 times the area of the smaller dots (meaning that their radius is sqrt
(2.5) times the radius of the small dots).
[in] | width | Width of the output image in pixels. |
[in] | height | Height of the output image in pixels. |
[in] | numColumns | Number of dot columns in the image. |
[in] | numRows | Number of dot rows in the image. |
[in] | style | Calibration pattern style to use. See TCalibrationPatternStyle for a description of the available options. |
[in] | contrast | Selects whether to use white on black or black on white dots. |
[out] | imgOut | Image containing the resulting pattern. |
cvbres_t CreateCalibrationPatternA4 | ( | cvbval_t | numColumns, |
cvbval_t | numRows, | ||
double | borderH, | ||
double | borderV, | ||
cvbval_t | dpi, | ||
cvbbool_t | landscape, | ||
TCalibrationPatternStyle | style, | ||
TCalibrationPatternContrast | contrast, | ||
IMG & | imgOut | ||
) |
Create a user-definable calibration pattern suitable for printing on an A4 sheet of paper.
The calibration pattern will consist of a regular spaced matrix of dots, the size of which will be determined by the input parameters. The size of the pattern image will be suitable for printing it on an A4 piece of paper (210x297 mm).
The calibration pattern will consist of a regular rectangular grid of dots. The distance between the dots in x and y direction will be 2.5 times the diameter of the dots. If an asymmetric pattern was selected, the bigger dots will have 2.5 times the area of the smaller dots (meaning that their radius is sqrt
(2.5) times the radius of the small dots).
[in] | numColumns | Number of dot columns in the image. |
[in] | numRows | Number of dot rows in the image. |
[in] | borderH | Horizontal borders to be applied (in inches). This value should match the setting that is going to be used for printing the resulting image. Must not be negative. The meaning of horizontal refers to the paper size definition and is independent of the landscape setting. |
[in] | borderV | Vertical borders to be applied (in inches). This value should match the setting that is going to be used for printing the resulting image. Must not be negative. The meaning of vertical refers to the paper size definition and is independent of the landscape setting. |
[in] | dpi | Dot density to be used. It usually makes sense to set this parameter to the printer's physical dot density or half or quarter of that. Minimum value is 150. |
[in] | landscape | Set to true to generate a landscape format image (relevant only when using an asymmetric pattern). |
[in] | style | Calibration pattern style to use. See TCalibrationPatternStyle for a description of the available options. |
[in] | contrast | Selects whether to use white on black or black on white dots. |
[out] | imgOut | Image containing the resulting pattern. |
cvbres_t CreateCalibrationPatternLetter | ( | cvbval_t | numColumns, |
cvbval_t | numRows, | ||
double | borderH, | ||
double | borderV, | ||
cvbval_t | dpi, | ||
cvbbool_t | landscape, | ||
TCalibrationPatternStyle | style, | ||
TCalibrationPatternContrast | contrast, | ||
IMG & | imgOut | ||
) |
Create a user-definable calibration pattern suitable for printing on an sheet of letter-sized paper.
The calibration pattern will consist of a regular spaced matrix of dots, the size of which will be determined by the input parameters. The size of the pattern image will be suitable for printing it on an piece of letter- sized paper (8.5 x 11 inches).
The calibration pattern will consist of a regular rectangular grid of dots. The distance between the dots in x and y direction will be 2.5 times the diameter of the dots. If an asymmetric pattern was selected, the bigger dots will have 2.5 times the area of the smaller dots (meaning that their radius is sqrt
(2.5) times the radius of the small dots).
[in] | numColumns | Number of dot columns in the image. |
[in] | numRows | Number of dot rows in the image. |
[in] | borderH | Horizontal borders to be applied (in inches). This value should match the setting that is going to be used for printing the resulting image. Must not be negative. The meaning of horizontal refers to the paper size definition and is independent of the landscape setting. |
[in] | borderV | Vertical borders to be applied (in inches). This value should match the setting that is going to be used for printing the resulting image. Must not be negative. The meaning of vertical refers to the paper size definition and is independent of the landscape setting. |
[in] | dpi | Dot density to be used. It usually makes sense to set this parameter to the printer's physical dot density or half or quarter of that. Minimum value is 150. |
[in] | landscape | Set to true to generate a landscape format image (relevant only when using an asymmetric pattern). |
[in] | style | Calibration pattern style to use. See TCalibrationPatternStyle for a description of the available options. |
[in] | contrast | Selects whether to use white on black or black on white dots. |
[out] | imgOut | Image containing the resulting pattern. |
cvbres_t CreateInverseNLTransformedImage | ( | IMG | Image, |
NLTRANSFORMATION | Transformation, | ||
cvbdim_t | TargetWidth, | ||
cvbdim_t | TargetHeight, | ||
cvbdim_t | XTargetOffset, | ||
cvbdim_t | YTargetOffset, | ||
IMG & | Out | ||
) |
Computes the inverse of a transformed image (or a part of the image) using a non-linear transformation.
[in] | Image | Handle of image object to be transformed. |
[in] | Transformation | Handle of the transformation object. |
[in] | TargetWidth | Desired width of the transformation result in pixels. Attention: A 1:1 correspondence of pixels and coordinate units in the target space is assumed. |
[in] | TargetHeight | Desired height of the transformation result in pixels. Attention: A 1:1 correspondence of pixels and coordinate units in the target space is assumed. |
[in] | XTargetOffset | X-offset to be applied for the transformation. If the offsets are zero, then the result of the transformation will contain the target-space coordinates 0/0, TargetWidth-1/TargetHeight-1. The offset allow to change the section of the target image. |
[in] | YTargetOffset | Y-offset to be applied for the transformation. If the offsets are zero, then the result of the transformation will contain the target-space coordinates 0/0, TargetWidth-1/TargetHeight-1. The offset allow to change the section of the target image. |
[out] | Out | Handle of the result image. |
cvbres_t CreateNLTransform | ( | PIXELLIST | OriginalPixels, |
PIXELLIST | TransformedPixels, | ||
cvbval_t | Order, | ||
TFProgress | Callback, | ||
void * | PrivateData, | ||
NLTRANSFORMATION & | Transformation, | ||
double & | Quality | ||
) |
Calculates a non linear transformation.
The transformation and inverse transformation is done simultaneously.
[in] | OriginalPixels | Calibration points in the original image space. |
[in] | TransformedPixels | Calibration points in the target space. Attention: The points in both pixel lists need to correspond 1:1 to each other, i.e. the 1st pixel in the transformed list will and must be the transformation result for the 1st pixel in the original list. |
[in] | Order | Order of the polynomial to be calculated. Set to 0 for auto-select. The decision is always based on the number of calibration points specified. |
[in] | Callback | Usually the fitting of the calibration data takes a significant amount of time. This callback provides a means of getting notification about the progress of the calculations. The callback must have the following signature: TFProgress = Function( pPrivate : Pointer; StepsTotal, StepsDone : LongInt ) : LongBool; stdcall;
cvbbool_t(* TFProgress)(void *pPrivate, cvbval_t StepsTotal, cvbval_t StepsDone) |
[in] | PrivateData | Private data pointer to be passed to the callback function. Specify whatever you need here. Attention: Visual Basic users please always specify 0 here! |
[out] | Transformation | Handle of result transformation object. |
[out] | Quality | Quality of the transformation. Ranges from -1 (very bad) to 1(perfect). |
cvbres_t CreateNLTransformedImage | ( | IMG | Image, |
NLTRANSFORMATION | Transformation, | ||
cvbdim_t | TargetWidth, | ||
cvbdim_t | TargetHeight, | ||
cvbdim_t | XTargetOffset, | ||
cvbdim_t | YTargetOffset, | ||
IMG & | Out | ||
) |
Transforms a complete image (or a part of the image) using a non-linear transformation.
[in] | Image | Handle of image object to be transformed. |
[in] | Transformation | Handle of the transformation object. |
[in] | TargetWidth | Desired width of the transformation result in pixels. Attention: A 1:1 correspondence of pixels and coordinate units in the target space is assumed. |
[in] | TargetHeight | Desired height of the transformation result in pixels. Attention: A 1:1 correspondence of pixels and coordinate units in the target space is assumed. |
[in] | XTargetOffset | X-offset to be applied for the transformation. If the offsets are zero, then the result of the transformation will contain the target-space coordinates 0/0, TargetWidth-1/TargetHeight-1. The offset allow to change the section of the target image. |
[in] | YTargetOffset | Y-offset to be applied for the transformation. If the offsets are zero, then the result of the transformation will contain the target-space coordinates 0/0, TargetWidth-1/TargetHeight-1. The offset allow to change the section of the target image. |
[out] | Out | Handle of the result image. |
cvbres_t GetCalibrationLists | ( | IMG | img, |
cvbdim_t | index, | ||
TCalibrationPatternStyle | style, | ||
TCalibrationPatternContrast | contrast, | ||
TArea | aoi, | ||
cvbdim_t | gridSpacing, | ||
cvbval_t | minContrast, | ||
double | maxRatio, | ||
PIXELLIST & | originalPixels, | ||
PIXELLIST & | transformedPixels | ||
) |
Automatically extracts the pixel lists required for a call to CreateNLTransform from an image.
The image given to this function should contain a calibration pattern as generated by the functions CreateCalibrationPattern, CreateCalibrationPatternA4 or CreateCalibrationPatternLetter: A regular spaced matrix of dots, the distance between the dots in x and y direction should be 2.5 times the diameter of the dots, if an asymmetric pattern was used, the bigger dots should have 2.5 times the area of the smaller dots (meaning that their radius is sqrt
(2.5) times the radius of the small dots).
Note that although the area of interest is given as a TArea structure here (and in the processing of the TArea structure the Image's coordinate system will be respected), the actual output of this function uses pixel coordinates! This seemingly inconsistent mix in this case is in fact useful because a TArea structure will better capture the actual location of a calibration pattern especially if the image has been rotated than a left/top - right/bottom style area of interest, but the calibration functions working on the output of GetCalibrationLists
usually assume that the pixel lists are given in pixel coordinates. To avoid misunderstandings and complications in the interpretation of the image content it is recommended to use a default coordinate system on the input image. If you do not want to specify an area of interest, use the function MaxImageArea
from the CVCImg.dll to define the maximum possible area of interest.
[in] | img | Image containing the calibration pattern. |
[in] | index | Index of the plane to be processed. |
[in] | style | Calibration pattern style visible in the image. |
[in] | contrast | Selects whether the image shows white on black or black on white dots. |
[in] | aoi | Area of interest in which to look for the calibration pattern's dots. |
[in] | gridSpacing | spacing of the calibration dot grid in the target image. |
[in] | minContrast | Minimum gray value contrast between the object and the background of the calibration target pattern. Value to be set depends on the quality of the image taken from the pattern, but in a typical situation this contrast should not drop below 64 gray values, otherwise it might become difficult to extract the calibration points. |
[in] | maxRatio | Maximum ratio between the biggest and the smallest calibration dot. This value will be used to identify outliers when looking for calibration dots. It should be set high enough to allow for the area variations to be expected due to perspective distortions and small enough to eliminate the candidates that are either too big or too small to be valid calibration pattern dots. Typically, values of about 3.0 to 5.0 are big enough - even if there is notable perspective distortion visible in the images. If an asymmetric calibration pattern has been selected, the ratio used for calculation will be adapted accordingly. |
[out] | originalPixels | Pixel list containing the locations of the calibration dots in the input image in pixel coordinates. |
[out] | transformedPixels | Pixel list containing the appropriate locations of the calibration dots in the target image of the calibration. |
BOOL IsNLTransform | ( | NLTRANSFORMATION | Transformation | ) |
Verifies whether the passed object describes a non-linear transformation object.
[in] | Transformation | Handle of transformation object. |
TRUE
indicates that it is a non-linear transformation object, FALSE
otherwise. cvbbool_t LoadNLTransformFile | ( | const char * | FileName, |
NLTRANSFORMATION & | Transformation | ||
) |
Loads a non-linear transformation object that has previously been stored in a file.
[in] | FileName | Name of the file to be loaded. |
[out] | Transformation | Handle of transformation object. |
TRUE
indicates that loading was successful, FALSE
otherwise. cvbbool_t LoadNLTransformFileW | ( | const wchar_t * | FileName, |
NLTRANSFORMATION & | Transformation | ||
) |
Loads a non-linear transformation object that has previously been stored in a file.
[in] | FileName | Name of the file to be loaded. |
[out] | Transformation | Handle of transformation object. |
TRUE
indicates that loading was successful, FALSE
otherwise. cvbbool_t NLTransformCoefficients | ( | NLTRANSFORMATION | Transformation, |
double * | CoeffsTransX, | ||
double * | CoeffsTransY, | ||
double * | CoeffsInvTransX, | ||
double * | CoeffsInvTransY | ||
) |
Retrieves the coefficients determining a non-linear transformation.
The transformation itself is always a polynomial for each, the X and the Y transformation. Additionally, there are two sets of polynomials: One for transformation and one for inverse transformation. The polynomials are assembled such that the higher order terms are always prepended at the beginning. \n\n \b Examples: \n 2nd Order Transformation polynomials: \n x' = a1 * x<sup>2</sup> + a2 * x * y + a3 * y<sup>2</sup> + a4 * x + a5 * y + a6 \n y' = b1 * x<sup>2</sup> + b2 * x * y + b3 * y<sup>2</sup> + b4 * x + b5 * y + b6 \n\n 3rd Order Transformation polynomials: \n x' = a1 * x<sup>3</sup> + a2 * x<sup>2</sup>y + a3 * xy<sup>2</sup> + a4 * y<sup>3</sup> + a5 * x<sup>2</sup> + a6 * x * y + a7 * y<sup>2</sup> + a8 * x + a9 * y + a10 \n y' = b1 * x<sup>3</sup> + b2 * x<sup>2</sup>y + b3 * xy<sup>2</sup> + b4 * y<sup>3</sup> + b5 * x<sup>2</sup> + b6 * x * y + b7 * y<sup>2</sup> + b8 * x + b9 * y + b10
[in] | Transformation | Handle of transformation object. |
[out] | CoeffsTransX | Array for the transformation coefficients of the x-transformation. Attention: Visual Basic user specify the first element of the array here! |
[out] | CoeffsTransY | Array for the transformation coefficients of the y-transformation. Attention: Visual Basic user specify the first element of the array here! |
[out] | CoeffsInvTransX | Array for the transformation coefficients of the inverse x-transformation. Attention: Visual Basic user specify the first element of the array here! |
[out] | CoeffsInvTransY | Array for the transformation coefficients of the inverse y-transformation. Attention: Visual Basic user specify the first element of the array here! |
TRUE
if succeeded, FALSE
otherwise. cvbres_t NLTransformNumCoefficients | ( | NLTRANSFORMATION | Transformation | ) |
Determines the number of coefficients a non-linear transformation object is using.
This function is normally used together with \ref NLTransformCoefficients.
[in] | Transformation | Handle of transformation object. |
cvbres_t NLTransformOrder | ( | NLTRANSFORMATION | Transformation | ) |
Determines the order of a non-linear transformation.
[in] | Transformation | Handle of transformation object. |
cvbbool_t WriteNLTransformFile | ( | NLTRANSFORMATION | Transformation, |
const char * | FileName | ||
) |
Stores a non-linear transformation object in a file.
[in] | Transformation | Handle of transformation object to be saved. |
[in] | FileName | Name of the file to be saved. |
TRUE
indicates that saving was successful, FALSE
otherwise. cvbbool_t WriteNLTransformFileW | ( | NLTRANSFORMATION | Transformation, |
const wchar_t * | FileName | ||
) |
Stores a non-linear transformation object in a file.
[in] | Transformation | Handle of transformation object to be saved. |
[in] | FileName | Name of the file to be saved. |
TRUE
indicates that saving was successful, FALSE
otherwise.