object_model_3d_to_xyz
— Transform 3D points from a 3D object model to images.
The operator object_model_3d_to_xyz
transforms the 3D points of
the 3D object model ObjectModel3D
into the three images
X
, Y
, and Z
.
Three transformation modes are possible. The parameter Type
is
used to select one of them. Note that multiple 3D object models can be
passed in ObjectModel3D
only for the mode 'cartesian_faces' .
All other modes expect a single 3D object model.
First, each point is transformed into the camera coordinate system
using the given Pose
. Then, these coordinates are projected
into the image coordinate system based on the internal camera parameters
CamParam
.
The internal camera parameters CamParam
describe the
projection characteristics of the camera (see
Calibration).
The Pose
is in the form ,
where ccs denotes camera coordinate system and
mcs the model coordinate system (which is a 3D world coordinate
system), see Transformations / Poses and
“Solution Guide III-C - 3D Vision”
.
Hence, it describes the
position and orientation of the model coordinate system relative
to the camera coordinate system.
The X-, Y-, and Z-coordinates of the transformed point are written into the corresponding image at the position of the projection. If multiple points are projected to the same image coordinates, the point with the smallest Z-value is written (hidden-point removal). The dimensions of the returned images are defined by the camera parameters.
The returned images show the object as it would look like when seeing it with the specified camera under the specified pose.
In order to use this transformation, the input 3D object models need to
contain faces (triangles or polygons), otherwise, the 3D object model
without faces is disregarded.
Note that if the 3D object models have polygon faces, those are converted
internally to triangles. This conversion can be done beforehand to speed
up this operator.
For this, read_object_model_3d
can be called with the
GenParamName
'convert_to_triangles' set to
'true' , to convert all faces to triangles.
Alternatively, triangulate_object_model_3d
can be called prior
to this operator.
First, each face of the 3D object models ObjectModel3D
is
transformed into the camera coordinate system
using the given Pose
. Then, these coordinates are projected
into the image coordinate system based on the internal camera parameters
CamParam
, while keeping the 3D information (X-, Y-, and
Z-coordinates) for each of those pixels. For a more detailed explanation
of CamParam
and Pose
please refer to the section
'cartesian' .
If multiple face are projected to the same image coordinates, the
value with the smallest Z-value is written (hidden-point removal).
The dimensions of the returned images are defined by the camera
parameters.
The returned images show the objects as they would look like when seeing them with the specified camera under the specified pose.
In case that OpenGL 2.1, GLSL 1.2, and the OpenGL extensions GL_EXT_framebuffer_object and GL_EXT_framebuffer_blit are available, speed increases.
This Type
can be used to create 3D object models containing
2D mapping data, by creating a 3D object model from the returned images
using xyz_to_object_model_3d
.
Note that in many cases, it is recommended to use the 2D mapping data,
if available, for speed and robustness reasons. This is beneficial for
example when using sample_object_model_3d
,
surface_normals_object_model_3d
, or when preparing a 3D object
model for surface-based matching, e.g., smoothing, removing outliers, and
reducing the domain.
This transformation mode works only if the 3D object model was created
with the operator xyz_to_object_model_3d
.
It writes each 3D point to the image coordinate where it originally
came from, using the mapping attribute that is stored within the
3D object model.
The parameters CamParam
and Pose
are ignored.
The dimensions of the returned images are equal to the dimensions of the
original images that were used with xyz_to_object_model_3d
to
create the 3D object model and can be queried from
get_object_model_3d_params
with 'mapping_size' .
This transformation mode is faster than 'cartesian' .
It is suitable, e.g., to visualize the results of a segmentation done with
segment_object_model_3d
.
Cameras with hypercentric lenses are not supported.
X
(output_object) singlechannelimage →
object (real)
Image with the X-Coordinates of the 3D points.
Y
(output_object) singlechannelimage →
object (real)
Image with the Y-Coordinates of the 3D points.
Z
(output_object) singlechannelimage →
object (real)
Image with the Z-Coordinates of the 3D points.
ObjectModel3D
(input_control) object_model_3d(-array) →
(handle)
Handle of the 3D object model.
Type
(input_control) string →
(string)
Type of the conversion.
Default value: 'cartesian'
List of values: 'cartesian' , 'cartesian_faces' , 'from_xyz_map'
CamParam
(input_control) campar →
(real / integer / string)
Camera parameters.
Pose
(input_control) pose →
(real / integer)
Pose of the 3D object model.
Number of elements: Pose == 0 || Pose == 7 || Pose == 12
The operator object_model_3d_to_xyz
returns the value
2 (H_MSG_TRUE) if the given parameters are correct. Otherwise, an exception
will be raised.
read_object_model_3d
,
xyz_to_object_model_3d
,
triangulate_object_model_3d
xyz_to_object_model_3d
,
get_object_model_3d_params
3D Metrology