3from __future__
import annotations
5from typing
import Union, Any
7from ids_peak_icv
import lib_loader
15from ids_peak_ipl
import ids_peak_ipl
21 Class for calibrating a workspace.
23 The WorkspaceCalibration calculates the extrinsic parameters based on a single image.
25 @ingroup ids_peak_icv_python_calibration
26 @since ids_peak_icv 1.1
31 calibration_plate: CalibrationPlate) -> WorkspaceCalibration:
34 Creates an instance of class WorkspaceCalibration.
36 In order to perform a workspace calibration, intrinsic parameters and a calibration plate must be provided.
38 @param intrinsic_parameters: Can be obtained using e.g. CameraCalibration.process() or
39 CalibrationParameters.create_from_file().
40 @param calibration_plate: A calibration plate.
42 @since ids_peak_icv 1.1
45 return cls(_intrinsic_parameters=intrinsic_parameters, _calibration_plate=calibration_plate)
47 def __init__(self, *args: Any, **kwargs: Any) ->
None:
50 In order to create a WorkspaceCalibration, please refer to the classmethods.
52 @since ids_peak_icv 1.1
59 "Cannot initialize {} with __init__. Please use a classmethod.".format(self.__class__.__name__))
61 def process(self, image: Union[Image, ids_peak_ipl.Image]) -> CalibrationResult:
64 Applies the workspace calibration and calculates the extrinsic camera parameters based on a single view of a
66 Furthermore, it computes the mean reprojection error.
68 @note This operation disregards any specified image regions. It processes the entire image.
70 @param image: An image containing a single calibration plate.
72 @exception NotPossibleException: If no image is provided.
73 @exception NotSupportedException: If the image format is not supported.
74 @exception MismatchException: If the sizes of the image is different to the one given
75 in the intrinsic parameters.
76 @exception TargetNotFoundException: If the images does not contain any calibration plate.
78 @since ids_peak_icv 1.1
80 if not isinstance(image, (Image, ids_peak_ipl.Image)):
82 "The given parameter type is not supported, only Images are supported.")
84 _image = _check_and_get_icv_image(image)
86 calibration_result = CalibrationResult._create_empty()
88 execute_and_map_return_codes(lib_loader.dll().peak_icv_WorkspaceCalibration_Process,
92 _image._handle, ctypes.pointer(calibration_result._handle))
94 return calibration_result
Class for calibrating a workspace.
None __init__(self, *Any args, **Any kwargs)
In order to create a WorkspaceCalibration, please refer to the classmethods.
WorkspaceCalibration create_from_intrinsics_and_plate(cls, IntrinsicParameters intrinsic_parameters, CalibrationPlate calibration_plate)
Creates an instance of class WorkspaceCalibration.
CalibrationResult process(self, Union[Image, ids_peak_ipl.Image] image)
Applies the workspace calibration and calculates the extrinsic camera parameters based on a single vi...
Thrown when an operation cannot be performed due to logical constraints.
Thrown when a requested operation is not implemented or supported.