Skip to content

find_ncc_modelsFindNccModelsFindNccModelsfind_ncc_modelsT_find_ncc_modelsπŸ”—

Short descriptionπŸ”—

find_ncc_modelsFindNccModelsFindNccModelsfind_ncc_modelsT_find_ncc_models β€” Find the best matches of multiple NCC models.

SignatureπŸ”—

find_ncc_models( image Image, ncc_model ModelIDs, angle.rad AngleStart, angle.rad AngleExtent, real MinScore, integer NumMatches, real MaxOverlap, string SubPixel, integer NumLevels, out point.y Row, out point.x Column, out angle.rad Angle, out real Score, out integer Model )void FindNccModels( const HObject& Image, const HTuple& ModelIDs, const HTuple& AngleStart, const HTuple& AngleExtent, const HTuple& MinScore, const HTuple& NumMatches, const HTuple& MaxOverlap, const HTuple& SubPixel, const HTuple& NumLevels, HTuple* Row, HTuple* Column, HTuple* Angle, HTuple* Score, HTuple* Model )static void HOperatorSet.FindNccModels( HObject image, HTuple modelIDs, HTuple angleStart, HTuple angleExtent, HTuple minScore, HTuple numMatches, HTuple maxOverlap, HTuple subPixel, HTuple numLevels, out HTuple row, out HTuple column, out HTuple angle, out HTuple score, out HTuple model )def find_ncc_models( image: HObject, model_ids: MaybeSequence[HHandle], angle_start: MaybeSequence[float], angle_extent: MaybeSequence[float], min_score: MaybeSequence[float], num_matches: MaybeSequence[int], max_overlap: MaybeSequence[float], sub_pixel: MaybeSequence[str], num_levels: MaybeSequence[int] ) -> Tuple[Sequence[float], Sequence[float], Sequence[float], Sequence[float], Sequence[int]]

Herror T_find_ncc_models( const Hobject Image, const Htuple ModelIDs, const Htuple AngleStart, const Htuple AngleExtent, const Htuple MinScore, const Htuple NumMatches, const Htuple MaxOverlap, const Htuple SubPixel, const Htuple NumLevels, Htuple* Row, Htuple* Column, Htuple* Angle, Htuple* Score, Htuple* Model )

static void HNCCModel::FindNccModels( const HImage& Image, const HNCCModelArray& ModelIDs, const HTuple& AngleStart, const HTuple& AngleExtent, const HTuple& MinScore, const HTuple& NumMatches, const HTuple& MaxOverlap, const HTuple& SubPixel, const HTuple& NumLevels, HTuple* Row, HTuple* Column, HTuple* Angle, HTuple* Score, HTuple* Model )

void HNCCModel::FindNccModels( const HImage& Image, double AngleStart, double AngleExtent, double MinScore, Hlong NumMatches, double MaxOverlap, const HString& SubPixel, Hlong NumLevels, HTuple* Row, HTuple* Column, HTuple* Angle, HTuple* Score, HTuple* Model ) const

void HNCCModel::FindNccModels( const HImage& Image, double AngleStart, double AngleExtent, double MinScore, Hlong NumMatches, double MaxOverlap, const char* SubPixel, Hlong NumLevels, HTuple* Row, HTuple* Column, HTuple* Angle, HTuple* Score, HTuple* Model ) const

void HNCCModel::FindNccModels( const HImage& Image, double AngleStart, double AngleExtent, double MinScore, Hlong NumMatches, double MaxOverlap, const wchar_t* SubPixel, Hlong NumLevels, HTuple* Row, HTuple* Column, HTuple* Angle, HTuple* Score, HTuple* Model ) const (Windows only)

void HImage::FindNccModels( const HNCCModelArray& ModelIDs, const HTuple& AngleStart, const HTuple& AngleExtent, const HTuple& MinScore, const HTuple& NumMatches, const HTuple& MaxOverlap, const HTuple& SubPixel, const HTuple& NumLevels, HTuple* Row, HTuple* Column, HTuple* Angle, HTuple* Score, HTuple* Model ) const

void HImage::FindNccModels( const HNCCModel& ModelIDs, double AngleStart, double AngleExtent, double MinScore, Hlong NumMatches, double MaxOverlap, const HString& SubPixel, Hlong NumLevels, HTuple* Row, HTuple* Column, HTuple* Angle, HTuple* Score, HTuple* Model ) const

void HImage::FindNccModels( const HNCCModel& ModelIDs, double AngleStart, double AngleExtent, double MinScore, Hlong NumMatches, double MaxOverlap, const char* SubPixel, Hlong NumLevels, HTuple* Row, HTuple* Column, HTuple* Angle, HTuple* Score, HTuple* Model ) const

void HImage::FindNccModels( const HNCCModel& ModelIDs, double AngleStart, double AngleExtent, double MinScore, Hlong NumMatches, double MaxOverlap, const wchar_t* SubPixel, Hlong NumLevels, HTuple* Row, HTuple* Column, HTuple* Angle, HTuple* Score, HTuple* Model ) const (Windows only)

static void HNCCModel.FindNccModels( HImage image, HNCCModel[] modelIDs, HTuple angleStart, HTuple angleExtent, HTuple minScore, HTuple numMatches, HTuple maxOverlap, HTuple subPixel, HTuple numLevels, out HTuple row, out HTuple column, out HTuple angle, out HTuple score, out HTuple model )

void HNCCModel.FindNccModels( HImage image, double angleStart, double angleExtent, double minScore, int numMatches, double maxOverlap, string subPixel, int numLevels, out HTuple row, out HTuple column, out HTuple angle, out HTuple score, out HTuple model )

void HImage.FindNccModels( HNCCModel[] modelIDs, HTuple angleStart, HTuple angleExtent, HTuple minScore, HTuple numMatches, HTuple maxOverlap, HTuple subPixel, HTuple numLevels, out HTuple row, out HTuple column, out HTuple angle, out HTuple score, out HTuple model )

void HImage.FindNccModels( HNCCModel modelIDs, double angleStart, double angleExtent, double minScore, int numMatches, double maxOverlap, string subPixel, int numLevels, out HTuple row, out HTuple column, out HTuple angle, out HTuple score, out HTuple model )

DescriptionπŸ”—

The operator find_ncc_modelsFindNccModels finds the best NumMatchesnumMatchesnum_matches instances of the NCC models that are passed in the tuple ModelIDsmodelIDsmodel_ids in the input Imageimageimage. The models must have been created previously by calling create_ncc_modelCreateNccModel or read_ncc_modelReadNccModel. In contrast to find_ncc_modelFindNccModel, multiple models can be searched in the same image in one call.

If NCC finds no suitable match or the matching scores are to low, the search should be performed using a different matching method (see, e.g., β€œSolution Guide II-B - Matching”).

Characteristics of the parameter semanticsπŸ”—

Compared to find_ncc_modelFindNccModel, the semantics of all input parameters have changed to some extent. All input parameters must either contain one element, in which case the parameter is used for all models, or they must contain the same number of elements as ModelIDsmodelIDsmodel_ids, in which case each parameter element refers to the corresponding element in ModelIDsmodelIDsmodel_ids. (NumLevelsnumLevelsnum_levels may also contain either two or twice the number of elements as ModelIDsmodelIDsmodel_ids). More details can be found below in the sections containing information for the respective parameters. Note that a call to find_ncc_modelsFindNccModels with multiple values for ModelIDsmodelIDsmodel_ids, NumMatchesnumMatchesnum_matches and MaxOverlapmaxOverlapmax_overlap has the same effect as multiple independent calls to find_ncc_modelFindNccModel with the respective parameters. However, a single call to find_ncc_modelsFindNccModels is considerably more efficient.

Input parameters in detailπŸ”—

Output parameters in detailπŸ”—

Specifying a timeoutπŸ”—

Using the operator set_ncc_model_paramSetNccModelParam you can specify a 'timeout'"timeout" for find_ncc_modelsFindNccModels. If the NCC models referenced by ModelIDsmodelIDsmodel_ids hold different values for 'timeout'"timeout", find_ncc_modelsFindNccModels uses the smallest one. If find_ncc_modelsFindNccModels reaches this 'timeout'"timeout", it terminates without results and returns the error code 9400 (H_ERR_TIMEOUT).

Visualization of the resultsπŸ”—

To display the results found by correlation-based matching, we highly recommend the usage of the procedure dev_display_ncc_matching_results.

Further InformationπŸ”—

For an explanation of the different 2D coordinate systems used in HALCON, see the introduction of chapter Transformations / 2D Transformations.

AttentionπŸ”—

Note that the internally used memory increases with the number of used threads.

Execution informationπŸ”—

Execution information
  • Supports OpenCL compute devices.

  • 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(-array) β†’ object (byte* / uint2*)HObject (byte* / uint2*)HImage (byte* / uint2*)HObject (byte* / uint2*)Hobject (byte* / uint2*) *allowed for compute devices

Input image in which the model should be found.

ModelIDsmodelIDsmodel_ids (input_control) ncc_model(-array) β†’ (handle)HTuple (HHandle)HNCCModel, HTuple (IntPtr)MaybeSequence[HHandle]Htuple (handle)

Handle of the models.

AngleStartangleStartangle_start (input_control) angle.rad(-array) β†’ (real)HTuple (double)HTuple (double)MaybeSequence[float]Htuple (double)

Smallest rotation of the models.

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(-array) β†’ (real)HTuple (double)HTuple (double)MaybeSequence[float]Htuple (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

MinScoreminScoremin_score (input_control) real(-array) β†’ (real)HTuple (double)HTuple (double)MaybeSequence[float]Htuple (double)

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

Default: 0.80.8
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(-array) β†’ (integer)HTuple (Hlong)HTuple (int / long)MaybeSequence[int]Htuple (Hlong)

Number of instances of the models 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(-array) β†’ (real)HTuple (double)HTuple (double)MaybeSequence[float]Htuple (double)

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

Default: 0.50.5
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

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

Subpixel accuracy if not equal to 'none'"none".

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

NumLevelsnumLevelsnum_levels (input_control) integer(-array) β†’ (integer)HTuple (Hlong)HTuple (int / long)MaybeSequence[int]Htuple (Hlong)

Number of pyramid levels used in the matching (and lowest pyramid level to use if \(|\textrm{NumLevels}| = 2\)).

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

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

Row coordinate of the found instances of the models.

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

Column coordinate of the found instances of the models.

Angleangleangle (output_control) angle.rad-array β†’ (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Rotation angle of the found instances of the models.

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

Score of the found instances of the models.

Modelmodelmodel (output_control) integer-array β†’ (integer)HTuple (Hlong)HTuple (int / long)Sequence[int]Htuple (Hlong)

Index of the found instances of the models.

ExampleπŸ”—

(HDevelop)

read_image (Image, 'pcb_focus/pcb_focus_telecentric_061')
gen_rectangle1 (ROI_0, 236, 241, 313, 321)
gen_circle (ROI_1, 281, 653, 41)
reduce_domain (Image, ROI_0, ImageReduced1)
reduce_domain (Image, ROI_1, ImageReduced2)
create_ncc_model (ImageReduced1, 'auto', rad(-45), rad(90), 'auto', \
                  'use_polarity', ModelID1)
create_ncc_model (ImageReduced2, 'auto', rad(-45), rad(90), 'auto', \
                  'use_polarity', ModelID2)
ModelIDs:=[ModelID1, ModelID2]
find_ncc_models (Image, ModelIDs, rad(-45), rad(90), 0.7, [1,1], 0.5, \
                 'true', 0, Row, Column, Angle, Score, Model)
dev_display_ncc_matching_results (ModelIDs, 'red', Row, Column, \
                                  Angle, Model)

ResultπŸ”—

If the parameter values are correct, the operator find_ncc_modelsFindNccModels returns the value 2 (H_MSG_TRUE). If the input is empty (no input images are available) the behavior can be set via set_system('no_object_result',<Result>). If necessary, an exception is raised.

Combinations with other operatorsπŸ”—

Combinations

Possible predecessors

create_ncc_modelCreateNccModel, read_ncc_modelReadNccModel, set_ncc_model_originSetNccModelOrigin

Possible successors

clear_ncc_modelClearNccModel

Alternatives

find_generic_shape_modelFindGenericShapeModel

ModuleπŸ”—

Matching