
Reference Manual
Chapter
5
IVC-2D
©
SICK AG • Advanced Industrial Sensors • www.sick.com • All rights reserved
215
Locating Shapes (tips and tricks)
Excluding parts of the reference shape that may vary during runtime will improve the
robustness. Such variations may stem from the inspected objects themselves (e.g. varying
date codes on packages), from illumination effects (e.g. shadows or direct reflexes) or
from occlusion effects. Masks can be used to exclude the parts of the reference shapes
that are affected by variations.
If the ROI perimeter is used with the ‘Add Shape Runtime’ tool to define the ROI for the
reference shape, please use the filling
0 = internal
to get all edges within the ROI.
Locate tips
The region of interest defines the area to be searched. If using a search ROI, only shapes
with all edges completely inside the ROI will be found.
If using the
Search full image
setting, also shapes with edges partly outside the image
may be returned in the search result. The criterion for being regarded inside using the
“Search full image” mode is that the center of gravity point of the ROI used when creating
the reference shape must be inside the image. Note that there therefore is a difference
between the “Search full image” mode and to search within a ROI covering the whole
image.
The value of the
Edge strength
parameter of the reference shape is also used when
searching for shapes. Having a similar contrast level in the reference image and in the
search image will therefore increase the robustness of the tool.
It is good practice to set the parameter
Max number of shapes
= 1 if only searching for
one shape. Using a higher value will lead to a longer execution time even if only one shape
is present in the image.
Advanced algorithm details
Lens distortion and perspective distortion of 2D images have a negative impact on both
the score and position results of the tools. Try to minimize these types of image distortion
if high robustness and accuracy is required.
The rotation handling of the tools is based on the assumption that the pixels are square.
Use the square pixels option in 3D grab setup. Encoder support is highly recommended for
3D applications if the
Allow rotation
option is used.
The polarity of an edge (going from dark to bright or vice versa) is significant for the locate
tool. The tool will give lower score if the polarity is switched for example by changing from a
bright to a dark background. The recommendation is to avoid edges that may change
polarity. One trick to improve robustness is to avoid outer edges and only include internal
edges if the background has variations.
The first steps of the algorithm only use the major edges to locate the position and orienta-
tion of the shapes. This may lead to problems for objects with rotational symmetry (more
than one possible match for the major edges) where the best rough match may turn out to
be in the wrong direction when later using all edges. This may result in the shape getting a
score below the score threshold.
Summary for improving speed and algorithm performance
To improve robustness and accuracy
Adjust the edge strength so that only the major edges of the shape are extracted.
Teach the whole shape to be found, not only a small detail.
Mask away edges that may vary between images.
Enable scale search.
Adjust the two trade-off parameters towards robustness and accuracy.
Increase the max number of shapes.
Reduce any clutter in the image.