machine vision - alpen-adria-universität klagenfurt vision 1.pdf · 10/8/2011 2 what's our goal?...
TRANSCRIPT
-
10/8/2011 1
Machine Vision
Transportation Informatics Group
University of Klagenfurt
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
Dr. Ing- Alireza Fasih, WS 2011
Address: L4.2.03, Lakeside Park, B04
-
10/8/2011 2
What's our Goal?
Image Processing Fundamental and Basic
Machine Vision Techniques
Programming Methods and Implementation in
Matlab and OpenCV
Application of smart sensors and laser scanners
in ADAS (Advance Driver Assistance Systems)
Basics about Embedded Systems and FPGA-
Based Image Processing
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
-
10/8/2011 3
Assessment
50% Homework
50% Final Project
Attending on Class
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
-
Digital Image Processing
Introduction to Machine Vision
Processing of Images which are Digital in
nature by Digital Computer
4
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
-
Why do we need Image Processing?
The main motivations are:
Enhancement of Images and Improvement of pictorial
information for human perception
Autonomous Machine Application
Efficient Storage and Transmission
5
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
-
Human Perception
Employ method capable of enhancing digital images
Typical applications:
Noise filtering
Content enhancement
Contrast Enhancement
Deblurring
Remote sensing
6
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
-
Noise Filtering
7
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
Noisy Image Filtered Image
-
Contrast Enhancement
8
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
Low Contrast Image Enhanced Contrast
-
Deblurring
9
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
Motion blurred image Deblurred Image
Image Ref: http://yuwing.kaist.ac.kr/
http://yuwing.kaist.ac.kr/
-
Aerial Images
10
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
Tehran, Iran
Satellite Image Map
Population: 14,000,000
-
Medical Image Processing
11
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
Snapshot from Neurosurgery Tool showing 3-D
segmentation of tumor and ventricle
Image Ref:
http://ub2020.buffalo.edu/ict/faculty/profile.php?fid=294&sid=25
Vessels Inspection before Angiography
http://ub2020.buffalo.edu/ict/faculty/profile.php?fid=294&sid=25
-
Automated Inspection
12
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
-
Boundary and Surface Inspection
13
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
-
Object Detection and Recognition
14
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
-
Surveillance Systems
15
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
-
Cinema & Entertainment
16
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
-
Machine Vision
17
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
Image
Acquisition
Pre-
Processing
Feature
Extraction
&
Analysis
AI
Decision
Unit
Digital Camera Processing Unit in the Computer Display or Actuator
-
Are you ready ?
18
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
-
19
What is an Image ?
A digital representation of a real-world scene.
Composed of discrete elements, generally called picture
element (Pixle).
Pixels are parameterized by
Position (x,y)
Intensity
Time
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
-
Image Intensity and human eye sensitivity
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
In this image patch A and Path B have the same Pixels intensity!
-
How to represent the color from reality into the
digital image?
We should know about depth color!
21
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
-
22
True Color
A real or True-Color image contains some accurate
representation of the original image obtained at several
or a broad range of wavelengths
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
Qazvin-kolah ferangi
-
23
Gray Scale Images
A Gray Scale image contains only intensity information
8 bit : 0~255 level
Is it sufficeint to have an 8 bit depth for gray images?
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
Tehran 1930
-
24
False Color
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
-
25
Variety of Images Format
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
Binary Representation
Gray Scale
True Color False Color
-
Color Depth
26
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
1 bit (2 colors) 2 bit (4 colors) 4 bit (16 colors)
8 bit (256 colors) 24 bit (16,777,216 colors)
-
27
Color space
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
http://raph.com/3dartists/artgallery/artistPage?aid=319
-
28
RGB, HSV and HSL Color Model
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
The RGB color model is an additive color model in which red, green,
and blue light are added together in various ways to reproduce a
broad array of colors.
-
29
RGB Color Space
Red Layer Green Layer Blue Layer
ColorSeparate
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
http://raph.com/3dartists/artgallery/artistPage?aid=319
-
30
RGB to Gray Scale
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
Gray = 0.2125 * Red + 0.7154 * Green + 0.0721 * Blue
Minimundus, Klagenfurt- Austria
0.2125 + 0.7154 + 0.0721 = 1
-
31
Exercise-1
Write a simple program in Matlab to convert a color
image to the gray scale image. Dont use built-in
function.
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
for x
for y
{
R = getRed (img, x,y);
G = getRed (img, x,y);
B = getRed (img, x,y);
.
gray = 0.3*R + 0.59*G + 0.11*B;
}
-
32
Comparison of RGB, HSL and HSV
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
RGB Color Space HSL Color Space HSV Color Space
-
33
Pseudo Code (RGB to HSV)
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
function RGBtoHSV(rgb)
{
r = getWord(rgb, 0);
g = getWord(rgb, 1);
b = getWord(rgb, 2);
var_Min = minimum3(r, g, b);
var_Max = maximum3(r, g, b);
del_Max = var_Max - var_Min; // Delta RGB
Value
v = var_Max;
if (del_Max == 0)
{
h = 0;
s = 0;
}
else
{
del_R = (((var_Max - r) / 6) + (del_Max / 2)) / del_Max;
del_G = (((var_Max - g) / 6) + (del_Max / 2)) / del_Max;
del_B = (((var_Max - b) / 6) + (del_Max / 2)) / del_Max;
s = del_Max / var_Max;
// S = {V min(R,G,B)} / V
if (r == var_Max)
h = del_B - del_G;
else if (g == var_Max)
h = (1 / 3) + del_R - del_B;
else if (b == var_Max)
h = (2 / 3) + del_G - del_R;
if (h < 0)
h += 1;
else if (h > 1)
h -= 1;
}
return (h @ " " @ s @ " " @ v);
}
-
34
Matlab Guide-3 (RGB to HSV)
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
RGB to HSV in Matlab
>> RGB = imread(image1.bmp);
[H S V] = rgb2hsv(RGB);
subplot(2,2,1), imshow(H)
subplot(2,2,2), imshow(S)
subplot(2,2,3), imshow(V)
subplot(2,2,4), imshow(RGB)
-
35
What is Image Processing ?
Digital Image processing is the method and technology that allows
scientists to manipulate images in order to bring out features and
properties that had been previously difficult or impossible to
distinguish.
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
-
36
What is Computer Vision ?
Computer vision is the science and technology of
machines that see. By this technology we can obtain the
information from the image.
Application of Machine Vision:
Medical Image Processing
Autonomous Vehicles
Automation in Factories
Surveillance and Security
Movie Special Effects (Augmented Reality, Video Post
Processing, )
Space and Astronomy
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
-
37
Matlab Guide-1 (Image Info)
k=imfinfo('autobahn_gray.jpg');
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
-
38
Matlab Guide-2
I = imread ('autobahn_gray.jpg'); % load the image into array
imshow (I); % display image
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
-
39
Matlab Guide-3
I = imread ('autobahn_gray.jpg'); % load the image into array
I2 = I (110:120,130:170); % crop image
imshow (I2); % display image
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
130 170
110
170
-
40
Gray Level Threshold
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
for (int i=0; i
-
41
Threshold Problems
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
If Pixle[i,j] >= thr1 then Pixle[i,j] := 255 else Pixle[i,j] := 0;
thr1 := 87;
-
42
Local Thresholding Method
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
Mean value
Max Value
Min Value
If Pixle[i,j] >= thr1 then Pixle[i,j] := 255 else Pixle[i,j] := 0;
thr1 := mean k (Max-mean);
-
43
Finding the ball by color threshold
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
R
G
B
-
44
Image Histogram
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
1. What is an Image Histogram ?
2. Whats a good Histogram ?
3. How to Interpret a Histogram ?
Effect of Rescaling Image Histogram
Effect of Changing the Contrast, Brightness on Histogram
4. Histogram Equalization.
-
45
What is an Image Histogram ?
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
72
15 4 9
12X Zoom
It plots the number of pixels for each tonal value.
By looking at the histogram for a specific image a viewer will be able to judge
the entire tonal distribution at a glance.
-
46
Whats a good Histogram ?
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
Histograms are Image dependents
There is no such thing as a good or right
histogram
-
47
RGB Histogram
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
Mathematica 7
-
48
Effect of Rescaling Image Histogram
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
-
49
Effect of Rotation on Image Histogram
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
-
50
How to Interpret a Histogram ?
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
Shift Right
Shift Left
Shrink
Scale
Hi Brightness
Low Brightness
Low Contrast
High Contrast
Original Image
-
51
Histogram in Matlab
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
>> I = imread('pout.tif');
>> [counts,x] = imhist(I);
>> imhist(I);
-
Gamma Correction and Image Adjustment
52
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
Gamma Correction is a Function that allows to adjust level of lightness or darkness
Of Image.
G(x) = x (1 / Gamma_Value)
Gamma Curves
-
Color Gamma Correction
53
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
R
G
B
-
54
LUT-Based Adjustment Function
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
LUT
-
55
LUT-Based Adjustment Function
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
-
Gamma Correction in Matlab
56
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
[X,map] = imread('forest.tif');
I = ind2gray(X,map);
J = imadjust(I,[ ],[ ],0.5);
imshow(I) figure, imshow(J)
-
57
Histogram Equalization
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
>> I = imread('tire.tif');
J = histeq(I);
imshow(I)
figure, imshow(J)
-
58
Histogram Equalization
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
Consider a discrete grayscale image {x} and let ni be the number of occurrences of gray level i. The probability of an
occurrence of a pixel of level i in the image is
L being the total number of gray levels in the image, n being the total number of pixels in the image, and px being in fact
the image's histogram, normalized to [0,1]. Let us also define the cumulative distribution function corresponding to px as
which is also the image's accumulated normalized histogram. We would like to create a transformation of the form y = T(x)
to produce a new image {y}, such that its CDF will be linearized across the value range, i.e.
for some constant K. The properties of the CDF allow us to perform such a transform it is defined as :
Notice that the T maps the levels into the range [0,1]. In order to map the values back into their original range, the following
simple transformation needs to be applied on the result
-
59
AppendixAppendix
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
-
60
Image Quality !
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
-
61
Fundamental parameters of Imaging System
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
-
62
CCD
A Charge-Coupled Device (CCD) is an analog
shift register that enables the transportation of
analog signals (electric charges) through
successive stages (capacitors), controlled by a
clock signal.
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
-
63
CCD Properties
CCD Dimension
There are several standard CCD sensor sizes:1/4", 1/3", 1/2", 2/3" and 1".
CCD Cell Dimension
http://www.itcnewsletter.com/2004/2004-10.htm
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
7 um
7 um
http://www.itcnewsletter.com/2004/2004-10.htmhttp://www.itcnewsletter.com/2004/2004-10.htmhttp://www.itcnewsletter.com/2004/2004-10.htmhttp://www.itcnewsletter.com/2004/2004-10.htmhttp://www.itcnewsletter.com/2004/2004-10.htmhttp://www.itcnewsletter.com/2004/2004-10.htmhttp://www.itcnewsletter.com/2004/2004-10.htm
-
64
CCD Exposure Time
In photography, shutter speed is a common term used to
discuss exposure time, the effective length of time a
shutter is open; the total exposure is proportional to this
exposure time, or duration of light reaching the film or
image sensor.
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
The agreed standards for shutter speeds are:
1/1000 s
1/500 s
1/250 s
1/125 s
1/60 s
1/30 s
1/15 s
1/8 s
1/4 s
1/2 s
1 s
-
65
CCD Exposure Time
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
A picture that captured with 30 sec
Exposure Time
Sparklers moved in a circular motion
with a exposure time of 4 seconds
http://upload.wikimedia.org/wikipedia/commons/f/f3/M3_at_Night_1.jpghttp://upload.wikimedia.org/wikipedia/commons/7/74/Sparklers_with_a_slow_shutter_speed.JPG
-
66
CCD Exposure Time
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
-
67
Field/Angle of View
What makes a lens wide angle or telephoto?
The relationship between the focal length of the
lens and the size of the sensor array determines
the field of view of the camera. If the focal length
is smaller, the field of view is wider and vice
versa.
http://www.itcnewsletter.com/2004/2004-10.htm
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
http://www.itcnewsletter.com/2004/2004-10.htmhttp://www.itcnewsletter.com/2004/2004-10.htmhttp://www.itcnewsletter.com/2004/2004-10.htm
-
68
Field of View
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
-
69
Field of View
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
Focal length, (5mm)
CCD Size
(ex: )
Angle of View
Angle of View = 2 * ArcTan( CCD / 2 * FOL )
CCD/2
FOL
-
70
Light and Illumination
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
http://www.ak3d.de/
-
71
Illumination Examples
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
-
72
Illumination Examples
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
-
73
Illumination Examples
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
-
74
Illumination Examples
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt
http://www.washington.edu/newsroom/news/images/David.jpg
-
75
Machine Vision
Thank you for your attention
Transportation Informatics Group, ALPEN-ADRIA University of Klagenfurt