Operators |
get_component_model_tree — Return the search tree of a component model.
get_component_model_tree( : Tree, Relations : ComponentModelID, RootComponent, Image : StartNode, EndNode, Row, Column, Phi, Length1, Length2, AngleStart, AngleExtent)
get_component_model_tree returns the search tree Tree and the associated relations Relations of the component model that is passed in ComponentModelID in form of regions as well as in numerical form. get_component_model_tree is particularly useful in order to visualize the search order of the components, which was automatically computed in create_trained_component_model or create_component_model.
Because the search tree depends on the selected root component, the root component must be passed in RootComponent. The nodes in the tree Tree 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 Image = 'model_image' or Image = 0) or in a training image (if Image >= 1). In the latter case, the component model must have been created based on a component training result with create_trained_component_model.
Let n be the number of components in ComponentModelID. The region object tuple Relations 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 RootComponent, 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 StartNode and EndNode, 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 Row, Column, Phi, Length1, Length2, AngleStart, and AngleExtent. 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 Row, Column, Phi, Length1, and Length2 (see gen_rectangle2). The orientation relation is described by the starting angle AngleStart and the angle extent AngleExtent.
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.
Search tree.
Relations of components that are connected in the search tree.
Handle of the component model.
Index of the root component.
Suggested values: 0, 1, 2, 3, 4, 5, 6, 7, 8
Image for which the tree is to be returned.
Default value: 'model_image'
Suggested values: 'model_image' , 0, 1, 2, 3, 4, 5, 6, 7, 8
Component index of the start node of an arc in the search tree.
Component index of the end node of an arc in the search tree.
Row coordinate of the center of the rectangle representing the relation.
Column index of the center of the rectangle representing the relation.
Orientation of the rectangle representing the relation (radians).
Assertion: - pi / 2 < Phi && Phi <= pi / 2
First radius (half length) of the rectangle representing the relation.
Assertion: Length1 >= 0.0
Second radius (half width) of the rectangle representing the relation.
Assertion: Length2 >= 0.0 && Length2 <= Length1
Smallest relative orientation angle.
Extent of the relative orientation angle.
* Read the model image. read_image (ModelImage, 'model_image.tif') * Describe the model components. gen_rectangle2 (ComponentRegions, 318, 109, -1.62, 34, 19) gen_rectangle2 (Rectangle2, 342, 238, -1.63, 32, 17) gen_rectangle2 (Rectangle3, 355, 505, 1.41, 25, 17) concat_obj (ComponentRegions, Rectangle2, ComponentRegions) concat_obj (ComponentRegions, Rectangle3, ComponentRegions) * Create the component model. create_component_model (ModelImage, ComponentRegions, 20, 20, rad(25), 0, \ rad(360), 15, 40, 15, 10, 0.8, 0, 0, 'none', \ 'use_polarity', 'true', ComponentModelID, \ RootRanking) * Get the component model tree. get_component_model_tree (Tree, Relations, ComponentModelID, RootRanking, \ 'model_image', StartNode, EndNode, Row, Column, \ Phi, Length1, Length2, AngleStart, AngleExtent) dev_set_colored (12) dev_display (ModelImage) dev_display (Tree) dev_display (Relations)
If the parameters are valid, the operator get_component_model_tree returns the value 2 (H_MSG_TRUE). If necessary an exception is raised.
create_trained_component_model, create_component_model
Matching
Operators |