1from __future__
import annotations
4from typing
import Any, TYPE_CHECKING
6from ids_peak_common.datatypes.geometry.size
import Size
7from ids_peak_common.datatypes.pixelformat
import PixelFormat
8from ids_peak_icv
import lib_loader
22 Represents a three-channel image encoding cartesian coordinates (x, y, z) of a 3D point.
24 This image is derived from an undistorted depth map
25 that contains embedded intrinsic parameters and uses radial coordinates.
27 In contrast to radial coordinates,
28 which measure the direct distance from the optical center to the object,
29 cartesian coordinates project these measurements onto a uniform plane.
32 If the camera faces a flat wall,
33 only the cartesian coordinates will form a flat plane,
34 whereas radial values will increase towards the image edges.
36 @ingroup ids_peak_icv_python_types
37 @since ids_peak_icv 1.1
44 Constructs a cartesian coordinate image from an undistorted depth map.
46 To convert a distorted depth map into the required format,
47 use the `Undistortion` class beforehand.
49 @supportedPixelformats{XYZImageTransformer}
51 @param undistorted_depth_map:
52 An image encoding radial distances to 3D points
53 that contains embedded intrinsic camera parameters.
55 @since ids_peak_icv 1.1
57 return cls(_undistorted_depth_map=undistorted_depth_map)
59 def __init__(self, *args: Any, **kwargs: Any) ->
None:
62 In order to create a xyz image, please refer to the class methods.
64 @since ids_peak_icv 1.1
66 if "_undistorted_depth_map" in kwargs:
67 image = Image.create_from_pixel_format_and_size(PixelFormat.COORD3D_ABC32F,
68 Size(kwargs[
"_undistorted_depth_map"].width,
69 kwargs[
"_undistorted_depth_map"].height))
70 super().
__init__(_handle=image._handle)
73 execute_and_map_return_codes(lib_loader.dll().peak_icv_Transform_DepthMap_To_XYZImage,
75 kwargs[
"_undistorted_depth_map"].intrinsic_parameters._parameters,
77 kwargs[
"_undistorted_depth_map"].intrinsic_parameters._parameters),
78 kwargs[
"_undistorted_depth_map"]._handle)
79 elif "_handle" in kwargs:
80 super().
__init__(_handle=kwargs[
"_handle"])
83 "Cannot initialize {} with __init__. Please use a classmethod.".format(self.__class__.__name__))
88 Transforms the camera-centric coordinates into workspace coordinates.
90 This applies the inverse of the provided extrinsic matrix
92 from the camera's perspective
93 into the physical workspace.
95 @param extrinsic_parameters:
96 Extrinsic parameters from the workspace calibration.
98 @since ids_peak_icv 1.1
103 execute_and_map_return_codes(lib_loader.dll().peak_icv_Image_Create,
104 ctypes.pointer(output_handle),
105 ctypes.c_int(PixelFormat.COORD3D_ABC32F.value),
107 execute_and_map_return_codes(lib_loader.dll().peak_icv_Image_TransformToWorkspace,
109 extrinsic_parameters._parameters, ctypes.sizeof(extrinsic_parameters._parameters),
112 return XYZImage(_handle=output_handle)
Image Class for working with algorithms.
Represents a three-channel image encoding cartesian coordinates (x, y, z) of a 3D point.
None __init__(self, *Any args, **Any kwargs)
In order to create a xyz image, please refer to the class methods.
XYZImage transform_to_workspace(self, ExtrinsicParameters extrinsic_parameters)
Transforms the camera-centric coordinates into workspace coordinates.
XYZImage create_from_undistorted_image(cls, UndistortedImage undistorted_depth_map)
Constructs a cartesian coordinate image from an undistorted depth map.
Occurs when an operation cannot be performed due to logical constraints (e.g., camera calibration wit...