HALCON Reference Manual 10.0.2
Table of Contents / Matching / Descriptor-Based ClassesClassesClasses | | | Operators

find_uncalib_descriptor_modelT_find_uncalib_descriptor_modelfind_uncalib_descriptor_modelFindUncalibDescriptorModelFindUncalibDescriptorModel (Operator)

Name

find_uncalib_descriptor_modelT_find_uncalib_descriptor_modelfind_uncalib_descriptor_modelFindUncalibDescriptorModelFindUncalibDescriptorModel — Find the best matches of a descriptor model in an image.

Signature

find_uncalib_descriptor_model(Image : : ModelID, DetectorParamName, DetectorParamValue, DescriptorParamName, DescriptorParamValue, MinScore, NumMatches, ScoreType : HomMat2D, Score)

Herror T_find_uncalib_descriptor_model(const Hobject Image, const Htuple ModelID, const Htuple DetectorParamName, const Htuple DetectorParamValue, const Htuple DescriptorParamName, const Htuple DescriptorParamValue, const Htuple MinScore, const Htuple NumMatches, const Htuple ScoreType, Htuple* HomMat2D, Htuple* Score)

Herror find_uncalib_descriptor_model(Hobject Image, const HTuple& ModelID, const HTuple& DetectorParamName, const HTuple& DetectorParamValue, const HTuple& DescriptorParamName, const HTuple& DescriptorParamValue, const HTuple& MinScore, const HTuple& NumMatches, const HTuple& ScoreType, HTuple* HomMat2D, HTuple* Score)

HTuple HImage::FindUncalibDescriptorModel(const HDescriptorModel& ModelID, const HTuple& DetectorParamName, const HTuple& DetectorParamValue, const HTuple& DescriptorParamName, const HTuple& DescriptorParamValue, const HTuple& MinScore, const HTuple& NumMatches, const HTuple& ScoreType, HTuple* Score) const

HTuple HDescriptorModel::FindUncalibDescriptorModel(const HImage& Image, const HTuple& DetectorParamName, const HTuple& DetectorParamValue, const HTuple& DescriptorParamName, const HTuple& DescriptorParamValue, const HTuple& MinScore, const HTuple& NumMatches, const HTuple& ScoreType, HTuple* Score) const

void HOperatorSetX.FindUncalibDescriptorModel(
[in] IHUntypedObjectX* Image, [in] VARIANT ModelID, [in] VARIANT DetectorParamName, [in] VARIANT DetectorParamValue, [in] VARIANT DescriptorParamName, [in] VARIANT DescriptorParamValue, [in] VARIANT MinScore, [in] VARIANT NumMatches, [in] VARIANT ScoreType, [out] VARIANT* HomMat2d, [out] VARIANT* Score)

IHHomMat2DX* HDescriptorModelX.FindUncalibDescriptorModel(
[in] IHImageX* Image, [in] VARIANT DetectorParamName, [in] VARIANT DetectorParamValue, [in] VARIANT DescriptorParamName, [in] VARIANT DescriptorParamValue, [in] VARIANT MinScore, [in] Hlong NumMatches, [in] VARIANT ScoreType, [out] VARIANT* Score)

IHHomMat2DX* HImageX.FindUncalibDescriptorModel(
[in] IHDescriptorModelX* ModelID, [in] VARIANT DetectorParamName, [in] VARIANT DetectorParamValue, [in] VARIANT DescriptorParamName, [in] VARIANT DescriptorParamValue, [in] VARIANT MinScore, [in] Hlong NumMatches, [in] VARIANT ScoreType, [out] VARIANT* Score)

static void HOperatorSet.FindUncalibDescriptorModel(HObject image, HTuple modelID, HTuple detectorParamName, HTuple detectorParamValue, HTuple descriptorParamName, HTuple descriptorParamValue, HTuple minScore, HTuple numMatches, HTuple scoreType, out HTuple homMat2D, out HTuple score)

HHomMat2D HDescriptorModel.FindUncalibDescriptorModel(HImage image, HTuple detectorParamName, HTuple detectorParamValue, HTuple descriptorParamName, HTuple descriptorParamValue, HTuple minScore, int numMatches, HTuple scoreType, out HTuple score)

HHomMat2D HDescriptorModel.FindUncalibDescriptorModel(HImage image, HTuple detectorParamName, HTuple detectorParamValue, HTuple descriptorParamName, HTuple descriptorParamValue, double minScore, int numMatches, string scoreType, out double score)

HHomMat2D HImage.FindUncalibDescriptorModel(HDescriptorModel modelID, HTuple detectorParamName, HTuple detectorParamValue, HTuple descriptorParamName, HTuple descriptorParamValue, HTuple minScore, int numMatches, HTuple scoreType, out HTuple score)

HHomMat2D HImage.FindUncalibDescriptorModel(HDescriptorModel modelID, HTuple detectorParamName, HTuple detectorParamValue, HTuple descriptorParamName, HTuple descriptorParamValue, double minScore, int numMatches, string scoreType, out double score)

Description

The operator find_uncalib_descriptor_modelfind_uncalib_descriptor_modelfind_uncalib_descriptor_modelFindUncalibDescriptorModelFindUncalibDescriptorModel finds the best matches of a descriptor model ModelIDModelIDModelIDModelIDmodelID in ImageImageImageImageimage. The descriptor model must have been created previously by calling create_uncalib_descriptor_modelcreate_uncalib_descriptor_modelcreate_uncalib_descriptor_modelCreateUncalibDescriptorModelCreateUncalibDescriptorModel, create_calib_descriptor_modelcreate_calib_descriptor_modelcreate_calib_descriptor_modelCreateCalibDescriptorModelCreateCalibDescriptorModel or read_descriptor_modelread_descriptor_modelread_descriptor_modelReadDescriptorModelReadDescriptorModel.

A match is only accepted if its score surpasses the value of MinScoreMinScoreMinScoreMinScoreminScore. Currently this criteria is based on the 'inlier_ratio' score that is described in details below. The main result of the operator find_uncalib_descriptor_modelfind_uncalib_descriptor_modelfind_uncalib_descriptor_modelFindUncalibDescriptorModelFindUncalibDescriptorModel for each match is a 3x3 matrix HomMat2DHomMat2DHomMat2DHomMat2DhomMat2D, which describes a 2D projection of model points to search image points and is represented by a tuple of 9 elements in row-major order. If more matches of the searched object (template) appear and pass the MinScoreMinScoreMinScoreMinScoreminScore criteria the resulting multiple homographies are concatenated. The number of objects actually found is then equal to NumObjects = |HomMat2DHomMat2DHomMat2DHomMat2DhomMat2D|/9.

The detection process is divided into three parts. First, interest points are extracted from a search image with the help of a point detector. This is done using the detector and its parameters selected once during the generation of the model. However, DetectorParamNameDetectorParamNameDetectorParamNameDetectorParamNamedetectorParamName and DetectorParamValueDetectorParamValueDetectorParamValueDetectorParamValuedetectorParamValue can be used to specify different detector parameter values during the find_uncalib_descriptor_modelfind_uncalib_descriptor_modelfind_uncalib_descriptor_modelFindUncalibDescriptorModelFindUncalibDescriptorModel call. By changing these parameters, it is possible to adjust to illumination changes between the model generation and the online detection. However, it is recommended to use the same values used to create the model (pass an empty tuple).

The second step of the detection process is to calculate correspondences between the model points and the points that were detected. The run time parameters of the descriptor can be adjusted with DescriptorParamNameDescriptorParamNameDescriptorParamNameDescriptorParamNamedescriptorParamName and DescriptorParamValueDescriptorParamValueDescriptorParamValueDescriptorParamValuedescriptorParamValue:

'min_score_descr'"min_score_descr""min_score_descr""min_score_descr""min_score_descr":

is the minimal classifier score for an interest point to be regarded as a potential match. The score function is between 0.0 and 1.0, but typically only values between 0.0 and 0.1 make sense. Increasing 'min_score_descr'"min_score_descr""min_score_descr""min_score_descr""min_score_descr" can increase significantly the detection speed. Note, however, that using 'min_score_descr'"min_score_descr""min_score_descr""min_score_descr""min_score_descr" might have negative effect on the robustness of the detection process, especially when only few points can be found. Typical values are [0.0 .. 0.1], default value is 0.0.

'guided_matching'"guided_matching""guided_matching""guided_matching""guided_matching":

enhances the accuracy of the object recognition when switched on. Note that it increases the computational costs up to 10% in some cases. Possible values are ['on'"on""on""on""on", 'off'"off""off""off""off"], default value is 'on'"on""on""on""on".

The last step is the estimation of a homography that describes the point correspondences. The homography is a 2D projection, which describes a transformation from model points to points in ImageImageImageImageimage. Here, Natural 3D Markers (N3Ms) are utilized to identify robustly the point corresondences (see references).

Additionally to the estimated homography in HomMat2DHomMat2DHomMat2DHomMat2DhomMat2D, the operator returns one or more ScoreScoreScoreScorescore estimations per object instance as specified by the user in a tuple ScoreTypeScoreTypeScoreTypeScoreTypescoreType. Currently the following values for ScoreTypeScoreTypeScoreTypeScoreTypescoreType are supported:

'num_points'"num_points""num_points""num_points""num_points":

number of point correspondences per instance. An object instance should be considered good, if it has 10 or more point correspondences with the model. Fewer points are insufficient, because any random 4 point correspondences define a mathematically correct homography between two images.

'inlier_ratio'"inlier_ratio""inlier_ratio""inlier_ratio""inlier_ratio":

the ratio of the number of point correspondences to the number of model points. Although this value can have values of [0.0 .. 1.0], it is rather unlikely that this ratio can reach 1.0. Yet, objects having inlier ratio less than 0.1, should be disregarded.

Note that the resulting scores for more than one object instance will be concatenated in ScoreScoreScoreScorescore, such that |ScoreScoreScoreScorescore| = NumObjects*|ScoreTypeScoreTypeScoreTypeScoreTypescoreType|.

The point correspondences for each object can be queried with get_descriptor_model_pointsget_descriptor_model_pointsget_descriptor_model_pointsGetDescriptorModelPointsGetDescriptorModelPoints.

Attention

A descriptor model 'ModelID'"ModelID""ModelID""ModelID""ModelID" cannot be shared between two or more user's threads. Different descriptor models can be used independently and safely in different threads.

Parallelization

Parameters

ImageImageImageImageimage (input_object)  singlechannelimage objectHImageHImageHImageXHobject (byte / uint2)

Input image where the model should be found.

ModelIDModelIDModelIDModelIDmodelID (input_control)  descriptor_model HDescriptorModel, HTupleHDescriptorModel, HTupleHDescriptorModelX, VARIANTHtuple (integer) (IntPtr) (Hlong) (Hlong) (Hlong)

The handle to the descriptor model.

DetectorParamNameDetectorParamNameDetectorParamNameDetectorParamNamedetectorParamName (input_control)  attribute.name-array HTupleHTupleVARIANTHtuple (string) (string) (char*) (BSTR) (char*)

The detector's parameter names.

Default value: []

List of values: 'alpha'"alpha""alpha""alpha""alpha", 'check_neighbor'"check_neighbor""check_neighbor""check_neighbor""check_neighbor", 'mask_size_grd'"mask_size_grd""mask_size_grd""mask_size_grd""mask_size_grd", 'mask_size_smooth'"mask_size_smooth""mask_size_smooth""mask_size_smooth""mask_size_smooth", 'min_check_neighbor_diff'"min_check_neighbor_diff""min_check_neighbor_diff""min_check_neighbor_diff""min_check_neighbor_diff", 'min_score'"min_score""min_score""min_score""min_score", 'radius'"radius""radius""radius""radius", 'sigma_grad'"sigma_grad""sigma_grad""sigma_grad""sigma_grad", 'sigma_smooth'"sigma_smooth""sigma_smooth""sigma_smooth""sigma_smooth", 'subpix'"subpix""subpix""subpix""subpix", 'threshold'"threshold""threshold""threshold""threshold"

DetectorParamValueDetectorParamValueDetectorParamValueDetectorParamValuedetectorParamValue (input_control)  attribute.value-array HTupleHTupleVARIANTHtuple (integer / real / string) (int / long / double / string) (Hlong / double / char*) (Hlong / double / BSTR) (Hlong / double / char*)

Values of the detector's parameters.

Default value: []

Suggested values: 0.08, 1, 1.2, 3, 15, 30, 1000, 'on'"on""on""on""on", 'off'"off""off""off""off"

DescriptorParamNameDescriptorParamNameDescriptorParamNameDescriptorParamNamedescriptorParamName (input_control)  attribute.name-array HTupleHTupleVARIANTHtuple (string) (string) (char*) (BSTR) (char*)

The descriptor's parameter names.

Default value: []

List of values: 'min_score_descr'"min_score_descr""min_score_descr""min_score_descr""min_score_descr", 'guided_matching'"guided_matching""guided_matching""guided_matching""guided_matching"

DescriptorParamValueDescriptorParamValueDescriptorParamValueDescriptorParamValuedescriptorParamValue (input_control)  attribute.value-array HTupleHTupleVARIANTHtuple (real / integer / string) (double / int / long / string) (double / Hlong / char*) (double / Hlong / BSTR) (double / Hlong / char*)

Values of the descriptor's parameters.

Default value: []

Suggested values: 0.0, 0.001, 0.005, 0.01, 'on'"on""on""on""on", 'off'"off""off""off""off"

MinScoreMinScoreMinScoreMinScoreminScore (input_control)  real(-array) HTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double)

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

Default value: 0.2

Suggested values: 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0

Typical range of values: 0 ≤ MinScore MinScore MinScore MinScore minScore ≤ 1

NumMatchesNumMatchesNumMatchesNumMatchesnumMatches (input_control)  integer HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

Maximal number of found instances.

Default value: 1

Suggested values: 1, 2, 3, 4

Restriction: NumMatches >= 1

ScoreTypeScoreTypeScoreTypeScoreTypescoreType (input_control)  string(-array) HTupleHTupleVARIANTHtuple (string) (string) (char*) (BSTR) (char*)

Score type to be evaluated in ScoreScoreScoreScorescore.

Default value: 'num_points' "num_points" "num_points" "num_points" "num_points"

List of values: 'num_points'"num_points""num_points""num_points""num_points", 'inlier_ratio'"inlier_ratio""inlier_ratio""inlier_ratio""inlier_ratio"

HomMat2DHomMat2DHomMat2DHomMat2DhomMat2D (output_control)  hom_mat2d-array HHomMat2D, HTupleHTupleHHomMat2DX, VARIANTHtuple (real) (double) (double) (double) (double)

Homography between model and found instance.

ScoreScoreScoreScorescore (output_control)  number(-array) HTupleHTupleVARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong)

Score of the found instances according to the ScoreType input.

Example (HDevelop)

create_uncalib_descriptor_model (ImageReduced,'harris',[],[], \
                                 [],[],42,ModelID)

get_descriptor_model_params (ModelID,DetectorType, \
                             DetectorParamName,DetectorParamValue, \
                             DescriptorParamName,DescriptorParamValue)
write_descriptor_model (ModelID,'simple_example.dsm')
clear_descriptor_model (ModelID)

read_descriptor_model ('simple_example.dsm',ModelID)
find_uncalib_descriptor_model (SearchImage,ModelID,[],[],[],[],0.2,1, \
                               ['num_points','inlier_ratio'],HomMat2D,Score)
clear_descriptor_model (ModelID)

Possible Predecessors

create_uncalib_descriptor_modelcreate_uncalib_descriptor_modelcreate_uncalib_descriptor_modelCreateUncalibDescriptorModelCreateUncalibDescriptorModel, create_calib_descriptor_modelcreate_calib_descriptor_modelcreate_calib_descriptor_modelCreateCalibDescriptorModelCreateCalibDescriptorModel, read_descriptor_modelread_descriptor_modelread_descriptor_modelReadDescriptorModelReadDescriptorModel

See also

create_uncalib_descriptor_modelcreate_uncalib_descriptor_modelcreate_uncalib_descriptor_modelCreateUncalibDescriptorModelCreateUncalibDescriptorModel, create_calib_descriptor_modelcreate_calib_descriptor_modelcreate_calib_descriptor_modelCreateCalibDescriptorModelCreateCalibDescriptorModel, find_calib_descriptor_modelfind_calib_descriptor_modelfind_calib_descriptor_modelFindCalibDescriptorModelFindCalibDescriptorModel, get_descriptor_model_pointsget_descriptor_model_pointsget_descriptor_model_pointsGetDescriptorModelPointsGetDescriptorModelPoints

References

S. Hinterstoisser, S. Benhimane, and N. Navab: “N3M: Natural 3D Markers for Real-Time Object Detection and Pose Estimation.“ IEEE 11th International Conference on Computer Vision, 2007. pp. 1-7, ICCV 2007.

Module

Matching


Table of Contents / Matching / Descriptor-Based ClassesClassesClasses | | | Operators
HALCON Reference Manual 10.0.2 Copyright © 1996-2011 MVTec Software GmbH