Zivid C++ API 2.17.1+7516d437-1
Zivid::Calibration Namespace Reference

Classes

class  AccuracyEstimate
 A dimension accuracy estimate for a specific working volume. More...
class  CameraCorrection
 An in-field correction that may be written to a camera. More...
class  CameraVerification
 An assessment of the current dimension trueness of a camera at a specific location. More...
class  DetectionResult
 A result returned by the detectCalibrationBoard(...) call. More...
class  DetectionResultFiducialMarkers
 Stores the result returned by a detectMarkers(const Frame &frame, const std::vector<int> &markerIds, const MarkerDictionary &markerDictionary) call. More...
class  HandEyeInput
 Binds together a robot pose and the detection result acquired from the pose. More...
class  HandEyeOutput
 The hand-eye calibration result containing the computed pose and reprojection errors for all the input poses. More...
class  HandEyeResidual
 Representation of the estimated errors of a calibrated hand-eye transform. More...
class  InfieldCorrectionInput
 Container for input-data needed by in-field verification and correction functions. More...
class  MarkerDictionary
 Holds information about fiducial markers such as ArUco or AprilTag for detection. More...
class  MarkerShape
 Holds physical (3D) and image (2D) properties of a detected fiducial marker. More...
class  MultiCameraOutput
 The results from a multi-camera calibration process. More...
class  MultiCameraResidual
 Representation of the estimated errors of a multi-camera calibration. More...
class  Pose
 Describes a rigid transform (rotation+translation), such as a robot pose. More...

Enumerations

enum class  CalibrationBoardDetectionStatus {
  ok , noValidFiducialMarkerDetected , multipleValidFiducialMarkersDetected , boardDetectionFailed ,
  insufficient3DQuality
}
enum class  InfieldCorrectionDetectionStatus { ok , detectionFailed , invalidAlignment }

Functions

ZIVID_CORE_EXPORT std::string toString (const CalibrationBoardDetectionStatus &status)
 Get string representation of the status.
ZIVID_CORE_EXPORT std::ostream & operator<< (std::ostream &stream, const CalibrationBoardDetectionStatus &status)
 Serialize the value to a stream.
ZIVID_CORE_EXPORT std::ostream & operator<< (std::ostream &stream, const DetectionResult &result)
 Serialize the value to a stream.
ZIVID_CORE_EXPORT std::ostream & operator<< (std::ostream &stream, const DetectionResultFiducialMarkers &result)
 Serialize the value to a stream.
ZIVID_CORE_EXPORT DetectionResult detectCalibrationBoard (Zivid::Camera &camera)
 Detects feature points from a calibration board using the given camera.
ZIVID_CORE_EXPORT DetectionResult detectCalibrationBoard (const Frame &frame)
 Detects feature points from a calibration board in a frame.
ZIVID_CORE_EXPORT DetectionResultFiducialMarkers detectMarkers (const Frame &frame, const std::vector< int > &allowedMarkerIds, const MarkerDictionary &markerDictionary)
 Detects fiducial markers such as ArUco markers in a frame.
ZIVID_CORE_EXPORT Frame captureCalibrationBoard (Zivid::Camera &camera)
 Capture calibration board with the given camera.
ZIVID_CORE_EXPORT DetectionResult detectFeaturePoints (const PointCloud &cloud)
 Detects feature points from a calibration board in a point cloud.
ZIVID_CORE_EXPORT std::ostream & operator<< (std::ostream &stream, const HandEyeInput &handEyeInput)
 Serialize the value to a stream.
ZIVID_CORE_EXPORT std::ostream & operator<< (std::ostream &stream, const HandEyeResidual &residual)
 Serialize the value to a stream.
ZIVID_CORE_EXPORT std::ostream & operator<< (std::ostream &stream, const HandEyeOutput &handEyeOutput)
 Serialize the value to a stream.
ZIVID_CORE_EXPORT HandEyeOutput calibrateEyeInHand (const std::vector< HandEyeInput > &inputs)
 Performs eye-in-hand calibration.
ZIVID_CORE_EXPORT HandEyeOutput calibrateEyeToHand (const std::vector< HandEyeInput > &inputs)
 Performs eye-to-hand calibration.
ZIVID_CORE_EXPORT std::ostream & operator<< (std::ostream &stream, const InfieldCorrectionInput &input)
 Serialize the value to a stream.
ZIVID_CORE_EXPORT std::ostream & operator<< (std::ostream &stream, const CameraVerification &cameraVerification)
 Serialize the value to a stream.
ZIVID_CORE_EXPORT std::ostream & operator<< (std::ostream &stream, const AccuracyEstimate &accuracyEstimate)
 Serialize the value to a stream.
ZIVID_CORE_EXPORT std::ostream & operator<< (std::ostream &stream, const CameraCorrection &cameraCorrection)
 Serialize the value to a stream.
ZIVID_CORE_EXPORT CameraVerification verifyCamera (const InfieldCorrectionInput &input)
 Verify the current camera trueness based on a single measurement.
ZIVID_CORE_EXPORT CameraCorrection computeCameraCorrection (const std::vector< InfieldCorrectionInput > &dataset)
 Calculate new in-field camera correction.
ZIVID_CORE_EXPORT void writeCameraCorrection (Camera &camera, const CameraCorrection &cameraCorrection)
 Write the in-field correction on a camera.
ZIVID_CORE_EXPORT void resetCameraCorrection (Camera &camera)
 Reset the in-field correction on a camera to factory settings.
ZIVID_CORE_EXPORT bool hasCameraCorrection (const Camera &camera)
 Check if the camera has an in-field correction written to it.
ZIVID_CORE_EXPORT std::chrono::time_point< std::chrono::system_clock > cameraCorrectionTimestamp (const Camera &camera)
 Get the UTC time at which the camera's in-field correction was created.
ZIVID_CORE_EXPORT std::string toString (InfieldCorrectionDetectionStatus status)
 Get string representation of the status.
ZIVID_CORE_EXPORT std::ostream & operator<< (std::ostream &stream, const InfieldCorrectionDetectionStatus &status)
 Serialize the value to a stream.
ZIVID_CORE_EXPORT std::ostream & operator<< (std::ostream &os, const MarkerDictionary &dictionary)
 Serialize the dictionary to a stream.
ZIVID_CORE_EXPORT std::ostream & operator<< (std::ostream &stream, const MarkerShape &shape)
 Serialize the value to a stream.
ZIVID_CORE_EXPORT std::ostream & operator<< (std::ostream &stream, const MultiCameraResidual &residual)
 Serialize the value to a stream.
ZIVID_CORE_EXPORT std::ostream & operator<< (std::ostream &stream, const MultiCameraOutput &multiCameraOutput)
 Serialize the value to a stream.
ZIVID_CORE_EXPORT MultiCameraOutput calibrateMultiCamera (const std::vector< DetectionResult > &detectionResults)
 Performs multi-camera calibration.
ZIVID_UTILS_EXPORT std::ostream & operator<< (std::ostream &stream, const Pose &pose)
 Serialize the value to a stream.

Enumeration Type Documentation

◆ CalibrationBoardDetectionStatus

Enumerator
ok 
noValidFiducialMarkerDetected 
multipleValidFiducialMarkersDetected 
boardDetectionFailed 
insufficient3DQuality 

◆ InfieldCorrectionDetectionStatus

Enumerator
ok 
detectionFailed 
invalidAlignment 

Function Documentation

◆ calibrateEyeInHand()

ZIVID_CORE_EXPORT HandEyeOutput Zivid::Calibration::calibrateEyeInHand ( const std::vector< HandEyeInput > & inputs)

Performs eye-in-hand calibration.

The procedure requires all robot poses to be different. At least 2 poses are required when using a calibration board, or 6 poses when using fiducial markers. For fiducial markers, each marker must be detected across 2 poses at minimum. An exception will be thrown if the preceding requirements are not fulfilled.

Note: the units of the input robot poses must be consistent with the units of the point clouds used to create the detection results. Zivid point clouds are, by default, in millimeters.

Parameters
inputsVector of HandEyeInput instances.
Returns
Instance of HandEyeOutput.

◆ calibrateEyeToHand()

ZIVID_CORE_EXPORT HandEyeOutput Zivid::Calibration::calibrateEyeToHand ( const std::vector< HandEyeInput > & inputs)

Performs eye-to-hand calibration.

The procedure requires all robot poses to be different. At least 2 poses are required when using a calibration board, or 6 poses when using fiducial markers. For fiducial markers, each marker must be detected across 2 poses at minimum. An exception will be thrown if the preceding requirements are not fulfilled.

Note: the units of the input robot poses must be consistent with the units of the point clouds used to create the detection results. Zivid point clouds are, by default, in millimeters.

Parameters
inputsVector of HandEyeInput instances.
Returns
Instance of HandEyeOutput.

◆ calibrateMultiCamera()

ZIVID_CORE_EXPORT MultiCameraOutput Zivid::Calibration::calibrateMultiCamera ( const std::vector< DetectionResult > & detectionResults)

Performs multi-camera calibration.

Multi-camera calibration is used in a multi-camera setup to find the pose of secondary cameras in the frame of a designated primary camera, e.g. to combine points clouds into a single frame of reference.

The input is generated by imaging the same checkerboard from each camera and inserting the resulting frame into Zivid::Calibration::detectCalibrationBoard(const Zivid::Frame &frame). Add the resulting DetectionResult objects to a vector with the first element corresponding to the primary camera.

The returned object contains a vector of transforms, which provides the pose of camera[i] in the frame of camera[0]. Apply transform[i] to the points from camera[i] to get the same points in the frame of camera[0]. The returned object also contains a vector of residuals corresponding to each transform.

Parameters
detectionResultsVector of DetectionResult instances.
Returns
A MultiCameraOutput instance.

◆ cameraCorrectionTimestamp()

ZIVID_CORE_EXPORT std::chrono::time_point< std::chrono::system_clock > Zivid::Calibration::cameraCorrectionTimestamp ( const Camera & camera)

Get the UTC time at which the camera's in-field correction was created.

If hasCameraCorrection is false, the returned timestamp will default to beginning of epoch (Jan 1st 1970 UTC).

Parameters
cameraThe camera to check
Returns
A UTC timestamp indicating when the correction was created

◆ captureCalibrationBoard()

ZIVID_CORE_EXPORT Frame Zivid::Calibration::captureCalibrationBoard ( Zivid::Camera & camera)

Capture calibration board with the given camera.

The functionality is to be exclusively used in combination with Zivid verified calibration boards. For further information please visit Zivid help page.

This function will perform a relatively slow but high-quality point cloud capture with the given camera. This function is necessary for applications that require very high-accuracy captures, such as in-field verification/correction.

The Frame that is returned from this function may be used as input to Zivid::Calibration::detectCalibrationBoard(const Zivid::Frame &frame). You may also use Zivid::Calibration::detectCalibrationBoard(Zivid::Camera &camera) directly, which will invoke this function under the hood and yield a DetectionResult.

◆ computeCameraCorrection()

ZIVID_CORE_EXPORT CameraCorrection Zivid::Calibration::computeCameraCorrection ( const std::vector< InfieldCorrectionInput > & dataset)

Calculate new in-field camera correction.

The purpose of this function is to calculate a new in-field correction for a camera based on a series of calibration object captures taken at varying distances. This function will throw an exception if any of the provided InfieldCorrectionInput have valid()==false.

The quantity and range of data is up to the user, but generally a larger dataset will yield a more accurate and reliable correction. If all measurements were taken at approximately the same distance, the resulting correction will mainly be valid at those distances. If several measurements were taken at significantly different distances, the resulting correction will likely be more suitable for extrapolation to distances beyond where the dataset was collected.

The result of this process is a CameraCorrection object, which will contain information regarding the proposed working range and the accuracy that can be expected within the working range, if the correction is written to the camera. The correction may be written to the camera using void writeCameraCorrection(Zivid::Camera &camera, const CameraCorrection &cameraCorrection).

This function will throw an exception if the input data is extremely inconsistent/noisy.

Parameters
datasetA sequence of in-field correction measurements.
Returns
A new correction that may be written to the camera.

◆ detectCalibrationBoard() [1/2]

ZIVID_CORE_EXPORT DetectionResult Zivid::Calibration::detectCalibrationBoard ( const Frame & frame)

Detects feature points from a calibration board in a frame.

The functionality is to be exclusively used in combination with Zivid verified calibration boards. For further information please visit Zivid help page.

Parameters
frameA frame containing an image of a calibration board

◆ detectCalibrationBoard() [2/2]

ZIVID_CORE_EXPORT DetectionResult Zivid::Calibration::detectCalibrationBoard ( Zivid::Camera & camera)

Detects feature points from a calibration board using the given camera.

The functionality is to be exclusively used in combination with Zivid verified calibration boards. For further information please visit Zivid help page.

This function will perform a relatively slow but high-quality point cloud capture with the given camera. This function is necessary for applications that require very high-accuracy DetectionResult, such as in-field verification/correction.

Parameters
cameraCamera to be used to capture the calibration board

◆ detectFeaturePoints()

ZIVID_CORE_EXPORT DetectionResult Zivid::Calibration::detectFeaturePoints ( const PointCloud & cloud)

Detects feature points from a calibration board in a point cloud.

The functionality is to be exclusively used in combination with Zivid verified calibration boards. For further information please visit Zivid help page.

This method is deprecated as of SDK 2.9. Instead you should use Zivid::Calibration::detectCalibrationBoard(const Zivid::Frame &frame) or Zivid::Calibration::detectCalibrationBoard(Zivid::Camera &camera).

Parameters
cloudPoint cloud from a frame containing an image of a calibration board

◆ detectMarkers()

ZIVID_CORE_EXPORT DetectionResultFiducialMarkers Zivid::Calibration::detectMarkers ( const Frame & frame,
const std::vector< int > & allowedMarkerIds,
const MarkerDictionary & markerDictionary )

Detects fiducial markers such as ArUco markers in a frame.

Only markers with integer IDs are supported. For further information on fiducial markers see this wikipedia page. For more information on ArUco markers specifically, refer to the OpenCV documentation. The Frame need not contain all markers listed in allowedMarkerIds for a successful detection.

Parameters
frameA frame containing an image of one or several fiducial markers
allowedMarkerIdsA list of the IDs of markers to be detected
markerDictionaryThe marker dictionary that describes the appearance of each marker

◆ hasCameraCorrection()

ZIVID_CORE_EXPORT bool Zivid::Calibration::hasCameraCorrection ( const Camera & camera)

Check if the camera has an in-field correction written to it.

This is false if writeCameraCorrection has never been called using this camera. It will also be false after calling resetCameraCorrection.

Parameters
cameraThe camera to check
Returns
Boolean indicating whether or not the camera has an in-field correction

◆ operator<<() [1/16]

ZIVID_CORE_EXPORT std::ostream & Zivid::Calibration::operator<< ( std::ostream & os,
const MarkerDictionary & dictionary )

Serialize the dictionary to a stream.

◆ operator<<() [2/16]

ZIVID_CORE_EXPORT std::ostream & Zivid::Calibration::operator<< ( std::ostream & stream,
const AccuracyEstimate & accuracyEstimate )

Serialize the value to a stream.

◆ operator<<() [3/16]

ZIVID_CORE_EXPORT std::ostream & Zivid::Calibration::operator<< ( std::ostream & stream,
const CalibrationBoardDetectionStatus & status )

Serialize the value to a stream.

◆ operator<<() [4/16]

ZIVID_CORE_EXPORT std::ostream & Zivid::Calibration::operator<< ( std::ostream & stream,
const CameraCorrection & cameraCorrection )

Serialize the value to a stream.

◆ operator<<() [5/16]

ZIVID_CORE_EXPORT std::ostream & Zivid::Calibration::operator<< ( std::ostream & stream,
const CameraVerification & cameraVerification )

Serialize the value to a stream.

◆ operator<<() [6/16]

ZIVID_CORE_EXPORT std::ostream & Zivid::Calibration::operator<< ( std::ostream & stream,
const DetectionResult & result )

Serialize the value to a stream.

◆ operator<<() [7/16]

ZIVID_CORE_EXPORT std::ostream & Zivid::Calibration::operator<< ( std::ostream & stream,
const DetectionResultFiducialMarkers & result )

Serialize the value to a stream.

◆ operator<<() [8/16]

ZIVID_CORE_EXPORT std::ostream & Zivid::Calibration::operator<< ( std::ostream & stream,
const HandEyeInput & handEyeInput )

Serialize the value to a stream.

◆ operator<<() [9/16]

ZIVID_CORE_EXPORT std::ostream & Zivid::Calibration::operator<< ( std::ostream & stream,
const HandEyeOutput & handEyeOutput )

Serialize the value to a stream.

◆ operator<<() [10/16]

ZIVID_CORE_EXPORT std::ostream & Zivid::Calibration::operator<< ( std::ostream & stream,
const HandEyeResidual & residual )

Serialize the value to a stream.

◆ operator<<() [11/16]

ZIVID_CORE_EXPORT std::ostream & Zivid::Calibration::operator<< ( std::ostream & stream,
const InfieldCorrectionDetectionStatus & status )

Serialize the value to a stream.

◆ operator<<() [12/16]

ZIVID_CORE_EXPORT std::ostream & Zivid::Calibration::operator<< ( std::ostream & stream,
const InfieldCorrectionInput & input )

Serialize the value to a stream.

◆ operator<<() [13/16]

ZIVID_CORE_EXPORT std::ostream & Zivid::Calibration::operator<< ( std::ostream & stream,
const MarkerShape & shape )

Serialize the value to a stream.

◆ operator<<() [14/16]

ZIVID_CORE_EXPORT std::ostream & Zivid::Calibration::operator<< ( std::ostream & stream,
const MultiCameraOutput & multiCameraOutput )

Serialize the value to a stream.

◆ operator<<() [15/16]

ZIVID_CORE_EXPORT std::ostream & Zivid::Calibration::operator<< ( std::ostream & stream,
const MultiCameraResidual & residual )

Serialize the value to a stream.

◆ operator<<() [16/16]

ZIVID_UTILS_EXPORT std::ostream & Zivid::Calibration::operator<< ( std::ostream & stream,
const Pose & pose )

Serialize the value to a stream.

◆ resetCameraCorrection()

ZIVID_CORE_EXPORT void Zivid::Calibration::resetCameraCorrection ( Camera & camera)

Reset the in-field correction on a camera to factory settings.

Parameters
cameraThe camera to reset

◆ toString() [1/2]

ZIVID_CORE_EXPORT std::string Zivid::Calibration::toString ( const CalibrationBoardDetectionStatus & status)

Get string representation of the status.

◆ toString() [2/2]

ZIVID_CORE_EXPORT std::string Zivid::Calibration::toString ( InfieldCorrectionDetectionStatus status)

Get string representation of the status.

◆ verifyCamera()

ZIVID_CORE_EXPORT CameraVerification Zivid::Calibration::verifyCamera ( const InfieldCorrectionInput & input)

Verify the current camera trueness based on a single measurement.

The purpose of this function is to allow quick assessment of the quality of the in-field correction on a camera (or the need for one if none exists already). This function will throw an exception if the provided InfieldCorrectionInput has valid()==false.

The return value of this function will give an indication of the dimension trueness at the location where the input data was captured. If the returned assessment indicates a trueness error that is above threshold for your application, consider using computeCameraCorrection(const std::vector<InfieldCorrectionInput> &dataset) in order to get an updated correction for the camera.

Parameters
inputA single in-field correction measurement.

◆ writeCameraCorrection()

ZIVID_CORE_EXPORT void Zivid::Calibration::writeCameraCorrection ( Camera & camera,
const CameraCorrection & cameraCorrection )

Write the in-field correction on a camera.

After calling this function, the given correction will automatically be used any time the capture function is called on this camera. The correction will be persisted on the camera even though the camera is power-cycled or connected to a different PC.

Beware that calling this will overwrite any existing correction present on the camera.

Parameters
cameraThe camera to write the correction to
cameraCorrectionThe camera correction to write