ClassesClasses | | Operators

create_shape_model_3dT_create_shape_model_3dCreateShapeModel3dCreateShapeModel3d (Operator)

Name

create_shape_model_3dT_create_shape_model_3dCreateShapeModel3dCreateShapeModel3d — Prepare a 3D object model for matching.

Signature

create_shape_model_3d( : : ObjectModel3D, CamParam, RefRotX, RefRotY, RefRotZ, OrderOfRotation, LongitudeMin, LongitudeMax, LatitudeMin, LatitudeMax, CamRollMin, CamRollMax, DistMin, DistMax, MinContrast, GenParamName, GenParamValue : ShapeModel3DID)

Herror T_create_shape_model_3d(const Htuple ObjectModel3D, const Htuple CamParam, const Htuple RefRotX, const Htuple RefRotY, const Htuple RefRotZ, const Htuple OrderOfRotation, const Htuple LongitudeMin, const Htuple LongitudeMax, const Htuple LatitudeMin, const Htuple LatitudeMax, const Htuple CamRollMin, const Htuple CamRollMax, const Htuple DistMin, const Htuple DistMax, const Htuple MinContrast, const Htuple GenParamName, const Htuple GenParamValue, Htuple* ShapeModel3DID)

void CreateShapeModel3d(const HTuple& ObjectModel3D, const HTuple& CamParam, const HTuple& RefRotX, const HTuple& RefRotY, const HTuple& RefRotZ, const HTuple& OrderOfRotation, const HTuple& LongitudeMin, const HTuple& LongitudeMax, const HTuple& LatitudeMin, const HTuple& LatitudeMax, const HTuple& CamRollMin, const HTuple& CamRollMax, const HTuple& DistMin, const HTuple& DistMax, const HTuple& MinContrast, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* ShapeModel3DID)

void HShapeModel3D::HShapeModel3D(const HObjectModel3D& ObjectModel3D, const HCamPar& CamParam, double RefRotX, double RefRotY, double RefRotZ, const HString& OrderOfRotation, double LongitudeMin, double LongitudeMax, double LatitudeMin, double LatitudeMax, double CamRollMin, double CamRollMax, double DistMin, double DistMax, Hlong MinContrast, const HTuple& GenParamName, const HTuple& GenParamValue)

void HShapeModel3D::HShapeModel3D(const HObjectModel3D& ObjectModel3D, const HCamPar& CamParam, double RefRotX, double RefRotY, double RefRotZ, const HString& OrderOfRotation, double LongitudeMin, double LongitudeMax, double LatitudeMin, double LatitudeMax, double CamRollMin, double CamRollMax, double DistMin, double DistMax, Hlong MinContrast, const HString& GenParamName, Hlong GenParamValue)

void HShapeModel3D::HShapeModel3D(const HObjectModel3D& ObjectModel3D, const HCamPar& CamParam, double RefRotX, double RefRotY, double RefRotZ, const char* OrderOfRotation, double LongitudeMin, double LongitudeMax, double LatitudeMin, double LatitudeMax, double CamRollMin, double CamRollMax, double DistMin, double DistMax, Hlong MinContrast, const char* GenParamName, Hlong GenParamValue)

void HShapeModel3D::CreateShapeModel3d(const HObjectModel3D& ObjectModel3D, const HCamPar& CamParam, double RefRotX, double RefRotY, double RefRotZ, const HString& OrderOfRotation, double LongitudeMin, double LongitudeMax, double LatitudeMin, double LatitudeMax, double CamRollMin, double CamRollMax, double DistMin, double DistMax, Hlong MinContrast, const HTuple& GenParamName, const HTuple& GenParamValue)

void HShapeModel3D::CreateShapeModel3d(const HObjectModel3D& ObjectModel3D, const HCamPar& CamParam, double RefRotX, double RefRotY, double RefRotZ, const HString& OrderOfRotation, double LongitudeMin, double LongitudeMax, double LatitudeMin, double LatitudeMax, double CamRollMin, double CamRollMax, double DistMin, double DistMax, Hlong MinContrast, const HString& GenParamName, Hlong GenParamValue)

void HShapeModel3D::CreateShapeModel3d(const HObjectModel3D& ObjectModel3D, const HCamPar& CamParam, double RefRotX, double RefRotY, double RefRotZ, const char* OrderOfRotation, double LongitudeMin, double LongitudeMax, double LatitudeMin, double LatitudeMax, double CamRollMin, double CamRollMax, double DistMin, double DistMax, Hlong MinContrast, const char* GenParamName, Hlong GenParamValue)

HShapeModel3D HCamPar::CreateShapeModel3d(const HObjectModel3D& ObjectModel3D, double RefRotX, double RefRotY, double RefRotZ, const HString& OrderOfRotation, double LongitudeMin, double LongitudeMax, double LatitudeMin, double LatitudeMax, double CamRollMin, double CamRollMax, double DistMin, double DistMax, Hlong MinContrast, const HTuple& GenParamName, const HTuple& GenParamValue) const

HShapeModel3D HCamPar::CreateShapeModel3d(const HObjectModel3D& ObjectModel3D, double RefRotX, double RefRotY, double RefRotZ, const HString& OrderOfRotation, double LongitudeMin, double LongitudeMax, double LatitudeMin, double LatitudeMax, double CamRollMin, double CamRollMax, double DistMin, double DistMax, Hlong MinContrast, const HString& GenParamName, Hlong GenParamValue) const

HShapeModel3D HCamPar::CreateShapeModel3d(const HObjectModel3D& ObjectModel3D, double RefRotX, double RefRotY, double RefRotZ, const char* OrderOfRotation, double LongitudeMin, double LongitudeMax, double LatitudeMin, double LatitudeMax, double CamRollMin, double CamRollMax, double DistMin, double DistMax, Hlong MinContrast, const char* GenParamName, Hlong GenParamValue) const

static void HOperatorSet.CreateShapeModel3d(HTuple objectModel3D, HTuple camParam, HTuple refRotX, HTuple refRotY, HTuple refRotZ, HTuple orderOfRotation, HTuple longitudeMin, HTuple longitudeMax, HTuple latitudeMin, HTuple latitudeMax, HTuple camRollMin, HTuple camRollMax, HTuple distMin, HTuple distMax, HTuple minContrast, HTuple genParamName, HTuple genParamValue, out HTuple shapeModel3DID)

public HShapeModel3D(HObjectModel3D objectModel3D, HCamPar camParam, double refRotX, double refRotY, double refRotZ, string orderOfRotation, double longitudeMin, double longitudeMax, double latitudeMin, double latitudeMax, double camRollMin, double camRollMax, double distMin, double distMax, int minContrast, HTuple genParamName, HTuple genParamValue)

public HShapeModel3D(HObjectModel3D objectModel3D, HCamPar camParam, double refRotX, double refRotY, double refRotZ, string orderOfRotation, double longitudeMin, double longitudeMax, double latitudeMin, double latitudeMax, double camRollMin, double camRollMax, double distMin, double distMax, int minContrast, string genParamName, int genParamValue)

void HShapeModel3D.CreateShapeModel3d(HObjectModel3D objectModel3D, HCamPar camParam, double refRotX, double refRotY, double refRotZ, string orderOfRotation, double longitudeMin, double longitudeMax, double latitudeMin, double latitudeMax, double camRollMin, double camRollMax, double distMin, double distMax, int minContrast, HTuple genParamName, HTuple genParamValue)

void HShapeModel3D.CreateShapeModel3d(HObjectModel3D objectModel3D, HCamPar camParam, double refRotX, double refRotY, double refRotZ, string orderOfRotation, double longitudeMin, double longitudeMax, double latitudeMin, double latitudeMax, double camRollMin, double camRollMax, double distMin, double distMax, int minContrast, string genParamName, int genParamValue)

HShapeModel3D HCamPar.CreateShapeModel3d(HObjectModel3D objectModel3D, double refRotX, double refRotY, double refRotZ, string orderOfRotation, double longitudeMin, double longitudeMax, double latitudeMin, double latitudeMax, double camRollMin, double camRollMax, double distMin, double distMax, int minContrast, HTuple genParamName, HTuple genParamValue)

HShapeModel3D HCamPar.CreateShapeModel3d(HObjectModel3D objectModel3D, double refRotX, double refRotY, double refRotZ, string orderOfRotation, double longitudeMin, double longitudeMax, double latitudeMin, double latitudeMax, double camRollMin, double camRollMax, double distMin, double distMax, int minContrast, string genParamName, int genParamValue)

Description

The operator create_shape_model_3dcreate_shape_model_3dCreateShapeModel3dCreateShapeModel3dCreateShapeModel3d prepares a 3D object model, which is passed in ObjectModel3DObjectModel3DObjectModel3DObjectModel3DobjectModel3D, as a 3D shape model used for matching. The 3D object model must previously been read from a file by using read_object_model_3dread_object_model_3dReadObjectModel3dReadObjectModel3dReadObjectModel3d.

The 3D shape model is generated by computing different views of the 3D object model within a user-specified pose range. The views are automatically generated by placing virtual cameras around the 3D object model and projecting the 3D object model into the image plane of each virtual camera position. For each such obtained view a 2D shape representation is computed. Thus, for the generation of the 3D shape model, no images of the object are used but only the 3D object model, which is passed in ObjectModel3DObjectModel3DObjectModel3DObjectModel3DobjectModel3D. The shape representations of all views are stored in the 3D shape model, which is returned in ShapeModel3DIDShapeModel3DIDShapeModel3DIDShapeModel3DIDshapeModel3DID. During the matching process with find_shape_model_3dfind_shape_model_3dFindShapeModel3dFindShapeModel3dFindShapeModel3d, the shape representations are used to find out the best-matching view, from which the pose is subsequently refined and returned.

In order to create the model views correctly, the camera parameters of the camera that will be used for the matching must be passed in CamParamCamParamCamParamCamParamcamParam. The camera parameters are necessary, for example, to determine the scale of the projections by using the actual focal length of the camera. Furthermore, they are used to treat radial distortions of the lens correctly. Consequently, it is essential to calibrate the camera by using calibrate_camerascalibrate_camerasCalibrateCamerasCalibrateCamerasCalibrateCameras before creating the 3D shape model. On the one hand, this is necessary to obtain accurate poses from find_shape_model_3dfind_shape_model_3dFindShapeModel3dFindShapeModel3dFindShapeModel3d. On the other hand, this makes the 3D matching applicable even when using lenses with significant radial distortions.

The pose range within which the model views are generated can be specified by the parameters RefRotXRefRotXRefRotXRefRotXrefRotX, RefRotYRefRotYRefRotYRefRotYrefRotY, RefRotZRefRotZRefRotZRefRotZrefRotZ, OrderOfRotationOrderOfRotationOrderOfRotationOrderOfRotationorderOfRotation, LongitudeMinLongitudeMinLongitudeMinLongitudeMinlongitudeMin, LongitudeMaxLongitudeMaxLongitudeMaxLongitudeMaxlongitudeMax, LatitudeMinLatitudeMinLatitudeMinLatitudeMinlatitudeMin, LatitudeMaxLatitudeMaxLatitudeMaxLatitudeMaxlatitudeMax, CamRollMinCamRollMinCamRollMinCamRollMincamRollMin, CamRollMaxCamRollMaxCamRollMaxCamRollMaxcamRollMax, DistMinDistMinDistMinDistMindistMin, and DistMaxDistMaxDistMaxDistMaxdistMax. Note that the model will only be recognized during the matching if it appears within the specified pose range. The parameters are described in the following:

Before computing the views, the origin of the coordinate system of the 3D object model is moved to the reference point of the 3D object model, which is the center of the smallest enclosing axis-parallel cuboid and can be queried by using get_object_model_3d_paramsget_object_model_3d_paramsGetObjectModel3dParamsGetObjectModel3dParamsGetObjectModel3dParams. The virtual cameras, which are used to create the views, are arranged around the 3D object model in such a way that they all look at the origin of the coordinate system, i.e., the z axes of the cameras pass through the origin. The pose range can then be specified by restricting the views to a certain quadrilateral on the sphere around the origin. This naturally leads to the use of the spherical coordinates longitude, latitude, and radius. The definition of the spherical coordinate system is chosen such that the equatorial plane corresponds to the xz plane of the Cartesian coordinate system with the y axis pointing to the south pole (negative latitude) and the negative z axis pointing in the direction of the zero meridian (see convert_point_3d_spher_to_cartconvert_point_3d_spher_to_cartConvertPoint3dSpherToCartConvertPoint3dSpherToCartConvertPoint3dSpherToCart or convert_point_3d_cart_to_spherconvert_point_3d_cart_to_spherConvertPoint3dCartToSpherConvertPoint3dCartToSpherConvertPoint3dCartToSpher for further details about the conversion between Cartesian and spherical coordinates). The advantage of this definition is that a camera with the pose [0,0,z,0,0,0,0] has its optical center at longitude=0, latitude=0, and radius=z. In this case, the radius represents the distance of the optical center of the camera to the reference point of the 3D object model.

The longitude range, for which views are to be generated, can be specified by LongitudeMinLongitudeMinLongitudeMinLongitudeMinlongitudeMin and LongitudeMaxLongitudeMaxLongitudeMaxLongitudeMaxlongitudeMax, both given in radians. Accordingly, the latitude range can be specified by LatitudeMinLatitudeMinLatitudeMinLatitudeMinlatitudeMin and LatitudeMaxLatitudeMaxLatitudeMaxLatitudeMaxlatitudeMax, also given in radians. LongitudeMinLongitudeMinLongitudeMinLongitudeMinlongitudeMin and LongitudeMaxLongitudeMaxLongitudeMaxLongitudeMaxlongitudeMax are adjusted to maintain a range of 360° . If an adjustment is possible, LongitudeMinLongitudeMinLongitudeMinLongitudeMinlongitudeMin and the range are preserved. The minimum and maximum distance between the camera center and the model reference point is specified by DistMinDistMinDistMinDistMindistMin and DistMaxDistMaxDistMaxDistMaxdistMax. Note that the unit of the distance must be meters (assuming that the parameter ScaleScaleScaleScalescale has been correctly set when reading the CAD file with read_object_model_3dread_object_model_3dReadObjectModel3dReadObjectModel3dReadObjectModel3d). Finally, the minimum and the maximum camera roll angle can be specified in CamRollMinCamRollMinCamRollMinCamRollMincamRollMin and CamRollMaxCamRollMaxCamRollMaxCamRollMaxcamRollMax. This interval specifies the allowable camera rotation around its z axis with respect to the 3D object model. If the image plane is parallel to the plane on which the objects reside and if it is known that the object may rotate in this plane only in a restricted range, then it is reasonable to specify this range in CamRollMinCamRollMinCamRollMinCamRollMincamRollMin and CamRollMaxCamRollMaxCamRollMaxCamRollMaxcamRollMax. In all other cases the interpretation of the camera roll angle is difficult, and hence, it is recommended to set this interval to . Note that the larger the specified pose range is chosen the more memory the model will consume (except from the range of the camera roll angle) and the slower the matching will be.

The orientation of the coordinate system of the 3D object model is defined by the coordinates within the CAD file that was read by using read_object_model_3dread_object_model_3dReadObjectModel3dReadObjectModel3dReadObjectModel3d. Therefore, it is reasonable to previously rotate the 3D object model into a reference orientation such that the view that corresponds to longitude=0 and latitude=0 is approximately at the center of the pose range. This can be achieved by passing appropriate values for the reference orientation in RefRotXRefRotXRefRotXRefRotXrefRotX, RefRotYRefRotYRefRotYRefRotYrefRotY, RefRotZRefRotZRefRotZRefRotZrefRotZ, and OrderOfRotationOrderOfRotationOrderOfRotationOrderOfRotationorderOfRotation. The rotation is performed around the axes of the 3D object model, which origin was set to the reference point. The longitude and latitude range can then be interpreted as a variation of the 3D object model pose around the reference orientation. There are two possible ways to specify the reference orientation. The first possibility is to specify three rotation angles in RefRotXRefRotXRefRotXRefRotXrefRotX, RefRotYRefRotYRefRotYRefRotYrefRotY, and RefRotZRefRotZRefRotZRefRotZrefRotZ and the order in which the three rotations are to be applied in OrderOfRotationOrderOfRotationOrderOfRotationOrderOfRotationorderOfRotation, which can either be 'gba'"gba""gba""gba""gba" or 'abg'"abg""abg""abg""abg". The second possibility is to specify the three components of the Rodriguez rotation vector in RefRotXRefRotXRefRotXRefRotXrefRotX, RefRotYRefRotYRefRotYRefRotYrefRotY, and RefRotZRefRotZRefRotZRefRotZrefRotZ. In this case, OrderOfRotationOrderOfRotationOrderOfRotationOrderOfRotationorderOfRotation must be set to 'rodriguez'"rodriguez""rodriguez""rodriguez""rodriguez" (see create_posecreate_poseCreatePoseCreatePoseCreatePose for detailed information about the order of the rotations and the definition of the Rodriguez vector).

Thus, two transformations are applied to the 3D object model before computing the model views within the pose range. The first transformation is the translation of the origin of the coordinate systems to the reference point. The second transformation is the rotation of the 3D object model to the desired reference orientation around the axes of the reference coordinate system. By combining both transformations one obtains the reference pose of the 3D shape model. The reference pose of the 3D shape model thus describes the pose of the reference coordinate system with respect to the coordinate system of the 3D object model defined by the CAD file. Let t = (x,y,z)' be the coordinates of the reference point of the 3D object model and R be the rotation matrix containing the reference orientation. Then, a point given in the 3D object model coordinate system can be transformed to a point in the reference coordinate system of the 3D shape model by applying the following formula:

This transformation can be expressed by a homogeneous 3D transformation matrix or alternatively in terms of a 3D pose. The latter can be queried by passing 'reference_pose'"reference_pose""reference_pose""reference_pose""reference_pose" for the parameter GenParamNameGenParamNameGenParamNameGenParamNamegenParamName of the operator get_shape_model_3d_paramsget_shape_model_3d_paramsGetShapeModel3dParamsGetShapeModel3dParamsGetShapeModel3dParams. The above formula can be best imagined as a pose of pose type 8, 10, or 12, depending on the value that was chosen for OrderOfRotationOrderOfRotationOrderOfRotationOrderOfRotationorderOfRotation (see create_posecreate_poseCreatePoseCreatePoseCreatePose for detailed information about the different pose types). Note, however, that get_shape_model_3d_paramsget_shape_model_3d_paramsGetShapeModel3dParamsGetShapeModel3dParamsGetShapeModel3dParams always returns the pose using the pose type 0. Finally, poses that are given in one of the two coordinate systems can be transformed to the other coordinate system by using trans_pose_shape_model_3dtrans_pose_shape_model_3dTransPoseShapeModel3dTransPoseShapeModel3dTransPoseShapeModel3d.

Furthermore, it should be noted that the reference coordinate system is introduced only to specify the pose range in a convenient way. The pose resulting from the 3D matching that is performed with find_shape_model_3dfind_shape_model_3dFindShapeModel3dFindShapeModel3dFindShapeModel3d always refers to the original 3D object model coordinate system used in the CAD file.

With MinContrastMinContrastMinContrastMinContrastminContrast, it can be determined which edge contrast the model must at least have in the recognition performed by find_shape_model_3dfind_shape_model_3dFindShapeModel3dFindShapeModel3dFindShapeModel3d. In other words, this parameter separates the model from the noise in the image. Therefore, a good choice is the range of gray value changes caused by the noise in the image. If, for example, the gray values fluctuate within a range of 10 gray levels, MinContrastMinContrastMinContrastMinContrastminContrast should be set to 10. If multichannel images are used for the search images, the noise in one channel must be multiplied by the square root of the number of channels to determine MinContrastMinContrastMinContrastMinContrastminContrast. If, for example, the gray values fluctuate within a range of 10 gray levels in a single channel and the image is a three-channel image, MinContrastMinContrastMinContrastMinContrastminContrast should be set to 17. If the model should be recognized in very low contrast images, MinContrastMinContrastMinContrastMinContrastminContrast must be set to a correspondingly small value. If the model should be recognized even if it is severely occluded, MinContrastMinContrastMinContrastMinContrastminContrast should be slightly larger than the range of gray value fluctuations created by noise in order to ensure that the pose of the model is extracted robustly and accurately by find_shape_model_3dfind_shape_model_3dFindShapeModel3dFindShapeModel3dFindShapeModel3d.

The parameters described above are application-dependent and must be always specified when creating a 3D shape model. In addition, there are some generic parameters that can optionally be used to influence the model creation. For most applications these parameters need not to be specified but can be left at their default values. If desired, these parameters and their corresponding values can be specified by using GenParamNameGenParamNameGenParamNameGenParamNamegenParamName and GenParamValueGenParamValueGenParamValueGenParamValuegenParamValue, respectively. The following values for GenParamNameGenParamNameGenParamNameGenParamNamegenParamName are possible:

'num_levels'"num_levels""num_levels""num_levels""num_levels":

For efficiency reasons the model views are generated on multiple pyramid levels. On higher levels fewer views are generated than on lower levels. With the parameter 'num_levels'"num_levels""num_levels""num_levels""num_levels" the number of pyramid levels on which model views are generated can be specified. It should be chosen as large as possible because by this the time necessary to find the model is significantly reduced. On the other hand, the number of levels must be chosen such that the shape representations of the views on the highest pyramid level are still recognizable and contain a sufficient number of points (at least four). If not enough model points are generated for a certain view, the view is deleted from the model and replaced by a view on a lower pyramid level. If for all views on a pyramid level not enough model points are generated, the number of levels is reduced internally until for at least one view enough model points are found on the highest pyramid level. If this procedure would lead to a model with no pyramid levels, i.e., if the number of model points is too small for all views already on the lowest pyramid level, create_shape_model_3dcreate_shape_model_3dCreateShapeModel3dCreateShapeModel3dCreateShapeModel3d returns an error message. If 'num_levels'"num_levels""num_levels""num_levels""num_levels" is set to 'auto'"auto""auto""auto""auto" (default value), create_shape_model_3dcreate_shape_model_3dCreateShapeModel3dCreateShapeModel3dCreateShapeModel3d determines the number of pyramid levels automatically. In this case all model views on all pyramid levels are automatically checked whether their shape representations are still recognizable. If the shape representation of a certain view is found to be not recognizable, the view is deleted from the model and replaced by a view on a lower pyramid level. Note that if 'num_levels'"num_levels""num_levels""num_levels""num_levels" is set to 'auto'"auto""auto""auto""auto", the number of pyramid levels can be different for different views. In rare cases, it might happen that create_shape_model_3dcreate_shape_model_3dCreateShapeModel3dCreateShapeModel3dCreateShapeModel3d determines a value for the number of pyramid levels that is too large or too small. If the number of pyramid levels is chosen too large, the model may not be recognized in the image or it may be necessary to select very low parameters for MinScoreMinScoreMinScoreMinScoreminScore or GreedinessGreedinessGreedinessGreedinessgreediness in find_shape_model_3dfind_shape_model_3dFindShapeModel3dFindShapeModel3dFindShapeModel3d in order to find the model. If the number of pyramid levels is chosen too small, the time required to find the model in find_shape_model_3dfind_shape_model_3dFindShapeModel3dFindShapeModel3dFindShapeModel3d may increase. In these cases, the views on the pyramid levels should be checked by using the output of get_shape_model_3d_contoursget_shape_model_3d_contoursGetShapeModel3dContoursGetShapeModel3dContoursGetShapeModel3dContours.

Suggested values: 'auto'"auto""auto""auto""auto", 3, 4, 5, 6

Default value: 'auto'"auto""auto""auto""auto"

'fast_pose_refinement'"fast_pose_refinement""fast_pose_refinement""fast_pose_refinement""fast_pose_refinement":

The parameter specifies whether the pose refinement during the search with find_shape_model_3dfind_shape_model_3dFindShapeModel3dFindShapeModel3dFindShapeModel3d is sped up. If 'fast_pose_refinement'"fast_pose_refinement""fast_pose_refinement""fast_pose_refinement""fast_pose_refinement" is set to 'false'"false""false""false""false", for complex models with a large number of faces the pose refinement step might amount to a significant part of the overall computation time. If 'fast_pose_refinement'"fast_pose_refinement""fast_pose_refinement""fast_pose_refinement""fast_pose_refinement" is set to 'true'"true""true""true""true", some of the calculations that are necessary during the pose refinement are already performed during the model generation and stored in the model. Consequently, the pose refinement during the search will be faster. Please note, however, that in this case the memory consumption of the model may increase significantly (typically by less than 30 percent). Further note that the resulting poses that are returned by find_shape_model_3dfind_shape_model_3dFindShapeModel3dFindShapeModel3dFindShapeModel3d might slightly differ depending on the value of 'fast_pose_refinement'"fast_pose_refinement""fast_pose_refinement""fast_pose_refinement""fast_pose_refinement", because internally the pose refinement is approximated if the parameter is set to 'true'"true""true""true""true".

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

Default value: 'true'"true""true""true""true"

'lowest_model_level'"lowest_model_level""lowest_model_level""lowest_model_level""lowest_model_level":

In some cases the model generation process might be very time consuming and the memory consumption of the model might be very high. The reason for this is that in these cases the number of views, which must be computed and stored in the model, is very high. The larger the pose range is chosen and the larger the objects appear in the image (measured in pixels) the more views are necessary. Consequently, especially the use of large images (e.g., images exceeding a size of 640×480 ) can result in very large models. Because the number of views is highest on lower pyramid levels, the parameter 'lowest_model_level'"lowest_model_level""lowest_model_level""lowest_model_level""lowest_model_level" can be used to exclude the lower pyramid levels from the generation of views. The value that is passed for 'lowest_model_level'"lowest_model_level""lowest_model_level""lowest_model_level""lowest_model_level" determines the lowest pyramid level down to which views are generated and stored in the 3d shape model. If, for example, a value of 2 is passed for large models, the time to generate the model as well as the size of the resulting model is reduced to approximately one third of the original values. If 'lowest_model_level'"lowest_model_level""lowest_model_level""lowest_model_level""lowest_model_level" is not passed, views are generated for all pyramid levels, which corresponds to the behavior when passing a value of 1 for 'lowest_model_level'"lowest_model_level""lowest_model_level""lowest_model_level""lowest_model_level". If for 'lowest_model_level'"lowest_model_level""lowest_model_level""lowest_model_level""lowest_model_level" a value larger than 1 is passed, in find_shape_model_3dfind_shape_model_3dFindShapeModel3dFindShapeModel3dFindShapeModel3d the tracking of matches through the pyramid will be stopped at this level. However, if in find_shape_model_3dfind_shape_model_3dFindShapeModel3dFindShapeModel3dFindShapeModel3d a least-squares adjustment is chosen for pose refinement, the matches are refined on the lowest pyramid level using the least-squares adjustment. Note that for different values for 'lowest_model_level'"lowest_model_level""lowest_model_level""lowest_model_level""lowest_model_level" different matches might be found during the search. Furthermore, the score of the matches depends on the chosen method for pose refinement. Also note that the higher 'lowest_model_level'"lowest_model_level""lowest_model_level""lowest_model_level""lowest_model_level" is chosen the higher the portion of the refinement step with respect to the overall run-time of find_shape_model_3dfind_shape_model_3dFindShapeModel3dFindShapeModel3dFindShapeModel3d will be. As a consequence for higher values of 'lowest_model_level'"lowest_model_level""lowest_model_level""lowest_model_level""lowest_model_level" the influence of the generic parameter 'fast_pose_refinement'"fast_pose_refinement""fast_pose_refinement""fast_pose_refinement""fast_pose_refinement" (see above) on the runtime will increase. A large value for 'lowest_model_level'"lowest_model_level""lowest_model_level""lowest_model_level""lowest_model_level" on the one hand may lead to long computation times of find_shape_model_3dfind_shape_model_3dFindShapeModel3dFindShapeModel3dFindShapeModel3d if 'fast_pose_refinement'"fast_pose_refinement""fast_pose_refinement""fast_pose_refinement""fast_pose_refinement" is switches off ('false'"false""false""false""false"). On the other hand it may lead to a decreased accuracy if 'fast_pose_refinement'"fast_pose_refinement""fast_pose_refinement""fast_pose_refinement""fast_pose_refinement" is switches on ('true'"true""true""true""true") because in this mode the pose refinement is only approximated. Therefore, the value for 'lowest_model_level'"lowest_model_level""lowest_model_level""lowest_model_level""lowest_model_level" should be chosen as small as possible. Furthermore, 'lowest_model_level'"lowest_model_level""lowest_model_level""lowest_model_level""lowest_model_level" should be chosen small enough such that the edges of the 3D object model are still observable on this level.

Suggested values: 1, 2, 3

Default value: 1

'optimization'"optimization""optimization""optimization""optimization":

For models with particularly large model views, it may be useful to reduce the number of model points by setting 'optimization'"optimization""optimization""optimization""optimization" to a value different from 'none'"none""none""none""none". If 'optimization'"optimization""optimization""optimization""optimization" = 'none'"none""none""none""none", all model points are stored. In all other cases, the number of points is reduced according to the value of 'optimization'"optimization""optimization""optimization""optimization". If the number of points is reduced, it may be necessary in find_shape_model_3dfind_shape_model_3dFindShapeModel3dFindShapeModel3dFindShapeModel3d to set the parameter GreedinessGreedinessGreedinessGreedinessgreediness to a smaller value, e.g., 0.7 or 0.8. For models with small model views, the reduction of the number of model points does not result in a speed-up of the search because in this case usually significantly more potential instances of the model must be examined. If 'optimization'"optimization""optimization""optimization""optimization" is set to 'auto'"auto""auto""auto""auto", create_shape_model_3dcreate_shape_model_3dCreateShapeModel3dCreateShapeModel3dCreateShapeModel3d automatically determines the reduction of the number of model points for each model view.

List of values: 'auto'"auto""auto""auto""auto", 'none'"none""none""none""none", 'point_reduction_low'"point_reduction_low""point_reduction_low""point_reduction_low""point_reduction_low", 'point_reduction_medium'"point_reduction_medium""point_reduction_medium""point_reduction_medium""point_reduction_medium", 'point_reduction_high'"point_reduction_high""point_reduction_high""point_reduction_high""point_reduction_high"

Default value: 'auto'"auto""auto""auto""auto"

'metric'"metric""metric""metric""metric":

This parameter determines the conditions under which the model is recognized in the image. If 'metric'"metric""metric""metric""metric" = 'ignore_part_polarity'"ignore_part_polarity""ignore_part_polarity""ignore_part_polarity""ignore_part_polarity", the contrast polarity is allowed to change only between different parts of the model, whereas the polarity of model points that are within the same model part must not change. Please note that the term 'ignore_part_polarity'"ignore_part_polarity""ignore_part_polarity""ignore_part_polarity""ignore_part_polarity" is capable of being misunderstood. It means that polarity changes between neighboring model parts do not influence the score, and hence are ignored. Appropriate model parts are automatically determined. The size of the parts can be controlled by the generic parameter 'part_size'"part_size""part_size""part_size""part_size", which is described below. Note that this metric only works for one-channel images. Consequently, if the model is created by using this metric and searched in a multi-channel image by using find_shape_model_3dfind_shape_model_3dFindShapeModel3dFindShapeModel3dFindShapeModel3d an error will be returned. If 'metric'"metric""metric""metric""metric" = 'ignore_local_polarity'"ignore_local_polarity""ignore_local_polarity""ignore_local_polarity""ignore_local_polarity", the model is found even if the contrast polarity changes for each individual model point. This metric works for one-channel images as well as for multi-channel images. The metric 'ignore_part_polarity'"ignore_part_polarity""ignore_part_polarity""ignore_part_polarity""ignore_part_polarity" should be used if the images contain strongly textured backgrounds or clutter objects, which might result in wrong matches. Note that in general the scores of the matches that are returned by find_shape_model_3dfind_shape_model_3dFindShapeModel3dFindShapeModel3dFindShapeModel3d are lower for 'ignore_part_polarity'"ignore_part_polarity""ignore_part_polarity""ignore_part_polarity""ignore_part_polarity" than for 'ignore_local_polarity'"ignore_local_polarity""ignore_local_polarity""ignore_local_polarity""ignore_local_polarity". This should be kept in mind when choosing the right value for the parameter MinScoreMinScoreMinScoreMinScoreminScore of find_shape_model_3dfind_shape_model_3dFindShapeModel3dFindShapeModel3dFindShapeModel3d.

List of values: 'ignore_local_polarity'"ignore_local_polarity""ignore_local_polarity""ignore_local_polarity""ignore_local_polarity", 'ignore_part_polarity'"ignore_part_polarity""ignore_part_polarity""ignore_part_polarity""ignore_part_polarity"

Default value: 'ignore_local_polarity'"ignore_local_polarity""ignore_local_polarity""ignore_local_polarity""ignore_local_polarity"

'part_size'"part_size""part_size""part_size""part_size":

This parameter determines the size of the model parts that is used when 'metric'"metric""metric""metric""metric" is set to 'ignore_part_polarity'"ignore_part_polarity""ignore_part_polarity""ignore_part_polarity""ignore_part_polarity" (see above). The size must be specified in pixels and should be approximately twice as large as the size of the background texture in the image. For example, if an object should be found in front of a chessboard with black and white squares of size 5×5 pixels, 'part_size'"part_size""part_size""part_size""part_size" should be set to 10. Note that higher values of 'part_size'"part_size""part_size""part_size""part_size" might also decrease the scores of correct instances especially when searching for objects with shiny or reflective surfaces. Therefore, the risk of missing correct instances might increase if 'part_size'"part_size""part_size""part_size""part_size" is set to a higher value. If 'metric'"metric""metric""metric""metric" is set to 'ignore_local_polarity'"ignore_local_polarity""ignore_local_polarity""ignore_local_polarity""ignore_local_polarity", the value of 'part_size'"part_size""part_size""part_size""part_size" is ignored.

Suggested values: 2, 3, 4, 6, 8, 10

Default value: 4

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

3D edges are only included in the shape representations of the views if the angle between the two 3D faces that are incident with the 3D object model 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 included. 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 included. This parameter can be used to suppress edges within curved surfaces, e.g., the surface of a cylinder or cone. Curved surfaces are approximated by multiple planar faces. The edges between such neighboring planar faces should not be included in the shape representation because they also do not appear in real images of the model. Thus, 'min_face_angle'"min_face_angle""min_face_angle""min_face_angle""min_face_angle" should be set sufficiently high to suppress these edges. The effect of different values for 'min_face_angle'"min_face_angle""min_face_angle""min_face_angle""min_face_angle" can be inspected by using project_object_model_3dproject_object_model_3dProjectObjectModel3dProjectObjectModel3dProjectObjectModel3d before calling create_shape_model_3dcreate_shape_model_3dCreateShapeModel3dCreateShapeModel3dCreateShapeModel3d. Note that if edges that are not visible in the search image are included in the shape representation, the performance (robustness and speed) of the matching may decrease considerably.

Suggested values: 'rad(10)'"rad(10)""rad(10)""rad(10)""rad(10)", 'rad(20)'"rad(20)""rad(20)""rad(20)""rad(20)", 'rad(30)'"rad(30)""rad(30)""rad(30)""rad(30)", 'rad(45)'"rad(45)""rad(45)""rad(45)""rad(45)"

Default value: 'rad(30)'"rad(30)""rad(30)""rad(30)""rad(30)"

'min_size'"min_size""min_size""min_size""min_size":

This value determines a threshold for the selection of significant model components based on the size of the components, i.e., connected components that have fewer points than the specified minimum size are suppressed. This threshold for the minimum size is divided by two for each successive pyramid level.

Suggested values: 'auto'"auto""auto""auto""auto", 0, 3, 5, 10, 20

Default value: 'auto'"auto""auto""auto""auto"

'model_tolerance'"model_tolerance""model_tolerance""model_tolerance""model_tolerance":

The parameter specifies the tolerance of the projected 3D object model edges in the image, given in pixels. The higher the value is chosen, the fewer views need to be generated. Consequently, a higher value results in models that are less memory consuming and faster to find with find_shape_model_3dfind_shape_model_3dFindShapeModel3dFindShapeModel3dFindShapeModel3d. On the other hand, if the value is chosen too high, the robustness of the matching will decrease. Therefore, this parameter should only be modified with care. For most applications, a good compromise between speed and robustness is obtained when setting 'model_tolerance'"model_tolerance""model_tolerance""model_tolerance""model_tolerance" to 1.

Suggested values: 0, 1, 2

Default value: 1

'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 by the operator project_shape_model_3dproject_shape_model_3dProjectShapeModel3dProjectShapeModel3dProjectShapeModel3d or not. Activating this option is equivalent to calling union_adjacent_contours_xldunion_adjacent_contours_xldUnionAdjacentContoursXldUnionAdjacentContoursXldUnionAdjacentContoursXld afterwards, but significantly faster.

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

Default value: 'false'"false""false""false""false"

If the system variable (see set_systemset_systemSetSystemSetSystemSetSystem) '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 default if it is available) the graphics card is used to accelerate the computation of the visible faces in the model views. Depending on the graphics card this is significantly faster than the analytic visibility computation. If 'fast_pose_refinement'"fast_pose_refinement""fast_pose_refinement""fast_pose_refinement""fast_pose_refinement" is set to 'true'"true""true""true""true", the precomputations necessary for the pose refinement step in find_shape_model_3dfind_shape_model_3dFindShapeModel3dFindShapeModel3dFindShapeModel3d are also performed on the graphics card. Be aware that the results of the OpenGL projection are slightly different compared to the analytic projection.

Execution Information

This operator returns a handle. Note that the state of an instance of this handle type may be changed by specific operators even though the handle is used as an input parameter by those operators.

Parameters

ObjectModel3DObjectModel3DObjectModel3DObjectModel3DobjectModel3D (input_control)  object_model_3d HObjectModel3D, HTupleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Handle of the 3D object model.

CamParamCamParamCamParamCamParamcamParam (input_control)  campar HCamPar, HTupleHTupleHtuple (real / integer / string) (double / int / long / string) (double / Hlong / HString) (double / Hlong / char*)

Internal camera parameters.

RefRotXRefRotXRefRotXRefRotXrefRotX (input_control)  angle.rad HTupleHTupleHtuple (real) (double) (double) (double)

Reference orientation: Rotation around x-axis or x component of the Rodriguez vector (in radians or without unit).

Default value: 0

Suggested values: -1.57, -0.78, -0.17, 0., 0.17, 0.78, 1.57

RefRotYRefRotYRefRotYRefRotYrefRotY (input_control)  angle.rad HTupleHTupleHtuple (real) (double) (double) (double)

Reference orientation: Rotation around y-axis or y component of the Rodriguez vector (in radians or without unit).

Default value: 0

Suggested values: -1.57, -0.78, -0.17, 0., 0.17, 0.78, 1.57

RefRotZRefRotZRefRotZRefRotZrefRotZ (input_control)  angle.rad HTupleHTupleHtuple (real) (double) (double) (double)

Reference orientation: Rotation around z-axis or z component of the Rodriguez vector (in radians or without unit).

Default value: 0

Suggested values: -1.57, -0.78, -0.17, 0., 0.17, 0.78, 1.57

OrderOfRotationOrderOfRotationOrderOfRotationOrderOfRotationorderOfRotation (input_control)  string HTupleHTupleHtuple (string) (string) (HString) (char*)

Meaning of the rotation values of the reference orientation.

Default value: 'gba' "gba" "gba" "gba" "gba"

List of values: 'abg'"abg""abg""abg""abg", 'gba'"gba""gba""gba""gba", 'rodriguez'"rodriguez""rodriguez""rodriguez""rodriguez"

LongitudeMinLongitudeMinLongitudeMinLongitudeMinlongitudeMin (input_control)  angle.rad HTupleHTupleHtuple (real) (double) (double) (double)

Minimum longitude of the model views.

Default value: -0.35

Suggested values: -0.78, -0.35, -0.17

LongitudeMaxLongitudeMaxLongitudeMaxLongitudeMaxlongitudeMax (input_control)  angle.rad HTupleHTupleHtuple (real) (double) (double) (double)

Maximum longitude of the model views.

Default value: 0.35

Suggested values: 0.17, 0.35, 0.78

Restriction: LongitudeMax >= LongitudeMin

LatitudeMinLatitudeMinLatitudeMinLatitudeMinlatitudeMin (input_control)  angle.rad HTupleHTupleHtuple (real) (double) (double) (double)

Minimum latitude of the model views.

Default value: -0.35

Suggested values: -0.78, -0.35, -0.17

Restriction: - pi / 2 <= LatitudeMin && LatitudeMin <= pi / 2

LatitudeMaxLatitudeMaxLatitudeMaxLatitudeMaxlatitudeMax (input_control)  angle.rad HTupleHTupleHtuple (real) (double) (double) (double)

Maximum latitude of the model views.

Default value: 0.35

Suggested values: 0.17, 0.35, 0.78

Restriction: - pi / 2 <= LatitudeMax && LatitudeMax <= pi / 2 && LatitudeMax >= LatitudeMin

CamRollMinCamRollMinCamRollMinCamRollMincamRollMin (input_control)  angle.rad HTupleHTupleHtuple (real) (double) (double) (double)

Minimum camera roll angle of the model views.

Default value: -3.1416

Suggested values: -3.14, -1.57, -0.39, 0.0, 0.39, 1.57, 3.14

CamRollMaxCamRollMaxCamRollMaxCamRollMaxcamRollMax (input_control)  angle.rad HTupleHTupleHtuple (real) (double) (double) (double)

Maximum camera roll angle of the model views.

Default value: 3.1416

Suggested values: -3.14, -1.57, -0.39, 0.0, 0.39, 1.57, 3.14

Restriction: CamRollMax >= CamRollMin

DistMinDistMinDistMinDistMindistMin (input_control)  number HTupleHTupleHtuple (real) (double) (double) (double)

Minimum camera-object-distance of the model views.

Default value: 0.3

Suggested values: 0.05, 0.1, 0.2, 0.5

Restriction: DistMin > 0

DistMaxDistMaxDistMaxDistMaxdistMax (input_control)  number HTupleHTupleHtuple (real) (double) (double) (double)

Maximum camera-object-distance of the model views.

Default value: 0.4

Suggested values: 0.1, 0.2, 0.5, 1.0

Restriction: DistMax >= DistMin

MinContrastMinContrastMinContrastMinContrastminContrast (input_control)  number HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Minimum contrast of the objects in the search images.

Default value: 10

Suggested values: 1, 2, 3, 5, 7, 10, 20, 30, 1000, 2000, 5000

GenParamNameGenParamNameGenParamNameGenParamNamegenParamName (input_control)  attribute.name(-array) HTupleHTupleHtuple (string) (string) (HString) (char*)

Names of (optional) parameters for controlling the behavior of the operator.

Default value: []

List of values: 'fast_pose_refinement'"fast_pose_refinement""fast_pose_refinement""fast_pose_refinement""fast_pose_refinement", 'lowest_model_level'"lowest_model_level""lowest_model_level""lowest_model_level""lowest_model_level", 'metric'"metric""metric""metric""metric", 'min_face_angle'"min_face_angle""min_face_angle""min_face_angle""min_face_angle", 'min_size'"min_size""min_size""min_size""min_size", 'model_tolerance'"model_tolerance""model_tolerance""model_tolerance""model_tolerance", 'num_levels'"num_levels""num_levels""num_levels""num_levels", 'optimization'"optimization""optimization""optimization""optimization", 'part_size'"part_size""part_size""part_size""part_size", 'union_adjacent_contours'"union_adjacent_contours""union_adjacent_contours""union_adjacent_contours""union_adjacent_contours"

GenParamValueGenParamValueGenParamValueGenParamValuegenParamValue (input_control)  attribute.name(-array) HTupleHTupleHtuple (integer / real / string) (int / long / double / string) (Hlong / double / HString) (Hlong / double / char*)

Values of the optional generic parameters.

Default value: []

Suggested values: 0, 1, 2, 3, 4, 6, 8, 10, 'auto'"auto""auto""auto""auto", 'none'"none""none""none""none", 'point_reduction_low'"point_reduction_low""point_reduction_low""point_reduction_low""point_reduction_low", 'point_reduction_medium'"point_reduction_medium""point_reduction_medium""point_reduction_medium""point_reduction_medium", 'point_reduction_high'"point_reduction_high""point_reduction_high""point_reduction_high""point_reduction_high", 0.1, 0.2, 0.3, 'ignore_local_polarity'"ignore_local_polarity""ignore_local_polarity""ignore_local_polarity""ignore_local_polarity", 'ignore_part_polarity'"ignore_part_polarity""ignore_part_polarity""ignore_part_polarity""ignore_part_polarity", 'true'"true""true""true""true", 'false'"false""false""false""false"

ShapeModel3DIDShapeModel3DIDShapeModel3DIDShapeModel3DIDshapeModel3DID (output_control)  shape_model_3d HShapeModel3D, HTupleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Handle of the 3D shape model.

Result

If the parameters are valid, the operator create_shape_model_3dcreate_shape_model_3dCreateShapeModel3dCreateShapeModel3dCreateShapeModel3d returns the value 2 (H_MSG_TRUE). If necessary an exception is raised. If the parameters are chosen such that all model views contain too few points, the error 8510 is raised. In the case that the projected model is bigger than twice the image size in at least one model view, the error 8910 is raised.

Possible Predecessors

read_object_model_3dread_object_model_3dReadObjectModel3dReadObjectModel3dReadObjectModel3d, project_object_model_3dproject_object_model_3dProjectObjectModel3dProjectObjectModel3dProjectObjectModel3d, get_object_model_3d_paramsget_object_model_3d_paramsGetObjectModel3dParamsGetObjectModel3dParamsGetObjectModel3dParams

Possible Successors

find_shape_model_3dfind_shape_model_3dFindShapeModel3dFindShapeModel3dFindShapeModel3d, write_shape_model_3dwrite_shape_model_3dWriteShapeModel3dWriteShapeModel3dWriteShapeModel3d, project_shape_model_3dproject_shape_model_3dProjectShapeModel3dProjectShapeModel3dProjectShapeModel3d, get_shape_model_3d_paramsget_shape_model_3d_paramsGetShapeModel3dParamsGetShapeModel3dParamsGetShapeModel3dParams, get_shape_model_3d_contoursget_shape_model_3d_contoursGetShapeModel3dContoursGetShapeModel3dContoursGetShapeModel3dContours

See also

convert_point_3d_cart_to_spherconvert_point_3d_cart_to_spherConvertPoint3dCartToSpherConvertPoint3dCartToSpherConvertPoint3dCartToSpher, convert_point_3d_spher_to_cartconvert_point_3d_spher_to_cartConvertPoint3dSpherToCartConvertPoint3dSpherToCartConvertPoint3dSpherToCart, create_cam_pose_look_at_pointcreate_cam_pose_look_at_pointCreateCamPoseLookAtPointCreateCamPoseLookAtPointCreateCamPoseLookAtPoint, trans_pose_shape_model_3dtrans_pose_shape_model_3dTransPoseShapeModel3dTransPoseShapeModel3dTransPoseShapeModel3d

References

Markus Ulrich, Christian Wiedemann, Carsten Steger, “Combining Scale-Space and Similarity-Based Aspect Graphs for Fast 3D Object Recognition,” IEEE Transactions on Pattern Analysis and Machine Intelligence, pp. 1902-1914, Oct., 2012.

Module

3D Metrology


ClassesClasses | | Operators