Name
find_aniso_shape_modelT_find_aniso_shape_modelFindAnisoShapeModelfind_aniso_shape_modelFindAnisoShapeModelFindAnisoShapeModel — Find the best matches of an anisotropically scaled shape model
in an image.
find_aniso_shape_model(Image : : ModelID, AngleStart, AngleExtent, ScaleRMin, ScaleRMax, ScaleCMin, ScaleCMax, MinScore, NumMatches, MaxOverlap, SubPixel, NumLevels, Greediness : Row, Column, Angle, ScaleR, ScaleC, Score)
Herror T_find_aniso_shape_model(const Hobject Image, const Htuple ModelID, const Htuple AngleStart, const Htuple AngleExtent, const Htuple ScaleRMin, const Htuple ScaleRMax, const Htuple ScaleCMin, const Htuple ScaleCMax, const Htuple MinScore, const Htuple NumMatches, const Htuple MaxOverlap, const Htuple SubPixel, const Htuple NumLevels, const Htuple Greediness, Htuple* Row, Htuple* Column, Htuple* Angle, Htuple* ScaleR, Htuple* ScaleC, Htuple* Score)
Herror find_aniso_shape_model(Hobject Image, const HTuple& ModelID, const HTuple& AngleStart, const HTuple& AngleExtent, const HTuple& ScaleRMin, const HTuple& ScaleRMax, const HTuple& ScaleCMin, const HTuple& ScaleCMax, const HTuple& MinScore, const HTuple& NumMatches, const HTuple& MaxOverlap, const HTuple& SubPixel, const HTuple& NumLevels, const HTuple& Greediness, HTuple* Row, HTuple* Column, HTuple* Angle, HTuple* ScaleR, HTuple* ScaleC, HTuple* Score)
HTuple HImage::FindAnisoShapeModel(const HShapeModel& ModelID, const HTuple& AngleStart, const HTuple& AngleExtent, const HTuple& ScaleRMin, const HTuple& ScaleRMax, const HTuple& ScaleCMin, const HTuple& ScaleCMax, const HTuple& MinScore, const HTuple& NumMatches, const HTuple& MaxOverlap, const HTuple& SubPixel, const HTuple& NumLevels, const HTuple& Greediness, HTuple* Column, HTuple* Angle, HTuple* ScaleR, HTuple* ScaleC, HTuple* Score) const
HTuple HShapeModel::FindAnisoShapeModel(const HImage& Image, const HTuple& AngleStart, const HTuple& AngleExtent, const HTuple& ScaleRMin, const HTuple& ScaleRMax, const HTuple& ScaleCMin, const HTuple& ScaleCMax, const HTuple& MinScore, const HTuple& NumMatches, const HTuple& MaxOverlap, const HTuple& SubPixel, const HTuple& NumLevels, const HTuple& Greediness, HTuple* Column, HTuple* Angle, HTuple* ScaleR, HTuple* ScaleC, HTuple* Score) const
void FindAnisoShapeModel(const HObject& Image, const HTuple& ModelID, const HTuple& AngleStart, const HTuple& AngleExtent, const HTuple& ScaleRMin, const HTuple& ScaleRMax, const HTuple& ScaleCMin, const HTuple& ScaleCMax, const HTuple& MinScore, const HTuple& NumMatches, const HTuple& MaxOverlap, const HTuple& SubPixel, const HTuple& NumLevels, const HTuple& Greediness, HTuple* Row, HTuple* Column, HTuple* Angle, HTuple* ScaleR, HTuple* ScaleC, HTuple* Score)
void HShapeModel::FindAnisoShapeModel(const HImage& Image, double AngleStart, double AngleExtent, double ScaleRMin, double ScaleRMax, double ScaleCMin, double ScaleCMax, double MinScore, Hlong NumMatches, double MaxOverlap, const HTuple& SubPixel, const HTuple& NumLevels, double Greediness, HTuple* Row, HTuple* Column, HTuple* Angle, HTuple* ScaleR, HTuple* ScaleC, HTuple* Score) const
void HShapeModel::FindAnisoShapeModel(const HImage& Image, double AngleStart, double AngleExtent, double ScaleRMin, double ScaleRMax, double ScaleCMin, double ScaleCMax, double MinScore, Hlong NumMatches, double MaxOverlap, const HString& SubPixel, Hlong NumLevels, double Greediness, HTuple* Row, HTuple* Column, HTuple* Angle, HTuple* ScaleR, HTuple* ScaleC, HTuple* Score) const
void HShapeModel::FindAnisoShapeModel(const HImage& Image, double AngleStart, double AngleExtent, double ScaleRMin, double ScaleRMax, double ScaleCMin, double ScaleCMax, double MinScore, Hlong NumMatches, double MaxOverlap, const char* SubPixel, Hlong NumLevels, double Greediness, HTuple* Row, HTuple* Column, HTuple* Angle, HTuple* ScaleR, HTuple* ScaleC, HTuple* Score) const
void HImage::FindAnisoShapeModel(const HShapeModel& ModelID, double AngleStart, double AngleExtent, double ScaleRMin, double ScaleRMax, double ScaleCMin, double ScaleCMax, double MinScore, Hlong NumMatches, double MaxOverlap, const HTuple& SubPixel, const HTuple& NumLevels, double Greediness, HTuple* Row, HTuple* Column, HTuple* Angle, HTuple* ScaleR, HTuple* ScaleC, HTuple* Score) const
void HImage::FindAnisoShapeModel(const HShapeModel& ModelID, double AngleStart, double AngleExtent, double ScaleRMin, double ScaleRMax, double ScaleCMin, double ScaleCMax, double MinScore, Hlong NumMatches, double MaxOverlap, const HString& SubPixel, Hlong NumLevels, double Greediness, HTuple* Row, HTuple* Column, HTuple* Angle, HTuple* ScaleR, HTuple* ScaleC, HTuple* Score) const
void HImage::FindAnisoShapeModel(const HShapeModel& ModelID, double AngleStart, double AngleExtent, double ScaleRMin, double ScaleRMax, double ScaleCMin, double ScaleCMax, double MinScore, Hlong NumMatches, double MaxOverlap, const char* SubPixel, Hlong NumLevels, double Greediness, HTuple* Row, HTuple* Column, HTuple* Angle, HTuple* ScaleR, HTuple* ScaleC, HTuple* Score) const
void HOperatorSetX.FindAnisoShapeModel(
[in] IHUntypedObjectX* Image, [in] VARIANT ModelID, [in] VARIANT AngleStart, [in] VARIANT AngleExtent, [in] VARIANT ScaleRMin, [in] VARIANT ScaleRMax, [in] VARIANT ScaleCMin, [in] VARIANT ScaleCMax, [in] VARIANT MinScore, [in] VARIANT NumMatches, [in] VARIANT MaxOverlap, [in] VARIANT SubPixel, [in] VARIANT NumLevels, [in] VARIANT Greediness, [out] VARIANT* Row, [out] VARIANT* Column, [out] VARIANT* Angle, [out] VARIANT* ScaleR, [out] VARIANT* ScaleC, [out] VARIANT* Score)
VARIANT HShapeModelX.FindAnisoShapeModel(
[in] IHImageX* Image, [in] double AngleStart, [in] double AngleExtent, [in] double ScaleRMin, [in] double ScaleRMax, [in] double ScaleCMin, [in] double ScaleCMax, [in] double MinScore, [in] Hlong NumMatches, [in] double MaxOverlap, [in] VARIANT SubPixel, [in] VARIANT NumLevels, [in] double Greediness, [out] VARIANT* Column, [out] VARIANT* Angle, [out] VARIANT* ScaleR, [out] VARIANT* ScaleC, [out] VARIANT* Score)
VARIANT HImageX.FindAnisoShapeModel(
[in] IHShapeModelX* ModelID, [in] double AngleStart, [in] double AngleExtent, [in] double ScaleRMin, [in] double ScaleRMax, [in] double ScaleCMin, [in] double ScaleCMax, [in] double MinScore, [in] Hlong NumMatches, [in] double MaxOverlap, [in] VARIANT SubPixel, [in] VARIANT NumLevels, [in] double Greediness, [out] VARIANT* Column, [out] VARIANT* Angle, [out] VARIANT* ScaleR, [out] VARIANT* ScaleC, [out] VARIANT* Score)
static void HOperatorSet.FindAnisoShapeModel(HObject image, HTuple modelID, HTuple angleStart, HTuple angleExtent, HTuple scaleRMin, HTuple scaleRMax, HTuple scaleCMin, HTuple scaleCMax, HTuple minScore, HTuple numMatches, HTuple maxOverlap, HTuple subPixel, HTuple numLevels, HTuple greediness, out HTuple row, out HTuple column, out HTuple angle, out HTuple scaleR, out HTuple scaleC, out HTuple score)
void HShapeModel.FindAnisoShapeModel(HImage image, double angleStart, double angleExtent, double scaleRMin, double scaleRMax, double scaleCMin, double scaleCMax, double minScore, int numMatches, double maxOverlap, HTuple subPixel, HTuple numLevels, double greediness, out HTuple row, out HTuple column, out HTuple angle, out HTuple scaleR, out HTuple scaleC, out HTuple score)
void HShapeModel.FindAnisoShapeModel(HImage image, double angleStart, double angleExtent, double scaleRMin, double scaleRMax, double scaleCMin, double scaleCMax, double minScore, int numMatches, double maxOverlap, string subPixel, int numLevels, double greediness, out HTuple row, out HTuple column, out HTuple angle, out HTuple scaleR, out HTuple scaleC, out HTuple score)
void HImage.FindAnisoShapeModel(HShapeModel modelID, double angleStart, double angleExtent, double scaleRMin, double scaleRMax, double scaleCMin, double scaleCMax, double minScore, int numMatches, double maxOverlap, HTuple subPixel, HTuple numLevels, double greediness, out HTuple row, out HTuple column, out HTuple angle, out HTuple scaleR, out HTuple scaleC, out HTuple score)
void HImage.FindAnisoShapeModel(HShapeModel modelID, double angleStart, double angleExtent, double scaleRMin, double scaleRMax, double scaleCMin, double scaleCMax, double minScore, int numMatches, double maxOverlap, string subPixel, int numLevels, double greediness, out HTuple row, out HTuple column, out HTuple angle, out HTuple scaleR, out HTuple scaleC, out HTuple score)
The operator find_aniso_shape_modelfind_aniso_shape_modelFindAnisoShapeModelfind_aniso_shape_modelFindAnisoShapeModelFindAnisoShapeModel finds the best
NumMatchesNumMatchesNumMatchesNumMatchesNumMatchesnumMatches instances of the anisotropically scaled
shape model ModelIDModelIDModelIDModelIDModelIDmodelID in the input image ImageImageImageImageImageimage. The
model must have been created previously by calling
create_aniso_shape_modelcreate_aniso_shape_modelCreateAnisoShapeModelcreate_aniso_shape_modelCreateAnisoShapeModelCreateAnisoShapeModel or read_shape_modelread_shape_modelReadShapeModelread_shape_modelReadShapeModelReadShapeModel.
The position, rotation, and scale in the row and column direction of
the found instances of the model are returned in RowRowRowRowRowrow,
ColumnColumnColumnColumnColumncolumn, AngleAngleAngleAngleAngleangle, ScaleRScaleRScaleRScaleRScaleRscaleR, and
ScaleCScaleCScaleCScaleCScaleCscaleC.
The coordinates RowRowRowRowRowrow and ColumnColumnColumnColumnColumncolumn are related to the
position of the origin of the shape model in the search image.
However, RowRowRowRowRowrow and ColumnColumnColumnColumnColumncolumn do not
exactly correspond to this position.
Instead, find_shape_modelfind_shape_modelFindShapeModelfind_shape_modelFindShapeModelFindShapeModel returns slightly modified values
that are optimized for creating a transformation matrix, that can be used for
alignment or visualization of the model contours.
(This has to do with the way HALCON transforms iconic objects,
see affine_trans_pixelaffine_trans_pixelAffineTransPixelaffine_trans_pixelAffineTransPixelAffineTransPixel).
The example below shows how to
create the transformation matrix for alignment and calculate the
exact coordinates of the found matches.
By default, the model
origin is the center of gravity of the domain (region) of the image
that was used to create the shape model with
create_shape_modelcreate_shape_modelCreateShapeModelcreate_shape_modelCreateShapeModelCreateShapeModel. A different origin can be set with
set_shape_model_originset_shape_model_originSetShapeModelOriginset_shape_model_originSetShapeModelOriginSetShapeModelOrigin.
Additionally, the score of each found instance is returned in
ScoreScoreScoreScoreScorescore. The score is a number between 0 and 1, which is an
approximate measure of how much of the model is visible in the
image. If, for example, half of the model is occluded, the score
cannot exceed 0.5.
The domain of the image ImageImageImageImageImageimage determines the search space
for the reference point of the model, i.e., for the center of
gravity of the domain (region) of the image that was used to create
the shape model with create_aniso_shape_modelcreate_aniso_shape_modelCreateAnisoShapeModelcreate_aniso_shape_modelCreateAnisoShapeModelCreateAnisoShapeModel. A different
origin set with set_shape_model_originset_shape_model_originSetShapeModelOriginset_shape_model_originSetShapeModelOriginSetShapeModelOrigin is not taken into
account. The model is searched within those points of the domain of
the image, in which the model lies completely within the image.
This means that the model will not be found if it extends beyond the
borders of the image, even if it would achieve a score greater than
MinScoreMinScoreMinScoreMinScoreMinScoreminScore (see below). This behavior can be changed with
set_system('border_shape_models','true')set_system("border_shape_models","true")SetSystem("border_shape_models","true")set_system("border_shape_models","true")SetSystem("border_shape_models","true")SetSystem("border_shape_models","true") for all models or
with set_shape_model_param(ModelID, 'border_shape_models','true')set_shape_model_param(ModelID, "border_shape_models","true")SetShapeModelParam(ModelID, "border_shape_models","true")set_shape_model_param(ModelID, "border_shape_models","true")SetShapeModelParam(ModelID, "border_shape_models","true")SetShapeModelParam(ModelID, "border_shape_models","true")
for a specific model, which will cause
models that extend beyond the image border to be found if they
achieve a score greater than MinScoreMinScoreMinScoreMinScoreMinScoreminScore. Here, points lying
outside the image are regarded as being occluded, i.e., they lower
the score. It should be noted that the runtime of the search will
increase in this mode.
The parameters AngleStartAngleStartAngleStartAngleStartAngleStartangleStart and AngleExtentAngleExtentAngleExtentAngleExtentAngleExtentangleExtent
determine the range of rotations for which the model is searched.
The parameters ScaleRMinScaleRMinScaleRMinScaleRMinScaleRMinscaleRMin, ScaleRMaxScaleRMaxScaleRMaxScaleRMaxScaleRMaxscaleRMax,
ScaleCMinScaleCMinScaleCMinScaleCMinScaleCMinscaleCMin, and ScaleCMaxScaleCMaxScaleCMaxScaleCMaxScaleCMaxscaleCMax determine the range of
scales in the row and column directions for which the model is
searched. If necessary, both ranges are clipped to the range given
when the model was created with create_aniso_shape_modelcreate_aniso_shape_modelCreateAnisoShapeModelcreate_aniso_shape_modelCreateAnisoShapeModelCreateAnisoShapeModel.
In particular, this means that the angle ranges of the model and the
search must truly overlap. The angle range in the search is not
adapted modulo 2*pi. To simplify the presentation, all
angles in the remainder of the paragraph are given in degrees,
whereas they have to be specified in radians in
find_aniso_shape_modelfind_aniso_shape_modelFindAnisoShapeModelfind_aniso_shape_modelFindAnisoShapeModelFindAnisoShapeModel. Hence, if the model, for example,
was created with AngleStartAngleStartAngleStartAngleStartAngleStartangleStart = -20° and
AngleExtentAngleExtentAngleExtentAngleExtentAngleExtentangleExtent = 40° and the angle search space
in find_scaled_shape_modelfind_scaled_shape_modelFindScaledShapeModelfind_scaled_shape_modelFindScaledShapeModelFindScaledShapeModel is, for example, set to
AngleStartAngleStartAngleStartAngleStartAngleStartangleStart = 350° and AngleExtentAngleExtentAngleExtentAngleExtentAngleExtentangleExtent =
20°, the model will not be found, even though the angle
ranges would overlap if they were regarded modulo
360°. To find the model, in this example it would be
necessary to select AngleStartAngleStartAngleStartAngleStartAngleStartangleStart = -10°.
If in ModelIDModelIDModelIDModelIDModelIDmodelID a model is passed that was created by
using create_shape_modelcreate_shape_modelCreateShapeModelcreate_shape_modelCreateShapeModelCreateShapeModel or create_scaled_shape_modelcreate_scaled_shape_modelCreateScaledShapeModelcreate_scaled_shape_modelCreateScaledShapeModelCreateScaledShapeModel
then the model is searched with an isotropic scaling of 1.0
or with an isotropic scaling within the range from ScaleRMinScaleRMinScaleRMinScaleRMinScaleRMinscaleRMin
to ScaleRMaxScaleRMaxScaleRMaxScaleRMaxScaleRMaxscaleRMax, respectively. In this case, for ScaleRScaleRScaleRScaleRScaleRscaleR
and ScaleCScaleCScaleCScaleCScaleCscaleC identical values are returned.
Furthermore, it should be noted that in some cases instances with a
rotation or scale that is slightly outside the specified range are
found. This may happen if the specified range is smaller than the
range given when the model was created.
The parameter MinScoreMinScoreMinScoreMinScoreMinScoreminScore determines what score a potential
match must at least have to be regarded as an instance of the model
in the image. The larger MinScoreMinScoreMinScoreMinScoreMinScoreminScore is chosen, the faster
the search is. If the model can be expected never to be occluded in
the images, MinScoreMinScoreMinScoreMinScoreMinScoreminScore may be set as high as 0.8 or even 0.9.
If the matches are not tracked to the lowest pyramid level (see
below) it might happen that instances with a score slightly below
MinScoreMinScoreMinScoreMinScoreMinScoreminScore are found.
The maximum number of instances to be found can be determined with
NumMatchesNumMatchesNumMatchesNumMatchesNumMatchesnumMatches. If more than NumMatchesNumMatchesNumMatchesNumMatchesNumMatchesnumMatches instances
with a score greater than MinScoreMinScoreMinScoreMinScoreMinScoreminScore are found in the image,
only the best NumMatchesNumMatchesNumMatchesNumMatchesNumMatchesnumMatches instances are returned. If fewer
than NumMatchesNumMatchesNumMatchesNumMatchesNumMatchesnumMatches are found, only that number is returned,
i.e., the parameter MinScoreMinScoreMinScoreMinScoreMinScoreminScore takes precedence over
NumMatchesNumMatchesNumMatchesNumMatchesNumMatchesnumMatches. If all model instances exceeding
MinScoreMinScoreMinScoreMinScoreMinScoreminScore in the image should be found, NumMatchesNumMatchesNumMatchesNumMatchesNumMatchesnumMatches
must be set to 0.
If the model exhibits symmetries it may happen that multiple
instances with similar positions but different rotations are found
in the image. The parameter MaxOverlapMaxOverlapMaxOverlapMaxOverlapMaxOverlapmaxOverlap determines by what
fraction (i.e., a number between 0 and 1) two instances may at most
overlap in order to consider them as different instances, and hence
to be returned separately. If two instances overlap each other by
more than MaxOverlapMaxOverlapMaxOverlapMaxOverlapMaxOverlapmaxOverlap only the best instance is returned.
The calculation of the overlap is based on the smallest enclosing
rectangle of arbitrary orientation (see smallest_rectangle2smallest_rectangle2SmallestRectangle2smallest_rectangle2SmallestRectangle2SmallestRectangle2)
of the found instances. If MaxOverlapMaxOverlapMaxOverlapMaxOverlapMaxOverlapmaxOverlap=0, the found
instances may not overlap at all, while for MaxOverlapMaxOverlapMaxOverlapMaxOverlapMaxOverlapmaxOverlap=1
all instances are returned.
The parameter SubPixelSubPixelSubPixelSubPixelSubPixelsubPixel determines whether the instances
should be extracted with subpixel accuracy. If SubPixelSubPixelSubPixelSubPixelSubPixelsubPixel is
set to 'none'"none""none""none""none""none" (or 'false'"false""false""false""false""false" for backwards
compatibility) the model's pose is only determined with pixel
accuracy and the angle and scale resolution that was specified with
create_aniso_shape_modelcreate_aniso_shape_modelCreateAnisoShapeModelcreate_aniso_shape_modelCreateAnisoShapeModelCreateAnisoShapeModel. If SubPixelSubPixelSubPixelSubPixelSubPixelsubPixel is set to
'interpolation'"interpolation""interpolation""interpolation""interpolation""interpolation" (or 'true'"true""true""true""true""true") the position as well
as the rotation and scale are determined with subpixel accuracy. In
this mode, the model's pose is interpolated from the score function.
This mode costs almost no computation time and achieves an accuracy
that is high enough for most applications. In some applications,
however, the accuracy requirements are extremely high. In these
cases, the model's pose can be determined through a least-squares
adjustment, i.e., by minimizing the distances of the model points to
their corresponding image points. In contrast to
'interpolation'"interpolation""interpolation""interpolation""interpolation""interpolation", this mode requires additional computation
time. The different modes for least-squares adjustment
('least_squares'"least_squares""least_squares""least_squares""least_squares""least_squares", 'least_squares_high'"least_squares_high""least_squares_high""least_squares_high""least_squares_high""least_squares_high", and
'least_squares_very_high'"least_squares_very_high""least_squares_very_high""least_squares_very_high""least_squares_very_high""least_squares_very_high") can be used to determine the
accuracy with which the minimum distance is being searched. The
higher the accuracy is chosen, the longer the subpixel extraction
will take, however. Usually, SubPixelSubPixelSubPixelSubPixelSubPixelsubPixel should be set to
'interpolation'"interpolation""interpolation""interpolation""interpolation""interpolation". If least-squares adjustment is desired,
'least_squares'"least_squares""least_squares""least_squares""least_squares""least_squares" should be chosen because this results in
the best tradeoff between runtime and accuracy.
Objects that are slightly deformed with respect to the model, in
some cases cannot be found or are found but only with a low
accuracy. For such objects it is possible to additionally pass a
maximal allowable object deformation in the parameter
SubPixelSubPixelSubPixelSubPixelSubPixelsubPixel. The deformation must be specified in pixels. This
can be done by passing the optional parameter value
'max_deformation '"max_deformation ""max_deformation ""max_deformation ""max_deformation ""max_deformation " followed by an integer value between
0 and 32 (in the same string), which specifies the
maximum deformation. For example, if the shape of the object may be
deformed by up to 2 pixels with respect to the shape that is stored
in the model, the value 'max_deformation 2'"max_deformation 2""max_deformation 2""max_deformation 2""max_deformation 2""max_deformation 2" must be passed
in SubPixelSubPixelSubPixelSubPixelSubPixelsubPixel in addition to the above described mode for the
subpixel extraction, i.e., for example ['least_squares',
'max_deformation 2']["least_squares",
"max_deformation 2"]["least_squares",
"max_deformation 2"]["least_squares",
"max_deformation 2"]["least_squares",
"max_deformation 2"]["least_squares",
"max_deformation 2"]. Passing the value 'max_deformation
0'"max_deformation
0""max_deformation
0""max_deformation
0""max_deformation
0""max_deformation
0" corresponds to a search without allowing deformations, i.e., the
behavior is the same as if no 'max_deformation '"max_deformation ""max_deformation ""max_deformation ""max_deformation ""max_deformation " is passed.
Note that higher values for the maximum deformation often result in
an increased runtime. Furthermore, the higher the deformation value
is chosen, the higher is the risk of finding wrong model instances.
Both problems mainly arise when searching for small objects or for
objects with fine structures. This is because such kinds of objects
for higher deformations lose their characteristic shape, which is
important for a robust search. Also note that for higher
deformations the accuracy of partially occluded objects might
decrease if clutter is present close to the object. Consequently,
the maximum deformation should be chosen as small as possible and
only as high as necessary.
Approximately rotationally symmetric objects may not be found if
'max_deformation'"max_deformation""max_deformation""max_deformation""max_deformation""max_deformation" and AngleExtentAngleExtentAngleExtentAngleExtentAngleExtentangleExtent are both set to a value greater
than 0. In that case, ambiguities may occur that cannot be resolved,
and the match is rejected as false. If this happens, try to set either
'max_deformation'"max_deformation""max_deformation""max_deformation""max_deformation""max_deformation" or AngleExtentAngleExtentAngleExtentAngleExtentAngleExtentangleExtent to 0, or adjust the model such that
symmetries are reduced. When specifying a deformation higher
than 0 the computation of the score depends on the chosen
value for the subpixel extraction. In most cases, the score of a
match changes if 'least_squares'"least_squares""least_squares""least_squares""least_squares""least_squares",
'least_squares_high'"least_squares_high""least_squares_high""least_squares_high""least_squares_high""least_squares_high", or 'least_squares_very_high'"least_squares_very_high""least_squares_very_high""least_squares_very_high""least_squares_very_high""least_squares_very_high"
(see above) is chosen for the subpixel extraction (in comparison to
'none'"none""none""none""none""none" or 'interpolation'"interpolation""interpolation""interpolation""interpolation""interpolation"). Furthermore, if one of
the least-squares adjustments is selected the score might increase
when increasing the maximum deformation because then for the model
points more corresponding image points can be found.
To get a meaningful score value and to avoid erroneous matches, we
recommend to always combine the allowance of a deformation with a
least-squares adjustment.
The number of pyramid levels used during the search is determined
with NumLevelsNumLevelsNumLevelsNumLevelsNumLevelsnumLevels. If necessary, the number of levels is
clipped to the range given when the shape model was created with
create_aniso_shape_modelcreate_aniso_shape_modelCreateAnisoShapeModelcreate_aniso_shape_modelCreateAnisoShapeModelCreateAnisoShapeModel. If NumLevelsNumLevelsNumLevelsNumLevelsNumLevelsnumLevels is set to
0, the number of pyramid levels specified in
create_aniso_shape_modelcreate_aniso_shape_modelCreateAnisoShapeModelcreate_aniso_shape_modelCreateAnisoShapeModelCreateAnisoShapeModel is used. Optionally,
NumLevelsNumLevelsNumLevelsNumLevelsNumLevelsnumLevels can contain a second value that determines the
lowest pyramid level to which the found matches are tracked. Hence,
a value of [4,2] for NumLevelsNumLevelsNumLevelsNumLevelsNumLevelsnumLevels means that the
matching starts at the fourth pyramid level and tracks the matches
to the second lowest pyramid level (the lowest pyramid level is
denoted by a value of 1). This mechanism can be used to decrease
the runtime of the matching. It should be noted, however, that in
general the accuracy of the extracted pose parameters is lower in
this mode than in the normal mode, in which the matches are tracked
to the lowest pyramid level. Hence, if a high accuracy is desired,
SubPixelSubPixelSubPixelSubPixelSubPixelsubPixel should be set to at least
'least_squares'"least_squares""least_squares""least_squares""least_squares""least_squares". If the lowest pyramid level to use is
chosen too large, it may happen that the desired accuracy cannot be
achieved, or that wrong instances of the model are found because the
model is not specific enough on the higher pyramid levels to
facilitate a reliable selection of the correct instance of the
model. In this case, the lowest pyramid level to use must be set to
a smaller value.
In input images of poor quality, i.e., in images that are, e.g.,
defocused, deformed, or noisy, often no instances of the shape model
can be found on the lowest pyramid level. The reason for this
behavior is the missing or deformed edge information which is a
result of the poor image quality. Nevertheless, the edge
information may be sufficient on higher pyramid levels. But keep in
mind the above mentioned restrictions on accuracy and robustness if
instances that were found on higher pyramid levels are used. The
selection of the suitable pyramid level, i.e., the lowest pyramid
level on which at least one instance of the shape model can be
found, depends on the model and on the input image. This pyramid
level may vary from image to image. To facilitate the matching on
images of poor quality, the lowest pyramid level on which at least
one instance of the model can be found can be determined
automatically during the matching. To activate this mechanism, i.e.,
to use the so-called 'increased tolerance mode', the
lowest pyramid level must be specified negatively in
NumLevelsNumLevelsNumLevelsNumLevelsNumLevelsnumLevels. If, e.g., NumLevelsNumLevelsNumLevelsNumLevelsNumLevelsnumLevels is set to
[4,-2], the matching starts at the fourth pyramid level and
tracks the matches to the second lowest pyramid level. This means
that an instance of the shape model is searched on the pyramid level
2. If no instance of the model can be found on this pyramid level,
the lowest pyramid level is determined on which at least one
instance of the model can be found. The instances of this pyramid
level will then be returned.
The parameter GreedinessGreedinessGreedinessGreedinessGreedinessgreediness determines how “greedily” the
search should be carried out. If GreedinessGreedinessGreedinessGreedinessGreedinessgreediness=0, a safe
search heuristic is used, which always finds the model if it is
visible in the image. However, the search will be relatively time
consuming in this case. If GreedinessGreedinessGreedinessGreedinessGreedinessgreediness=1, an unsafe
search heuristic is used, which may cause the model not to be found
in rare cases, even though it is visible in the image. For
GreedinessGreedinessGreedinessGreedinessGreedinessgreediness=1, the maximum search speed is achieved. In
almost all cases, the shape model will always be found for
GreedinessGreedinessGreedinessGreedinessGreedinessgreediness=0.9.
Using the operator set_shape_model_paramset_shape_model_paramSetShapeModelParamset_shape_model_paramSetShapeModelParamSetShapeModelParam you can specify a
'timeout'"timeout""timeout""timeout""timeout""timeout" for find_aniso_shape_modelfind_aniso_shape_modelFindAnisoShapeModelfind_aniso_shape_modelFindAnisoShapeModelFindAnisoShapeModel.
If find_aniso_shape_modelfind_aniso_shape_modelFindAnisoShapeModelfind_aniso_shape_modelFindAnisoShapeModelFindAnisoShapeModel reaches this 'timeout'"timeout""timeout""timeout""timeout""timeout", it
terminates without results and returns the error code 9400 (H_ERR_TIMEOUT).
Depending on the scaling ranges specified by ScaleRMinScaleRMinScaleRMinScaleRMinScaleRMinscaleRMin,
ScaleRMaxScaleRMaxScaleRMaxScaleRMaxScaleRMaxscaleRMax, ScaleCMinScaleCMinScaleCMinScaleCMinScaleCMinscaleCMin, and ScaleCMaxScaleCMaxScaleCMaxScaleCMaxScaleCMaxscaleCMax,
find_aniso_shape_modelfind_aniso_shape_modelFindAnisoShapeModelfind_aniso_shape_modelFindAnisoShapeModelFindAnisoShapeModel needs a significant
amount of time to free cached transformations if the shape model is not
pregenerated. As this transformations have to be freed after a timeout
occurs, the runtime of find_aniso_shape_modelfind_aniso_shape_modelFindAnisoShapeModelfind_aniso_shape_modelFindAnisoShapeModelFindAnisoShapeModel exceeds the value of
the specified 'timeout'"timeout""timeout""timeout""timeout""timeout" by this time.
- Multithreading type: reentrant (runs in parallel with non-exclusive operators).
- Multithreading scope: global (may be called from any thread).
- Automatically parallelized on internal data level.
Input image in which the model should be found.
Smallest rotation of the model.
Default value: -0.39
Suggested values: -3.14, -1.57, -0.78, -0.39, -0.20, 0.0
Extent of the rotation angles.
Default value: 0.79
Suggested values: 6.29, 3.14, 1.57, 0.78, 0.39, 0.0
Restriction: AngleExtent >= 0
Minimum scale of the model 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 model 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
Minimum scale of the model 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 model 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
Minimum score of the instances of the model to
be found.
Default value: 0.5
Suggested values: 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0
Typical range of values: 0
≤
MinScore
MinScore
MinScore
MinScore
MinScore
minScore
≤
1
Minimum increment: 0.01
Recommended increment: 0.05
Number of instances of the model to be found
(or 0 for all matches).
Default value: 1
Suggested values: 0, 1, 2, 3, 4, 5, 10, 20
Maximum overlap of the instances of the model
to be found.
Default value: 0.5
Suggested values: 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0
Typical range of values: 0
≤
MaxOverlap
MaxOverlap
MaxOverlap
MaxOverlap
MaxOverlap
maxOverlap
≤
1
Minimum increment: 0.01
Recommended increment: 0.05
Subpixel accuracy if not equal to 'none'"none""none""none""none""none".
Default value:
'least_squares'
"least_squares"
"least_squares"
"least_squares"
"least_squares"
"least_squares"
List of values: 'interpolation'"interpolation""interpolation""interpolation""interpolation""interpolation", 'least_squares'"least_squares""least_squares""least_squares""least_squares""least_squares", 'least_squares_high'"least_squares_high""least_squares_high""least_squares_high""least_squares_high""least_squares_high", 'least_squares_very_high'"least_squares_very_high""least_squares_very_high""least_squares_very_high""least_squares_very_high""least_squares_very_high", 'max_deformation 1'"max_deformation 1""max_deformation 1""max_deformation 1""max_deformation 1""max_deformation 1", 'max_deformation 2'"max_deformation 2""max_deformation 2""max_deformation 2""max_deformation 2""max_deformation 2", 'max_deformation 3'"max_deformation 3""max_deformation 3""max_deformation 3""max_deformation 3""max_deformation 3", 'max_deformation 4'"max_deformation 4""max_deformation 4""max_deformation 4""max_deformation 4""max_deformation 4", 'max_deformation 5'"max_deformation 5""max_deformation 5""max_deformation 5""max_deformation 5""max_deformation 5", 'max_deformation 6'"max_deformation 6""max_deformation 6""max_deformation 6""max_deformation 6""max_deformation 6", 'none'"none""none""none""none""none"
Number of pyramid levels used in the matching
(and lowest pyramid level to use if
|NumLevelsNumLevelsNumLevelsNumLevelsNumLevelsnumLevels| = 2).
Default value: 0
List of values: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
“Greediness” of the search heuristic (0: safe
but slow; 1: fast but matches may be missed).
Default value: 0.9
Suggested values: 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0
Typical range of values: 0
≤
Greediness
Greediness
Greediness
Greediness
Greediness
greediness
≤
1
Minimum increment: 0.01
Recommended increment: 0.05
Row coordinate of the found instances of the model.
Column coordinate of the found instances of the model.
Rotation angle of the found instances of the model.
Scale of the found instances of the model in
the row direction.
Scale of the found instances of the model in
the column direction.
Score of the found instances of the model.
create_aniso_shape_model (ImageReduced, 0, rad(-15), rad(30), 0, \
0.9, 1.1, 0, 0.9, 1.1, 0, 'none', \
'use_polarity', 30, 10, ModelID)
get_shape_model_contours (ModelXLD, ModelID, 1)
find_aniso_shape_model (SearchImage, ModelID, rad(-15), rad(30), \
0.9, 1.1, 0.9, 1.1, 0.5, 1, 0.5, 'interpolation', \
0, 0, Row, Column, Angle, ScaleR, ScaleC, Score)
* Create transformation matrix
hom_mat2d_identity (HomMat2DIdentity)
hom_mat2d_scale (HomMat2DIdentity, ScaleR, ScaleC, 0, 0, HomMat2DScale)
hom_mat2d_rotate (HomMat2DScale, Angle, 0, 0, HomMat2DRotate)
hom_mat2d_translate (HomMat2DRotate, Row, Column, HomMat2DObject)
* Transform model contours for visualization
affine_trans_contour_xld (ModelXLD, ObjectXLD, HomMat2DObject)
* Calculate true position of the model origin in the search image
affine_trans_pixel (HomMat2DObject, 0, 0, RowObject, ColObject)
If the parameter values are correct, the operator
find_aniso_shape_modelfind_aniso_shape_modelFindAnisoShapeModelfind_aniso_shape_modelFindAnisoShapeModelFindAnisoShapeModel returns the value 2 (H_MSG_TRUE). If the
input is empty (no input images are available) the behavior can be
set via set_system('no_object_result',<Result>)set_system("no_object_result",<Result>)SetSystem("no_object_result",<Result>)set_system("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>). If
necessary, an exception is raised.
create_aniso_shape_modelcreate_aniso_shape_modelCreateAnisoShapeModelcreate_aniso_shape_modelCreateAnisoShapeModelCreateAnisoShapeModel,
read_shape_modelread_shape_modelReadShapeModelread_shape_modelReadShapeModelReadShapeModel,
set_shape_model_originset_shape_model_originSetShapeModelOriginset_shape_model_originSetShapeModelOriginSetShapeModelOrigin
clear_shape_modelclear_shape_modelClearShapeModelclear_shape_modelClearShapeModelClearShapeModel
find_shape_modelfind_shape_modelFindShapeModelfind_shape_modelFindShapeModelFindShapeModel,
find_scaled_shape_modelfind_scaled_shape_modelFindScaledShapeModelfind_scaled_shape_modelFindScaledShapeModelFindScaledShapeModel,
find_shape_modelsfind_shape_modelsFindShapeModelsfind_shape_modelsFindShapeModelsFindShapeModels,
find_scaled_shape_modelsfind_scaled_shape_modelsFindScaledShapeModelsfind_scaled_shape_modelsFindScaledShapeModelsFindScaledShapeModels,
find_aniso_shape_modelsfind_aniso_shape_modelsFindAnisoShapeModelsfind_aniso_shape_modelsFindAnisoShapeModelsFindAnisoShapeModels,
best_match_rot_mgbest_match_rot_mgBestMatchRotMgbest_match_rot_mgBestMatchRotMgBestMatchRotMg
set_systemset_systemSetSystemset_systemSetSystemSetSystem,
get_systemget_systemGetSystemget_systemGetSystemGetSystem
Matching