Operator Reference

project_object_model_3dT_project_object_model_3dProjectObjectModel3dProjectObjectModel3dproject_object_model_3d (Operator)

project_object_model_3dT_project_object_model_3dProjectObjectModel3dProjectObjectModel3dproject_object_model_3d — Project a 3D object model into image coordinates.

Signature

project_object_model_3d( : ModelContours : ObjectModel3D, CamParam, Pose, GenParamName, GenParamValue : )

Herror T_project_object_model_3d(Hobject* ModelContours, const Htuple ObjectModel3D, const Htuple CamParam, const Htuple Pose, const Htuple GenParamName, const Htuple GenParamValue)

void ProjectObjectModel3d(HObject* ModelContours, const HTuple& ObjectModel3D, const HTuple& CamParam, const HTuple& Pose, const HTuple& GenParamName, const HTuple& GenParamValue)

HXLDCont HObjectModel3D::ProjectObjectModel3d(const HCamPar& CamParam, const HPose& Pose, const HTuple& GenParamName, const HTuple& GenParamValue) const

HXLDCont HObjectModel3D::ProjectObjectModel3d(const HCamPar& CamParam, const HPose& Pose, const HString& GenParamName, const HString& GenParamValue) const

HXLDCont HObjectModel3D::ProjectObjectModel3d(const HCamPar& CamParam, const HPose& Pose, const char* GenParamName, const char* GenParamValue) const

HXLDCont HObjectModel3D::ProjectObjectModel3d(const HCamPar& CamParam, const HPose& Pose, const wchar_t* GenParamName, const wchar_t* GenParamValue) const   ( Windows only)

HXLDCont HCamPar::ProjectObjectModel3d(const HObjectModel3D& ObjectModel3D, const HPose& Pose, const HTuple& GenParamName, const HTuple& GenParamValue) const

HXLDCont HCamPar::ProjectObjectModel3d(const HObjectModel3D& ObjectModel3D, const HPose& Pose, const HString& GenParamName, const HString& GenParamValue) const

HXLDCont HCamPar::ProjectObjectModel3d(const HObjectModel3D& ObjectModel3D, const HPose& Pose, const char* GenParamName, const char* GenParamValue) const

HXLDCont HCamPar::ProjectObjectModel3d(const HObjectModel3D& ObjectModel3D, const HPose& Pose, const wchar_t* GenParamName, const wchar_t* GenParamValue) const   ( Windows only)

HXLDCont HPose::ProjectObjectModel3d(const HObjectModel3D& ObjectModel3D, const HCamPar& CamParam, const HTuple& GenParamName, const HTuple& GenParamValue) const

HXLDCont HPose::ProjectObjectModel3d(const HObjectModel3D& ObjectModel3D, const HCamPar& CamParam, const HString& GenParamName, const HString& GenParamValue) const

HXLDCont HPose::ProjectObjectModel3d(const HObjectModel3D& ObjectModel3D, const HCamPar& CamParam, const char* GenParamName, const char* GenParamValue) const

HXLDCont HPose::ProjectObjectModel3d(const HObjectModel3D& ObjectModel3D, const HCamPar& CamParam, const wchar_t* GenParamName, const wchar_t* GenParamValue) const   ( Windows only)

static void HOperatorSet.ProjectObjectModel3d(out HObject modelContours, HTuple objectModel3D, HTuple camParam, HTuple pose, HTuple genParamName, HTuple genParamValue)

HXLDCont HObjectModel3D.ProjectObjectModel3d(HCamPar camParam, HPose pose, HTuple genParamName, HTuple genParamValue)

HXLDCont HObjectModel3D.ProjectObjectModel3d(HCamPar camParam, HPose pose, string genParamName, string genParamValue)

HXLDCont HCamPar.ProjectObjectModel3d(HObjectModel3D objectModel3D, HPose pose, HTuple genParamName, HTuple genParamValue)

HXLDCont HCamPar.ProjectObjectModel3d(HObjectModel3D objectModel3D, HPose pose, string genParamName, string genParamValue)

HXLDCont HPose.ProjectObjectModel3d(HObjectModel3D objectModel3D, HCamPar camParam, HTuple genParamName, HTuple genParamValue)

HXLDCont HPose.ProjectObjectModel3d(HObjectModel3D objectModel3D, HCamPar camParam, string genParamName, string genParamValue)

def project_object_model_3d(object_model_3d: HHandle, cam_param: Sequence[Union[int, float, str]], pose: Sequence[Union[int, float]], gen_param_name: MaybeSequence[str], gen_param_value: MaybeSequence[Union[str, int, float]]) -> HObject

Description

The operator project_object_model_3dproject_object_model_3dProjectObjectModel3dProjectObjectModel3dproject_object_model_3d projects a 3D object model into the image coordinate system and returns the projected contours in ModelContoursModelContoursModelContoursmodelContoursmodel_contours. This operator is particularly useful for the visualization of 3D object models. Note that primitives are not projected but silently ignored. The coordinates of the 3D object model are given in the model coordinate system (mcs), a 3D world coordinate system. First, they are transformed into the camera coordinate system (ccs) using the given PosePosePoseposepose. Then, these coordinates are projected into the image coordinate system based on the internal camera parameters CamParamCamParamCamParamcamParamcam_param. Thereby the pose is needed in the form , see Transformations / Poses and “Solution Guide III-C - 3D Vision”. Thus, the PosePosePoseposepose describes the position and orientation of the world coordinate system with respect to the camera coordinate system. The internal camera parameters CamParamCamParamCamParamcamParamcam_param describe the projection characteristics of the camera (see Calibration).

There are some generic parameters that can optionally be used to influence the projection. If desired, these parameters and their corresponding values can be specified by using GenParamNameGenParamNameGenParamNamegenParamNamegen_param_name and GenParamValueGenParamValueGenParamValuegenParamValuegen_param_value, respectively. The following values for GenParamNameGenParamNameGenParamNamegenParamNamegen_param_name are possible:

'data'"data""data""data""data":

This parameter specifies which geometric data of the 3D object model should be projected. If 'data'"data""data""data""data" is set to 'faces'"faces""faces""faces""faces", the faces of the 3D object model are projected. The faces are represented by their border lines in ModelContoursModelContoursModelContoursmodelContoursmodel_contours. If 'data'"data""data""data""data" is set to 'lines'"lines""lines""lines""lines", the 3D lines of the 3D object model are projected. If 'data'"data""data""data""data" is set to 'points'"points""points""points""points", the points of the 3D object model are projected. The projected points can be represented in ModelContoursModelContoursModelContoursmodelContoursmodel_contours in different ways. The point representation can be selected by using the generic parameter 'point_shape'"point_shape""point_shape""point_shape""point_shape" (see below). Finally, if 'data'"data""data""data""data" is set to 'auto'"auto""auto""auto""auto", HALCON automatically chooses the most descriptive geometry data that is available in the 3D object model for visualization.

List of values: 'auto'"auto""auto""auto""auto", 'faces'"faces""faces""faces""faces", 'lines'"lines""lines""lines""lines", 'points'"points""points""points""points".

Default: 'auto'"auto""auto""auto""auto".

'point_shape'"point_shape""point_shape""point_shape""point_shape":

This parameter specifies how points are represented in the output contour ModelContoursModelContoursModelContoursmodelContoursmodel_contours. Consequently, this parameter only has an effect if the points of the 3D object model are selected for projection (see above). If 'point_shape'"point_shape""point_shape""point_shape""point_shape" is set to 'circle'"circle""circle""circle""circle", points are represented by circles, whereas if 'point_shape'"point_shape""point_shape""point_shape""point_shape" is set to 'cross'"cross""cross""cross""cross", points are represented by crosses. In both cases the size of the points (i.e., the size of the circles or the size of the crosses) can be specified by the generic parameter 'point_size'"point_size""point_size""point_size""point_size" (see below). The orientation of the crosses can be specified by the generic parameter 'point_orientation'"point_orientation""point_orientation""point_orientation""point_orientation" (see below).

List of values: 'circle'"circle""circle""circle""circle", 'cross'"cross""cross""cross""cross".

Default: 'circle'"circle""circle""circle""circle".

'point_size'"point_size""point_size""point_size""point_size":

This parameter specifies the size of the point representation in the output contour ModelContoursModelContoursModelContoursmodelContoursmodel_contours, i.e., the size of the circles or the size of the crosses depending on the selected 'point_shape'"point_shape""point_shape""point_shape""point_shape". Consequently, this parameter only has an effect if the points of the 3D object model are selected for projection (see above). The size must be given in pixel units. If 'point_size'"point_size""point_size""point_size""point_size" is set to 0, each point is represented by a contour that contains a single contour point.

Suggested values: 0, 2, 4.

Default: 4.

'point_orientation'"point_orientation""point_orientation""point_orientation""point_orientation":

This parameter specifies the orientation of the crosses in radians. Consequently, this parameter only has an effect if the points of the 3D object model are selected for projection and 'point_shape'"point_shape""point_shape""point_shape""point_shape" is set to 'cross'"cross""cross""cross""cross" (see above).

Suggested values: 0, 0.39, 0.79.

Default: 0.79.

'union_adjacent_contours'"union_adjacent_contours""union_adjacent_contours""union_adjacent_contours""union_adjacent_contours":

This parameter specifies if adjacent projected contours should be joined or not. Activating this option is equivalent to calling union_adjacent_contours_xldunion_adjacent_contours_xldUnionAdjacentContoursXldUnionAdjacentContoursXldunion_adjacent_contours_xld after this operator, but significantly faster.

List of values: 'true'"true""true""true""true", 'false'"false""false""false""false".

Default: 'true'"true""true""true""true".

'hidden_surface_removal'"hidden_surface_removal""hidden_surface_removal""hidden_surface_removal""hidden_surface_removal":

This parameter can be used to switch on or off the removal of hidden surfaces. If 'hidden_surface_removal'"hidden_surface_removal""hidden_surface_removal""hidden_surface_removal""hidden_surface_removal" is set to 'true'"true""true""true""true", only those projected edges are returned that are not hidden by faces of the 3D object model. If 'hidden_surface_removal'"hidden_surface_removal""hidden_surface_removal""hidden_surface_removal""hidden_surface_removal" is set to 'false'"false""false""false""false", all projected edges are returned. This is faster than a projection with 'hidden_surface_removal'"hidden_surface_removal""hidden_surface_removal""hidden_surface_removal""hidden_surface_removal" set to 'true'"true""true""true""true".

If the system variable (see set_systemset_systemSetSystemSetSystemset_system) 'opengl_hidden_surface_removal_enable'"opengl_hidden_surface_removal_enable""opengl_hidden_surface_removal_enable""opengl_hidden_surface_removal_enable""opengl_hidden_surface_removal_enable" is set to 'true'"true""true""true""true" (which is the default if it is available) and 'hidden_surface_removal'"hidden_surface_removal""hidden_surface_removal""hidden_surface_removal""hidden_surface_removal" is set to 'true'"true""true""true""true", the projection of the model is accelerated using the graphics card. Depending on the graphics card this is significantly faster than the non accelerated algorithm. Be aware that the results of the OpenGL projection are slightly different compared to the analytic projection. Notable, only the contours visible through CamParamCamParamCamParamcamParamcam_param are projected in this mode.

List of values: 'true'"true""true""true""true", 'false'"false""false""false""false".

Default: 'true'"true""true""true""true".

'min_face_angle'"min_face_angle""min_face_angle""min_face_angle""min_face_angle":

3D edges are only projected if the angle between the two 3D faces that are incident with the 3D edge is at least 'min_face_angle'"min_face_angle""min_face_angle""min_face_angle""min_face_angle". If 'min_face_angle'"min_face_angle""min_face_angle""min_face_angle""min_face_angle" is set to 0.0, all edges are projected. If 'min_face_angle'"min_face_angle""min_face_angle""min_face_angle""min_face_angle" is set to (equivalent to 180 degrees), only the silhouette of the 3D object model is returned. This parameter can be used to suppress edges within curved surfaces, e.g., the surface of a cylinder or cone.

Suggested values: 0.17, 0.26, 0.35, 0.52.

Default: 0.52.

Attention

Cameras with hypercentric lenses are not supported. For displaying large faces with a non-zero distortion in CamParamCamParamCamParamcamParamcam_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

  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).
  • Multithreading scope: global (may be called from any thread).
  • Processed without parallelization.

Parameters

ModelContoursModelContoursModelContoursmodelContoursmodel_contours (output_object)  xld_cont(-array) objectHXLDContHObjectHObjectHobject *

Projected model contours.

ObjectModel3DObjectModel3DObjectModel3DobjectModel3Dobject_model_3d (input_control)  object_model_3d HObjectModel3D, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Handle of the 3D object model.

CamParamCamParamCamParamcamParamcam_param (input_control)  campar HCamPar, HTupleSequence[Union[int, float, str]]HTupleHtuple (real / integer / string) (double / int / long / string) (double / Hlong / HString) (double / Hlong / char*)

Internal camera parameters.

PosePosePoseposepose (input_control)  pose HPose, HTupleSequence[Union[int, float]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

3D pose of the world coordinate system in camera coordinates.

Number of elements: Pose == 7

GenParamNameGenParamNameGenParamNamegenParamNamegen_param_name (input_control)  string(-array) HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)

Name of the generic parameter.

Default: []

List of values: 'data'"data""data""data""data", 'false'"false""false""false""false", 'hidden_surface_removal'"hidden_surface_removal""hidden_surface_removal""hidden_surface_removal""hidden_surface_removal", 'min_face_angle'"min_face_angle""min_face_angle""min_face_angle""min_face_angle", 'point_orientation'"point_orientation""point_orientation""point_orientation""point_orientation", 'point_shape'"point_shape""point_shape""point_shape""point_shape", 'point_size'"point_size""point_size""point_size""point_size", 'true'"true""true""true""true", 'union_adjacent_contours'"union_adjacent_contours""union_adjacent_contours""union_adjacent_contours""union_adjacent_contours"

GenParamValueGenParamValueGenParamValuegenParamValuegen_param_value (input_control)  string(-array) HTupleMaybeSequence[Union[str, int, float]]HTupleHtuple (string / integer / real) (string / int / long / double) (HString / Hlong / double) (char* / Hlong / double)

Value of the generic parameter.

Default: []

Suggested values: 0.17, 0.26, 0.35, 0.52, 'true'"true""true""true""true", 'false'"false""false""false""false", 'auto'"auto""auto""auto""auto", 'points'"points""points""points""points", 'faces'"faces""faces""faces""faces", 'lines'"lines""lines""lines""lines", 'circle'"circle""circle""circle""circle", 'cross'"cross""cross""cross""cross", 1, 2, 3, 4, 0.785398

Result

project_object_model_3dproject_object_model_3dProjectObjectModel3dProjectObjectModel3dproject_object_model_3d returns 2 ( H_MSG_TRUE) if all parameters are correct. If necessary, an exception is raised. If the geometric data that was selected for the projection is not available in the 3D object model, the error 9514 is raised.

Possible Predecessors

read_object_model_3dread_object_model_3dReadObjectModel3dReadObjectModel3dread_object_model_3d, affine_trans_object_model_3daffine_trans_object_model_3dAffineTransObjectModel3dAffineTransObjectModel3daffine_trans_object_model_3d, prepare_object_model_3dprepare_object_model_3dPrepareObjectModel3dPrepareObjectModel3dprepare_object_model_3d

Possible Successors

clear_object_model_3dclear_object_model_3dClearObjectModel3dClearObjectModel3dclear_object_model_3d

See also

project_shape_model_3dproject_shape_model_3dProjectShapeModel3dProjectShapeModel3dproject_shape_model_3d, object_model_3d_to_xyzobject_model_3d_to_xyzObjectModel3dToXyzObjectModel3dToXyzobject_model_3d_to_xyz

Module

3D Metrology