ClassesClasses | | Operators

get_found_component_modelT_get_found_component_modelGetFoundComponentModelGetFoundComponentModel (Operator)

Name

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

Signature

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

Herror T_get_found_component_model(Hobject* FoundComponents, const Htuple ComponentModelID, const Htuple ModelStart, const Htuple ModelEnd, const Htuple RowComp, const Htuple ColumnComp, const Htuple AngleComp, const Htuple ScoreComp, const Htuple ModelComp, const Htuple ModelMatch, const Htuple MarkOrientation, Htuple* RowCompInst, Htuple* ColumnCompInst, Htuple* AngleCompInst, Htuple* ScoreCompInst)

void GetFoundComponentModel(HObject* FoundComponents, const HTuple& ComponentModelID, const HTuple& ModelStart, const HTuple& ModelEnd, const HTuple& RowComp, const HTuple& ColumnComp, const HTuple& AngleComp, const HTuple& ScoreComp, const HTuple& ModelComp, const HTuple& ModelMatch, const HTuple& MarkOrientation, HTuple* RowCompInst, HTuple* ColumnCompInst, HTuple* AngleCompInst, HTuple* ScoreCompInst)

HRegion HComponentModel::GetFoundComponentModel(const HTuple& ModelStart, const HTuple& ModelEnd, const HTuple& RowComp, const HTuple& ColumnComp, const HTuple& AngleComp, const HTuple& ScoreComp, const HTuple& ModelComp, Hlong ModelMatch, const HString& MarkOrientation, HTuple* RowCompInst, HTuple* ColumnCompInst, HTuple* AngleCompInst, HTuple* ScoreCompInst) const

HRegion HComponentModel::GetFoundComponentModel(Hlong ModelStart, Hlong ModelEnd, double RowComp, double ColumnComp, double AngleComp, double ScoreComp, Hlong ModelComp, Hlong ModelMatch, const HString& MarkOrientation, double* RowCompInst, double* ColumnCompInst, double* AngleCompInst, double* ScoreCompInst) const

HRegion HComponentModel::GetFoundComponentModel(Hlong ModelStart, Hlong ModelEnd, double RowComp, double ColumnComp, double AngleComp, double ScoreComp, Hlong ModelComp, Hlong ModelMatch, const char* MarkOrientation, double* RowCompInst, double* ColumnCompInst, double* AngleCompInst, double* ScoreCompInst) const

static void HOperatorSet.GetFoundComponentModel(out HObject foundComponents, HTuple componentModelID, HTuple modelStart, HTuple modelEnd, HTuple rowComp, HTuple columnComp, HTuple angleComp, HTuple scoreComp, HTuple modelComp, HTuple modelMatch, HTuple markOrientation, out HTuple rowCompInst, out HTuple columnCompInst, out HTuple angleCompInst, out HTuple scoreCompInst)

HRegion HComponentModel.GetFoundComponentModel(HTuple modelStart, HTuple modelEnd, HTuple rowComp, HTuple columnComp, HTuple angleComp, HTuple scoreComp, HTuple modelComp, int modelMatch, string markOrientation, out HTuple rowCompInst, out HTuple columnCompInst, out HTuple angleCompInst, out HTuple scoreCompInst)

HRegion HComponentModel.GetFoundComponentModel(int modelStart, int modelEnd, double rowComp, double columnComp, double angleComp, double scoreComp, int modelComp, int modelMatch, string markOrientation, out double rowCompInst, out double columnCompInst, out double angleCompInst, out double scoreCompInst)

Description

get_found_component_modelget_found_component_modelGetFoundComponentModelGetFoundComponentModelGetFoundComponentModel returns the components of a found instance of the component model ComponentModelIDComponentModelIDComponentModelIDComponentModelIDcomponentModelID in form of contour regions in FoundComponentsFoundComponentsFoundComponentsFoundComponentsfoundComponents as well as in numerical form.

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

The pose of the returned components corresponds to their pose in the search image as returned by find_component_modelfind_component_modelFindComponentModelFindComponentModelFindComponentModel. Hence, the parameters ModelStartModelStartModelStartModelStartmodelStart, ModelEndModelEndModelEndModelEndmodelEnd, RowCompRowCompRowCompRowComprowComp, ColumnCompColumnCompColumnCompColumnCompcolumnComp, AngleCompAngleCompAngleCompAngleCompangleComp, ScoreCompScoreCompScoreCompScoreCompscoreComp, and ModelCompModelCompModelCompModelCompmodelComp must be passed to get_found_component_modelget_found_component_modelGetFoundComponentModelGetFoundComponentModelGetFoundComponentModel as they have been returned by find_component_modelfind_component_modelFindComponentModelFindComponentModelFindComponentModel. In ModelMatchModelMatchModelMatchModelMatchmodelMatch the index of the found instance of the component model must be passed. Consequently, ModelMatchModelMatchModelMatchModelMatchmodelMatch must lie within the range between 0 and m-1, where m is the number of elements in ModelStartModelStartModelStartModelStartmodelStart and ModelEndModelEndModelEndModelEndmodelEnd, and hence corresponds to the number of found model instances. For example, if the best match should be retuned, ModelMatchModelMatchModelMatchModelMatchmodelMatch 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 MarkOrientationMarkOrientationMarkOrientationMarkOrientationmarkOrientation to 'true'"true""true""true""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_componentstrain_model_componentsTrainModelComponentsTrainModelComponentsTrainModelComponents or create_component_modelcreate_component_modelCreateComponentModelCreateComponentModelCreateComponentModel) 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 RowCompInstRowCompInstRowCompInstRowCompInstrowCompInst, ColumnCompInstColumnCompInstColumnCompInstColumnCompInstcolumnCompInst, AngleCompInstAngleCompInstAngleCompInstAngleCompInstangleCompInst, and ScoreCompInstScoreCompInstScoreCompInstScoreCompInstscoreCompInst. The four tuples are always of length n, where n is the number of components in the component model ComponentModelIDComponentModelIDComponentModelIDComponentModelIDcomponentModelID. If a component could not be found during the search, an empty region is passed in the corresponding element of FoundComponentsFoundComponentsFoundComponentsFoundComponentsfoundComponents and the value of the corresponding element in RowCompInstRowCompInstRowCompInstRowCompInstrowCompInst, ColumnCompInstColumnCompInstColumnCompInstColumnCompInstcolumnCompInst, AngleCompInstAngleCompInstAngleCompInstAngleCompInstangleCompInst, and ScoreCompInstScoreCompInstScoreCompInstScoreCompInstscoreCompInst is set to 0.

Execution Information

Parameters

FoundComponentsFoundComponentsFoundComponentsFoundComponentsfoundComponents (output_object)  region-array objectHRegionHRegionHobject *

Found components of the selected component model instance.

ComponentModelIDComponentModelIDComponentModelIDComponentModelIDcomponentModelID (input_control)  component_model HComponentModel, HTupleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Handle of the component model.

ModelStartModelStartModelStartModelStartmodelStart (input_control)  integer(-array) HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Start index of each found instance of the component model in the tuples describing the component matches.

ModelEndModelEndModelEndModelEndmodelEnd (input_control)  integer(-array) HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

End index of each found instance of the component model to the tuples describing the component matches.

RowCompRowCompRowCompRowComprowComp (input_control)  point.y(-array) HTupleHTupleHtuple (real) (double) (double) (double)

Row coordinate of the found component matches.

ColumnCompColumnCompColumnCompColumnCompcolumnComp (input_control)  point.x(-array) HTupleHTupleHtuple (real) (double) (double) (double)

Column coordinate of the found component matches.

AngleCompAngleCompAngleCompAngleCompangleComp (input_control)  angle.rad(-array) HTupleHTupleHtuple (real) (double) (double) (double)

Rotation angle of the found component matches.

ScoreCompScoreCompScoreCompScoreCompscoreComp (input_control)  real(-array) HTupleHTupleHtuple (real) (double) (double) (double)

Score of the found component matches.

ModelCompModelCompModelCompModelCompmodelComp (input_control)  integer(-array) HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Index of the found components.

ModelMatchModelMatchModelMatchModelMatchmodelMatch (input_control)  integer HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Index of the found instance of the component model to be returned.

MarkOrientationMarkOrientationMarkOrientationMarkOrientationmarkOrientation (input_control)  string HTupleHTupleHtuple (string) (string) (HString) (char*)

Mark the orientation of the components.

Default value: 'false' "false" "false" "false" "false"

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

RowCompInstRowCompInstRowCompInstRowCompInstrowCompInst (output_control)  point.y(-array) HTupleHTupleHtuple (real) (double) (double) (double)

Row coordinate of all components of the selected model instance.

ColumnCompInstColumnCompInstColumnCompInstColumnCompInstcolumnCompInst (output_control)  point.x(-array) HTupleHTupleHtuple (real) (double) (double) (double)

Column coordinate of all components of the selected model instance.

AngleCompInstAngleCompInstAngleCompInstAngleCompInstangleCompInst (output_control)  angle.rad(-array) HTupleHTupleHtuple (real) (double) (double) (double)

Rotation angle of all components of the selected model instance.

ScoreCompInstScoreCompInstScoreCompInstScoreCompInstscoreCompInst (output_control)  real(-array) HTupleHTupleHtuple (real) (double) (double) (double)

Score of all components of the selected model instance.

Example (HDevelop)

* 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_modelget_found_component_modelGetFoundComponentModelGetFoundComponentModelGetFoundComponentModel returns the value 2 (H_MSG_TRUE). If necessary an exception is raised.

Possible Predecessors

find_component_modelfind_component_modelFindComponentModelFindComponentModelFindComponentModel

See also

train_model_componentstrain_model_componentsTrainModelComponentsTrainModelComponentsTrainModelComponents, create_component_modelcreate_component_modelCreateComponentModelCreateComponentModelCreateComponentModel

Module

Matching


ClassesClasses | | Operators