get_found_component_model ( : FoundComponents : ComponentModelID, ModelStart, ModelEnd, RowComp, ColumnComp, AngleComp, ScoreComp, ModelComp, ModelMatch, MarkOrientation : RowCompInst, ColumnCompInst, AngleCompInst, ScoreCompInst )

Return the components of a found instance of a component model.

get_found_component_model returns the components of a found instance of the component model ComponentModelID in form of contour regions in FoundComponents as well as in numerical form.

The operator get_found_component_model is particularly useful in order to visualize the matches that have been obtained by find_component_model.

The pose of the returned components corresponds to their pose in the search image as returned by find_component_model. Hence, the parameters ModelStart, ModelEnd, RowComp, ColumnComp, AngleComp, ScoreComp, and ModelComp must be passed to get_found_component_model as they have been returned by find_component_model. In ModelMatch the index of the found instance of the component model must be passed. Consequently, ModelMatch must lie within the range between 0 and m-1, where m is the number of elements in ModelStart and ModelEnd, and hence corresponds to the number of found model instances. For example, if the best match should be retuned, ModelMatch should be set to 0.

When dealing with rotationally symmetric components, one may wish to mark the current orientation of the found component. This can be achieved by setting MarkOrientation to 'true'. In this case, the contour region of each component is complemented by an arrow at its reference point that points in the reference direction. The reference direction of a component is based on the orientation of the component in the model image (see train_model_components or create_component_model) and is represented by an arrow that starts at the reference point and points to the right in the horizontal direction.

For convenience, the pose parameters as well as the score of each component of the found model instance are additionally returned in numerical form in RowCompInst, ColumnCompInst, AngleCompInst, and ScoreCompInst. The four tuples are always of length n, where n is the number of components in the component model ComponentModelID. If a component could not be found during the search, an empty region is passed in the corresponding element of FoundComponents and the value of the corresponding element in RowCompInst, ColumnCompInst, AngleCompInst, and ScoreCompInst is set to 0.


Parameters

FoundComponents (output_object)
region-array -> object
Found components of the selected component model instance.

ComponentModelID (input_control)
component_model -> integer
Handle of the component model.

ModelStart (input_control)
integer(-array) -> integer
Start index of each found instance of the component model in the tuples describing the component matches.

ModelEnd (input_control)
integer(-array) -> integer
End index of each found instance of the component model to the tuples describing the component matches.

RowComp (input_control)
point.y(-array) -> real
Row coordinate of the found component matches.

ColumnComp (input_control)
point.x(-array) -> real
Column coordinate of the found component matches.

AngleComp (input_control)
angle.rad(-array) -> real
Rotation angle of the found component matches.

ScoreComp (input_control)
real(-array) -> real
Score of the found component matches.

ModelComp (input_control)
integer(-array) -> integer
Index of the found components.

ModelMatch (input_control)
integer -> integer
Index of the found instance of the component model to be returned.

MarkOrientation (input_control)
string -> string
Mark the orientation of the components.
Default value: 'false'
List of values: 'true', 'false'

RowCompInst (output_control)
point.y(-array) -> real
Row coordinate of all components of the selected model instance.

ColumnCompInst (output_control)
point.x(-array) -> real
Column coordinate of all components of the selected model instance.

AngleCompInst (output_control)
angle.rad(-array) -> real
Rotation angle of all components of the selected model instance.

ScoreCompInst (output_control)
real(-array) -> real
Score of all components of the selected model instance.


Example
* Read a component model from file.
read_component_model ('pliers.cpm', ComponentModelID)
* Find the component model in a run-time image.
read_image (SearchImage, 'search_image.tif')
find_component_model (SearchImage, ComponentModelID, RootRanking, 0,
                      rad(360), 0.5, 0, 0.5, 'stop_search', 'prune_branch',
                      'none', 0.8, 'least_squares', 0, 0.8, ModelStart,
                      ModelEnd, Score, RowComp, ColumnComp, AngleComp,
                      ScoreComp, ModelComp)
* Visualize the found instances.
for i := 0 to |ModelStart|-1 by 1
    get_found_component_model (FoundComponents, ComponentModelID,
                               ModelStart, ModelEnd, RowComp, ColumnComp,
                               AngleComp, ScoreComp, ModelComp, i, 'false',
                               RowCompInst, ColumnCompInst, AngleCompInst,
                               ScoreCompInst)
    dev_display (FoundComponents)
endfor

Result

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


Parallelization Information

get_found_component_model is reentrant and processed without parallelization.


Possible Predecessors

find_component_model


See also

train_model_components, create_component_model


Module

Matching



Copyright © 1996-2008 MVTec Software GmbH