08image - Processing I
08image - Processing I
MATLAB IN ENGINEERING
Yan-Fu Kuo Fall 2015
Dept. of Bio-industrial Mechatronics Engineering
National Taiwan University
Today:
• Introduction to digital image
• Read and show images
• Image arithmetic
Applications of MATLAB in Engineering Y.-F. Kuo 2
Why RGB?
• Three kinds of light-sensitive photoreceptor cells
in the human eye (i.e., cone cells) respond most
to red, green and blue
Applications of MATLAB in Engineering Y.-F. Kuo 6
Elements of Images
Pixels
Applications of MATLAB in Engineering Y.-F. Kuo 7
Binary Image
Applications of MATLAB in Engineering Y.-F. Kuo 8
Greyscale Image
Applications of MATLAB in Engineering Y.-F. Kuo 9
Color Image
Applications of MATLAB in Engineering Y.-F. Kuo 10
• Example:
clear, close all
I = imread('pout.tif'); %read
imshow(I); %show
Applications of MATLAB in Engineering Y.-F. Kuo 11
Image Processing
• Any form of signal processing for which the input
is an image
Applications of MATLAB in Engineering Y.-F. Kuo 15
Image Arithmetic
Practice
• Adjust the “brightness” and “contrast” of
rice.png and display it on the screen
Applications of MATLAB in Engineering Y.-F. Kuo 19
1600
1400
1200
1000
800
600
400
200
Practice
• Plot the histograms of the images before and
after the “brightness” and “contrast” adjustment
for rice.png
Applications of MATLAB in Engineering Y.-F. Kuo 21
1500 1500
1000 1000
500 500
0 0
0 100 200 0 100 200
Applications of MATLAB in Engineering Y.-F. Kuo 22
Practice
• Write your own equalization function, try it on
pout.tif, and display it on the screen
Applications of MATLAB in Engineering Y.-F. Kuo 23
Geometric Transformation
• Moving the coordinates (Not the gray-levels) of
the pixels in an image
Applications of MATLAB in Engineering Y.-F. Kuo 24
𝑠𝑥 0 0
Scale
0 𝑠𝑦 0
imresize() 0 0 1
1 ℎ𝑥 0
Shear ℎ𝑦 1 0
0 0 1
http://www.mathworks.com/help/images/performing-general-2-d-spatial-transformations.html
Applications of MATLAB in Engineering Y.-F. Kuo 25
Image Rotation
• In two dimensions, rotation of a point (𝑥, 𝑦) for an
angle 𝜃 “counter-clockwise” can be written as:
𝑥′ cos 𝜃 − sin 𝜃 𝑥
′ =
𝑦 sin 𝜃 cos 𝜃 𝑦
Applications of MATLAB in Engineering Y.-F. Kuo 27
End of Class