CVB++ 14.0
Cvb::Foundation::CalibrationLineScan Namespace Reference

Namespace for collection of calibration line-scan functions from the Foundation package. More...

Classes

class  EdgeDetectionResult
 A set of parameters that stores the result from an edge detection. More...
 
class  LineScanCalibrationConfiguration
 A set of parameters, which is used to configure line-scan calibration. More...
 
class  LineScanCalibrator
 A set of parameters that is required by the following data transformation to get the final result. More...
 

Typedefs

using LineScanCalibratorPtr = std::shared_ptr< LineScanCalibrator >
 Convenience shared pointer for LineScanCalibrator.
 

Enumerations

enum class  ScanDirection { X = CExports::CVFScanDirection::CVFSD_X , Y = CExports::CVFScanDirection::CVFSD_Y }
 Specifies the scanning direction. More...
 
enum class  PreDefinedPixelSizeMode { DoNotUse , Use }
 Specifies if the predefined pixel resolution is used for the metric calibration. More...
 

Functions

std::pair< Point2D< double >, Point2D< double > > CalculateTwoPointsForCalibrationOfMovement (const ImagePlane &imagePlane, const Area2D &aoi, CalibrationPatternContrast contrast, int minContrast, const ValueRange< double > &pointSizeRange, const ScanDirection &scanDirection)
 Extracts two points which can be used for the calibration of the movement of line-scan cameras. More...
 
EdgeDetectionResult DetectEdgesOfStripeTarget (const Image &imageStripes, const Area2D &aoi, int numStripes, const ScanDirection &scanDirection, double threshold)
 This function detects edges from a calibration pattern with alternating black and white stripes. More...
 
std::unique_ptr< LineScanCalibratorCreateLineScanCalibration (const Point2D< double > &calibrationPoint1, const Point2D< double > &calibrationPoint2, double referenceDistanceCalibrationPoints, const EdgeDetectionResult &edgeDetectionResult, double referenceWidthStripes, const LineScanCalibrationConfiguration &configuration)
 Calibrates line-scan cameras. More...
 

Detailed Description

Namespace for collection of calibration line-scan functions from the Foundation package.

Remarks
CMake users: Link to imported target CVB::CvbFoundationCalibrationLineScan.

Enumeration Type Documentation

◆ PreDefinedPixelSizeMode

enum class PreDefinedPixelSizeMode
strong

Specifies if the predefined pixel resolution is used for the metric calibration.

Enumerator
DoNotUse 

Predefined pixel resolution will not be used.

Use 

Predefined pixel resolution will be used.

◆ ScanDirection

enum class ScanDirection
strong

Specifies the scanning direction.

Enumerator

Scans along the X coordinate.

Scans along the Y coordinate.

Function Documentation

◆ CalculateTwoPointsForCalibrationOfMovement()

std::pair< Point2D< double >, Point2D< double > > CalculateTwoPointsForCalibrationOfMovement ( const ImagePlane imagePlane,
const Area2D aoi,
CalibrationPatternContrast  contrast,
int  minContrast,
const ValueRange< double > &  pointSizeRange,
const ScanDirection scanDirection 
)
inline

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

Parameters
[in]imagePlaneAn image plane containing the calibration points.
[in]aoiArea of interest where the calibration points can be found.
[in]contrastSelects whether the image shows white on black or black on white dots.
[in]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.
[in]pointSizeRangeDesired range of the point size (in number of pixels).
[in]scanDirectionScan direction of the camera.
Returns
first: X and Y coordinate of left calibration point if the scan direction is X, otherwise top point. second: X and Y coordinate of right calibration point if the scan direction is Y, otherwise bottom point.
Exceptions
Anyexception derived from std::exception including CvbException.

If the image contains more than two points, the points which are nearest to the left and right edge (or top and bottom edge, if movement direction is x) are chosen.

◆ CreateLineScanCalibration()

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

Calibrates line-scan cameras.

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 line-scan calibration.
Returns
A line-scan calibrator including a transformation and its quality.

The transformation result includes a 3rd order polynomial for the line calibration and a factor to correct the movement direction. Note, that x and y do not depend on each other. All mixed coefficients are zero.

For the calibration of the movement direction, an image containing two calibration dots is needed. The pixel coordinates of the dots calibrationPoint1 and calibrationPoint2 are calculated by the function CalculateTwoPointsForCalibrationOfMovement.

This function needs these coordinates and the reference distance between the dots referenceDistanceCalibrationPoints.

For the line-scan calibration, an image of a pattern with alternating black and white stripes has to be acquired. Also, the width of the stripes referenceWidthStripes has to be given as reference.

◆ DetectEdgesOfStripeTarget()

EdgeDetectionResult DetectEdgesOfStripeTarget ( const Image imageStripes,
const Area2D aoi,
int  numStripes,
const ScanDirection scanDirection,
double  threshold 
)
inline

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

Parameters
[in]imageStripesCalibration pattern with alternating black and white stripes.
[in]aoiArea of interest in the given image.
[in]numStripesNumber of stripes in the calibration pattern.
[in]scanDirectionScan direction of the camera.
[in]thresholdThreshold for edge detection in the given image (pixel data type-dependent, see also Edge::FindAllEdges).
Returns
Result of the edge detection.

The output of this function is used by CreateLineScanCalibration calculating the line-scan calibration.

For the detection of the transition between the stripes, the CVB function Edge::FindAllEdges is used. For further information see the documentation of the CVB edge tool.