Skip to content

object_model_3d_to_xyzobject_model_3d_to_xyzObjectModel3dToXyzObjectModel3dToXyzobject_model_3d_to_xyzT_object_model_3d_to_xyzπŸ”—

Short descriptionπŸ”—

object_model_3d_to_xyzobject_model_3d_to_xyzObjectModel3dToXyzObjectModel3dToXyzobject_model_3d_to_xyzT_object_model_3d_to_xyz β€” Transform 3D points from a 3D object model to images.

SignatureπŸ”—

object_model_3d_to_xyz( out image X, out image Y, out image Z, object_model_3d ObjectModel3D, string Type, campar CamParam, pose Pose )object_model_3d_to_xyz( : X, Y, Z : ObjectModel3D, Type, CamParam, Pose : )void ObjectModel3dToXyz( HObject* X, HObject* Y, HObject* Z, const HTuple& ObjectModel3D, const HTuple& Type, const HTuple& CamParam, const HTuple& Pose )static void HOperatorSet.ObjectModel3dToXyz( out HObject x, out HObject y, out HObject z, HTuple objectModel3D, HTuple type, HTuple camParam, HTuple pose )def object_model_3d_to_xyz( object_model_3d: MaybeSequence[HHandle], type: str, cam_param: Sequence[Union[float, int, str]], pose: Sequence[Union[int, float]] ) -> Tuple[HObject, HObject, HObject]

Herror T_object_model_3d_to_xyz( Hobject* X, Hobject* Y, Hobject* Z, const Htuple ObjectModel3D, const Htuple Type, const Htuple CamParam, const Htuple Pose )

static HImage HObjectModel3D::ObjectModel3dToXyz( HImage* Y, HImage* Z, const HObjectModel3DArray& ObjectModel3D, const HString& Type, const HCamPar& CamParam, const HPose& Pose )

HImage HObjectModel3D::ObjectModel3dToXyz( HImage* Y, HImage* Z, const HString& Type, const HCamPar& CamParam, const HPose& Pose ) const

HImage HObjectModel3D::ObjectModel3dToXyz( HImage* Y, HImage* Z, const char* Type, const HCamPar& CamParam, const HPose& Pose ) const

HImage HObjectModel3D::ObjectModel3dToXyz( HImage* Y, HImage* Z, const wchar_t* Type, const HCamPar& CamParam, const HPose& Pose ) const (Windows only)

HImage HCamPar::ObjectModel3dToXyz( HImage* Y, HImage* Z, const HObjectModel3DArray& ObjectModel3D, const HString& Type, const HPose& Pose ) const

HImage HCamPar::ObjectModel3dToXyz( HImage* Y, HImage* Z, const HObjectModel3D& ObjectModel3D, const HString& Type, const HPose& Pose ) const

HImage HCamPar::ObjectModel3dToXyz( HImage* Y, HImage* Z, const HObjectModel3D& ObjectModel3D, const char* Type, const HPose& Pose ) const

HImage HCamPar::ObjectModel3dToXyz( HImage* Y, HImage* Z, const HObjectModel3D& ObjectModel3D, const wchar_t* Type, const HPose& Pose ) const (Windows only)

static HImage HObjectModel3D.ObjectModel3dToXyz( out HImage y, out HImage z, HObjectModel3D[] objectModel3D, string type, HCamPar camParam, HPose pose )

HImage HObjectModel3D.ObjectModel3dToXyz( out HImage y, out HImage z, string type, HCamPar camParam, HPose pose )

HImage HCamPar.ObjectModel3dToXyz( out HImage y, out HImage z, HObjectModel3D[] objectModel3D, string type, HPose pose )

HImage HCamPar.ObjectModel3dToXyz( out HImage y, out HImage z, HObjectModel3D objectModel3D, string type, HPose pose )

DescriptionπŸ”—

The operator object_model_3d_to_xyzObjectModel3dToXyz transforms the 3D points of the 3D object model ObjectModel3DobjectModel3Dobject_model_3d into the three images Xxx, Yyy, and Zzz.

Three transformation modes are possible. The parameter Typetypetype is used to select one of them. Note that multiple 3D object models can be passed in ObjectModel3DobjectModel3Dobject_model_3d only for the mode 'cartesian_faces'"cartesian_faces". All other modes expect a single 3D object model.

  • 'cartesian'"cartesian": First, each point is transformed into the camera coordinate system using the given Poseposepose. Then, these coordinates are projected into the image coordinate system based on the internal camera parameters CamParamcamParamcam_param.

    The internal camera parameters CamParamcamParamcam_param describe the projection characteristics of the camera (see Calibration). The Poseposepose is in the form \(\mvPoseVar{{ccs}}{mcs}\), where ccs denotes camera coordinate system and mcs the model coordinate system (which is a 3D world coordinate system), see [``Solving machine vision tasks > Machine vision basics

    Transformations > 3D Transformationsβ€™β€˜](https://docs.mvtec.com/hdevelopevo/26.11/content/mvtasks/machine_vision_basics/transformations/3d/poses/index.html). 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.

  • 'cartesian_faces'"cartesian_faces": 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_3dReadObjectModel3d can be called with the GenParamNamegenParamNamegen_param_name 'convert_to_triangles'"convert_to_triangles" set to 'true'"true", to convert all faces to triangles. Alternatively, triangulate_object_model_3dTriangulateObjectModel3d can be called prior to this operator.

    First, each face of the 3D object models ObjectModel3DobjectModel3Dobject_model_3d is transformed into the camera coordinate system using the given Poseposepose. Then, these coordinates are projected into the image coordinate system based on the internal camera parameters CamParamcamParamcam_param, while keeping the 3D information (X-, Y-, and Z-coordinates) for each of those pixels. For a more detailed explanation of CamParamcamParamcam_param and Poseposepose please refer to the section 'cartesian'"cartesian". If multiple faces 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 Typetypetype 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_3dXyzToObjectModel3d. 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_3dSampleObjectModel3d, surface_normals_object_model_3dSurfaceNormalsObjectModel3d, or when preparing a 3D object model for surface-based matching, e.g., smoothing, removing outliers, and reducing the domain.

  • 'cartesian_faces_no_opengl'"cartesian_faces_no_opengl": This transformation mode works in the same way as the method 'cartesian_faces'"cartesian_faces" but does not use OpenGL. In general, 'cartesian_faces'"cartesian_faces" automatically determines if OpenGL is available. Thus, it is usually not required to use 'cartesian_faces_no_opengl'"cartesian_faces_no_opengl" explicitly. It can make sense, however, to use it in cases where the automatic mode selection does not work due to, for example, driver issues with OpenGL, or for higher accuracy when using camera parameters with distortion or tilt.

  • 'from_xyz_map'"from_xyz_map": This transformation mode works only if the 3D object model was created with the operator xyz_to_object_model_3dXyzToObjectModel3d. 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 CamParamcamParamcam_param and Poseposepose 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_3dXyzToObjectModel3d to create the 3D object model and can be queried from get_object_model_3d_paramsGetObjectModel3dParams with 'mapping_size'"mapping_size".

    This transformation mode is faster than 'cartesian'"cartesian". It is suitable, e.g., to visualize the results of a segmentation done with segment_object_model_3dSegmentObjectModel3d.

AttentionπŸ”—

Cameras with hypercentric lenses are not supported. For displaying large faces with a non-zero distortion in CamParamcamParamcam_param, note that the distortion is only applied to the points of the model. In the projection, these points are subsequently connected by straight lines. For a good approximation of the distorted lines, please use a triangulation with sufficiently small triangles.

Execution informationπŸ”—

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

ParametersπŸ”—

Xxx (output_object) singlechannelimage β†’ object (real)object (real)HObject (real)HImage (real)HObject (real)Hobject * (real)

Image with the X-Coordinates of the 3D points.

Yyy (output_object) singlechannelimage β†’ object (real)object (real)HObject (real)HImage (real)HObject (real)Hobject * (real)

Image with the Y-Coordinates of the 3D points.

Zzz (output_object) singlechannelimage β†’ object (real)object (real)HObject (real)HImage (real)HObject (real)Hobject * (real)

Image with the Z-Coordinates of the 3D points.

ObjectModel3DobjectModel3Dobject_model_3d (input_control) object_model_3d(-array) β†’ (handle)(handle)HTuple (HHandle)HObjectModel3D, HTuple (IntPtr)MaybeSequence[HHandle]Htuple (handle)

Handle of the 3D object model.

Typetypetype (input_control) string β†’ (string)(string)HTuple (HString)HTuple (string)strHtuple (char*)

Type of the conversion.

Default: 'cartesian'"cartesian"
List of values: 'cartesian', 'cartesian_faces', 'cartesian_faces_no_opengl', 'from_xyz_map'"cartesian", "cartesian_faces", "cartesian_faces_no_opengl", "from_xyz_map"

CamParamcamParamcam_param (input_control) campar β†’ (real / integer / string)(real / integer / string)HTuple (double / Hlong / HString)HCamPar, HTuple (double / int / long / string)Sequence[Union[float, int, str]]Htuple (double / Hlong / char*)

Camera parameters.

Poseposepose (input_control) pose β†’ (real / integer)(real / integer)HTuple (double / Hlong)HPose, HTuple (double / int / long)Sequence[Union[int, float]]Htuple (double / Hlong)

Pose of the 3D object model.

Number of elements: Pose == 0 || Pose == 7 || Pose == 12

ResultπŸ”—

The operator object_model_3d_to_xyzObjectModel3dToXyz returns the value 2 (H_MSG_TRUE) if the given parameters are correct. Otherwise, an exception will be raised.

Combinations with other operatorsπŸ”—

Combinations

Possible predecessors

read_object_model_3dReadObjectModel3d, xyz_to_object_model_3dXyzToObjectModel3d, triangulate_object_model_3dTriangulateObjectModel3d

Alternatives

project_object_model_3dProjectObjectModel3d

See also

xyz_to_object_model_3dXyzToObjectModel3d, get_object_model_3d_paramsGetObjectModel3dParams

ModuleπŸ”—

3D Metrology