If you set the
GradientMode parameter to
CreateSF2ExEx will behave exactly like
GradientMode set to
true, however, the following will happen: At every location where ShapeFinder2 would normally find just one feature, it will add not add only one, but
AProfileSize correlation points that are arranged on a line that is perpendicular to the orientation of the edge that defines the feature. The following images are trained from the luster terminal sample that is part of the ShapeFinder2 tutorials, but with gradient mode.
Image 1 shows the entire model that resulted from using an
AProfileSize value of 7 and an
ADelta of two. You can see features all around the screw, roughly arranged in concentric circles:
If you look at the line that I marked in cyan you can see the seven points that belong to the center feature (cyan box; the slightly sketchy position of the leftmost feature point is due to rounding - the line looks straight but the gradient orientation is not perfectly vertical, hence the slight deviation):
What this approach does is that for every single feature that you would have in “normal” mode it gives a selectable number of additional points for the correlation step that is used in the higher precision modes of ShapeFinder2. These additional correlation points of course do come at a runtime cost (you need to correlate more data, which obviously takes more time) and in many cases they are not actually necessary. However, in situations where your pattern is ambiguous given only the “normal” ShapeFinder2 approach the additional correlation points can greatly improve robustness and positional accuracy of the results. Consider for example a crosshair that is in some cases but not always surrounded by horizontal and/or vertical lines of similar contrast. In such a scenario, correlating just the crosshair points won’t do much good because the neighboring image content is so similar that it will lead to problems. In such a situation adding additional correlation points can make the difference.
The profile size you choose is typically dependent on how much processing time you have available. The more profile points you choose the more precise the correlation results will potentially be (again: Only use this when you have to - in many applications the classifiers generated without this gradient mode will be good enough).
The spacing of the points also depend on the application. You should not aim too high: If you end up adding points where usually e.g. neighboring objects are located then you’ll do more harm than good. Unlike the profile size, the spacing will not affect execution speed.
If I use gradient mode (which is not often the case), then I usually start with low values for
AProfileSize (e.g. [3, 5, 7]) and
ADelta (e.g. [1, 2, 3]) and end up using the smallest combination of numbers that gives a good result.