Skip to content

set_planar_calib_deformable_model_metricset_planar_calib_deformable_model_metricSetPlanarCalibDeformableModelMetricSetPlanarCalibDeformableModelMetricset_planar_calib_deformable_model_metricT_set_planar_calib_deformable_model_metric🔗

Short description🔗

set_planar_calib_deformable_model_metricset_planar_calib_deformable_model_metricSetPlanarCalibDeformableModelMetricSetPlanarCalibDeformableModelMetricset_planar_calib_deformable_model_metricT_set_planar_calib_deformable_model_metric — Set the metric of a planar calibrated deformable model that was created from XLD contours.

Signature🔗

set_planar_calib_deformable_model_metric( image Image, deformable_model ModelID, pose Pose, string Metric )set_planar_calib_deformable_model_metric( Image : : ModelID, Pose, Metric : )void SetPlanarCalibDeformableModelMetric( const HObject& Image, const HTuple& ModelID, const HTuple& Pose, const HTuple& Metric )static void HOperatorSet.SetPlanarCalibDeformableModelMetric( HObject image, HTuple modelID, HTuple pose, HTuple metric )def set_planar_calib_deformable_model_metric( image: HObject, model_id: HHandle, pose: Sequence[Union[float, int]], metric: str ) -> None

Herror T_set_planar_calib_deformable_model_metric( const Hobject Image, const Htuple ModelID, const Htuple Pose, const Htuple Metric )

void HDeformableModel::SetPlanarCalibDeformableModelMetric( const HImage& Image, const HPose& Pose, const HString& Metric ) const

void HDeformableModel::SetPlanarCalibDeformableModelMetric( const HImage& Image, const HPose& Pose, const char* Metric ) const

void HDeformableModel::SetPlanarCalibDeformableModelMetric( const HImage& Image, const HPose& Pose, const wchar_t* Metric ) const (Windows only)

void HImage::SetPlanarCalibDeformableModelMetric( const HDeformableModel& ModelID, const HPose& Pose, const HString& Metric ) const

void HImage::SetPlanarCalibDeformableModelMetric( const HDeformableModel& ModelID, const HPose& Pose, const char* Metric ) const

void HImage::SetPlanarCalibDeformableModelMetric( const HDeformableModel& ModelID, const HPose& Pose, const wchar_t* Metric ) const (Windows only)

void HDeformableModel.SetPlanarCalibDeformableModelMetric( HImage image, HPose pose, string metric )

void HImage.SetPlanarCalibDeformableModelMetric( HDeformableModel modelID, HPose pose, string metric )

Description🔗

set_planar_calib_deformable_model_metricSetPlanarCalibDeformableModelMetric changes the value of the parameter Metricmetricmetric that was selected during the creation of the deformable model ModelIDmodelIDmodel_id from XLD contours. Because no information about the polarity of the model contours is available for XLD contours, the polarity is determined based on a representative Imageimageimage. For this, the model contours are mapped to the respective position where the object appears in the Imageimageimage using Poseposepose, which can be obtained by a previous call to find_planar_calib_deformable_modelFindPlanarCalibDeformableModel.

The parameter Metricmetricmetric then determines the conditions under which the model is recognized later in the search image. If Metricmetricmetric \(=\) 'use_polarity'"use_polarity", the object in the image and the model must have the same contrast. If, e.g., the model is a bright object on a dark background, the object is found only if it is also brighter than the background. If Metricmetricmetric \(=\) 'ignore_global_polarity'"ignore_global_polarity", the object is found in the image also if the contrast reverses globally. In the above example, the object hence is also found if it is darker than the background. The runtime of find_planar_calib_deformable_modelFindPlanarCalibDeformableModel will increase slightly in this case.

It must be ensured that the object contours in the Imageimageimage have the same (or inverse) polarity as the object contours in the image in which the object must be searched later. Especially, the object must not be occluded in the Imageimageimage and the background must be either brighter than the object or darker. Otherwise, the determined polarity of the model contour will not represent the polarity of the object contour during the search. Note that only the polarity of the contours is determined, not their contrast. Note also that the polarity is determined from a single-channel image, only. If a multi-channel image is passed in Imageimageimage, only the first channel will be used (and no error message will be returned).

A typical proceeding is to read the XLD contours from file. Since these XLD contours do not provide polarity information, the model must be created from the XLD contours by setting the parameter Metricmetricmetric to 'ignore_local_polarity'"ignore_local_polarity". Then, in a first search image the model is recognized. The transformation that maps the model contours to the position of the object in the search image Poseposepose can be determined from the matching result. To verify the match interactively, the model contours can be mapped to this position. If the matching result is correct, the value of the parameter Metricmetricmetric can be changed, e.g., to 'use_polarity'"use_polarity". This leads to a faster and more robust recognition in the following images.

Attention🔗

set_planar_calib_deformable_model_metricSetPlanarCalibDeformableModelMetric can only be used with deformable models that were created from XLD contours.

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.

This operator modifies the state of the following input parameter:

During execution of this operator, access to the value of this parameter must be synchronized if it is used across multiple threads.

Parameters🔗

Imageimageimage (input_object) singlechannelimage → object (byte / uint2)object (byte / uint2)HObject (byte / uint2)HImage (byte / uint2)HObject (byte / uint2)Hobject (byte / uint2)

Input image used for the determination of the polarity.

ModelIDmodelIDmodel_id (input_control, state is modified) deformable_model → (handle)(handle)HTuple (HHandle)HDeformableModel, HTuple (IntPtr)HHandleHtuple (handle)

Handle of the model.

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

Pose of the model in the image.

Number of elements: 7

Metricmetricmetric (input_control) string → (string)(string)HTuple (HString)HTuple (string)strHtuple (char*)

Match metric.

Default: 'use_polarity'"use_polarity"
List of values: 'ignore_global_polarity', 'use_polarity'"ignore_global_polarity", "use_polarity"

Result🔗

If the parameters are valid, the operator set_planar_calib_deformable_model_metricSetPlanarCalibDeformableModelMetric returns the value 2 (H_MSG_TRUE). If necessary, an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

create_planar_calib_deformable_model_xldCreatePlanarCalibDeformableModelXld, find_planar_calib_deformable_modelFindPlanarCalibDeformableModel

Possible successors

find_planar_calib_deformable_modelFindPlanarCalibDeformableModel

See also

create_planar_calib_deformable_model_xldCreatePlanarCalibDeformableModelXld

Module🔗

Matching