Sie sind auf Seite 1von 4

ADVANCED Vol.

Machine Vision Academy


MA ST ER T H E L AT E S T A PPLI C AT I ON T E C H NI QUES
Introduction
Are you interested in image processing (inspection using a camera)?
Have you thought about automating the visual inspections on your production line?
Have you considered implementing a vision sensor, but given up because it seemed too difficult to use?
If you answered yes to any of these questions, this guide provides professional image processing solutions for factory automation.

ADVANCED

Get optimal results from image processing


Pretreatment filter (first volume)

8−1 Effects of basic pretreatment filters

Example 1 Shrink filter By shrinking the lighter colored pixels around the small dark spot and replacing them with
dark pixels, the small defect becomes more apparent.

Pretreatment

Example 2 Expansion filter The lighter colored pixels surrounding the small spots are expanded and the small dark
pixels disappear.

Pretreatment

The purpose of understanding image processing fundamentals is to enable users to capture the most accurate
images. In addition, by using pretreatment filtering image content inspections can process an optimal image
(correct focus and contrast). The potential for stable examination is increased by implementing pretreatment
filters before the processing of flaw detection, dimensional measurement, and other forms of inspections
occur. Selecting the optimal pretreatment filter is explained in greater detail ahead.
8−2 Basic types of pretreatment filters

3X3 Pixel Rule Image data

Below, four types of pretreatment filters are described. Example of the original image
Each filter uses a 3x3 principle to perform pretreatment
calculations, and process the image.
2 5 9

4 7 3

0 1 2

Expansion filter Expansion


Maximum density value

The maximum density (brightest value) of nine pixels are 2 5 9


inspected and the center pixel is adjusted to the largest
density value.
4 9 3

0 1 2

Shrinkage filter Shrinkage

The minimum density (darkest value) in nine pixels is 2 5 9


identified and the center pixel is adjusted to that value.
Dark pixels are therefore emphasized and a more stable
flaw detection is performed. 4 0 3

0 1 2
Minimum density value

Averaging filter Averaging

The average density of nine pixels is calculated 2 5 9


(2+5+9+7+3+0+1+2 / 9 =3.66, rounded to the 1/100
decimal point) and the center pixel is adjusted to the
average value. 4 3 3
This stabilizes the image and reduces the effect of noise
which may cause blurry images. 0 1 2

Median filter Median

The density of the center pixel is adjusted to the fifth 2 5 9


element in the order of density value. This allows for a more
stable removal of noise.
4 3 3

0 1 2

2
8−3 Edge extractions and enhancement filters
Below, pretreatment filters such as Edge Extraction and Edge Enhancement are used to
emphasize the characteristics which are contrasting to the original image. Edge filters have
many purposes and selecting the appropriate one for each situation should be based on the
knowledge and theory of each filters correct use. The use of Sobel and Prewitt and the
extraction of edges in the X and Y directions are described ahead.

Original image

Sobel and Prewitt


Sobel and prewitt are edge extraction processes that extract edges in the X and Y direction separately and then combine
the results. After multiplying by a determined coefficient the center pixel is then replaced with an appropriate added density
value.

Sobel Prewitt
-1 -2 -1 -1 0 1 -1 -1 -1 -1 0 1

0 0 0 -2 0 2 0 0 0 -1 0 1

1 2 1 -1 0 1 1 1 1 -1 0 1

Edge extraction series summary


Differential Horizontal direction Vertical direction Diagonal direction Others
Prewitt First differential
Sobel Second differential
Roberts First differential
Laplacian Second differential Doesn't depend on the direction

These symbols show the strength.

Direction specific edge extraction filter Edge extraction X Edge extraction Y


(X Direction Sobel) (Y direction Sobel)
Edge extraction in the X and Y direction using sobel is
leveraged by the limitations of the defect length in both
-1 0 1 -1 -2 -1
the vertical and horizontal directions.
-2 0 2 0 0 0

-1 0 1 1 2 1

Differences between the Edge Extraction filter and the Edge Enhancement filter
Edge enhancement is a process that clarifies blurred images. It is
0 -1 0
different from the Edge Extraction filter in that it emphasizes the
concentration of the center pixel by adjusting the combined result of
-1 5 -1
nine pixels to zero and one. As for edge extraction, if the nine pixels
have the same data, the density will be 0. However, the density of the
0 -1 0
center pixel is emphasized and remains.
Edge Enhancement

The Edge Extraction filter processes the concentration of the center pixel of the 3x3, top and bottom (X direction), and
right and left (Y direction), and replaces them. It is necessary to select the type of noise presence and the direction to
emphasize. Furthermore, please note that even though the Edge Enhancement filter is uniform, the center pixel of the
noise element will increase.

3
8−4 Example filter technique applications
The CV-3000 is capable of inspecting one region with two or more pretreatment filters able to repeatedly inspect one region with
two or more pretreatment filters. It is possible to process the optimal image using each filter if the theory of the filter is known.

Example1. Outline smoothing : expand(X) + shrink(Y)


The expand and shrink filters are applied at the same
time and are able to remove uneven contours and
burrs, thereby, maintaining an even surface for
inspection.

Before After

Example2. Emphasize microscopic flaws : Sobel + binary + expansion


First, the sobel filter extracts the edges of the flaw.
Then, using binarization to compile a black and white
image and emphasizing the white pixels using the
expansion filter the flaw is made to clearly stand out.

Before filtering Sobel Binarization+expansion

Example3. Smoothing noise components Averaging + Median


This technique is effective for stabilizing
measurements in edge detections. This method uses
the averaging filter to eliminate the effect of blurred
A B A B images and the median filter to more accurately
stabilize noise.

Typical Repeatability of unstable edge detections


No filter 6.27 pixels
Before filtering After filtering
Averaging + Median 0.3 pixels Stabilized
Waveform of edge intensity (Conceptual image)
A B A B

SUMMARY
When using pretreatment filters, first obtain a clear picture of the original image by properly adjusting the contrast and focus . Use
image processing to emphasize desired aspects of the object to be inspected. Finally, know each theory and understand how to properly
implement each filter for the most effective use.

CALL T O C O N TA C T Y O U R L O C A L O F F I C E
TOLL
FREE
1-888-KEYENCE
1 - 8 8 8 - 5 3 9 - 3 6 2 3
www.keyence.com SAFETY INFORMATION
Please read the instruction manual carefully in
order to safely operate any KEYENCE product.

KEYENCE CORPORATION OF AMERICA


Corporate Office 669 River Drive, Suite 403, Elmwood Park, NJ 07407 PHONE: 888-539-3623 FAX: 855-539-0123 E-mail: keyence@keyence.com
Sales & Marketing Head Office 1100 North Arlington Heights Road, Suite 210, Itasca, IL 60143 PHONE: 888-539-3623 FAX: 855-539-0123
 Regional offices CO Denver IN Indianapolis MI Detroit NJ Elmwood Park OH Cincinnati SC Greenville TX Dallas
AL Birmingham FL Tampa KS Kansas City MI Grand Rapids NY Rochester OH Cleveland TN Knoxville VA Richmond
CA N.California GA Atlanta KY Louisville MN Minneapolis NC Charlotte OR Portland TN Nashville WA Seattle
CA Los Angeles IL Chicago MA Boston MO St. Louis NC Raleigh PA Philadelphia TX Austin WI Milwaukee
KEYENCE CANADA INC. KEYENCE MEXICO S.A. DE C.V.
Head Office PHONE: 905-366-7655 FAX: 905-366-1122 E-mail: keyencecanada@keyence.com PHONE: +52-81-8220-7900 FAX: +52-81-8220-9097
Montreal PHONE: 514-694-4740 FAX: 514-694-3206 E-mail: keyencemexico@keyence.com
KEYENCE CORPORATION
1-3-14, Higashi-Nakajima, Higashi-Yodogawa-ku, Osaka, 533-8555, Japan PHONE: +81-6-6379-2211 KA1-1014

The information in this publication is based on KEYENCE’s internal research/evaluation at the time of release and is subject to change without notice.
Copyright (c) 2008 KEYENCE CORPORATION. All rights reserved. CVAcademy8-KA-EN-US 1024-1 E 611837 Printed in Japan
* 6 1 1 8 3 7 *

Das könnte Ihnen auch gefallen