Rockwell Automation 5370-CVIM2 Module User Manual
Page 310

Chapter 7
Inspection Tools
7–72
Average 3x3, Average 5x5 Kernels
The
Average 3x3
and
Average 5x5
kernels calculate the average value of
the pixels in a neighborhood, and then replace the center pixel in the
neighborhood with that value. The general effect of the neighborhood
operations by each of these kernels is to smooth gradients or discontinuities
in the image. The main differences between these two kernels is that the 5x5
kernel has a greater smoothing effect than the 3x3 kernel, but it operates
somewhat more slowly.
Average 3x3 Kernel –– The coefficients values in the
Average 3x3
kernel
are all equal to 1, as follows:
1
1
1
1
1
1
1
1
1
Figure 7.60 illustrates the operation of the
Average 3x3
kernel on a
neighborhood of image pixels.
Figure 7.60 Example: Effect of Average 3x3 Kernel on Pixel Gray Scale Values
1/9 x 27 + 1/9 x 28 + 1/9 x 27 + 1/9 x 28 + 1/9 x 27
+ 1/9 x 29 + 1/9 x 31 + 1/9 x 32+ 1/9 x 33 = 29
1
32
28
27
31
27
28
33
27
29
1
1
1
1
1
1
1
1
3x3 matrix of
Average 3x3 kernel
Portion of image field
within image tool.
32
28
29
31
27
28
33
27
29
Center pixel after
averaging operation.
As the example in Figure 7.60 shows, the effect of the
Average 3x3
operation is to multiply each gray scale value by 1/9, add the nine results,
and replace the pixel value under the center of the matrix with the sum.
Figure 7.61 (page 7–73) illustrates the effect of the
Average 3x3
kernel on a
dark grid with a light background. Notice that the grid lines within the image
tool are somewhat blurred when compared to the portion of the grid outside
the tool. This indicates that the kernel has “smoothed” the sharp contrast
between the dark grid lines and the light background.