Name
create_aniso_shape_modelcreate_aniso_shape_modelCreateAnisoShapeModelcreate_aniso_shape_modelCreateAnisoShapeModelCreateAnisoShapeModel — Prepare an anisotropically scaled shape model for matching.
create_aniso_shape_model(Template : : NumLevels, AngleStart, AngleExtent, AngleStep, ScaleRMin, ScaleRMax, ScaleRStep, ScaleCMin, ScaleCMax, ScaleCStep, Optimization, Metric, Contrast, MinContrast : ModelID)
Herror create_aniso_shape_model(const Hobject Template, const 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, const Hlong Contrast, const Hlong MinContrast, Hlong* ModelID)
Herror T_create_aniso_shape_model(const Hobject Template, 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 Contrast, const Htuple MinContrast, Htuple* ModelID)
Herror create_aniso_shape_model(Hobject Template, 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& Contrast, const HTuple& MinContrast, Hlong* ModelID)
HShapeModel HImage::CreateAnisoShapeModel(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& Contrast, const HTuple& MinContrast) const
void HShapeModel::CreateAnisoShapeModel(const HImage& Template, 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& Contrast, const HTuple& MinContrast)
void CreateAnisoShapeModel(const HObject& Template, 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& Contrast, const HTuple& MinContrast, HTuple* ModelID)
void HShapeModel::HShapeModel(const HImage& Template, 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, const HTuple& Contrast, const HTuple& MinContrast)
void HShapeModel::HShapeModel(const HImage& Template, 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 Contrast, Hlong MinContrast)
void HShapeModel::HShapeModel(const HImage& Template, 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 Contrast, Hlong MinContrast)
void HShapeModel::CreateAnisoShapeModel(const HImage& Template, 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, const HTuple& Contrast, const HTuple& MinContrast)
void HShapeModel::CreateAnisoShapeModel(const HImage& Template, 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 Contrast, Hlong MinContrast)
void HShapeModel::CreateAnisoShapeModel(const HImage& Template, 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 Contrast, Hlong MinContrast)
HShapeModel HImage::CreateAnisoShapeModel(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, const HTuple& Contrast, const HTuple& MinContrast) const
HShapeModel HImage::CreateAnisoShapeModel(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 Contrast, Hlong MinContrast) const
HShapeModel HImage::CreateAnisoShapeModel(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 Contrast, Hlong MinContrast) const
void HOperatorSetX.CreateAnisoShapeModel(
[in] IHUntypedObjectX* Template, [in] VARIANT NumLevels, [in] VARIANT AngleStart, [in] VARIANT AngleExtent, [in] VARIANT AngleStep, [in] VARIANT ScaleRMin, [in] VARIANT ScaleRMax, [in] VARIANT ScaleRStep, [in] VARIANT ScaleCMin, [in] VARIANT ScaleCMax, [in] VARIANT ScaleCStep, [in] VARIANT Optimization, [in] VARIANT Metric, [in] VARIANT Contrast, [in] VARIANT MinContrast, [out] VARIANT* ModelID)
void HShapeModelX.CreateAnisoShapeModel(
[in] IHImageX* Template, [in] VARIANT NumLevels, [in] double AngleStart, [in] double AngleExtent, [in] VARIANT AngleStep, [in] double ScaleRMin, [in] double ScaleRMax, [in] VARIANT ScaleRStep, [in] double ScaleCMin, [in] double ScaleCMax, [in] VARIANT ScaleCStep, [in] VARIANT Optimization, [in] BSTR Metric, [in] VARIANT Contrast, [in] VARIANT MinContrast)
IHShapeModelX* HImageX.CreateAnisoShapeModel(
[in] VARIANT NumLevels, [in] double AngleStart, [in] double AngleExtent, [in] VARIANT AngleStep, [in] double ScaleRMin, [in] double ScaleRMax, [in] VARIANT ScaleRStep, [in] double ScaleCMin, [in] double ScaleCMax, [in] VARIANT ScaleCStep, [in] VARIANT Optimization, [in] BSTR Metric, [in] VARIANT Contrast, [in] VARIANT MinContrast)
static void HOperatorSet.CreateAnisoShapeModel(HObject template, 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 contrast, HTuple minContrast, out HTuple modelID)
public HShapeModel(HImage template, HTuple numLevels, double angleStart, double angleExtent, HTuple angleStep, double scaleRMin, double scaleRMax, HTuple scaleRStep, double scaleCMin, double scaleCMax, HTuple scaleCStep, HTuple optimization, string metric, HTuple contrast, HTuple minContrast)
public HShapeModel(HImage template, 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 contrast, int minContrast)
void HShapeModel.CreateAnisoShapeModel(HImage template, HTuple numLevels, double angleStart, double angleExtent, HTuple angleStep, double scaleRMin, double scaleRMax, HTuple scaleRStep, double scaleCMin, double scaleCMax, HTuple scaleCStep, HTuple optimization, string metric, HTuple contrast, HTuple minContrast)
void HShapeModel.CreateAnisoShapeModel(HImage template, 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 contrast, int minContrast)
HShapeModel HImage.CreateAnisoShapeModel(HTuple numLevels, double angleStart, double angleExtent, HTuple angleStep, double scaleRMin, double scaleRMax, HTuple scaleRStep, double scaleCMin, double scaleCMax, HTuple scaleCStep, HTuple optimization, string metric, HTuple contrast, HTuple minContrast)
HShapeModel HImage.CreateAnisoShapeModel(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 contrast, int minContrast)
The operator create_aniso_shape_modelcreate_aniso_shape_modelCreateAnisoShapeModelcreate_aniso_shape_modelCreateAnisoShapeModelCreateAnisoShapeModel prepares a template,
which is passed in the image TemplateTemplateTemplateTemplateTemplatetemplate, as an anisotropically
scaled shape model used for matching. The ROI of the model
is passed as the domain of TemplateTemplateTemplateTemplateTemplatetemplate.
The model is generated using 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 output parameter
ModelIDModelIDModelIDModelIDModelIDmodelID is a handle for this model, which is used in
subsequent calls to find_aniso_shape_modelfind_aniso_shape_modelFindAnisoShapeModelfind_aniso_shape_modelFindAnisoShapeModelFindAnisoShapeModel.
The number of pyramid levels is determined with the parameter
NumLevelsNumLevelsNumLevelsNumLevelsNumLevelsnumLevels. 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, NumLevelsNumLevelsNumLevelsNumLevelsNumLevelsnumLevels 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. This can be checked using the output of
inspect_shape_modelinspect_shape_modelInspectShapeModelinspect_shape_modelInspectShapeModelInspectShapeModel. 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_modelcreate_aniso_shape_modelCreateAnisoShapeModelcreate_aniso_shape_modelCreateAnisoShapeModelCreateAnisoShapeModel returns with an error
message. If NumLevelsNumLevelsNumLevelsNumLevelsNumLevelsnumLevels is set to 'auto'"auto""auto""auto""auto""auto" (or
0 for backwards compatibility),
create_aniso_shape_modelcreate_aniso_shape_modelCreateAnisoShapeModelcreate_aniso_shape_modelCreateAnisoShapeModelCreateAnisoShapeModel determines the number of pyramid
levels automatically. The automatically computed number of pyramid
levels can be queried using get_shape_model_paramsget_shape_model_paramsGetShapeModelParamsget_shape_model_paramsGetShapeModelParamsGetShapeModelParams. In rare
cases, it might happen that create_aniso_shape_modelcreate_aniso_shape_modelCreateAnisoShapeModelcreate_aniso_shape_modelCreateAnisoShapeModelCreateAnisoShapeModel
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 or Greediness
in find_aniso_shape_modelfind_aniso_shape_modelFindAnisoShapeModelfind_aniso_shape_modelFindAnisoShapeModelFindAnisoShapeModel 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_modelfind_aniso_shape_modelFindAnisoShapeModelfind_aniso_shape_modelFindAnisoShapeModelFindAnisoShapeModel may increase.
In these cases, the number of pyramid levels should be selected
using the output of inspect_shape_modelinspect_shape_modelInspectShapeModelinspect_shape_modelInspectShapeModelInspectShapeModel.
The parameters AngleStartAngleStartAngleStartAngleStartAngleStartangleStart and AngleExtentAngleExtentAngleExtentAngleExtentAngleExtentangleExtent
determine the range of possible rotations, in which the model can
occur in the image. Note that the model can only be found in this
range of angles by find_aniso_shape_modelfind_aniso_shape_modelFindAnisoShapeModelfind_aniso_shape_modelFindAnisoShapeModelFindAnisoShapeModel. The parameter
AngleStepAngleStepAngleStepAngleStepAngleStepangleStep determines the step length within the selected
range of angles. Hence, if subpixel accuracy is not specified in
find_aniso_shape_modelfind_aniso_shape_modelFindAnisoShapeModelfind_aniso_shape_modelFindAnisoShapeModelFindAnisoShapeModel, this parameter specifies the
accuracy that is achievable for the angles in
find_aniso_shape_modelfind_aniso_shape_modelFindAnisoShapeModelfind_aniso_shape_modelFindAnisoShapeModelFindAnisoShapeModel. AngleStepAngleStepAngleStepAngleStepAngleStepangleStep should be chosen
based on the size of the object. Smaller models do not have many
different discrete rotations in the image, and hence
AngleStepAngleStepAngleStepAngleStepAngleStepangleStep should be chosen larger for smaller models. If
AngleExtentAngleExtentAngleExtentAngleExtentAngleExtentangleExtent is not an integer multiple of
AngleStepAngleStepAngleStepAngleStepAngleStepangleStep, AngleStepAngleStepAngleStepAngleStepAngleStepangleStep is modified accordingly.
To ensure that for model instances without rotation angle values of
exactly 0.0 are returned by find_aniso_shape_modelfind_aniso_shape_modelFindAnisoShapeModelfind_aniso_shape_modelFindAnisoShapeModelFindAnisoShapeModel,
the range of possible
rotations is modified as follows: If there is no positive integer
value n such that AngleStartAngleStartAngleStartAngleStartAngleStartangleStart plus n times
AngleStepAngleStepAngleStepAngleStepAngleStepangleStep is exactly 0.0, AngleStartAngleStartAngleStartAngleStartAngleStartangleStart is decreased
by up to AngleStepAngleStepAngleStepAngleStepAngleStepangleStep and AngleExtentAngleExtentAngleExtentAngleExtentAngleExtentangleExtent is increased by
AngleStepAngleStepAngleStepAngleStepAngleStepangleStep.
The parameters ScaleRMinScaleRMinScaleRMinScaleRMinScaleRMinscaleRMin, ScaleRMaxScaleRMaxScaleRMaxScaleRMaxScaleRMaxscaleRMax,
ScaleCMinScaleCMinScaleCMinScaleCMinScaleCMinscaleCMin, and ScaleCMaxScaleCMaxScaleCMaxScaleCMaxScaleCMaxscaleCMax determine the range of
possible anisotropic scales of the model in the row and column
direction. A scale of 1 in both scale factors corresponds to the
original size of the model. The parameters ScaleRStepScaleRStepScaleRStepScaleRStepScaleRStepscaleRStep and
ScaleCStepScaleCStepScaleCStepScaleCStepScaleCStepscaleCStep determine the step length within the selected
range of scales. Hence, if subpixel accuracy is not specified in
find_aniso_shape_modelfind_aniso_shape_modelFindAnisoShapeModelfind_aniso_shape_modelFindAnisoShapeModelFindAnisoShapeModel, these parameters specify the
accuracy that is achievable for the scales in
find_aniso_shape_modelfind_aniso_shape_modelFindAnisoShapeModelfind_aniso_shape_modelFindAnisoShapeModelFindAnisoShapeModel. Like AngleStepAngleStepAngleStepAngleStepAngleStepangleStep,
ScaleRStepScaleRStepScaleRStepScaleRStepScaleRStepscaleRStep and ScaleCStepScaleCStepScaleCStepScaleCStepScaleCStepscaleCStep should be chosen based
on the size of the object. If the respective range of scales is not
an integer multiple of ScaleRStepScaleRStepScaleRStepScaleRStepScaleRStepscaleRStep and ScaleCStepScaleCStepScaleCStepScaleCStepScaleCStepscaleCStep,
ScaleRStepScaleRStepScaleRStepScaleRStepScaleRStepscaleRStep and ScaleCStepScaleCStepScaleCStepScaleCStepScaleCStepscaleCStep are modified
accordingly.
To ensure that for model instances without scaling scale values of
exactly 0.0 are returned by find_aniso_shape_modelfind_aniso_shape_modelFindAnisoShapeModelfind_aniso_shape_modelFindAnisoShapeModelFindAnisoShapeModel,
the range of possible scales is modified as follows: If there are no
positive integer values n and m such that ScaleRMinScaleRMinScaleRMinScaleRMinScaleRMinscaleRMin plus n
times ScaleRStepScaleRStepScaleRStepScaleRStepScaleRStepscaleRStep is exactly 0.0 and ScaleCMinScaleCMinScaleCMinScaleCMinScaleCMinscaleCMin plus
m times ScaleCStepScaleCStepScaleCStepScaleCStepScaleCStepscaleCStep is exactly 0.0, ScaleRMinScaleRMinScaleRMinScaleRMinScaleRMinscaleRMin and
ScaleCMinScaleCMinScaleCMinScaleCMinScaleCMinscaleCMin are decreased by up to ScaleRStepScaleRStepScaleRStepScaleRStepScaleRStepscaleRStep and
ScaleCStepScaleCStepScaleCStepScaleCStepScaleCStepscaleCStep, respectively, and ScaleRMaxScaleRMaxScaleRMaxScaleRMaxScaleRMaxscaleRMax and
ScaleCMaxScaleCMaxScaleCMaxScaleCMaxScaleCMaxscaleCMax are increased such that the range of possible
scales is increased by ScaleRStepScaleRStepScaleRStepScaleRStepScaleRStepscaleRStep and ScaleCStepScaleCStepScaleCStepScaleCStepScaleCStepscaleCStep,
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.
If a complete pregeneration of the model is selected (see below),
the model is pre-generated 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
AngleStepAngleStepAngleStepAngleStepAngleStepangleStep, ScaleRStepScaleRStepScaleRStepScaleRStepScaleRStepscaleRStep, or ScaleCStepScaleCStepScaleCStepScaleCStepScaleCStepscaleCStep are
too small or AngleExtentAngleExtentAngleExtentAngleExtentAngleExtentangleExtent or the range of scales are too
big, it may happen that the model no longer fits into the (virtual)
memory. In this case, AngleStepAngleStepAngleStepAngleStepAngleStepangleStep, ScaleRStepScaleRStepScaleRStepScaleRStepScaleRStepscaleRStep, or
ScaleCStepScaleCStepScaleCStepScaleCStepScaleCStepscaleCStep must be enlarged or AngleExtentAngleExtentAngleExtentAngleExtentAngleExtentangleExtent 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_modelfind_aniso_shape_modelFindAnisoShapeModelfind_aniso_shape_modelFindAnisoShapeModelFindAnisoShapeModel,
AngleStepAngleStepAngleStepAngleStepAngleStepangleStep >= 1° and
ScaleRStepScaleRStepScaleRStepScaleRStepScaleRStepscaleRStep, ScaleCStepScaleCStepScaleCStepScaleCStepScaleCStepscaleCStep >= 0.02 can be
selected for models of a diameter smaller than about 200 pixels. If
AngleStepAngleStepAngleStepAngleStepAngleStepangleStep =
'auto'"auto""auto""auto""auto""auto" or ScaleRStepScaleRStepScaleRStepScaleRStepScaleRStepscaleRStep, ScaleCStepScaleCStepScaleCStepScaleCStepScaleCStepscaleCStep =
'auto'"auto""auto""auto""auto""auto" (or 0 for backwards compatibility in both
cases) is selected, create_aniso_shape_modelcreate_aniso_shape_modelCreateAnisoShapeModelcreate_aniso_shape_modelCreateAnisoShapeModelCreateAnisoShapeModel 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_paramsget_shape_model_paramsGetShapeModelParamsget_shape_model_paramsGetShapeModelParamsGetShapeModelParams.
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_modelfind_aniso_shape_modelFindAnisoShapeModelfind_aniso_shape_modelFindAnisoShapeModelFindAnisoShapeModel. Because of
this, the recognition of the model might require slightly more time.
For particularly large models, it may be useful to reduce the number
of model points by setting OptimizationOptimizationOptimizationOptimizationOptimizationoptimization to a value
different from 'none'"none""none""none""none""none". If OptimizationOptimizationOptimizationOptimizationOptimizationoptimization =
'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
OptimizationOptimizationOptimizationOptimizationOptimizationoptimization. If the number of points is reduced, it may
be necessary in find_aniso_shape_modelfind_aniso_shape_modelFindAnisoShapeModelfind_aniso_shape_modelFindAnisoShapeModelFindAnisoShapeModel to set the parameter
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 OptimizationOptimizationOptimizationOptimizationOptimizationoptimization is set to 'auto'"auto""auto""auto""auto""auto",
create_aniso_shape_modelcreate_aniso_shape_modelCreateAnisoShapeModelcreate_aniso_shape_modelCreateAnisoShapeModelCreateAnisoShapeModel automatically determines the
reduction of the number of model points.
Optionally, a second value can be passed in OptimizationOptimizationOptimizationOptimizationOptimizationoptimization.
This value determines whether the model is pregenerated completely
or not. To do so, the second value of OptimizationOptimizationOptimizationOptimizationOptimizationoptimization 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",...)set_system("pregenerate_shape_models",...)SetSystem("pregenerate_shape_models",...)SetSystem("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_modelfind_aniso_shape_modelFindAnisoShapeModelfind_aniso_shape_modelFindAnisoShapeModelFindAnisoShapeModel typically returns slightly lower
scores, which may require setting a slightly lower value for
MinScore 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.
The parameter ContrastContrastContrastContrastContrastcontrast determines the contrast the model
points must have. The contrast is a measure for local gray value
differences between the object and the background and between
different parts of the object. ContrastContrastContrastContrastContrastcontrast should be chosen
such that only the significant features of the template are used for
the model. ContrastContrastContrastContrastContrastcontrast can also contain a tuple with two
values. In this case, the model is segmented using a method similar
to the hysteresis threshold method used in edges_imageedges_imageEdgesImageedges_imageEdgesImageEdgesImage.
Here, the first element of the tuple determines the lower threshold,
while the second element determines the upper threshold. For more
information about the hysteresis threshold method, see
hysteresis_thresholdhysteresis_thresholdHysteresisThresholdhysteresis_thresholdHysteresisThresholdHysteresisThreshold. Optionally, ContrastContrastContrastContrastContrastcontrast can
contain a third value as the last element of the tuple. This value
determines a threshold for the selection of significant model
components based on the size of the components, i.e., components
that have fewer points than the minimum size thus specified are
suppressed. This threshold for the minimum size is divided by two
for each successive pyramid level. If small model components should
be suppressed, but hysteresis thresholding should not be performed,
nevertheless three values must be specified in ContrastContrastContrastContrastContrastcontrast.
In this case, the first two values can simply be set to identical
values. The effect of this parameter can be checked in advance with
inspect_shape_modelinspect_shape_modelInspectShapeModelinspect_shape_modelInspectShapeModelInspectShapeModel. If ContrastContrastContrastContrastContrastcontrast is set to
'auto'"auto""auto""auto""auto""auto", create_aniso_shape_modelcreate_aniso_shape_modelCreateAnisoShapeModelcreate_aniso_shape_modelCreateAnisoShapeModelCreateAnisoShapeModel determines the
three above described values automatically. Alternatively, only the
contrast ('auto_contrast'"auto_contrast""auto_contrast""auto_contrast""auto_contrast""auto_contrast"), the hysteresis thresholds
('auto_contrast_hyst'"auto_contrast_hyst""auto_contrast_hyst""auto_contrast_hyst""auto_contrast_hyst""auto_contrast_hyst"), or the minimum size
('auto_min_size'"auto_min_size""auto_min_size""auto_min_size""auto_min_size""auto_min_size") can be determined automatically. The
remaining values that are not determined automatically can
additionally be passed in the form of a tuple. Also various
combinations are allowed: If, for example,
['auto_contrast','auto_min_size']["auto_contrast","auto_min_size"]["auto_contrast","auto_min_size"]["auto_contrast","auto_min_size"]["auto_contrast","auto_min_size"]["auto_contrast","auto_min_size"] is passed, both the
contrast and the minimum size are determined automatically. If
['auto_min_size',20,30]["auto_min_size",20,30]["auto_min_size",20,30]["auto_min_size",20,30]["auto_min_size",20,30]["auto_min_size",20,30] is passed, the minimum size is
determined automatically while the hysteresis thresholds are set to
20 and 30, etc. In certain cases, it might happen
that the automatic determination of the contrast thresholds is not
satisfying. For example, a manual setting of these parameters should
be preferred if certain model components should be included or
suppressed because of application-specific reasons or if the object
contains several different contrasts. Therefore, the contrast
thresholds should be automatically determined with
determine_shape_model_paramsdetermine_shape_model_paramsDetermineShapeModelParamsdetermine_shape_model_paramsDetermineShapeModelParamsDetermineShapeModelParams and subsequently verified using
inspect_shape_modelinspect_shape_modelInspectShapeModelinspect_shape_modelInspectShapeModelInspectShapeModel before calling
create_aniso_shape_modelcreate_aniso_shape_modelCreateAnisoShapeModelcreate_aniso_shape_modelCreateAnisoShapeModelCreateAnisoShapeModel.
With MinContrastMinContrastMinContrastMinContrastMinContrastminContrast, it can be determined which contrast the
model must at least have in the recognition performed by
find_aniso_shape_modelfind_aniso_shape_modelFindAnisoShapeModelfind_aniso_shape_modelFindAnisoShapeModelFindAnisoShapeModel. In other words, this parameter
separates the model 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, MinContrastMinContrastMinContrastMinContrastMinContrastminContrast should be set to 10. If
multichannel images are used for the model and the search images,
and if the parameter MetricMetricMetricMetricMetricmetric is set to
'ignore_color_polarity'"ignore_color_polarity""ignore_color_polarity""ignore_color_polarity""ignore_color_polarity""ignore_color_polarity" (see below) the noise in one
channel must be multiplied by the square root of the number of
channels to determine MinContrastMinContrastMinContrastMinContrastMinContrastminContrast. 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 MinContrastMinContrastMinContrastMinContrastMinContrastminContrast
should be set to 17. Obviously, MinContrastMinContrastMinContrastMinContrastMinContrastminContrast must be
smaller than ContrastContrastContrastContrastContrastcontrast. If the model should be recognized
in very low contrast images, MinContrastMinContrastMinContrastMinContrastMinContrastminContrast must be set to a
correspondingly small value. If the model should be recognized even
if it is severely occluded, MinContrastMinContrastMinContrastMinContrastMinContrastminContrast 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_modelfind_aniso_shape_modelFindAnisoShapeModelfind_aniso_shape_modelFindAnisoShapeModelFindAnisoShapeModel. If MinContrastMinContrastMinContrastMinContrastMinContrastminContrast is set to
'auto'"auto""auto""auto""auto""auto", the minimum contrast is determined automatically
based on the noise in the model image. Consequently, an automatic
determination only makes sense if the image noise during the
recognition is similar to the noise in the model image.
Furthermore, in some cases it is advisable to increase the
automatically determined value in order to increase the robustness
against occlusions (see above). The automatically computed minimum
contrast can be queried using get_shape_model_paramsget_shape_model_paramsGetShapeModelParamsget_shape_model_paramsGetShapeModelParamsGetShapeModelParams.
The parameter MetricMetricMetricMetricMetricmetric determines the conditions under which
the model is recognized in the image. If MetricMetricMetricMetricMetricmetric =
'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 MetricMetricMetricMetricMetricmetric =
'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_modelfind_aniso_shape_modelFindAnisoShapeModelfind_aniso_shape_modelFindAnisoShapeModelFindAnisoShapeModel will increase slightly in
this case. If MetricMetricMetricMetricMetricmetric = '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_modelfind_aniso_shape_modelFindAnisoShapeModelfind_aniso_shape_modelFindAnisoShapeModelFindAnisoShapeModel increases significantly, it is
usually better to create several models that reflect the possible
contrast variations of the object with
create_aniso_shape_modelcreate_aniso_shape_modelCreateAnisoShapeModelcreate_aniso_shape_modelCreateAnisoShapeModelCreateAnisoShapeModel, and to match them simultaneously
with find_aniso_shape_modelsfind_aniso_shape_modelsFindAnisoShapeModelsfind_aniso_shape_modelsFindAnisoShapeModelsFindAnisoShapeModels. 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
MetricMetricMetricMetricMetricmetric = '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_modelfind_aniso_shape_modelFindAnisoShapeModelfind_aniso_shape_modelFindAnisoShapeModelFindAnisoShapeModel 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
MetricMetricMetricMetricMetricmetric = 'ignore_color_polarity'"ignore_color_polarity""ignore_color_polarity""ignore_color_polarity""ignore_color_polarity""ignore_color_polarity" the number of
channels in the model creation with create_aniso_shape_modelcreate_aniso_shape_modelCreateAnisoShapeModelcreate_aniso_shape_modelCreateAnisoShapeModelCreateAnisoShapeModel
and in the search with find_aniso_shape_modelfind_aniso_shape_modelFindAnisoShapeModelfind_aniso_shape_modelFindAnisoShapeModelFindAnisoShapeModel can be
different. This can, for example, be used to create a model from a
synthetically generated single-channel image. Furthermore, it
should be noted that 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.
The center of gravity of the domain (region) of the model image
TemplateTemplateTemplateTemplateTemplatetemplate is used as the origin (reference point) of the
model. A different origin can be set with
set_shape_model_originset_shape_model_originSetShapeModelOriginset_shape_model_originSetShapeModelOriginSetShapeModelOrigin.
- 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.
Input image whose domain will be used to create
the model.
Maximum number of pyramid levels.
Default value:
'auto'
"auto"
"auto"
"auto"
"auto"
"auto"
List of values: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 'auto'"auto""auto""auto""auto""auto"
Smallest rotation of the pattern.
Default value: -0.39
Suggested values: -3.14, -1.57, -0.79, -0.39, -0.20, 0.0
Extent of the rotation angles.
Default value: 0.79
Suggested values: 6.29, 3.14, 1.57, 0.79, 0.39
Restriction: AngleExtent >= 0
Step length of the angles (resolution).
Default value:
'auto'
"auto"
"auto"
"auto"
"auto"
"auto"
Suggested values: 'auto'"auto""auto""auto""auto""auto", 0.0175, 0.0349, 0.0524, 0.0698, 0.0873
Restriction: AngleStep >= 0 && AngleStep <= pi / 16
Minimum scale of the pattern in the row direction.
Default value: 0.9
Suggested values: 0.5, 0.6, 0.7, 0.8, 0.9, 1.0
Restriction: ScaleRMin > 0
Maximum scale of the pattern in the row direction.
Default value: 1.1
Suggested values: 1.0, 1.1, 1.2, 1.3, 1.4, 1.5
Restriction: ScaleRMax >= ScaleRMin
Scale step length (resolution) in the row direction.
Default value:
'auto'
"auto"
"auto"
"auto"
"auto"
"auto"
Suggested values: 'auto'"auto""auto""auto""auto""auto", 0.01, 0.02, 0.05, 0.1, 0.15, 0.2
Restriction: ScaleRStep >= 0
Minimum scale of the pattern in the column direction.
Default value: 0.9
Suggested values: 0.5, 0.6, 0.7, 0.8, 0.9, 1.0
Restriction: ScaleCMin > 0
Maximum scale of the pattern in the column direction.
Default value: 1.1
Suggested values: 1.0, 1.1, 1.2, 1.3, 1.4, 1.5
Restriction: ScaleCMax >= ScaleCMin
Scale step length (resolution) in the column direction.
Default value:
'auto'
"auto"
"auto"
"auto"
"auto"
"auto"
Suggested values: 'auto'"auto""auto""auto""auto""auto", 0.01, 0.02, 0.05, 0.1, 0.15, 0.2
Restriction: ScaleCStep >= 0
Kind of optimization and optionally method used
for generating the model.
Default value:
'auto'
"auto"
"auto"
"auto"
"auto"
"auto"
List of values: '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"
Match metric.
Default value:
'use_polarity'
"use_polarity"
"use_polarity"
"use_polarity"
"use_polarity"
"use_polarity"
List of values: '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"
Threshold or hysteresis thresholds for the contrast
of the object in the template image and optionally
minimum size of the object parts.
Default value:
'auto'
"auto"
"auto"
"auto"
"auto"
"auto"
Suggested values: 'auto'"auto""auto""auto""auto""auto", 'auto_contrast'"auto_contrast""auto_contrast""auto_contrast""auto_contrast""auto_contrast", 'auto_contrast_hyst'"auto_contrast_hyst""auto_contrast_hyst""auto_contrast_hyst""auto_contrast_hyst""auto_contrast_hyst", 'auto_min_size'"auto_min_size""auto_min_size""auto_min_size""auto_min_size""auto_min_size", 10, 20, 30, 40, 60, 80, 100, 120, 140, 160
Minimum contrast of the objects in the search images.
Default value:
'auto'
"auto"
"auto"
"auto"
"auto"
"auto"
Suggested values: 'auto'"auto""auto""auto""auto""auto", 1, 2, 3, 5, 7, 10, 20, 30, 40
Restriction: MinContrast < Contrast
If the parameters are valid, the operator
create_aniso_shape_modelcreate_aniso_shape_modelCreateAnisoShapeModelcreate_aniso_shape_modelCreateAnisoShapeModelCreateAnisoShapeModel returns the value 2 (H_MSG_TRUE). If
necessary an exception is raised. If the parameters
NumLevelsNumLevelsNumLevelsNumLevelsNumLevelsnumLevels and ContrastContrastContrastContrastContrastcontrast are chosen such that the
model contains too few points, the error 8510 is raised.
draw_regiondraw_regionDrawRegiondraw_regionDrawRegionDrawRegion,
reduce_domainreduce_domainReduceDomainreduce_domainReduceDomainReduceDomain,
thresholdthresholdThresholdthresholdThresholdThreshold
find_aniso_shape_modelfind_aniso_shape_modelFindAnisoShapeModelfind_aniso_shape_modelFindAnisoShapeModelFindAnisoShapeModel,
find_aniso_shape_modelsfind_aniso_shape_modelsFindAnisoShapeModelsfind_aniso_shape_modelsFindAnisoShapeModelsFindAnisoShapeModels,
get_shape_model_paramsget_shape_model_paramsGetShapeModelParamsget_shape_model_paramsGetShapeModelParamsGetShapeModelParams,
clear_shape_modelclear_shape_modelClearShapeModelclear_shape_modelClearShapeModelClearShapeModel,
write_shape_modelwrite_shape_modelWriteShapeModelwrite_shape_modelWriteShapeModelWriteShapeModel,
set_shape_model_originset_shape_model_originSetShapeModelOriginset_shape_model_originSetShapeModelOriginSetShapeModelOrigin
create_shape_modelcreate_shape_modelCreateShapeModelcreate_shape_modelCreateShapeModelCreateShapeModel,
create_scaled_shape_modelcreate_scaled_shape_modelCreateScaledShapeModelcreate_scaled_shape_modelCreateScaledShapeModelCreateScaledShapeModel,
create_template_rotcreate_template_rotCreateTemplateRotcreate_template_rotCreateTemplateRotCreateTemplateRot
set_systemset_systemSetSystemset_systemSetSystemSetSystem,
get_systemget_systemGetSystemget_systemGetSystemGetSystem
Matching