CVB.Net 15.0
CalibrationLineScan Class Reference

Collection of calibration line scan functions. More...

Static Public Member Functions

static Point2Dd[] CalculateTwoPointsForCalibrationOfMovement (ImagePlane imagePlane, Area2D aoi, CalibrationPatternContrast contrast, int minContrast, ValueRange< double > pointSizeRange, ScanDirection scanDirection)
 Extracts two points which can be used for the calibration of the movement of line scan cameras. More...
 
static EdgeDetectionResult DetectEdgesOfStripeTarget (Image imageStripes, Rect aoi, int numStripes, ScanDirection scanDirection, double threshold)
 This function detects edges from a calibration pattern with alternating black and white stripes. More...
 
static LineScanCalibrator CreateLineScanCalibration (Point2Dd calibrationPoint1, Point2Dd calibrationPoint2, double referenceDistanceCalibrationPoints, EdgeDetectionResult edgeDetectionResult, double referenceWidthStripes, LineScanCalibrationConfiguration configuration)
 This function calibrates linescan cameras. More...
 

Detailed Description

Collection of calibration line scan functions.

Member Function Documentation

◆ CalculateTwoPointsForCalibrationOfMovement()

static Point2Dd[] CalculateTwoPointsForCalibrationOfMovement ( ImagePlane  imagePlane,
Area2D  aoi,
CalibrationPatternContrast  contrast,
int  minContrast,
ValueRange< double >  pointSizeRange,
ScanDirection  scanDirection 
)
static

Extracts two points which can be used for the calibration of the movement of line scan cameras.

The output of this function serves as input for the linescan calibration process executed by the CreateLineScanCalibration function. If the image contains more than two points, the points which are nearest to the top and bottom edge(or left and right edge if ScanDirection is Y) are chosen.

Parameters
imagePlaneAn image plane containing the calibration points.
aoiArea of interest where the calibration points can be found.
contrastSelects whether the image shows white on black or black on white dots.
minContrastMinimum gray value contrast between the object and the background of the calibration points. Value to be set depends on the quality of the image taken.
pointSizeRangeThe minimum and maximum size of the markers in the image in [number of pixels].
scanDirectionScan direction of the camera.
Returns

◆ CreateLineScanCalibration()

static LineScanCalibrator CreateLineScanCalibration ( Point2Dd  calibrationPoint1,
Point2Dd  calibrationPoint2,
double  referenceDistanceCalibrationPoints,
EdgeDetectionResult  edgeDetectionResult,
double  referenceWidthStripes,
LineScanCalibrationConfiguration  configuration 
)
static

This function 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 = new Point2Dd(0, 0); // first point
auto calibrationPoint2 = new Point2Dd(1, 0); // second point
referenceDistanceCalibrationPoints = encoderStep; // reference distance between calibration points in[mm]
Multi-purpose 2D Point class
Definition: Point2Dd.cs:35
Parameters
calibrationPoint1First calibration point (left or top).
calibrationPoint2Second calibration point (right or bottom).
referenceDistanceCalibrationPointsReference distance between the two calibration points (same units as referenceWidthStripes ).
edgeDetectionResultResult returned by DetectEdgesOfStripeTarget.
referenceWidthStripesReference width of stripes in calibration pattern ImageStripes (same units as referenceDistanceCalibrationPoints ).
configurationConfiguration of the linescan calibration .
Returns
A line scan calibrator including a transformation and its quality.

◆ DetectEdgesOfStripeTarget()

static EdgeDetectionResult DetectEdgesOfStripeTarget ( Image  imageStripes,
Rect  aoi,
int  numStripes,
ScanDirection  scanDirection,
double  threshold 
)
static

This function detects edges from a calibration pattern with alternating black and white stripes.

The output of this function is used by function CreateLineScanCalibration calculating the linescan calibration. This function internally calls Edge.FindAll, where all input parameter are described, too. For detailed information see the documentation of the CVB edge tool.

Note, that the given area of interest aoi must only cover areas with stripes.

Note
The given number of stripes numStripes is only used for memory allocation. It does not necessarily have to precisely match the number of stripes, but it must be equal to or greater than the actual number of stripes. If the selected value is too low, an error is thrown ("bad allocation").
Parameters
imageStripesCalibration pattern with alternating black and white stripes.
aoiArea of interest in the given image.
numStripesNumber of stripes in the calibration pattern.
scanDirectionScan direction of the camera.
thresholdThreshold for gray value change.
Returns
Result of the edge detection.