IMAGE PROCESSING USEFUL TIPS Compilation
IMAGE PROCESSING USEFUL TIPS Compilation
PROCESSING
USEFUL TIPS
Compilation
IMAGE PROCESSING USEFUL TIPS
Lenses #1
04 Lens Characteristics 09
Lenses #2
05 Depth of Field 10
06 Lens Resolution 11
07 Lens Magnification 12
08 F-Stop 12
09 Mount 12
10 Distortion 12
11 Chromatic Aberration 13
2
Image Capture
12 What is a Pixel? 14
14 Shutter Speed 15
15 What is Gain? 15
18 LED 18
3
Color
20 What is Color? 21
23 Complementary Colors 23
24 Relationship Between Wavelength and Color 24
25 Sensitivity Characteristics (Spectral Characteristics) 24
Communication (RS-232C)
26 What is RS-232C? 25
28 Communication Speed 26
30 Handshake 27
31 Communication Protocol and Script 28
4
Preprocessing
32 What is Preprocessing? 29
34 Filter Coefficients 29
35 Typical Filters 30
36 Other Preprocessing 32
Communication (Ethernet)
37 What is Ethernet? 33
38 Default Gateway 34
5
IMAGE PROCESSING USEFUL TIPS
Image processing is an essential technology that raises the accuracy and efficiency of product defect
inspection. Recently, technology in this area has seen significant advances and is producing results in
on-site manufacturing. In order to correctly perform on-site image processing, it is essential to acquire a
basic knowledge on the subject.
In this chapter we will explain basic knowledge regarding image processing.
A
Focal
point Axis of convex lens
B
Focal C
point
Real
image
When seen through the mechanism of a camera, light that is emitted from a target which is outside of the
focal point of a convex lens, is refracted on the lens, drawing an image whose vertical and horizontal planes
have been reversed. This image is called a real image and if an image receiving element is placed here, a
real image will be projected.
6
Lenses #1
Telecentric Lenses
These are lenses that have been arranged to pass principal light through the focal point at a 0° angle of view.
In other words, these lenses have been designed to have principal light advance parallel to the optical axis of
the lens. Because the optical axis is parallel, distortion is difficult to generate and it is possible to acquire the
size and position of the target with high-accuracy. Telecentric lenses demonstrate their true value in cases
where high-magnification, low-distortion, and a deeper depth of field are required for image processing.
Object-side
Object-side
Margin of error
7
IMAGE PROCESSING USEFUL TIPS
Optical Optical
axis axis
Focal point of light rays passing through the periphery of the lens
Focal point of light rays passing through the near-center of the lens
Optical axis
Lens Mounts
Lens mounts, which act as joints between the CCD camera and the lens, come in a variety of types and if the
pre-existing requirements of each side of the lens mount are not met together, it is not possible to maintain
compatibility between the CCD camera and lens. Due to the occurrence of mechanical issues that include
joint structure and dimension, and optical issues related to the CCD-side flange focus, it is necessary to
confirm the mount of the CCD camera that will be used when selecting lenses. A mount for CCD cameras that
is often used in the FA industry is called a C-mount. This type of mount has a 25.4 mm (1 in.) inner-diameter, a
0.794 mm pitch (32 TPI).
8
Lenses #1
04 Lens Characteristics
In the FA industry, the distance between the inspection target and the lens in image processing is generally
called WD (working distance) and the image area is called the field of view. The field of view is determined by
lens type and the size in inches, of the WD and CCD.
Focal Length
“Focal length” exists as one of the specifications of a lens. As representational models, lenses used for
factory automation come in 8 mm 0.32", 16 mm 0.63", 25 mm 0.98", and 50 mm 1.97" specifications. The WD
(working distance) can be equated to the position that aligns with the focal point from the field of view and
focal length required for the target that you would like to capture.
Lens
Example
3.6 mm
0.14"
Field of 16 mm
CCD size
view 0.63"
45 mm WD=200 mm
1.77" 7.84"
WD Focal length
The size of the WD and the field of view is determined by the focal length of the lens along with the size of the
CCD, and in ranges that are at the closest possible distance, where a close-up ring is not required, or at
distances above this, the relationship can be represented with the following proportional expression.
Example: Using a lens with a 16 mm 0.63" focal length and
WD : Field of View = Focal Length : CCD size CCD with a size of 3.6 mm 0.14", selecting a 45 mm 1.77" field of
view will yield a WD of 200 mm 7.84".
Field of View
This is the image area within the range of the working distance. In general, the longer the working distance
between the target and lens is, the wider the field of view (view angle). Additionally, the width of the field of
view is determined according to the focal length of the lens. The angle of the range in which the lens can be
used to capture images in regard to the field of view is called the angle of view or the view angle. Because the
angle of view becomes larger as the focal length of the lens becomes shorter, the field of view will widen.
Conversely, it’s possible to enlarge distant targets when the focal length is long.
CCD image receiving element CCD image receiving element
Angle of Angle of
view view
9
IMAGE PROCESSING USEFUL TIPS
05 Depth of Field
Depth of field means the range that appears in focus through
In the image below, an inclined surface that
the lens (target-side distance). When the range is wide, it is
has been affixed with tape displaying height
called a “deep depth of field”. Conversely, when the range is is shown. To the left of this image, is a
narrow, it is called a “shallow depth of field”. Strictly comparison between an instance where the
aperture has been reduced and an instance
speaking, though only one area can be in focus, to the
where it has been opened.
human eye, images in a certain range appear to form clearly.
This range is called depth of field.
Camera
Field of view
Tape (3 mm)
0.12"
15 mm
0.59"
COLUMN 1
Does a CCD whose size per pixel (cell size) is large
have a deep depth of field?
The position of the light apex is misaligned with Image 2 A: State in which the target is misaligned in a far direction
the position of the CCD, but it does not overlap
with neighboring CCDs.
Images 1 through 3 are actually all in focus.
This is because even if the size of the focal point
within in the range of a single CCD pixel has
fluctuated, images that have been output
through electronic signals will not be reflected at
all (won’t be understood). In this way, the S1 S2
changing range of the working distance, which
limits the size of the focal point in a defined Image 3 B: State in which the target is misaligned in a close direction
range, is called depth of field.
In other words, when using the same size and
same optical magnification, because the
allowable range in which CCDs with larger per
pixel sizes is wide, it has a deep depth of field.
10
Lenses #2
COLUMN 2 The reason why depth of field changes with aperture and focal length
Considering the principles that were explained in column 1, the answer is easy. No matter which lens, as the aperture
is reduced, depth of field becomes deeper. This is because the aperture mechanism can make the angle smaller
while maintaining the values for S1, and S2. This makes the size of the focal point smaller and widens the focus
range.
S1 S2
06 Lens Resolution
Not limited to image processing, lens resolution is used in lenses for all optical measurement devices and it
signifies the minimum interval in which observation is possible. A lens with a resolution of 10 μm 0.39 Mil can
soundly observe striped lines that have been arranged in 10 μm 0.39 Mil line widths and 10 μm 0.39 Mil
pitches. When the resolution is insufficient, 2 lines will appear as if they are stuck together, making the
resolution unsuitable for an inspection that requires accuracy. Lens resolution is expressed in the formula for
the Rayleigh limit*1 listed below.
λ
ε = 0.61 × N.A.*2
(Rayleigh’s equation)
β
N.A. =
2F
β: Optical magnification F: Effective No.
To improve resolution, it is important to raise the numerical aperture (N.A.) of the target lens.
*1 R
ayleigh limit
An evaluative standard for lenses. This was defined by the English physicist, Lord Rayleigh.
*2 N
umerical aperture (N.A.)
An index for the purpose of calculating the performance of a lens, including resolution. Brighter images
can be obtained as the numerical aperture increases in size.
11
IMAGE PROCESSING USEFUL TIPS
07 Lens Magnification
Magnification is a ratio between the actual size of the measurement target and the size that can be seen
through an optical measurement device. Conventionally, optical magnification was used when observing
through the eyepiece of a microscope, but recently, the idea of monitor magnification is spreading from the
increase of systems that display observation targets on an LCD monitor.
[ Optical magnification ]
With a digital camera, optical magnification is calculated by dividing the dimensions of the effective camera elements by
the field of view.
[ Monitor magnification ]
Monitor magnification is calculated by dividing the diagonal length of the monitor by the diagonal length of the camera
elements, and then multiplying that by the optical magnification.
08 F-Stop
This value (also called F-number) signifies a standard that displays the brightness of a lens. Accurately
speaking, it is a value that divides the focal length of the lens by its diameter (gauge). F: The “F” in F-stop
derives from the word focal.
f F : F-stop
F= D : Lens diameter
D f : Lens focal length
In practice, the lens won’t transmit all the light; part of it will be reflected by the lens. Additionally, in order to
reduce optical aberration, multiple lenses are used, reducing the amount of transmitted light. Through this,
lenses that have a large amount of light transmission obtain bright images and are said to be “bright” and
lenses that have a small amount of light transmission are said to be “dark”.
The relationship between lens focal length and diameter, or in other words, the F-stop, is one element that
greatly influences the brightness and darkness of a lens. A lens with a small F-stop value will be a “bright
lens” and one with a large value will be a “dark lens”. With a general compact camera, the side of the lens will
be marked with something like “F=2.5” or “1:2.5”. This means that the F-stop is 2.5. For the performance of
the camera lens, if the F-stop is around 2.0, it can be said that its class is rather bright.
09 Mount
A mount is a mechanism that secures the lens for image processing equipment that can replace the lens. It is
also called a lens mount and in general, lens mounts for SLR cameras are well known. In image processing,
C-mounts and CS-mounts are often used.
10 Distortion
Distortion signifies a state where an image reflected through the lens is deformed. In truth, a perfectly-shaped
lens does not exist. Due to this, ideally, direct light that has passed through the lens should advance
unaltered, however the light that has passed through the lens will distort along the outer or inner areas. The
former is called “barrel distortion”, while the latter is called “pincushion distortion”.
12
Lenses #2
11 Chromatic Aberration
Principles of Chromatic Aberration
Chromatic aberration signifies when the refractive index differs depending on the wavelength of the visible
beam, causing the image that is generated after being transmitted through the lens to be misaligned. A
differing refractive index means a differing focal length. So, the colors of each wavelength each, individually
form an image and reflect an image that looks blurred.
Blurred Non-blurred
Blue Green Red image image
13
IMAGE PROCESSING USEFUL TIPS
12 What is a Pixel?
A pixel signifies the smallest structural unit of a digital image. An image on a computer is rendered in pixels, a
collection of points that have been aligned in an orderly fashion. Every single point possesses color
information called hue or tone and through this, it’s possible to draw a color image.
Valid pixels:
The pixels amongst the total pixels that handle image signals. When showing the performance of a digital camera, its
performance is determined by guidelines that ask you to use the number of valid pixels.
Virtual pixels:
The pixels amongst the valid pixels that guarantee the performance of the product.
14
Image Capture
14 Shutter Speed
This signifies the period of time in which a charge is accumulated in the image sensor of a CCD or CMOS. If
the shutter speed is 1/250, then period of time in which it will gather light is 1/250 seconds. When the shutter
speed is fast, the amount of light that hits the sensor is small. Conversely, when it is slow, the amount of light
that hits is large. In other words, it can be said that shutter speed serves as a function that adjusts the amount
of light. Shutter speed and the amount of received light (accurately speaking, the amount of accumulated
charge) have the following relationship.
15 What is Gain?
Gain signifies the electrical amplification of image signals. CCD cameras for image processing have a built-in
function that amplifies signals when capture has been performed in dark areas, making it so that they appear
bright. They also have a gain control function, which automatically adjusts the gain in response to the
brightness of the target.
15
IMAGE PROCESSING USEFUL TIPS
1 1
1 1.28
Pixel
CCD receiver
When image data that has been captured with a non-square grid CCD is displayed in direct image
processing pixels ( 1 : 1 ), circles will appear horizontally elongated, making it necessary to correct the image.
16
Lighting
Many different kinds of lighting are used in factory automation (FA) for positioning, inspections, and
other applications.
When selecting appropriate lighting for each application, it is necessary to understand the
characteristics of light sources.
Fluorescent Lights
Fluorescent lights emit visible light when ultraviolet rays generated by arc discharge phenomena hit the
fluorescent substance inside of their glass tubes. Typically, the insides of the tubes are coated with the
fluorescent substance and contain encapsulated mercury. The tubes are then sealed and electrodes for
discharging electricity are placed at each end.
Fluorescent lights have been widely used in the past because they last longer than incandescent bulbs. They
emit white light and daylight colors, and there are three-wavelength fluorescent lights that emit colors very
similar to natural light. They come in various shapes such as bulbs and straight or circular tubes.
Halogen Lamps
Halogen lamps feature bulbs with inactive gases, such as nitrogen, and halogen gases, such as iodine,
enclosed inside. They emit light using the same principle as incandescent bulbs but shine brighter and last
longer. They are used in car headlights, spotlights at commercial facilities and photography studio lights. The
light is limited to the color of the bulb.
17
IMAGE PROCESSING USEFUL TIPS
Xenon Lamps
Xenon lamps are gas discharge lamps that emit light similar to natural light. Xenon gas is enclosed inside of
silica tubes. Compared to incandescent bulbs, xenon lamps are brighter, consume less energy, and last
longer. They are mainly used as light sources for projection devices and projectors.
Xenon lamps include short-arc lamps, long-arc lamps, and flash lamps.
18 LED
Basic Structure
LEDs emit light when electrons collide with positive holes inside of joined N-type and P-type semiconductors
with electricity flowing through them.
The wavelength (color) of the light depends on the size of the bandgap of the semiconductor (the region
where electrons cannot exist).
Thus, many different semiconductor materials for many different wavelengths have been created.
Applications in display, lighting and other areas have increased greatly in recent years thanks to the invention
of blue LEDs that use gallium nitride as well as white LEDs.
Electric Current Flow Direction
18
Lighting
Long Lifespan
With half-lives of tens of thousands of hours, LEDs last tens to hundreds of times longer than fluorescent
lights, and, unlike fluorescent lights, repeated switching does not shorten their lifespans. This long lifespan
makes it possible to save on costs and on the bother of replacing lamps.
Continuous Lighting (Blue Line) vs Intermittent Lighting (Red Line) (Representative Example)
100
Relative Light Intensity [%]
90
80
70
19
IMAGE PROCESSING USEFUL TIPS
Diffusion Plates
Diffusion plates are sheets or films that diffuse light evenly across entire surfaces. Polished glass filled this
role in the past. Nowadays, diffusion plates are used as part of the backlights fitted into the back of LCD
panels.
Polarizing Plates
Natural light includes many vibration planes facing in different directions. This is where polarizing plates are
used to produce light only from a given plane. Polarizing plates have extremely thin slits cut into them, and
light shone through one polarizing plate produces only the ray on the same vibration plane as the slit. When
two polarizing plates are used together, sometimes light will not shine through.
The display boards on LCDs make use of this phenomenon that helps display images depending on whether
or not light is transmitted.
Includes light
Transmitted Light
from various
vibration planes
Natural Light
20
Color
20 What is Color?
All objects have color. However, in order to recognize that color, two other elements are essential: light and an
eye that can recognize that color. In short, ‘color’ is perceived visual stimuli, specifically the light reflecting off
an object, received through the eye and transmitted to the brain.
Object
Light
Reflected light
Y (Yellow)
M+Y R (Red)
R (Red) Y+C+MBk (Black)
R+G+BW (White)
B (Blue) G (Green)
G+BC (Cyan) C+M B (Blue)
M (Magenta)
C (Cyan)
21
IMAGE PROCESSING USEFUL TIPS
Hue
Color can be classified into a group of chromatic colors, or
A B
colors that have a hue, or a group of achromatic colors (white,
Reddish color Bluish color
black, pure grays), or colors that do not have a hue.
Among chromatic colors, the color variation (red, blue, and
yellow) is called a “hue.”
Saturation
Saturation is the level of vividness of a color and indicates chromatic purity. A highly chromatic, vivid color is
described as “saturated” while a less chromatic, pastel color is described as “desaturated.”
The most saturated colors are the “pure colors” while the most desaturated colors (colors with no vividness)
are neutral colors.
Saturated Desaturated
(Highly chromatic) (Less chromatic)
1 2
22
Color
Brightness
Brightness (also called “Value”) represents the brightness or darkness of color. Both chromatic and
achromatic colors have brightness.
Bright colors are described as “bright” while darker colors are described as “dark.”
The brightest color is white and the darkest color is black, and this applies to both the chromatic color group
and achromatic color group. In other words, the brightness of a chromatic color can be expressed by the
level of neutral color that corresponds to that brightness.
High
9.5
8.5
7.5
6.5
Brightness
5.5
4.5
3.5
2.5
Low
1.5
Brightness of a chromatic color is represented by the value
of gray with the same brightness.
23 Complementary Colors
Complementary colors are any two colors on opposite sides of the color wheel, such as red and green, blue
and orange.
Mixing the complementary colors will produce a neutral color. When complementary colors of pigment are
mixed (subtractive color mixing), you will get black. When complementary colors of light are mixed (additive
color mixing), you will get white.
23
IMAGE PROCESSING USEFUL TIPS
be seven different colors of light. The difference in the color of Violet 400 to 435 nm
Blue 435 to 480 nm
light varies depending on its wavelength. As the wavelength
Green-blue 480 to 490 nm
gets longer, the color changes from violet to blue, then green Blue-green 490 to 500 nm
and yellow, before finally hitting red. The wavelength of each Green 500 to 560 nm
color is shown below. Yellow-green 560 to 580 nm
Yellow 580 to 595 nm
Orange 595 to 610 nm
Red 610 to 750 nm
Red-violet 750 to 800 nm
Invisible Invisible
Visible light
light light
Ultraviolet Infrared
Violet Blue Green-blue Blue-green Green Yellow-green Yellow Orange Red
light light
380 430 480 490 500 560 580 595 650 780
(Unit: nm)
1.0
0.9 Blue appears brighter than red
Spectral sensitivity characteristics
0.8
0.7 The figure shows an example of sensitivity characteristics of
0.6 a CCD camera if 560 nm, the wavelength the human eye is
0.5 most sensitive to, is ‘1.’
0.4
Here, you can see that blue (460 nm) appears approximately
1.3 times brighter than red (660 nm).
0.3
0.2
0.1
0
400 500 600 700 800 900 1000
Wavelength (nm)
24
Communication (RS-232C)
RS-232C is a communication method used to output the result of image processing, or to control an
image processing instrument from a PC or PLC. The following describes details of the RS-232C
communication.
26 What is RS-232C?
Communication protocol for serial type transmission
RS-232C is a type of serial transmission used for communication between computers (or PLCs) and sensors
or other peripheral devices. Another serial type communication protocol is USB. This type is generally
incorporated into personal computers.
RS-232C is an abbreviation for “Recommended Standard 232 version C.” It is a designation of the
communication protocol used to transmit digital signals and is standardized by Electronic Industries Alliance
(EIA) in the United States. The maximum communication speed is 115.2 kbps.
There are two types of digital signal transmission: Parallel and serial.
The former transmits data of 8 or 16 bits simultaneously through multiple lines. The latter transmits one bit of
data at a time through two lines, one for sending and the other for receiving. Consequently, it is noticeable
that the parallel transmission is faster in terms of communication speed.
However, the parallel transmission involves complicated wiring. The serial transmission is slower in terms of
communication speed, but its wiring is far simpler.
At present, parallel transmission is used for signal transmission inside a device, such as internal transmission
inside a computer; and serial transmission is used for transmission between devices.
RS-232C terminal pins (D-sub 25-pin) RS-232C terminal pins (D-sub 9-pin)
1 13 1 5
6 9
14 25
25
IMAGE PROCESSING USEFUL TIPS
Gender changer
When a PC (or PLC) and a peripheral device are connected with more than one cable for extension, an
“extension adapter” is used to connect the cables.
Normally, the RS-232C connector on the device is “female”, and the connectors at both ends of the cable are
“male”.
Therefore, a “female-to-female” gender changer (device to change between male and female) is required to
connect two cables.
28 Communication Speed
Baud rate and bps
Although both the baud rate and bps (bit per second) are used as the unit to transmit digital signals, the baud
rate does not equal the bps rate. The Baud rate is a unit to express the number of modulation/demodulation
actions which a modem or other device can make in one second. On the other hand, bps is a unit to express
the amount of signals which can be transmitted in one second.
The unit to express communication speed is bps.
For example when a modem can make 2400 modulation/demodulation actions in one second and can
transmit a signal of 2 bits in one modulation/demodulation, its baud rate is 2400 and communication speed is
4800 bps.
26
Communication (RS-232C)
Data bits
Parity bit
Start bit
Stop bit
t
Start bit
This bit notifies that communication will start from now. The start bit is always fixed to 0 (zero).
Data bits
The data bits normally consist of 7 or 8 bits. The number of bits can be specified as desired.
Parity bit
This bit is used to check whether the sent data is correct or not. The setting can be selected from “Odd”,
“Even”, or “None”.
Stop bit
This bit notifies that one byte of communication has finished. One (1) is always sent as a stop bit.
Delimiter
To send a communication command from the RS-232C port of a PC (or PLC), you need to set a symbol to
separate each command between the PC (or PLC) and peripheral device. This separating symbol is called a
delimiter. In most cases, “CR (Carriage Return)” or “CR + LF (Carriage Return + Line Feed)” is used.
30 Handshake
To enable the RS-232C type communication, the terminals at both of the sender and receiver sides need to
read/write signals at the same communication speed. However, if the signal processing on the receiver side
delays, the sent signals may be lost. Handshake is a mechanism to prevent this problem, where the terminals
on both sides confirm the communication status of each other. If the processing in the receiver terminal
delays, the sender temporarily stops sending signals and resumes sending when the receiver can accept
signals.
There are three types of handshake: Hardware handshake, software handshake, and Xmodem.
27
IMAGE PROCESSING USEFUL TIPS
Communication command
The commands for executing communication through the RS-232C port.
Script
A series of commands used when communication is made through the RS-232C port. A script is written in a
more simplified language than programming languages.
Ladder language
A programming language used to write a logical circuit used by a PLC. Since the program is written based on
two rails and rungs between them, the written program is called a “ladder diagram”. This programming
language provides visually recognizable relationships between the input conditions and outputs.
Ladder example: “AND circuit” which turns on output relay 500 when both input relays 000 and 001 are ON
28
Preprocessing
To allow stable inspections using image processing technology, it is crucial to minimize noise in images.
This chapter introduces preprocessing filters which reduce noise which cannot be eliminated only by
improving optical conditions.
32 What is Preprocessing?
To perform quality inspections or measurements using image processing, it is essential to first obtain images
of a high enough quality for their respective purposes. Images simply captured by a camera are not always
suitable for these purposes due to the type of light source, material of workpiece or image capturing
environment, which may result in an inconsistency in inspection results.
To avoid this problem, the captured images are sometimes processed (converted) using image filters in
accordance with the intended use of images.
This processing procedure is called image
preprocessing. Image preprocessing can
enhance the clarity of captured images, make
the elements required for applications
(shapes, colors, etc.) more distinct or
eliminate undesirable components (noise).
When preprocessing with filters, materials
such as image processing devices and PC
photo retouch software are used. There are
Example of image preprocessing many different types of filters, and it is
Filters eliminate noise to provide a clear image.
important to understand their characteristics to
select the optimum filter for the respective
applications.
34 Filter Coefficients
The typical filters used for preprocessing consist of filter coefficients of
“3 × 3”, “9 × 9”, “16 × 16”, etc. With the “3 × 3” type, which is the most
commonly used, the image data for 3 horizontal and vertical pixels are
Example of filter coefficient
referenced, and the filter is applied to the pixel in the center.
Filter coefficient used for averaging
For example, if an image is composed of 320 horizontal pixels and of an image
240 vertical pixels, the image is filtered 76,800 times (320 × 240). 1 1 1
9 9 9
1 1 1
9 9 9
1 1 1
9 9 9
29
IMAGE PROCESSING USEFUL TIPS
When the filter coefficient in the below figure is used, a preprocessed pixel value for each 3 × 3 area is
obtained by multiplying respective pixel values of nine pixels in the original image by 1/9 and then adding
them up. The filtered image can be obtained by repeating this calculation for each 3 × 3 area by shifting one
column at a time.
Example of calculation using filter coefficient
1 3 2 4 6 1 2 3 3 …
3 4 2 6 0 5 Filter 2 3 … …
processing
1 2 0 4 3 5 2 3 … …
1 2 3 4 3 4 … … … …
2 3 4 5 4 3
35 Typical Filters
The following section introduces major filters typically used for image preprocessing. In actual applications,
the combined use of multiple filters to obtain images which meet application needs has become a mainstream
method.
Expansion filter
This filter eliminates noise components (dirt) which are undesirable for image processing. It replaces the pixel
value of the center pixel in the 3 × 3 area with that of the highest value among nine pixels.
When an expansion filter is applied to a monochrome image, it will make all nine pixels white if any one of pixels
surrounding the center pixel in the 3 × 3 area is white.
Shrink filter
Expansion
A shrink filter is also effective to eliminate Replace a pixel value of 2 5 9
noise components. In contrast to the the center pixel with a
30
Preprocessing
Even if fine noise components such as dirt are captured as part of an image, an expansion or shrink filter can
remove them to make the image clearer.
Example of filter
processing
Original image After applying an expansion filter After applying a shrink filter
Averaging filter
The filter improves image quality by smoothing (softening) shading on them. It averages pixel values of all
nine pixels including the one in the center. The impact of noise components can be also reduced by softening
images. The filter also helps position measurements such as the edge detection of workpieces or pattern
search stable.
To provide more natural smoothing, a weighted average filter can be used.
1 1 1
9 9 9
1 1 1
9 9 9
1 1 1
9 9 9
Median filter
The filter sorts pixel values of nine pixels and then assigns their median to the center pixel as its pixel value.
Unlike the averaging filter, it can reduce noise components without blurring images. The filter is effective
especially for removing noise which is caused by pixels of very different color and intensity from those in their
area.
31
IMAGE PROCESSING USEFUL TIPS
Sobel filter
It is a type of filters which are effective for edge
extraction. It emphasizes the edges on images with
small contrast. In addition, the processed images
look more natural.
Besides the Sobel filter, there are more filters used for
the edge extraction, including Prewitt, Roberts and
Laplacian filters.
Original image Sobel
36 Other Preprocessing
Color extraction
It is processing to extract specified color elements from a captured color image.
The color video signals are converted into R (Red), G (Green) and B (Blue) digital data. The color extraction is
performed using these data.
This processing binary-converts each pixel into an extracted pixel or an unextracted one. For this reason, the
process not only ensures a stable extraction even for dark colors but also diminishes the amount of color
information data to be processed, eventually allowing high-speed post-processing.
Gray-scale processing
The gray-scale processing, which is also known as shade-scale processing, is used to obtain the shade-scale
information for an image captured with a camera. This processing divides the shade gradation of pixel into
8 bits (= 256 levels) and utilizes all of these 256-level shade data. Therefore, this processing significantly
increases the accuracy in the detection of workpieces. It is very useful in the applications like the detection of
workpieces which are difficult to detect with monochromatic binary processing.
32
Communication (Ethernet)
In image processing applications, there is a growing need for data storage not only for measurement
data but also images. This data is communicated between image processing devices and controllers to
be stored in memory or on HDDs. Recently, Ethernet is more often used for this communication.
Ethernet, which enables faster communication than RS-232C and USB, is suitable for the transmission
of large volumes of data, and it is expected to have further widespread use.
37 What is Ethernet?
Overview of Ethernet
Many different types of communication functions are used for control systems. One of them is LAN (Local
Area Network), which is the communications network connecting a group of computers to each other or a
computer to other devices including measurement instruments and sensors.
LAN is a communications network used within a relatively limited area such as a office or factory, and Ethernet
is widespread as major communication standard for LAN. In our daily life, Ethernet is used for the computer-
to-computer or PC-to-Internet connections.
33
IMAGE PROCESSING USEFUL TIPS
38 Default Gateway
LAN is a network built up with multiple computers Default gateway is a “gate” to connect different networks to each other.
and peripheral devices which are interconnected
each other. In other words, it is a closed network PC D
since the devices on the network, which can Z.Z.Z.10
34
Communication (Ethernet)
40 IP Address
Overview of IP address
The devices on an Ethernet network communicate with each other using a protocol called TCP/IP. The same
goes with the access to the Internet. In these communications, each computer or peripheral device is
recognized with its IP address, which is an identification number assigned to each device. The IP address is
unique to each device to represent its location on the network.
The IP address consists of four sets of numbers from 0 to 255; for example “192.168.36.91”. In an internet
connection, no identical IP addresses can exist.
The total number of currently available IP addresses (IPv4) is approximately 4300 million, but the world is
expected to run out of available IP addresses under IPv4 due to the global spread of the Internet. To cope
with this problem, switching the protocol to IPv6 (340 trillion × 1 trillion × 1 trillion addresses) is now under
discussion.
Global IP address
Among the IP addresses, a global IP address is a unique address assigned to a communication device such
as a computer when it is connected to the Internet. The global IP address is assigned to devices to be
connected to a LAN and/or WAN (Wide Area Network).
This was originally controlled by an organization called the IANA (Internet Assigned Number Authority), but
now the actual control work is performed by the ICANN.
Private IP address
The global IP address is needed for the connection to the Internet, whilst a private IP address is an address
assigned to a device on a LAN. The device uses the private IP address for the communication within the LAN,
but when it accesses external networks like the Internet, the private IP address is converted into its global IP
address.
35
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 KEYENCE CANADA INC. KEYENCE MEXICO S.A. DE C.V.
500 Park Boulevard, Suite 200, Itasca, IL 60143, U.S.A. PHONE: +1-201-930-0100 FAX: +1-855-539-0123 E-mail: keyencecanada@keyence.com E-mail: keyencemexico@keyence.com
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. Company and product names mentioned in this catalog are either trademarks or registered trademarks KA11-1017
of their respective companies. The specifications are expressed in metric units. The English units have been converted from the original metric units.
Copyright © 2018 KEYENCE CORPORATION. All rights reserved. CVLensTipComp-KA-TG2-US 1088-1 611I26