Skip to content

find_local_deformable_modelFindLocalDeformableModelFindLocalDeformableModelfind_local_deformable_modelT_find_local_deformable_modelπŸ”—

Short descriptionπŸ”—

find_local_deformable_modelFindLocalDeformableModelFindLocalDeformableModelfind_local_deformable_modelT_find_local_deformable_model β€” Find the best matches of a local deformable model in an image.

SignatureπŸ”—

find_local_deformable_model( image Image, out image ImageRectified, out image VectorField, out xld_cont DeformedContours, deformable_model ModelID, angle.rad AngleStart, angle.rad AngleExtent, number ScaleRMin, number ScaleRMax, number ScaleCMin, number ScaleCMax, real MinScore, integer NumMatches, real MaxOverlap, integer NumLevels, real Greediness, string ResultType, string GenParamName, integer GenParamValue, out real Score, out real Row, out real Column )void FindLocalDeformableModel( const HObject& Image, HObject* ImageRectified, HObject* VectorField, HObject* DeformedContours, const HTuple& ModelID, const HTuple& AngleStart, const HTuple& AngleExtent, const HTuple& ScaleRMin, const HTuple& ScaleRMax, const HTuple& ScaleCMin, const HTuple& ScaleCMax, const HTuple& MinScore, const HTuple& NumMatches, const HTuple& MaxOverlap, const HTuple& NumLevels, const HTuple& Greediness, const HTuple& ResultType, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* Score, HTuple* Row, HTuple* Column )static void HOperatorSet.FindLocalDeformableModel( HObject image, out HObject imageRectified, out HObject vectorField, out HObject deformedContours, HTuple modelID, HTuple angleStart, HTuple angleExtent, HTuple scaleRMin, HTuple scaleRMax, HTuple scaleCMin, HTuple scaleCMax, HTuple minScore, HTuple numMatches, HTuple maxOverlap, HTuple numLevels, HTuple greediness, HTuple resultType, HTuple genParamName, HTuple genParamValue, out HTuple score, out HTuple row, out HTuple column )def find_local_deformable_model( image: HObject, model_id: HHandle, angle_start: float, angle_extent: float, scale_rmin: float, scale_rmax: float, scale_cmin: float, scale_cmax: float, min_score: float, num_matches: int, max_overlap: float, num_levels: int, greediness: float, result_type: Sequence[str], gen_param_name: Sequence[str], gen_param_value: Sequence[Union[int, float, str]] ) -> Tuple[HObject, HObject, HObject, Sequence[float], Sequence[float], Sequence[float]]

Herror T_find_local_deformable_model( const Hobject Image, Hobject* ImageRectified, Hobject* VectorField, Hobject* DeformedContours, const Htuple ModelID, const Htuple AngleStart, const Htuple AngleExtent, const Htuple ScaleRMin, const Htuple ScaleRMax, const Htuple ScaleCMin, const Htuple ScaleCMax, const Htuple MinScore, const Htuple NumMatches, const Htuple MaxOverlap, const Htuple NumLevels, const Htuple Greediness, const Htuple ResultType, const Htuple GenParamName, const Htuple GenParamValue, Htuple* Score, Htuple* Row, Htuple* Column )

HImage HDeformableModel::FindLocalDeformableModel( const HImage& Image, HImage* VectorField, HXLDCont* DeformedContours, double AngleStart, double AngleExtent, double ScaleRMin, double ScaleRMax, double ScaleCMin, double ScaleCMax, double MinScore, Hlong NumMatches, double MaxOverlap, Hlong NumLevels, double Greediness, const HTuple& ResultType, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* Score, HTuple* Row, HTuple* Column ) const

HImage HImage::FindLocalDeformableModel( HImage* VectorField, HXLDCont* DeformedContours, const HDeformableModel& ModelID, double AngleStart, double AngleExtent, double ScaleRMin, double ScaleRMax, double ScaleCMin, double ScaleCMax, double MinScore, Hlong NumMatches, double MaxOverlap, Hlong NumLevels, double Greediness, const HTuple& ResultType, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* Score, HTuple* Row, HTuple* Column ) const

HImage HDeformableModel.FindLocalDeformableModel( HImage image, out HImage vectorField, out HXLDCont deformedContours, double angleStart, double angleExtent, double scaleRMin, double scaleRMax, double scaleCMin, double scaleCMax, double minScore, int numMatches, double maxOverlap, int numLevels, double greediness, HTuple resultType, HTuple genParamName, HTuple genParamValue, out HTuple score, out HTuple row, out HTuple column )

HImage HImage.FindLocalDeformableModel( out HImage vectorField, out HXLDCont deformedContours, HDeformableModel modelID, double angleStart, double angleExtent, double scaleRMin, double scaleRMax, double scaleCMin, double scaleCMax, double minScore, int numMatches, double maxOverlap, int numLevels, double greediness, HTuple resultType, HTuple genParamName, HTuple genParamValue, out HTuple score, out HTuple row, out HTuple column )

DescriptionπŸ”—

The operator find_local_deformable_modelFindLocalDeformableModel finds the best NumMatchesnumMatchesnum_matches instances of the locally deformable model ModelIDmodelIDmodel_id in the input Imageimageimage. The model must have been created previously by calling create_local_deformable_modelCreateLocalDeformableModel or read_deformable_modelReadDeformableModel.

The model is searched within those points of the domain of the image in which the model lies completely within the image. This means that the model will not be found if it extends beyond the borders of the image, even if it would achieve a score greater than MinScoreminScoremin_score. Note that, if for a certain pyramid level the model touches the image border, it might not be found even if it lies completely within the original image. As a rule of thumb, the model might not be found if its distance to an image border falls below \(2^{NumLevels-1}\). This behavior can be changed with set_system('border_shape_models','true'), which will cause models that extend beyond the image border to be found if they achieve a score greater than MinScoreminScoremin_score. Here, points lying outside the image are regarded as being occluded, i.e., they lower the score. It should be noted that the runtime of the search will increase in this mode. Note further, that in rare cases, which occur typically only for artificial images, the model might not be found also if for certain pyramid levels them model touches the border of the reduced domain. Then, it may help to enlarge the reduced domain by \(2^{NumLevels-1}\) using, e.g., dilation_circleDilationCircle.

The operator find_local_deformable_modelFindLocalDeformableModel returns the Rowrowrow and Columncolumncolumn coordinates of the found instances. Additionally, a rectified part of the image, the respective vector field, and the contours of the found deformed model instance can be returned in ImageRectifiedimageRectifiedimage_rectified, VectorFieldvectorFieldvector_field, and DeformedContoursdeformedContoursdeformed_contours. By default, these iconic objects are not returned. In case they are needed the parameter ResultTyperesultTyperesult_type should be set to 'image_rectified'"image_rectified", 'vector_field'"vector_field" or 'deformed_contours'"deformed_contours". The size of ImageRectifiedimageRectifiedimage_rectified and VectorFieldvectorFieldvector_field is the smallest axis-aligned rectangle of the domain of the image that was used to create the local deformable model with create_local_deformable_modelCreateLocalDeformableModel. The size of the rectified image and the vector field can be expanded in all directions by setting GenParamNamegenParamNamegen_param_name to 'expand_border'"expand_border" and the respective GenParamValuegenParamValuegen_param_value to the number of pixels. Optionally, a specific direction can be selected with 'expand_border_top'"expand_border_top", 'expand_border_bottom'"expand_border_bottom", 'expand_border_left'"expand_border_left", or 'expand_border_right'"expand_border_right". Please note that the returned VectorFieldvectorFieldvector_field is in absolute coordinates and can be used for convert_map_typeConvertMapType.

The smoothness of the estimated deformation can be selected with GenParamNamegenParamNamegen_param_name set to 'deformation_smoothness'"deformation_smoothness". The value for 'deformation_smoothness'"deformation_smoothness" can be imagined as the size of a smoothing filter to the estimated deformation field. A too small value expects a strong deformation a too big value expects a rigid object. The minimal value for 'deformation_smoothness'"deformation_smoothness" is 33, a typical value is 1111, and the value can be increased further for only small global deformations.

Finally, the score of each found instance is returned in Scorescorescore. The score is a number between 0 and 1, which is an approximate measure of how much of the model is visible in the image.

For further explanation on the parameters used for the search of a local deformable model we refer to the description of find_planar_uncalib_deformable_modelFindPlanarUncalibDeformableModel.

Execution informationπŸ”—

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

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

  • Automatically parallelized on internal data level.

ParametersπŸ”—

Imageimageimage (input_object) (multichannel-)image β†’ object (byte / uint2)HObject (byte / uint2)HImage (byte / uint2)HObject (byte / uint2)Hobject (byte / uint2)

Input image in which the model should be found.

ImageRectifiedimageRectifiedimage_rectified (output_object) (multichannel-)image(-array) β†’ object (byte / uint2)HObject (byte / uint2)HImage (byte / uint2)HObject (byte / uint2)Hobject * (byte / uint2)

Rectified image of the found model.

VectorFieldvectorFieldvector_field (output_object) singlechannelimage(-array) β†’ object (vector_field)HObject (vector_field)HImage (vector_field)HObject (vector_field)Hobject * (vector_field)

Vector field of the rectification transformation.

DeformedContoursdeformedContoursdeformed_contours (output_object) xld_cont-array β†’ objectHObjectHXLDContHObjectHobject *

Contours of the found instances of the model.

ModelIDmodelIDmodel_id (input_control) deformable_model β†’ (handle)HTuple (HHandle)HDeformableModel, HTuple (IntPtr)HHandleHtuple (handle)

Handle of the model.

AngleStartangleStartangle_start (input_control) angle.rad β†’ (real)HTuple (double)HTuple (double)floatHtuple (double)

Smallest rotation of the model.

Default: -0.39-0.39
Suggested values: -3.14, -1.57, -0.79, -0.39, -0.20, 0.0-3.14, -1.57, -0.79, -0.39, -0.20, 0.0

AngleExtentangleExtentangle_extent (input_control) angle.rad β†’ (real)HTuple (double)HTuple (double)floatHtuple (double)

Extent of the rotation angles.

Default: 0.790.79
Suggested values: 6.29, 3.14, 1.57, 0.79, 0.39, 0.06.29, 3.14, 1.57, 0.79, 0.39, 0.0
Restriction: AngleExtent >= 0

ScaleRMinscaleRMinscale_rmin (input_control) number β†’ (real)HTuple (double)HTuple (double)floatHtuple (double)

Minimum scale of the model in row direction.

Default: 1.01.0
Suggested values: 0.5, 0.6, 0.7, 0.8, 0.9, 1.00.5, 0.6, 0.7, 0.8, 0.9, 1.0
Restriction: ScaleRMin > 0

ScaleRMaxscaleRMaxscale_rmax (input_control) number β†’ (real)HTuple (double)HTuple (double)floatHtuple (double)

Maximum scale of the model in row direction.

Default: 1.01.0
Suggested values: 1.0, 1.1, 1.2, 1.3, 1.4, 1.51.0, 1.1, 1.2, 1.3, 1.4, 1.5
Restriction: ScaleRMax >= ScaleRMin

ScaleCMinscaleCMinscale_cmin (input_control) number β†’ (real)HTuple (double)HTuple (double)floatHtuple (double)

Minimum scale of the model in column direction.

Default: 1.01.0
Suggested values: 0.5, 0.6, 0.7, 0.8, 0.9, 1.00.5, 0.6, 0.7, 0.8, 0.9, 1.0
Restriction: ScaleCMin > 0

ScaleCMaxscaleCMaxscale_cmax (input_control) number β†’ (real)HTuple (double)HTuple (double)floatHtuple (double)

Maximum scale of the model in column direction.

Default: 1.01.0
Suggested values: 1.0, 1.1, 1.2, 1.3, 1.4, 1.51.0, 1.1, 1.2, 1.3, 1.4, 1.5
Restriction: ScaleCMax >= ScaleCMin

MinScoreminScoremin_score (input_control) real β†’ (real)HTuple (double)HTuple (double)floatHtuple (double)

Minimum score of the instances of the model to be found.

Default: 0.50.5
Suggested values: 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.00.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0
Value range: 0 ≀ MinScore ≀ 1
Minimum increment: 0.01
Recommended increment: 0.05

NumMatchesnumMatchesnum_matches (input_control) integer β†’ (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Number of instances of the model to be found (or 0 for all matches).

Default: 11
Suggested values: 0, 1, 2, 3, 4, 5, 10, 200, 1, 2, 3, 4, 5, 10, 20

MaxOverlapmaxOverlapmax_overlap (input_control) real β†’ (real)HTuple (double)HTuple (double)floatHtuple (double)

Maximum overlap of the instances of the model to be found.

Default: 1.01.0
Suggested values: 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.00.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0
Value range: 0 ≀ MaxOverlap ≀ 1
Minimum increment: 0.01
Recommended increment: 0.05

NumLevelsnumLevelsnum_levels (input_control) integer β†’ (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Number of pyramid levels used in the matching.

Default: 00
List of values: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10

Greedinessgreedinessgreediness (input_control) real β†’ (real)HTuple (double)HTuple (double)floatHtuple (double)

β€œGreediness” of the search heuristic (0: safe but slow; 1: fast but matches may be missed).

Default: 0.90.9
Suggested values: 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.00.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0
Value range: 0 ≀ Greediness ≀ 1
Minimum increment: 0.01
Recommended increment: 0.05

ResultTyperesultTyperesult_type (input_control) string-array β†’ (string)HTuple (HString)HTuple (string)Sequence[str]Htuple (char*)

Switch for requested iconic result.

Default: [][]
List of values: [], 'deformed_contours', 'image_rectified', 'vector_field'[], "deformed_contours", "image_rectified", "vector_field"

GenParamNamegenParamNamegen_param_name (input_control) string-array β†’ (string)HTuple (HString)HTuple (string)Sequence[str]Htuple (char*)

The general parameter names.

Default: [][]
List of values: [], 'angle_step', 'deformation_smoothness', 'expand_border', 'expand_border_bottom', 'expand_border_left', 'expand_border_right', 'expand_border_top', 'scale_c_step', 'scale_r_step', 'subpixel'[], "angle_step", "deformation_smoothness", "expand_border", "expand_border_bottom", "expand_border_left", "expand_border_right", "expand_border_top", "scale_c_step", "scale_r_step", "subpixel"

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

Values of the general parameters.

Default: [][]
List of values: [], 'least_squares', 'least_squares_high', 'least_squares_very_high', 'none'[], "least_squares", "least_squares_high", "least_squares_very_high", "none"

Scorescorescore (output_control) real-array β†’ (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Scores of the found instances of the model.

Rowrowrow (output_control) real-array β†’ (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Row coordinates of the found instances of the model.

Columncolumncolumn (output_control) real-array β†’ (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Column coordinates of the found instances of the model.

ResultπŸ”—

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

Combinations with other operatorsπŸ”—

Combinations

Possible predecessors

create_local_deformable_modelCreateLocalDeformableModel, create_local_deformable_model_xldCreateLocalDeformableModelXld, read_deformable_modelReadDeformableModel

ModuleπŸ”—

Matching