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

find_calib_descriptor_modelT_find_calib_descriptor_modelfind_calib_descriptor_modelFindCalibDescriptorModelFindCalibDescriptorModel (Operator)

Name

find_calib_descriptor_modelT_find_calib_descriptor_modelfind_calib_descriptor_modelFindCalibDescriptorModelFindCalibDescriptorModel — Find the best matches of a calibrated descriptor model in an image and return their 3D pose.

Signature

find_calib_descriptor_model(Image : : ModelID, DetectorParamName, DetectorParamValue, DescriptorParamName, DescriptorParamValue, MinScore, NumMatches, CamParam, ScoreType : Pose, Score)

Herror T_find_calib_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 CamParam, const Htuple ScoreType, Htuple* Pose, Htuple* Score)

Herror find_calib_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& CamParam, const HTuple& ScoreType, HTuple* Pose, HTuple* Score)

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

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

void HOperatorSetX.FindCalibDescriptorModel(
[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 CamParam, [in] VARIANT ScoreType, [out] VARIANT* Pose, [out] VARIANT* Score)

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

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

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

HPose HDescriptorModel.FindCalibDescriptorModel(HImage image, HTuple detectorParamName, HTuple detectorParamValue, HTuple descriptorParamName, HTuple descriptorParamValue, HTuple minScore, int numMatches, HTuple camParam, HTuple scoreType, out HTuple score)

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

HPose HImage.FindCalibDescriptorModel(HDescriptorModel modelID, HTuple detectorParamName, HTuple detectorParamValue, HTuple descriptorParamName, HTuple descriptorParamValue, HTuple minScore, int numMatches, HTuple camParam, HTuple scoreType, out HTuple score)

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

Description

The operator find_calib_descriptor_modelfind_calib_descriptor_modelfind_calib_descriptor_modelFindCalibDescriptorModelFindCalibDescriptorModel finds the best NumMatchesNumMatchesNumMatchesNumMatchesnumMatches matches of the descriptor model ModelIDModelIDModelIDModelIDmodelID in ImageImageImageImageimage. The descriptor model must have been created previously by calling create_calib_descriptor_modelcreate_calib_descriptor_modelcreate_calib_descriptor_modelCreateCalibDescriptorModelCreateCalibDescriptorModel or read_descriptor_modelread_descriptor_modelread_descriptor_modelReadDescriptorModelReadDescriptorModel.

The operator returns the 3D PosePosePosePosepose (in camera coordinate system) of the template object found in the search ImageImageImageImageimage. As two different cameras can be used for the model generation and the online search, the camera parameters of the camera used to create ImageImageImageImageimage have to be set in CamParamCamParamCamParamCamParamcamParam.

The detection process is the same as for find_uncalib_descriptor_modelfind_uncalib_descriptor_modelfind_uncalib_descriptor_modelFindUncalibDescriptorModelFindUncalibDescriptorModel. The setting of DetectorParamNameDetectorParamNameDetectorParamNameDetectorParamNamedetectorParamName, DetectorParamValueDetectorParamValueDetectorParamValueDetectorParamValuedetectorParamValue, DescriptorParamNameDescriptorParamNameDescriptorParamNameDescriptorParamNamedescriptorParamName, DescriptorParamValueDescriptorParamValueDescriptorParamValueDescriptorParamValuedescriptorParamValue, MinScoreMinScoreMinScoreMinScoreminScore, NumMatchesNumMatchesNumMatchesNumMatchesnumMatches and ScoreTypeScoreTypeScoreTypeScoreTypescoreType are explained with find_uncalib_descriptor_modelfind_uncalib_descriptor_modelfind_uncalib_descriptor_modelFindUncalibDescriptorModelFindUncalibDescriptorModel. After the object was detected, and using the world (from reference plane) coordinates of the matched model points (explained with create_calib_descriptor_modelcreate_calib_descriptor_modelcreate_calib_descriptor_modelCreateCalibDescriptorModelCreateCalibDescriptorModel), the pose of the object is computed similarly to applying vector_to_posevector_to_posevector_to_poseVectorToPoseVectorToPose operator.

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

CamParamCamParamCamParamCamParamcamParam (input_control)  number-array HTupleHTupleVARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong)

Camera parameter (inner orientation) obtained from camera calibration.

Number of elements: (CamParam == 8) || (CamParam == 12)

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"

PosePosePosePosepose (output_control)  pose-array HPose, HTupleHTupleHPoseX, VARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong)

3D pose of the object.

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)

* Determination of a reference pose:
* Two images of the object are needed: One shows the object (Image)
* and the other one shows the object with a calibration table put
* onto it (ImageCal)

find_caltab (ImageCal,Caltab,CaltabName,SizeGauss,MarkThresh,MinDiamMarks)
find_marks_and_pose (ImageCal,Caltab,CaltabName,CamParam,StartThresh, \
                     DeltaThresh,MinThresh,Alpha,MinContLength, \
                     MaxDiamMarks,RCoord,CCoord, \
                     InitialPoseForCalibrationPlate)
caltab_points (CaltabName,X,Y,Z)
camera_calibration (X,Y,Z,RCoord,CCoord,CamParam, \
                    InitialPoseForCalibrationPlate,'pose', \
                    CamParamUnchanged,PoseReference,Errors)

* The thickness of the calibration table itself (0.75 mm) has to be
* reduced:
set_origin_pose (PoseReference,0,0,0.00075,PoseReference)

* Create descriptor model:
create_calib_descriptor_model (Image,CamParam,PoseReference, \
                               '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_calib_descriptor_model (SearchImage,ModelID,[],[],[],[],0.2,1, \
                             CamParam,['num_points','inlier_ratio'], \
                             Pose,Score)
clear_descriptor_model (ModelID)

Possible Predecessors

create_calib_descriptor_modelcreate_calib_descriptor_modelcreate_calib_descriptor_modelCreateCalibDescriptorModelCreateCalibDescriptorModel, read_descriptor_modelread_descriptor_modelread_descriptor_modelReadDescriptorModelReadDescriptorModel

See also

vector_to_posevector_to_posevector_to_poseVectorToPoseVectorToPose, points_lepetitpoints_lepetitpoints_lepetitPointsLepetitPointsLepetit, create_calib_descriptor_modelcreate_calib_descriptor_modelcreate_calib_descriptor_modelCreateCalibDescriptorModelCreateCalibDescriptorModel

Module

Matching


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