Rockwell Automation 5370-CVIM2 Module User Manual

Page 280

Advertising
background image

Chapter 7

Inspection Tools

7–42

The

Nearest Neighbor

selection panel (Figure 7.35, page 7–40) enables you

activate the nearest neighbor function and select a direction in which to
search for the nearest neighbor, as follows:

None –– This selection disables the nearest neighbor function.

Up, Down, Left, Right –– These selections correspond to the nearest
neighbor
above, below, to the left of, and to the right of the target object.

Overall –– This selection corresponds to the nearest neighbor in any
direction.

Figure 7.36 is an example that compares the “

Near

” result, which measures

the distance between two objects’ centroids, and the “

NearBox

” result,

which measures the distance between two objects’ bounding boxes.

Figure 7.36 Example: Comparing “Near” and “NearBox” Results

A

B

In this example, “

Up

” was selected in the

Nearest Neighbor

selection

panel, and the lower of the two objects was then picked (it has a red border
when picked). Note that the distance (A) between the centroids of the two
objects is 145.5 pixels, while the distance (B) between the closest edges of
the two objects’ bounding boxes is 57.0 pixels.

When a direction such as “

Up

” is selected in the

Nearest Neighbor

panel,

the bounding boxes of the target object and the nearest “

Up

” object must

overlap in a vertical direction in order for the “

Up

” object to be detected. In

Figure 7.36, the bounding boxes clearly do overlap in the vertical direction;
thus, when the lower object is picked, the two values are calculated. (Note
that if the upper object were picked, in this example no values would be
calculated because there is no object above it in the window.)

Advertising