create_aniso_shape_model_xld T_create_aniso_shape_model_xld CreateAnisoShapeModelXld CreateAnisoShapeModelXld create_aniso_shape_model_xld (Operator)
名称
create_aniso_shape_model_xld T_create_aniso_shape_model_xld CreateAnisoShapeModelXld CreateAnisoShapeModelXld create_aniso_shape_model_xld — 准备一个各向异性缩放的形状模型,以便从扩展线描述轮廓进行匹配。
签名
create_aniso_shape_model_xld (Contours : : NumLevels , AngleStart , AngleExtent , AngleStep , ScaleRMin , ScaleRMax , ScaleRStep , ScaleCMin , ScaleCMax , ScaleCStep , Optimization , Metric , MinContrast : ModelID )
Herror T_create_aniso_shape_model_xld (const Hobject Contours , const Htuple NumLevels , const Htuple AngleStart , const Htuple AngleExtent , const Htuple AngleStep , const Htuple ScaleRMin , const Htuple ScaleRMax , const Htuple ScaleRStep , const Htuple ScaleCMin , const Htuple ScaleCMax , const Htuple ScaleCStep , const Htuple Optimization , const Htuple Metric , const Htuple MinContrast , Htuple* ModelID )
void CreateAnisoShapeModelXld (const HObject& Contours , const HTuple& NumLevels , const HTuple& AngleStart , const HTuple& AngleExtent , const HTuple& AngleStep , const HTuple& ScaleRMin , const HTuple& ScaleRMax , const HTuple& ScaleRStep , const HTuple& ScaleCMin , const HTuple& ScaleCMax , const HTuple& ScaleCStep , const HTuple& Optimization , const HTuple& Metric , const HTuple& MinContrast , HTuple* ModelID )
void HShapeModel ::HShapeModel (const HXLDCont& Contours , const HTuple& NumLevels , double AngleStart , double AngleExtent , const HTuple& AngleStep , double ScaleRMin , double ScaleRMax , const HTuple& ScaleRStep , double ScaleCMin , double ScaleCMax , const HTuple& ScaleCStep , const HTuple& Optimization , const HString& Metric , Hlong MinContrast )
void HShapeModel ::HShapeModel (const HXLDCont& Contours , Hlong NumLevels , double AngleStart , double AngleExtent , double AngleStep , double ScaleRMin , double ScaleRMax , double ScaleRStep , double ScaleCMin , double ScaleCMax , double ScaleCStep , const HString& Optimization , const HString& Metric , Hlong MinContrast )
void HShapeModel ::HShapeModel (const HXLDCont& Contours , Hlong NumLevels , double AngleStart , double AngleExtent , double AngleStep , double ScaleRMin , double ScaleRMax , double ScaleRStep , double ScaleCMin , double ScaleCMax , double ScaleCStep , const char* Optimization , const char* Metric , Hlong MinContrast )
void HShapeModel ::HShapeModel (const HXLDCont& Contours , Hlong NumLevels , double AngleStart , double AngleExtent , double AngleStep , double ScaleRMin , double ScaleRMax , double ScaleRStep , double ScaleCMin , double ScaleCMax , double ScaleCStep , const wchar_t* Optimization , const wchar_t* Metric , Hlong MinContrast )
(
Windows only)
void HShapeModel ::CreateAnisoShapeModelXld (const HXLDCont& Contours , const HTuple& NumLevels , double AngleStart , double AngleExtent , const HTuple& AngleStep , double ScaleRMin , double ScaleRMax , const HTuple& ScaleRStep , double ScaleCMin , double ScaleCMax , const HTuple& ScaleCStep , const HTuple& Optimization , const HString& Metric , Hlong MinContrast )
void HShapeModel ::CreateAnisoShapeModelXld (const HXLDCont& Contours , Hlong NumLevels , double AngleStart , double AngleExtent , double AngleStep , double ScaleRMin , double ScaleRMax , double ScaleRStep , double ScaleCMin , double ScaleCMax , double ScaleCStep , const HString& Optimization , const HString& Metric , Hlong MinContrast )
void HShapeModel ::CreateAnisoShapeModelXld (const HXLDCont& Contours , Hlong NumLevels , double AngleStart , double AngleExtent , double AngleStep , double ScaleRMin , double ScaleRMax , double ScaleRStep , double ScaleCMin , double ScaleCMax , double ScaleCStep , const char* Optimization , const char* Metric , Hlong MinContrast )
void HShapeModel ::CreateAnisoShapeModelXld (const HXLDCont& Contours , Hlong NumLevels , double AngleStart , double AngleExtent , double AngleStep , double ScaleRMin , double ScaleRMax , double ScaleRStep , double ScaleCMin , double ScaleCMax , double ScaleCStep , const wchar_t* Optimization , const wchar_t* Metric , Hlong MinContrast )
(
Windows only)
HShapeModel HXLDCont ::CreateAnisoShapeModelXld (const HTuple& NumLevels , double AngleStart , double AngleExtent , const HTuple& AngleStep , double ScaleRMin , double ScaleRMax , const HTuple& ScaleRStep , double ScaleCMin , double ScaleCMax , const HTuple& ScaleCStep , const HTuple& Optimization , const HString& Metric , Hlong MinContrast ) const
HShapeModel HXLDCont ::CreateAnisoShapeModelXld (Hlong NumLevels , double AngleStart , double AngleExtent , double AngleStep , double ScaleRMin , double ScaleRMax , double ScaleRStep , double ScaleCMin , double ScaleCMax , double ScaleCStep , const HString& Optimization , const HString& Metric , Hlong MinContrast ) const
HShapeModel HXLDCont ::CreateAnisoShapeModelXld (Hlong NumLevels , double AngleStart , double AngleExtent , double AngleStep , double ScaleRMin , double ScaleRMax , double ScaleRStep , double ScaleCMin , double ScaleCMax , double ScaleCStep , const char* Optimization , const char* Metric , Hlong MinContrast ) const
HShapeModel HXLDCont ::CreateAnisoShapeModelXld (Hlong NumLevels , double AngleStart , double AngleExtent , double AngleStep , double ScaleRMin , double ScaleRMax , double ScaleRStep , double ScaleCMin , double ScaleCMax , double ScaleCStep , const wchar_t* Optimization , const wchar_t* Metric , Hlong MinContrast ) const
(
Windows only)
static void HOperatorSet .CreateAnisoShapeModelXld (HObject contours , HTuple numLevels , HTuple angleStart , HTuple angleExtent , HTuple angleStep , HTuple scaleRMin , HTuple scaleRMax , HTuple scaleRStep , HTuple scaleCMin , HTuple scaleCMax , HTuple scaleCStep , HTuple optimization , HTuple metric , HTuple minContrast , out HTuple modelID )
public HShapeModel (HXLDCont contours , HTuple numLevels , double angleStart , double angleExtent , HTuple angleStep , double scaleRMin , double scaleRMax , HTuple scaleRStep , double scaleCMin , double scaleCMax , HTuple scaleCStep , HTuple optimization , string metric , int minContrast )
public HShapeModel (HXLDCont contours , int numLevels , double angleStart , double angleExtent , double angleStep , double scaleRMin , double scaleRMax , double scaleRStep , double scaleCMin , double scaleCMax , double scaleCStep , string optimization , string metric , int minContrast )
void HShapeModel .CreateAnisoShapeModelXld (HXLDCont contours , HTuple numLevels , double angleStart , double angleExtent , HTuple angleStep , double scaleRMin , double scaleRMax , HTuple scaleRStep , double scaleCMin , double scaleCMax , HTuple scaleCStep , HTuple optimization , string metric , int minContrast )
void HShapeModel .CreateAnisoShapeModelXld (HXLDCont contours , int numLevels , double angleStart , double angleExtent , double angleStep , double scaleRMin , double scaleRMax , double scaleRStep , double scaleCMin , double scaleCMax , double scaleCStep , string optimization , string metric , int minContrast )
HShapeModel HXLDCont .CreateAnisoShapeModelXld (HTuple numLevels , double angleStart , double angleExtent , HTuple angleStep , double scaleRMin , double scaleRMax , HTuple scaleRStep , double scaleCMin , double scaleCMax , HTuple scaleCStep , HTuple optimization , string metric , int minContrast )
HShapeModel HXLDCont .CreateAnisoShapeModelXld (int numLevels , double angleStart , double angleExtent , double angleStep , double scaleRMin , double scaleRMax , double scaleRStep , double scaleCMin , double scaleCMax , double scaleCStep , string optimization , string metric , int minContrast )
def create_aniso_shape_model_xld (contours : HObject, num_levels : Union[int, str], angle_start : float, angle_extent : float, angle_step : Union[float, str], scale_rmin : float, scale_rmax : float, scale_rstep : Union[float, str], scale_cmin : float, scale_cmax : float, scale_cstep : Union[float, str], optimization : MaybeSequence[str], metric : str, min_contrast : int) -> HHandle
描述
The operator create_aniso_shape_model_xld create_aniso_shape_model_xld CreateAnisoShapeModelXld CreateAnisoShapeModelXld CreateAnisoShapeModelXld create_aniso_shape_model_xld creates an anisotropically
scaled shape model used for matching from the XLD contours passed in
Contours Contours Contours Contours contours contours . The XLD contours represent the gray value edges of the
object to be searched for. In contrast to the operator
create_aniso_shape_model create_aniso_shape_model CreateAnisoShapeModel CreateAnisoShapeModel CreateAnisoShapeModel create_aniso_shape_model , which creates a shape model from a
template image, the operator create_aniso_shape_model_xld create_aniso_shape_model_xld CreateAnisoShapeModelXld CreateAnisoShapeModelXld CreateAnisoShapeModelXld create_aniso_shape_model_xld creates
the shape model from XLD contours, i.e., without the use of a template
image.
The output parameter ModelID ModelID ModelID ModelID modelID model_id is a handle for this model, which is
used in subsequent calls to find_aniso_shape_model find_aniso_shape_model FindAnisoShapeModel FindAnisoShapeModel FindAnisoShapeModel find_aniso_shape_model . The center of
gravity of the smallest surrounding rectangle of the Contours Contours Contours Contours contours contours that
is parallel to the coordinate axes is used as the origin (reference point)
of the model. A different origin can be set with
set_shape_model_origin set_shape_model_origin SetShapeModelOrigin SetShapeModelOrigin SetShapeModelOrigin set_shape_model_origin . The model is generated for multiple image
pyramid levels and is stored in memory. If a complete pregeneration of the
model is selected (see below), the model is generated at multiple rotations
and anisotropic scales (i.e., independent scales in the row and
column direction) on each level. The model can be extended by clutter
parameters with set_shape_model_clutter set_shape_model_clutter SetShapeModelClutter SetShapeModelClutter SetShapeModelClutter set_shape_model_clutter .
Input parameters in detail
NumLevels NumLevels NumLevels NumLevels numLevels num_levels :
The number of pyramid levels is determined with the parameter
NumLevels NumLevels NumLevels NumLevels numLevels num_levels . It should be chosen as large as possible
because by this the time necessary to find the object is
significantly reduced. On the other hand, NumLevels NumLevels NumLevels NumLevels numLevels num_levels must
be chosen such that the model is still recognizable and contains a
sufficient number of points (at least four) on the highest pyramid
level. If not enough model points are
generated, the number of pyramid levels is reduced internally until
enough model points are found on the highest pyramid level. If this
procedure would lead to a model with no pyramid levels, i.e., if the
number of model points is already too small on the lowest pyramid
level, create_aniso_shape_model_xld create_aniso_shape_model_xld CreateAnisoShapeModelXld CreateAnisoShapeModelXld CreateAnisoShapeModelXld create_aniso_shape_model_xld returns with an error
message.
If NumLevels NumLevels NumLevels NumLevels numLevels num_levels is set to 'auto' "auto" "auto" "auto" "auto" "auto" ,
create_aniso_shape_model_xld create_aniso_shape_model_xld CreateAnisoShapeModelXld CreateAnisoShapeModelXld CreateAnisoShapeModelXld create_aniso_shape_model_xld determines the number of pyramid
levels automatically. The computed number of pyramid
levels can be queried using get_shape_model_params get_shape_model_params GetShapeModelParams GetShapeModelParams GetShapeModelParams get_shape_model_params . In rare
cases, it might happen that create_aniso_shape_model_xld create_aniso_shape_model_xld CreateAnisoShapeModelXld CreateAnisoShapeModelXld CreateAnisoShapeModelXld create_aniso_shape_model_xld
determines a value for the number of pyramid levels that is too
large or too small. If the number of pyramid levels is chosen too
large, the model may not be recognized in the image or it may be
necessary to select very low parameters for MinScore MinScore MinScore MinScore minScore min_score or
Greediness Greediness Greediness Greediness greediness greediness in find_aniso_shape_model find_aniso_shape_model FindAnisoShapeModel FindAnisoShapeModel FindAnisoShapeModel find_aniso_shape_model in order to find the
model.
If the number of pyramid levels is chosen too small, the time required
to find the model in find_aniso_shape_model find_aniso_shape_model FindAnisoShapeModel FindAnisoShapeModel FindAnisoShapeModel find_aniso_shape_model may increase.
In these cases, the number of pyramid levels should be selected manually.
AngleStart AngleStart AngleStart AngleStart angleStart angle_start , AngleExtent AngleExtent AngleExtent AngleExtent angleExtent angle_extent , and AngleStep AngleStep AngleStep AngleStep angleStep angle_step :
The parameters AngleStart AngleStart AngleStart AngleStart angleStart angle_start and AngleExtent AngleExtent AngleExtent AngleExtent angleExtent angle_extent
determine the range of possible rotations, in which the object can
occur in the image. Note that the object can only be found in this
range of angles by find_aniso_shape_model find_aniso_shape_model FindAnisoShapeModel FindAnisoShapeModel FindAnisoShapeModel find_aniso_shape_model . The parameter
AngleStep AngleStep AngleStep AngleStep angleStep angle_step determines the step length within the selected
range of angles. Hence, if subpixel accuracy is not specified in
find_aniso_shape_model find_aniso_shape_model FindAnisoShapeModel FindAnisoShapeModel FindAnisoShapeModel find_aniso_shape_model , this parameter specifies the
accuracy that is achievable for the angles in
find_aniso_shape_model find_aniso_shape_model FindAnisoShapeModel FindAnisoShapeModel FindAnisoShapeModel find_aniso_shape_model . AngleStep AngleStep AngleStep AngleStep angleStep angle_step should be chosen
based on the size of the object. Smaller models do not have many
different discrete rotations in the image, and hence
AngleStep AngleStep AngleStep AngleStep angleStep angle_step should be chosen larger for smaller models. If
AngleExtent AngleExtent AngleExtent AngleExtent angleExtent angle_extent is not an integer multiple of
AngleStep AngleStep AngleStep AngleStep angleStep angle_step , AngleStep AngleStep AngleStep AngleStep angleStep angle_step is modified accordingly.
To ensure that for model instances without rotation angle values of
exactly 0.0 are returned by find_aniso_shape_model find_aniso_shape_model FindAnisoShapeModel FindAnisoShapeModel FindAnisoShapeModel find_aniso_shape_model ,
the range of possible
rotations is modified as follows: If there is no positive integer
value n such that AngleStart AngleStart AngleStart AngleStart angleStart angle_start plus n times
AngleStep AngleStep AngleStep AngleStep angleStep angle_step is exactly 0.0, AngleStart AngleStart AngleStart AngleStart angleStart angle_start is decreased
by up to AngleStep AngleStep AngleStep AngleStep angleStep angle_step and AngleExtent AngleExtent AngleExtent AngleExtent angleExtent angle_extent is increased by
AngleStep AngleStep AngleStep AngleStep angleStep angle_step .
ScaleRMin ScaleRMin ScaleRMin ScaleRMin scaleRMin scale_rmin , ScaleRMax ScaleRMax ScaleRMax ScaleRMax scaleRMax scale_rmax , ScaleCMin ScaleCMin ScaleCMin ScaleCMin scaleCMin scale_cmin ,
ScaleCMax ScaleCMax ScaleCMax ScaleCMax scaleCMax scale_cmax , ScaleRStep ScaleRStep ScaleRStep ScaleRStep scaleRStep scale_rstep , and ScaleCStep ScaleCStep ScaleCStep ScaleCStep scaleCStep scale_cstep :
The parameters ScaleRMin ScaleRMin ScaleRMin ScaleRMin scaleRMin scale_rmin , ScaleRMax ScaleRMax ScaleRMax ScaleRMax scaleRMax scale_rmax ,
ScaleCMin ScaleCMin ScaleCMin ScaleCMin scaleCMin scale_cmin , and ScaleCMax ScaleCMax ScaleCMax ScaleCMax scaleCMax scale_cmax determine the range of
possible anisotropic scales of the object in the row and column
direction. A scale of 1 in both scale factors corresponds to the
original size of the model. The parameters ScaleRStep ScaleRStep ScaleRStep ScaleRStep scaleRStep scale_rstep and
ScaleCStep ScaleCStep ScaleCStep ScaleCStep scaleCStep scale_cstep determine the step length within the selected
range of scales. Hence, if subpixel accuracy is not specified in
find_aniso_shape_model find_aniso_shape_model FindAnisoShapeModel FindAnisoShapeModel FindAnisoShapeModel find_aniso_shape_model , these parameters specify the
accuracy that is achievable for the scales in
find_aniso_shape_model find_aniso_shape_model FindAnisoShapeModel FindAnisoShapeModel FindAnisoShapeModel find_aniso_shape_model . Like AngleStep AngleStep AngleStep AngleStep angleStep angle_step ,
ScaleRStep ScaleRStep ScaleRStep ScaleRStep scaleRStep scale_rstep and ScaleCStep ScaleCStep ScaleCStep ScaleCStep scaleCStep scale_cstep should be chosen based
on the size of the object. If the respective range of scales is not
an integer multiple of ScaleRStep ScaleRStep ScaleRStep ScaleRStep scaleRStep scale_rstep and ScaleCStep ScaleCStep ScaleCStep ScaleCStep scaleCStep scale_cstep ,
ScaleRStep ScaleRStep ScaleRStep ScaleRStep scaleRStep scale_rstep and ScaleCStep ScaleCStep ScaleCStep ScaleCStep scaleCStep scale_cstep are modified
accordingly.
To ensure that for model instances that are not scaled scale values of
exactly 1.0 are returned by find_aniso_shape_model find_aniso_shape_model FindAnisoShapeModel FindAnisoShapeModel FindAnisoShapeModel find_aniso_shape_model ,
the range of possible scales is modified as follows: If there are no
positive integer values n and m such that ScaleRMin ScaleRMin ScaleRMin ScaleRMin scaleRMin scale_rmin plus n
times ScaleRStep ScaleRStep ScaleRStep ScaleRStep scaleRStep scale_rstep is exactly 1.0 and ScaleCMin ScaleCMin ScaleCMin ScaleCMin scaleCMin scale_cmin plus
m times ScaleCStep ScaleCStep ScaleCStep ScaleCStep scaleCStep scale_cstep is exactly 1.0, ScaleRMin ScaleRMin ScaleRMin ScaleRMin scaleRMin scale_rmin and
ScaleCMin ScaleCMin ScaleCMin ScaleCMin scaleCMin scale_cmin are decreased by up to ScaleRStep ScaleRStep ScaleRStep ScaleRStep scaleRStep scale_rstep and
ScaleCStep ScaleCStep ScaleCStep ScaleCStep scaleCStep scale_cstep , respectively, and ScaleRMax ScaleRMax ScaleRMax ScaleRMax scaleRMax scale_rmax and
ScaleCMax ScaleCMax ScaleCMax ScaleCMax scaleCMax scale_cmax are increased such that the range of possible
scales is increased by ScaleRStep ScaleRStep ScaleRStep ScaleRStep scaleRStep scale_rstep and ScaleCStep ScaleCStep ScaleCStep ScaleCStep scaleCStep scale_cstep ,
respectively.
Note that the transformations are treated internally such that the
scalings are applied first, followed by the rotation. Therefore,
the model should usually be aligned such that it appears
horizontally or vertically in the model image.
Optimization Optimization Optimization Optimization optimization optimization :
For particularly large models, it may be useful to reduce the number
of model points by setting Optimization Optimization Optimization Optimization optimization optimization to a value
different from 'none' "none" "none" "none" "none" "none" . If Optimization Optimization Optimization Optimization optimization optimization =
'none' "none" "none" "none" "none" "none" , all model points are stored. In all other cases,
the number of points is reduced according to the value of
Optimization Optimization Optimization Optimization optimization optimization . If the number of points is reduced, it may
be necessary in find_aniso_shape_model find_aniso_shape_model FindAnisoShapeModel FindAnisoShapeModel FindAnisoShapeModel find_aniso_shape_model to set the parameter
Greediness Greediness Greediness Greediness greediness greediness to a smaller value, e.g., 0.7 or 0.8 .
For small models, the reduction of the number of model points does not result
in a speed-up of the search because in this case usually
significantly more potential instances of the model must be
examined.
If Optimization Optimization Optimization Optimization optimization optimization is set to 'auto' "auto" "auto" "auto" "auto" "auto" ,
create_aniso_shape_model_xld create_aniso_shape_model_xld CreateAnisoShapeModelXld CreateAnisoShapeModelXld CreateAnisoShapeModelXld create_aniso_shape_model_xld automatically determines the
reduction of the number of model points.
Metric Metric Metric Metric metric metric :
The parameter Metric Metric Metric Metric metric metric determines the conditions under which
the model is recognized in the image.
If Metric Metric Metric Metric metric metric = 'use_polarity' "use_polarity" "use_polarity" "use_polarity" "use_polarity" "use_polarity" , the object in the image and
the model must have the same contrast. If, for example, the model is a
bright object on a dark background, the object is found only if it is also
brighter than the background.
If Metric Metric Metric Metric metric metric = 'ignore_global_polarity' "ignore_global_polarity" "ignore_global_polarity" "ignore_global_polarity" "ignore_global_polarity" "ignore_global_polarity" , the object is
found in the image also if the contrast reverses globally. In the above
example, the object hence is also found if it is darker than the background.
The runtime of find_aniso_shape_model find_aniso_shape_model FindAnisoShapeModel FindAnisoShapeModel FindAnisoShapeModel find_aniso_shape_model will increase slightly in
this case.
Note that the metrics ('use_polarity' "use_polarity" "use_polarity" "use_polarity" "use_polarity" "use_polarity" and
'ignore_global_polarity' "ignore_global_polarity" "ignore_global_polarity" "ignore_global_polarity" "ignore_global_polarity" "ignore_global_polarity" ) can only be selected if all
Contours Contours Contours Contours contours contours provide the attribute 'edge_direction' "edge_direction" "edge_direction" "edge_direction" "edge_direction" "edge_direction" , which
defines the polarity of the edges. This attribute is available for contours
created, e.g., with edges_sub_pix edges_sub_pix EdgesSubPix EdgesSubPix EdgesSubPix edges_sub_pix with the parameter
Method Method Method Method method method set to, e.g., 'canny' "canny" "canny" "canny" "canny" "canny" . Otherwise, these two
metrics can be selected with the operator set_shape_model_metric set_shape_model_metric SetShapeModelMetric SetShapeModelMetric SetShapeModelMetric set_shape_model_metric ,
which determines the polarity of the edges from an image.
If Metric Metric Metric Metric metric metric = 'ignore_local_polarity' "ignore_local_polarity" "ignore_local_polarity" "ignore_local_polarity" "ignore_local_polarity" "ignore_local_polarity" ,
the model is found even if the contrast changes locally. This mode
can, for example, be useful if the object consists of a part with
medium gray value, within which either darker or brighter
sub-objects lie. Since in this case the runtime of
find_aniso_shape_model find_aniso_shape_model FindAnisoShapeModel FindAnisoShapeModel FindAnisoShapeModel find_aniso_shape_model increases significantly, it is
usually better to create several models that reflect the possible
contrast variations of the object with
create_aniso_shape_model_xld create_aniso_shape_model_xld CreateAnisoShapeModelXld CreateAnisoShapeModelXld CreateAnisoShapeModelXld create_aniso_shape_model_xld , and to match them simultaneously
with find_aniso_shape_models find_aniso_shape_models FindAnisoShapeModels FindAnisoShapeModels FindAnisoShapeModels find_aniso_shape_models .
The above three metrics can only be applied to single-channel images.
If a multichannel image is used as the model image or as the search image,
only the first channel will be used (and no error message will be returned).
If Metric Metric Metric Metric metric metric = 'ignore_color_polarity' "ignore_color_polarity" "ignore_color_polarity" "ignore_color_polarity" "ignore_color_polarity" "ignore_color_polarity" , the model is
found even if the color contrast changes locally. This is, for
example, the case if parts of the object can change their color,
e.g., from red to green. In particular, this mode is useful if it
is not known in advance in which channels the object is visible. In
this mode, the runtime of find_aniso_shape_model find_aniso_shape_model FindAnisoShapeModel FindAnisoShapeModel FindAnisoShapeModel find_aniso_shape_model can also
increase significantly. The metric 'ignore_color_polarity' "ignore_color_polarity" "ignore_color_polarity" "ignore_color_polarity" "ignore_color_polarity" "ignore_color_polarity"
can be used for images with an arbitrary number of channels. If it
is used for single-channel images it has the same effect as
'ignore_local_polarity' "ignore_local_polarity" "ignore_local_polarity" "ignore_local_polarity" "ignore_local_polarity" "ignore_local_polarity" . It should be noted that for
Metric Metric Metric Metric metric metric = 'ignore_color_polarity' "ignore_color_polarity" "ignore_color_polarity" "ignore_color_polarity" "ignore_color_polarity" "ignore_color_polarity" the
channels do not need to contain a spectral
subdivision of the light (like in an RGB image). The channels can,
for example, also contain images of the same object that were
obtained by illuminating the object from different directions.
Note that the first two metrics ('use_polarity' "use_polarity" "use_polarity" "use_polarity" "use_polarity" "use_polarity" and
'ignore_global_polarity' "ignore_global_polarity" "ignore_global_polarity" "ignore_global_polarity" "ignore_global_polarity" "ignore_global_polarity" ) can only be selected if all
Contours Contours Contours Contours contours contours provide the attribute 'edge_direction' "edge_direction" "edge_direction" "edge_direction" "edge_direction" "edge_direction" , which
defines the polarity of the edges. For more information about
contour attributes like 'edge_direction' "edge_direction" "edge_direction" "edge_direction" "edge_direction" "edge_direction" see
get_contour_attrib_xld get_contour_attrib_xld GetContourAttribXld GetContourAttribXld GetContourAttribXld get_contour_attrib_xld .
Otherwise, these two metrics can be selected with the operator
set_shape_model_metric set_shape_model_metric SetShapeModelMetric SetShapeModelMetric SetShapeModelMetric set_shape_model_metric , which determines
the polarity of the edges from an image.
MinContrast MinContrast MinContrast MinContrast minContrast min_contrast :
With MinContrast MinContrast MinContrast MinContrast minContrast min_contrast , it can be determined which contrast the
object edges must at least have in the recognition performed by
find_aniso_shape_model find_aniso_shape_model FindAnisoShapeModel FindAnisoShapeModel FindAnisoShapeModel find_aniso_shape_model . In other words, this parameter
separates the object from the noise in the image. Therefore, a good
choice is the range of gray value changes caused by the noise in the
image. If, for example, the gray values fluctuate within a range of
10 gray levels, MinContrast MinContrast MinContrast MinContrast minContrast min_contrast should be set to 10. If
multichannel images are used for the model and the search images,
and if the parameter Metric Metric Metric Metric metric metric is set to
'ignore_color_polarity' "ignore_color_polarity" "ignore_color_polarity" "ignore_color_polarity" "ignore_color_polarity" "ignore_color_polarity" (see above) the noise in one
channel must be multiplied by the square root of the number of
channels to determine MinContrast MinContrast MinContrast MinContrast minContrast min_contrast . If, for example, the
gray values fluctuate within a range of 10 gray levels in a single
channel and the image is a three-channel image MinContrast MinContrast MinContrast MinContrast minContrast min_contrast
should be set to 17. If the model should be recognized
in very low contrast images, MinContrast MinContrast MinContrast MinContrast minContrast min_contrast must be set to a
correspondingly small value. If the model should be recognized even
if it is severely occluded, MinContrast MinContrast MinContrast MinContrast minContrast min_contrast should be slightly
larger than the range of gray value fluctuations created by noise in
order to ensure that the position and rotation of the model are
extracted robustly and accurately by
find_aniso_shape_model find_aniso_shape_model FindAnisoShapeModel FindAnisoShapeModel FindAnisoShapeModel find_aniso_shape_model .
Complete pregeneration of the model
Optionally, a second value can be passed in Optimization Optimization Optimization Optimization optimization optimization .
This value determines whether the model is pregenerated completely
or not. To do so, the second value of Optimization Optimization Optimization Optimization optimization optimization must be
set to either 'pregeneration' "pregeneration" "pregeneration" "pregeneration" "pregeneration" "pregeneration" or
'no_pregeneration' "no_pregeneration" "no_pregeneration" "no_pregeneration" "no_pregeneration" "no_pregeneration" . If the second value is not used (i.e.,
if only one value is passed), the mode that is set with
set_system('pregenerate_shape_models',...) set_system("pregenerate_shape_models",...) SetSystem("pregenerate_shape_models",...) SetSystem("pregenerate_shape_models",...) SetSystem("pregenerate_shape_models",...) set_system("pregenerate_shape_models",...) is used. With
the default value ('pregenerate_shape_models' "pregenerate_shape_models" "pregenerate_shape_models" "pregenerate_shape_models" "pregenerate_shape_models" "pregenerate_shape_models" =
'false' "false" "false" "false" "false" "false" ), the model is not pregenerated completely. The
complete pregeneration of the model normally leads to slightly lower
runtimes because the model does not need to be transformed at
runtime. However, in this case, the memory requirements and the
time required to create the model are significantly higher. It
should also be noted that it cannot be expected that the two modes
return exactly identical results because transforming the model at
runtime necessarily leads to different internal data for the
transformed models than pregenerating the transformed models. For
example, if the model is not pregenerated completely,
find_aniso_shape_model find_aniso_shape_model FindAnisoShapeModel FindAnisoShapeModel FindAnisoShapeModel find_aniso_shape_model typically returns slightly lower
scores, which may require setting a slightly lower value for
MinScore MinScore MinScore MinScore minScore min_score than for a completely pregenerated model.
Furthermore, the poses obtained by interpolation may differ slightly
in the two modes.
If maximum accuracy is desired, the pose of the model should
be determined by least-squares adjustment.
If a complete pregeneration of the model is selected,
the model is pregenerated for the selected angle and scale range
and stored in memory. The memory required to store the model is
proportional to the number of angle steps, the number of scale
steps, and the number of points in the model. Hence, if
AngleStep AngleStep AngleStep AngleStep angleStep angle_step , ScaleRStep ScaleRStep ScaleRStep ScaleRStep scaleRStep scale_rstep , or ScaleCStep ScaleCStep ScaleCStep ScaleCStep scaleCStep scale_cstep are
too small or AngleExtent AngleExtent AngleExtent AngleExtent angleExtent angle_extent or the range of scales are too
big, it may happen that the model no longer fits into the (virtual)
memory. In this case, AngleStep AngleStep AngleStep AngleStep angleStep angle_step , ScaleRStep ScaleRStep ScaleRStep ScaleRStep scaleRStep scale_rstep , or
ScaleCStep ScaleCStep ScaleCStep ScaleCStep scaleCStep scale_cstep must be enlarged or AngleExtent AngleExtent AngleExtent AngleExtent angleExtent angle_extent or the
range of scales must be reduced. In any case, it is desirable that
the model completely fits into the main memory, because this avoids
paging by the operating system, and hence the time to find the
object will be much smaller. Since angles can be determined with
subpixel resolution by find_aniso_shape_model find_aniso_shape_model FindAnisoShapeModel FindAnisoShapeModel FindAnisoShapeModel find_aniso_shape_model ,
AngleStep AngleStep AngleStep AngleStep angleStep angle_step >= 1° and
ScaleRStep ScaleRStep ScaleRStep ScaleRStep scaleRStep scale_rstep , ScaleCStep ScaleCStep ScaleCStep ScaleCStep scaleCStep scale_cstep >= 0.02 can be
selected for models of a diameter smaller than about 200 pixels.
If AngleStep AngleStep AngleStep AngleStep angleStep angle_step =
'auto' "auto" "auto" "auto" "auto" "auto" or ScaleRStep ScaleRStep ScaleRStep ScaleRStep scaleRStep scale_rstep , ScaleCStep ScaleCStep ScaleCStep ScaleCStep scaleCStep scale_cstep =
'auto' "auto" "auto" "auto" "auto" "auto"
is selected, create_aniso_shape_model_xld create_aniso_shape_model_xld CreateAnisoShapeModelXld CreateAnisoShapeModelXld CreateAnisoShapeModelXld create_aniso_shape_model_xld automatically
determines a suitable angle or scale step length, respectively,
based on the size of the model. The automatically computed angle
and scale step lengths can be queried using
get_shape_model_params get_shape_model_params GetShapeModelParams GetShapeModelParams GetShapeModelParams get_shape_model_params .
If a complete pregeneration of the model is not selected, the model
is only created in a reference pose on each pyramid level. In this
case, the model must be transformed to the different angles and
scales at runtime in find_aniso_shape_model find_aniso_shape_model FindAnisoShapeModel FindAnisoShapeModel FindAnisoShapeModel find_aniso_shape_model . Because of
this, the recognition of the model might require slightly more time.
Note that pregenerated shape models are tailored to a specific image size.
For runtime reasons using images of different sizes during the search with
the same model in parallel is not supported. In this case, copies of the same
model must be used, otherwise the program may crash!
注意
The XLD contours passed in Contours Contours Contours Contours contours contours should have been scaled
to approximately the average size of the object in the search images.
This means that the products
and
should be
approximately equal to 1.
Note that, in contrast to the operator
create_aniso_shape_model create_aniso_shape_model CreateAnisoShapeModel CreateAnisoShapeModel CreateAnisoShapeModel create_aniso_shape_model , it is not possible to specify a
minimum size of the model components. To avoid small model
components in the shape model, short contours can be eliminated
before calling create_aniso_shape_model_xld create_aniso_shape_model_xld CreateAnisoShapeModelXld CreateAnisoShapeModelXld CreateAnisoShapeModelXld create_aniso_shape_model_xld with the
operator select_contours_xld select_contours_xld SelectContoursXld SelectContoursXld SelectContoursXld select_contours_xld .
执行信息
Multithreading type: reentrant (runs in parallel with non-exclusive operators).
Multithreading scope: global (may be called from any thread).
Processed without parallelization.
This operator returns a handle. Note that the state of an instance of this handle type may be changed by specific operators even though the handle is used as an input parameter by those operators.
参数
Contours Contours Contours Contours contours contours (input_object) xld_cont(-array) → object HXLDCont HObject HXLDCont Hobject
Input contours that will be used to create the model.
NumLevels NumLevels NumLevels NumLevels numLevels num_levels (input_control) integer → HTuple Union[int, str] HTuple Htuple (integer / string) (int / long / string) (Hlong / HString) (Hlong / char*)
Maximum number of pyramid levels.
默认值:
'auto'
"auto"
"auto"
"auto"
"auto"
"auto"
值列表:
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 'auto' "auto" "auto" "auto" "auto" "auto"
AngleStart AngleStart AngleStart AngleStart angleStart angle_start (input_control) angle.rad → HTuple float HTuple Htuple (real) (double ) (double ) (double )
Smallest rotation of the pattern.
默认值:
-0.39
建议值:
-3.14, -1.57, -0.79, -0.39, -0.20, 0.0
AngleExtent AngleExtent AngleExtent AngleExtent angleExtent angle_extent (input_control) angle.rad → HTuple float HTuple Htuple (real) (double ) (double ) (double )
Extent of the rotation angles.
默认值:
0.79
建议值:
6.29, 3.14, 1.57, 0.79, 0.39
限制:
AngleExtent >= 0
AngleStep AngleStep AngleStep AngleStep angleStep angle_step (input_control) angle.rad → HTuple Union[float, str] HTuple Htuple (real / string) (double / string) (double / HString) (double / char*)
Step length of the angles (resolution).
默认值:
'auto'
"auto"
"auto"
"auto"
"auto"
"auto"
建议值:
'auto' "auto" "auto" "auto" "auto" "auto" , 0.0175, 0.0349, 0.0524, 0.0698, 0.0873
限制:
AngleStep >= 0 && AngleStep <= pi / 2
ScaleRMin ScaleRMin ScaleRMin ScaleRMin scaleRMin scale_rmin (input_control) number → HTuple float HTuple Htuple (real) (double ) (double ) (double )
Minimum scale of the pattern in the row direction.
默认值:
0.9
建议值:
0.5, 0.6, 0.7, 0.8, 0.9, 1.0
限制:
ScaleRMin > 0
ScaleRMax ScaleRMax ScaleRMax ScaleRMax scaleRMax scale_rmax (input_control) number → HTuple float HTuple Htuple (real) (double ) (double ) (double )
Maximum scale of the pattern in the row direction.
默认值:
1.1
建议值:
1.0, 1.1, 1.2, 1.3, 1.4, 1.5
限制:
ScaleRMax >= ScaleRMin
ScaleRStep ScaleRStep ScaleRStep ScaleRStep scaleRStep scale_rstep (input_control) number → HTuple Union[float, str] HTuple Htuple (real / string) (double / string) (double / HString) (double / char*)
Scale step length (resolution) in the row direction.
默认值:
'auto'
"auto"
"auto"
"auto"
"auto"
"auto"
建议值:
'auto' "auto" "auto" "auto" "auto" "auto" , 0.01, 0.02, 0.05, 0.1, 0.15, 0.2
限制:
ScaleRStep >= 0
ScaleCMin ScaleCMin ScaleCMin ScaleCMin scaleCMin scale_cmin (input_control) number → HTuple float HTuple Htuple (real) (double ) (double ) (double )
Minimum scale of the pattern in the column direction.
默认值:
0.9
建议值:
0.5, 0.6, 0.7, 0.8, 0.9, 1.0
限制:
ScaleCMin > 0
ScaleCMax ScaleCMax ScaleCMax ScaleCMax scaleCMax scale_cmax (input_control) number → HTuple float HTuple Htuple (real) (double ) (double ) (double )
Maximum scale of the pattern in the column direction.
默认值:
1.1
建议值:
1.0, 1.1, 1.2, 1.3, 1.4, 1.5
限制:
ScaleCMax >= ScaleCMin
ScaleCStep ScaleCStep ScaleCStep ScaleCStep scaleCStep scale_cstep (input_control) number → HTuple Union[float, str] HTuple Htuple (real / string) (double / string) (double / HString) (double / char*)
Scale step length (resolution) in the column direction.
默认值:
'auto'
"auto"
"auto"
"auto"
"auto"
"auto"
建议值:
'auto' "auto" "auto" "auto" "auto" "auto" , 0.01, 0.02, 0.05, 0.1, 0.15, 0.2
限制:
ScaleCStep >= 0
Optimization Optimization Optimization Optimization optimization optimization (input_control) string(-array) → HTuple MaybeSequence[str] HTuple Htuple (string) (string ) (HString ) (char* )
Kind of optimization and optionally method used
for generating the model.
默认值:
'auto'
"auto"
"auto"
"auto"
"auto"
"auto"
值列表:
'auto' "auto" "auto" "auto" "auto" "auto" , 'no_pregeneration' "no_pregeneration" "no_pregeneration" "no_pregeneration" "no_pregeneration" "no_pregeneration" , 'none' "none" "none" "none" "none" "none" , 'point_reduction_high' "point_reduction_high" "point_reduction_high" "point_reduction_high" "point_reduction_high" "point_reduction_high" , 'point_reduction_low' "point_reduction_low" "point_reduction_low" "point_reduction_low" "point_reduction_low" "point_reduction_low" , 'point_reduction_medium' "point_reduction_medium" "point_reduction_medium" "point_reduction_medium" "point_reduction_medium" "point_reduction_medium" , 'pregeneration' "pregeneration" "pregeneration" "pregeneration" "pregeneration" "pregeneration"
Metric Metric Metric Metric metric metric (input_control) string → HTuple str HTuple Htuple (string) (string ) (HString ) (char* )
Match metric.
默认值:
'ignore_local_polarity'
"ignore_local_polarity"
"ignore_local_polarity"
"ignore_local_polarity"
"ignore_local_polarity"
"ignore_local_polarity"
值列表:
'ignore_color_polarity' "ignore_color_polarity" "ignore_color_polarity" "ignore_color_polarity" "ignore_color_polarity" "ignore_color_polarity" , 'ignore_global_polarity' "ignore_global_polarity" "ignore_global_polarity" "ignore_global_polarity" "ignore_global_polarity" "ignore_global_polarity" , 'ignore_local_polarity' "ignore_local_polarity" "ignore_local_polarity" "ignore_local_polarity" "ignore_local_polarity" "ignore_local_polarity" , 'use_polarity' "use_polarity" "use_polarity" "use_polarity" "use_polarity" "use_polarity"
MinContrast MinContrast MinContrast MinContrast minContrast min_contrast (input_control) number → HTuple int HTuple Htuple (integer) (int / long) (Hlong ) (Hlong )
Minimum contrast of the objects in the search images.
默认值:
5
建议值:
1, 2, 3, 5, 7, 10, 20, 30, 40
ModelID ModelID ModelID ModelID modelID model_id (output_control) shape_model → HShapeModel , HTuple HHandle HTuple Htuple (handle) (IntPtr ) (HHandle ) (handle )
Handle of the model.
结果
If the parameters are valid, the operator
create_aniso_shape_model_xld create_aniso_shape_model_xld CreateAnisoShapeModelXld CreateAnisoShapeModelXld CreateAnisoShapeModelXld create_aniso_shape_model_xld returns the value 2 (
H_MSG_TRUE )
. If necessary an
exception is raised. If the parameter NumLevels NumLevels NumLevels NumLevels numLevels num_levels is chosen such that
the model contains too few points, the error 8510 is raised.
可能的前置算子
read_contour_xld_dxf read_contour_xld_dxf ReadContourXldDxf ReadContourXldDxf ReadContourXldDxf read_contour_xld_dxf ,
edges_sub_pix edges_sub_pix EdgesSubPix EdgesSubPix EdgesSubPix edges_sub_pix ,
select_contours_xld select_contours_xld SelectContoursXld SelectContoursXld SelectContoursXld select_contours_xld
可能的后继算子
find_aniso_shape_model find_aniso_shape_model FindAnisoShapeModel FindAnisoShapeModel FindAnisoShapeModel find_aniso_shape_model ,
find_aniso_shape_models find_aniso_shape_models FindAnisoShapeModels FindAnisoShapeModels FindAnisoShapeModels find_aniso_shape_models ,
get_shape_model_params get_shape_model_params GetShapeModelParams GetShapeModelParams GetShapeModelParams get_shape_model_params ,
clear_shape_model clear_shape_model ClearShapeModel ClearShapeModel ClearShapeModel clear_shape_model ,
write_shape_model write_shape_model WriteShapeModel WriteShapeModel WriteShapeModel write_shape_model ,
set_shape_model_origin set_shape_model_origin SetShapeModelOrigin SetShapeModelOrigin SetShapeModelOrigin set_shape_model_origin ,
set_shape_model_param set_shape_model_param SetShapeModelParam SetShapeModelParam SetShapeModelParam set_shape_model_param ,
set_shape_model_metric set_shape_model_metric SetShapeModelMetric SetShapeModelMetric SetShapeModelMetric set_shape_model_metric ,
set_shape_model_clutter set_shape_model_clutter SetShapeModelClutter SetShapeModelClutter SetShapeModelClutter set_shape_model_clutter
替代算子
create_generic_shape_model create_generic_shape_model CreateGenericShapeModel CreateGenericShapeModel CreateGenericShapeModel create_generic_shape_model
另见
set_system set_system SetSystem SetSystem SetSystem set_system ,
get_system get_system GetSystem GetSystem GetSystem get_system
模块
Matching