CVB++ 15.0
LineScanCalibrator Class Referencefinal

Result of the linescan calibration executed by the CreateLineScanCalibration function. More...

#include <cvb/foundation/calibration_line_scan.hpp>

Public Member Functions

NonLinearTransformationPtr Transformation () const noexcept
 Gets the transformation. More...
 
double PixelSize () const noexcept
 Gets the pixel size after transformation. More...
 
double MeanError () const noexcept
 Gets the mean difference between stripe width in the transformed image and reference. More...
 
double StandardDeviation () const noexcept
 Gets the standard deviation of the mean error. More...
 

Friends

std::unique_ptr< LineScanCalibratorCreateLineScanCalibration (const Point2D< double > &calibrationPoint1, const Point2D< double > &calibrationPoint2, double referenceDistanceCalibrationPoints, const EdgeDetectionResult &edgeDetectionResult, double referenceWidthStripes, const LineScanCalibrationConfiguration &configuration)
 Calibrates linescan cameras. More...
 

Detailed Description

Result of the linescan calibration executed by the CreateLineScanCalibration function.

Member Function Documentation

◆ MeanError()

double MeanError ( ) const
inlinenoexcept

Gets the mean difference between stripe width in the transformed image and reference.

This is calculated over all stripes.

Returns
The mean error.
Exceptions
Doesnot throw any exception.

◆ PixelSize()

double PixelSize ( ) const
inlinenoexcept

Gets the pixel size after transformation.

The pixel size has the same units as referenceDistanceCalibrationPoints and referenceWidthStripes given within function CreateLineScanCalibration.

Returns
The pixel size of the transformed image.
Exceptions
Doesnot throw any exception.

◆ StandardDeviation()

double StandardDeviation ( ) const
inlinenoexcept

Gets the standard deviation of the mean error.

Returns
The standard deviation.
Exceptions
Doesnot throw any exception.

◆ Transformation()

NonLinearTransformationPtr Transformation ( ) const
inlinenoexcept

Gets the transformation.

The transformation object includes the coefficients of a 3rd order polynomial. Mixed coefficients are zero. Depending on the ScanDirection specified in LineScanCalibrationConfiguration, the estimated polynomial is:

Scan direction in X:

x' = a1 * x^3 + a5 * x^2 + a8 * x + a10

y' = b9 * y

Scan direction in Y:

y' = b4 * y^3 + b7 * y^2 + b9 * y + b10

x' = a8 * x

where

x: pixel position in x (column),

y: pixel position in y (row),

a1-a10: coefficients in x,

b1-b10: coefficients in y,

x' and y': transformed x and y coordinates.

Returns
The transformation.
Exceptions
Doesnot throw any exception.

Friends And Related Function Documentation

◆ CreateLineScanCalibration

std::unique_ptr< LineScanCalibrator > CreateLineScanCalibration ( const Point2D< double > &  calibrationPoint1,
const Point2D< double > &  calibrationPoint2,
double  referenceDistanceCalibrationPoints,
const EdgeDetectionResult edgeDetectionResult,
double  referenceWidthStripes,
const LineScanCalibrationConfiguration configuration 
)
friend

Calibrates linescan cameras.

This function estimates coefficients of a 3rd order polynomial which calibrates linescan cameras. The polynomial corrects lens distortion as well as the camera's direction of movement (described by a scaling factor).

For the estimation of the lens distortion correction a pattern with alternating black and white stripes where the width of the stripes referenceWidthStripes is precisely known has to be acquired. For the camera's direction of movement a target with two circular markers can be used. The distance between the calibration points referenceDistanceCalibrationPoints has to be known, too. Note, that referenceWidthStripes and referenceDistanceCalibrationPoints must be provided in the same units.

In a first step the edges of the stripe target have to be detected via function DetectEdgesOfStripeTarget.

Second the two markers have to be extracted from the image via function CalculateTwoPointsForCalibrationOfMovement. Note, that if the encoder step of your setup is precisely known (e.g. in [mm/scanline]), you do not need to acquire an image with markers. You may manually define fictive calibration points and the corresponding reference distance:

double encoderStep = ... // mm/scanline
auto calibrationPoint1 = Cvb::Point2D<double>(0, 0); // first point
auto calibrationPoint2 = Cvb::Point2D<double>(1, 0); // second point
referenceDistanceCalibrationPoints = encoderStep; // reference distance between calibration points in[mm]
Parameters
[in]calibrationPoint1First calibration point (left or top).
[in]calibrationPoint2Second calibration point (right or bottom).
[in]referenceDistanceCalibrationPointsReference distance between the two calibration points (same units as referenceWidthStripes).
[in]edgeDetectionResultResult returned by DetectEdgesOfStripeTarget.
[in]referenceWidthStripesReference width of stripes in calibration pattern (same units as referenceDistanceCalibrationPoints).
[in]configurationConfiguration of linescan calibration.
Returns
A linescan calibrator including a transformation and its quality.