get_component_model_treeT_get_component_model_treeGetComponentModelTreeGetComponentModelTreeget_component_model_tree (Operator)
Name
get_component_model_treeT_get_component_model_treeGetComponentModelTreeGetComponentModelTreeget_component_model_tree
— Return the search tree of a component model.
Warning
get_component_model_treeget_component_model_treeGetComponentModelTreeGetComponentModelTreeget_component_model_tree
is obsolete and is only provided for
reasons of backward compatibility.
The operator will be removed with HALCON 26.11.
Signature
get_component_model_tree( : Tree, Relations : ComponentModelID, RootComponent, Image : StartNode, EndNode, Row, Column, Phi, Length1, Length2, AngleStart, AngleExtent)
Herror T_get_component_model_tree(Hobject* Tree, Hobject* Relations, const Htuple ComponentModelID, const Htuple RootComponent, const Htuple Image, Htuple* StartNode, Htuple* EndNode, Htuple* Row, Htuple* Column, Htuple* Phi, Htuple* Length1, Htuple* Length2, Htuple* AngleStart, Htuple* AngleExtent)
void GetComponentModelTree(HObject* Tree, HObject* Relations, const HTuple& ComponentModelID, const HTuple& RootComponent, const HTuple& Image, HTuple* StartNode, HTuple* EndNode, HTuple* Row, HTuple* Column, HTuple* Phi, HTuple* Length1, HTuple* Length2, HTuple* AngleStart, HTuple* AngleExtent)
HRegion HComponentModel::GetComponentModelTree(HRegion* Relations, const HTuple& RootComponent, const HTuple& Image, HTuple* StartNode, HTuple* EndNode, HTuple* Row, HTuple* Column, HTuple* Phi, HTuple* Length1, HTuple* Length2, HTuple* AngleStart, HTuple* AngleExtent) const
HRegion HComponentModel::GetComponentModelTree(HRegion* Relations, Hlong RootComponent, const HString& Image, Hlong* StartNode, Hlong* EndNode, double* Row, double* Column, double* Phi, double* Length1, double* Length2, double* AngleStart, double* AngleExtent) const
HRegion HComponentModel::GetComponentModelTree(HRegion* Relations, Hlong RootComponent, const char* Image, Hlong* StartNode, Hlong* EndNode, double* Row, double* Column, double* Phi, double* Length1, double* Length2, double* AngleStart, double* AngleExtent) const
HRegion HComponentModel::GetComponentModelTree(HRegion* Relations, Hlong RootComponent, const wchar_t* Image, Hlong* StartNode, Hlong* EndNode, double* Row, double* Column, double* Phi, double* Length1, double* Length2, double* AngleStart, double* AngleExtent) const
(
Windows only)
static void HOperatorSet.GetComponentModelTree(out HObject tree, out HObject relations, HTuple componentModelID, HTuple rootComponent, HTuple image, out HTuple startNode, out HTuple endNode, out HTuple row, out HTuple column, out HTuple phi, out HTuple length1, out HTuple length2, out HTuple angleStart, out HTuple angleExtent)
HRegion HComponentModel.GetComponentModelTree(out HRegion relations, HTuple rootComponent, HTuple image, out HTuple startNode, out HTuple endNode, out HTuple row, out HTuple column, out HTuple phi, out HTuple length1, out HTuple length2, out HTuple angleStart, out HTuple angleExtent)
HRegion HComponentModel.GetComponentModelTree(out HRegion relations, int rootComponent, string image, out int startNode, out int endNode, out double row, out double column, out double phi, out double length1, out double length2, out double angleStart, out double angleExtent)
def get_component_model_tree(component_model_id: HHandle, root_component: MaybeSequence[int], image: Union[str, int]) -> Tuple[HObject, HObject, Sequence[int], Sequence[int], Sequence[float], Sequence[float], Sequence[float], Sequence[float], Sequence[float], Sequence[float], Sequence[float]]
def get_component_model_tree_s(component_model_id: HHandle, root_component: MaybeSequence[int], image: Union[str, int]) -> Tuple[HObject, HObject, int, int, float, float, float, float, float, float, float]
Description
get_component_model_treeget_component_model_treeGetComponentModelTreeGetComponentModelTreeget_component_model_tree
returns the search tree
TreeTreeTreetreetree
and the associated relations RelationsRelationsRelationsrelationsrelations
of the
component model that is passed in ComponentModelIDComponentModelIDComponentModelIDcomponentModelIDcomponent_model_id
in form
of regions as well as in numerical form.
get_component_model_treeget_component_model_treeGetComponentModelTreeGetComponentModelTreeget_component_model_tree
is particularly useful in order to
visualize the search order of the components, which was
automatically computed in create_trained_component_modelcreate_trained_component_modelCreateTrainedComponentModelCreateTrainedComponentModelcreate_trained_component_model
or
create_component_modelcreate_component_modelCreateComponentModelCreateComponentModelcreate_component_model
.
Because the search tree depends on the selected root component, the
root component must be passed in RootComponentRootComponentRootComponentrootComponentroot_component
. The nodes
in the tree TreeTreeTreetreetree
represent the model components, the
connecting lines between the nodes indicate which components are
searched relative to each other. The position of the nodes
corresponds to the position of the components in the model image (if
ImageImageImageimageimage
= 'model_image'"model_image""model_image""model_image""model_image" or ImageImageImageimageimage
=
0) or in a training image (if ImageImageImageimageimage
>=
1). In the latter case, the component model must have been
created based on a component training result with
create_trained_component_modelcreate_trained_component_modelCreateTrainedComponentModelCreateTrainedComponentModelcreate_trained_component_model
.
Let n be the number of components in
ComponentModelIDComponentModelIDComponentModelIDcomponentModelIDcomponent_model_id
. The region object tuple
RelationsRelationsRelationsrelationsrelations
of length n is designed as follows: For
each component a separate region is returned. The positions of all
components in the image are represented by circles with a radius of
3 pixels. For each component other than the root component
RootComponentRootComponentRootComponentrootComponentroot_component
, additionally the position relation and the
orientation relation relative to the predecessor component in the
search tree are represented. The position relation is represented
by a rectangle, the orientation relation is represented by a circle
sector with a radius of 30 pixels. The center of the circle is
placed at the mean relative position of the component. The rectangle
describes the movement of the reference point of the respective
component relative to the pose of its predecessor component, the
circle sector describes the variation of the relative orientation. A
relative orientation of 0 corresponds to the relative orientation of
both components in the model image.
In addition to the regions, the search tree as well as the
associated relations are also returned in numerical form. The search
tree is described by the two tuples StartNodeStartNodeStartNodestartNodestart_node
and
EndNodeEndNodeEndNodeendNodeend_node
, both of length n, which contain the start
and the end node of all arcs in the tree. The nodes contain the
indices of the components. This means that during the search the
component that is described by the end node is searched relative to
the pose of the component that is described by the start node
(predecessor component). Since the root component is not searched
relative to any other component, and hence does not have a
predecessor component, the associated start node is set to
-1. The relations are returned in RowRowRowrowrow
,
ColumnColumnColumncolumncolumn
, PhiPhiPhiphiphi
, Length1Length1Length1length1length_1
, Length2Length2Length2length2length_2
,
AngleStartAngleStartAngleStartangleStartangle_start
, and AngleExtentAngleExtentAngleExtentangleExtentangle_extent
. These parameters are
tuples of length n, and contain the relations of all
components relative to their associated predecessor component, where
the order of the values within the tuples is determined by the index
of the corresponding component. The position relation is described
by the parameters of the corresponding rectangle RowRowRowrowrow
,
ColumnColumnColumncolumncolumn
, PhiPhiPhiphiphi
, Length1Length1Length1length1length_1
, and
Length2Length2Length2length2length_2
(see gen_rectangle2gen_rectangle2GenRectangle2GenRectangle2gen_rectangle2
). The orientation
relation is described by the starting angle AngleStartAngleStartAngleStartangleStartangle_start
and
the angle extent AngleExtentAngleExtentAngleExtentangleExtentangle_extent
.
For the root component as well as for components that do not have a
predecessor in the current image or that have not been found in the
current image, an empty region is returned and the corresponding
values of the seven parameters are set to 0.
Execution Information
- Multithreading type: reentrant (runs in parallel with non-exclusive operators).
- Multithreading scope: global (may be called from any thread).
- Processed without parallelization.
Parameters
TreeTreeTreetreetree
(output_object) region →
objectHRegionHObjectHObjectHobject *
Search tree.
RelationsRelationsRelationsrelationsrelations
(output_object) region-array →
objectHRegionHObjectHObjectHobject *
Relations of components that are connected in
the search tree.
ComponentModelIDComponentModelIDComponentModelIDcomponentModelIDcomponent_model_id
(input_control) component_model →
HComponentModel, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)
Handle of the component model.
RootComponentRootComponentRootComponentrootComponentroot_component
(input_control) integer(-array) →
HTupleMaybeSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)
Index of the root component.
Suggested values:
0, 1, 2, 3, 4, 5, 6, 7, 8
ImageImageImageimageimage
(input_control) string →
HTupleUnion[str, int]HTupleHtuple (string / integer) (string / int / long) (HString / Hlong) (char* / Hlong)
Image for which the tree is to be returned.
Default:
'model_image'
"model_image"
"model_image"
"model_image"
"model_image"
Suggested values:
'model_image'"model_image""model_image""model_image""model_image", 0, 1, 2, 3, 4, 5, 6, 7, 8
StartNodeStartNodeStartNodestartNodestart_node
(output_control) integer(-array) →
HTupleSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)
Component index of the start node of an arc in the
search tree.
EndNodeEndNodeEndNodeendNodeend_node
(output_control) integer(-array) →
HTupleSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)
Component index of the end node of an arc in the
search tree.
RowRowRowrowrow
(output_control) rectangle2.center.y(-array) →
HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)
Row coordinate of the center of the rectangle
representing the relation.
ColumnColumnColumncolumncolumn
(output_control) rectangle2.center.x(-array) →
HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)
Column index of the center of the rectangle
representing the relation.
PhiPhiPhiphiphi
(output_control) rectangle2.angle.rad(-array) →
HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)
Orientation of the rectangle representing
the relation (radians).
Assertion:
- pi / 2 < Phi && Phi <= pi / 2
Length1Length1Length1length1length_1
(output_control) rectangle2.hwidth(-array) →
HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)
First radius (half length) of the rectangle
representing the relation.
Assertion:
Length1 >= 0.0
Length2Length2Length2length2length_2
(output_control) rectangle2.hheight(-array) →
HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)
Second radius (half width) of the rectangle
representing the relation.
Assertion:
Length2 >= 0.0 && Length2 <= Length1
AngleStartAngleStartAngleStartangleStartangle_start
(output_control) angle.rad(-array) →
HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)
Smallest relative orientation angle.
AngleExtentAngleExtentAngleExtentangleExtentangle_extent
(output_control) angle.rad(-array) →
HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)
Extent of the relative orientation angle.
Result
If the parameters are valid, the operator
get_component_model_treeget_component_model_treeGetComponentModelTreeGetComponentModelTreeget_component_model_tree
returns the value 2 (
H_MSG_TRUE)
.
If necessary, an exception is raised.
Module
Matching