digital image fundamentals
DESCRIPTION
Digital Image Fundamentals. What is Digital Image Processing ?. Processing of a multidimensional pictures by a digital computer. การประมวลผลสัญญาณรูปภาพโดยใช้ดิจิตอลคอมพิวเตอร์. Why we need Digital Image Processing ?. เพื่อบันทึกและจัดเก็บภาพ - PowerPoint PPT PresentationTRANSCRIPT
ISAN-DSP GROUP
Digital Image Fundamentals
ISAN-DSP GROUP
What is Digital Image Processing ?
Processing of a multidimensional pictures by a digital computer
การประมวลผลสั�ญญาณร�ปภาพโดยใช้�ด�จิ�ตอลคอมพ�วเตอร�
Why we need Digital Image Processing ?
1. เพ��อบั�นทึ#กและจิ�ดเก%บัภาพ2. เพ��อปร�บัปร&งภาพให้�ด)ขึ้#+นโดยใช้�กระบัวนการ
ทึางคณ�ตศาสัตร�3. เพ��อช้-วยในการว�เคราะห้�ร�ปภาพ4. เพ��อสั�งเคราะห้�ภาพ5. เพ��อสัร�างระบับัการมองเห้%นให้�ก�บั
คอมพ�วเตอร�
ISAN-DSP GROUP
Image “After snow storm”
Fundamentals of Digital Images
f(x,y)
x
y
An image: a multidimensional function of spatial coordinates. Spatial coordinate: (x,y) for 2D case such as photograph,
(x,y,z) for 3D case such as CT scan images (x,y,t) for movies
The function f may represent intensity (for monochrome images) or color (for color images) or other associated values.
Origin
ISAN-DSP GROUP
Digital Images
Digital image: an image that has been discretized both inSpatial coordinates and associated value.
Consist of 2 sets:(1) a point set and (2) a value set
Can be represented in the formI = {(x,a(x)): x X, a(x) F}
where X and F are a point set and value set, respectively.
An element of the image, (x,a(x)) is called a pixel where- x is called the pixel location and- a(x) is the pixel value at the location x
ISAN-DSP GROUP
CCD KAF-3200E from Kodak.(2184 x 1472 pixels,
Pixel size 6.8 microns2)
Image Sensor:Charge-Coupled Device (CCD)
Used for convert a continuous image into a digital image
Contains an array of light sensors
Converts photon into electric chargesaccumulated in each sensor unit
ISAN-DSP GROUP
Horizontal Transportation Register
Out
put G
ate
Image Sensor: Inside Charge-Coupled Device
Am
plif
ier
Ver
tical
Tra
nspo
rt R
egis
ter
Gat
e
Ver
tical
Tra
nspo
rt R
egis
ter
Gat
e
Ver
tical
Tra
nspo
rt R
egis
ter
Gat
e
Photosites Output
ISAN-DSP GROUP
Image Sensor: How CCD works
abc
ghi
def
abc
ghi
def
abc
ghi
def
Vertical shift
Horizontal shift
Image pixel
Horizontal transportregister
Output
ISAN-DSP GROUP
Image Types
Intensity image or monochrome image each pixel corresponds to light intensitynormally represented in gray scale (gray level).
39871532
22132515
372669
28161010
Gray scale values
ISAN-DSP GROUP
39871532
22132515
372669
28161010
39656554
42475421
67965432
43567065
99876532
92438585
67969060
78567099
Image Types
Color image or RGB image:each pixel contains a vectorrepresenting red, green andblue components.
RGB components
ISAN-DSP GROUP
Image TypesBinary image or black and white imageEach pixel contains one bit :
1 represent white0 represents black
1111
1111
0000
0000
Binary data
ISAN-DSP GROUP
Image TypesIndex imageEach pixel contains index numberpointing to a color in a color table
256
746
941
Index value
Index No.
Redcomponent
Greencomponent
Bluecomponent
1 0.1 0.5 0.3
2 1.0 0.0 0.0
3 0.0 1.0 0.0
4 0.5 0.5 0.5
5 0.2 0.8 0.9
… … … …
Color Table
ISAN-DSP GROUP
Image Sampling
Image sampling: discretize an image in the spatial domain
Spatial resolution / image resolution: pixel size or number of pixels
ISAN-DSP GROUP
How to choose the spatial resolution
= Sampling locationsO
rigi
nal i
mag
eS
ampl
ed im
age
Under sampling, we lost some image details!
Spatial resolution
ISAN-DSP GROUP
How to choose the spatial resolution : Nyquist RateO
rigi
nal i
mag
e
= Sampling locations
MinimumPeriod
Spatial resolution(sampling rate)
Sampled image
No detail is lost!
Nyquist Rate: Spatial resolution must be less or equalhalf of the minimum period of the imageor sampling frequency must be greater orEqual twice of the maximum frequency.
2mm
1mm
ISAN-DSP GROUP
Effect of Spatial Resolution
256x256 pixels
64x64 pixels
128x128 pixels
32x32 pixels
Down samplingis an irreversibleprocess.
ISAN-DSP GROUP
Image Quantization
Image quantization: discretize continuous pixel values into discrete numbers
Color resolution/ color depth/ levels: - No. of colors or gray levels or- No. of bits representing each pixel value- No. of colors or gray levels Nc is given by
bcN 2
where b = no. of bits
ISAN-DSP GROUP
Image Quantization : Quantization function
Light intensity
Qua
ntiz
atio
n le
vel
0
1
2
Nc-1
Nc-2
Darkest Brightest
ISAN-DSP GROUP
Effect of Quantization Levels
256 levels 128 levels
32 levels64 levels
ISAN-DSP GROUP
Effect of Quantization Levels (cont.)
16 levels 8 levels
2 levels4 levels
In this image,it is easy to seefalse contour.
ISAN-DSP GROUP
Basic Relationship of Pixels
x
y
(0,0)
Conventional indexing method
(x,y) (x+1,y)(x-1,y)
(x,y-1)
(x,y+1)
(x+1,y-1)(x-1,y-1)
(x-1,y+1) (x+1,y+1)
ISAN-DSP GROUP
Neighbors of a Pixel
p (x+1,y)(x-1,y)
(x,y-1)
(x,y+1)
4-neighbors of p:
N4(p) =
(x1,y)(x+1,y)(x,y1)(x,y+1)
Neighborhood relation is used to tell adjacent pixels. It is useful for analyzing regions.
Note: q N4(p) implies p N4(q)
4-neighborhood relation considers only vertical and horizontal neighbors.
ISAN-DSP GROUP
p (x+1,y)(x-1,y)
(x,y-1)
(x,y+1)
(x+1,y-1)(x-1,y-1)
(x-1,y+1) (x+1,y+1)
Neighbors of a Pixel (cont.)
8-neighbors of p:
(x1,y1)(x,y1)
(x+1,y1)(x1,y)(x+1,y)
(x1,y+1)(x,y+1)
(x+1,y+1)
N8(p) =
8-neighborhood relation considers all neighbor pixels.
ISAN-DSP GROUP
p
(x+1,y-1)(x-1,y-1)
(x-1,y+1) (x+1,y+1)
Diagonal neighbors of p:
ND(p) =
(x1,y1)(x+1,y1)(x1,y1)(x+1,y+1)
Neighbors of a Pixel (cont.)
Diagonal -neighborhood relation considers only diagonalneighbor pixels.
ISAN-DSP GROUP
Template, Window, and Mask Operation
Sometime we need to manipulate values obtained from neighboring pixels
Example: How can we compute an average value of pixelsin a 3x3 region center at a pixel z?
4
4
67
6
1
9
2
2
2
7
5
2
26
4
4
5
212
1
3
3
4
2
9
5
7
7
35 8222
Pixel z
Image
ISAN-DSP GROUP
Template, Window, and Mask Operation (cont.)
4
4
67
6
1
9
2
2
2
7
5
2
26
4
4
5
212
1
3
3
4
2
9
5
7
7
35 8222
Pixel z
Step 1. Selected only needed pixels
4
67
6
9
1
3
3
4……
……
ISAN-DSP GROUP
4
67
6
9
1
3
3
4……
……
Template, Window, and Mask Operation (cont.)
Step 2. Multiply every pixel by 1/9 and then sum up the values
19
16
9
13
9
1
69
17
9
19
9
1
49
14
9
13
9
1
y
1 1
1
1
1
1
1
1
19
1
X
Mask orWindow orTemplate
ISAN-DSP GROUP
Template, Window, and Mask Operation (cont.)
Question: How to compute the 3x3 average values at every pixels?
4
4
67
6
1
9
2
2
2
7
5
2
26
4
4
5
212
1
3
3
4
2
9
5
7
7
Solution: Imagine that we havea 3x3 window that can be placedeverywhere on the image
Masking Window
ISAN-DSP GROUP
4.3
Template, Window, and Mask Operation (cont.)
Step 1: Move the window to the first location where we want to compute the average value and then select only pixels inside the window.
4
4
67
6
1
9
2
2
2
7
5
2
26
4
4
5
212
1
3
3
4
2
9
5
7
7
Step 2: Computethe average value
3
1
3
1
),(9
1
i j
jipy
Sub image p
Original image
4 1
9
2
2
3
2
9
7
Output image
Step 3: Place theresult at the pixelin the output image
Step 4: Move the window to the next location and go to Step 2
ISAN-DSP GROUP
Template, Window, and Mask Operation (cont.)
The 3x3 averaging method is one example of the mask operation or Spatial filtering.
The mask operation has the corresponding mask (sometimes called window or template).
The mask contains coefficients to be multiplied with pixelvalues.
w(2,1) w(3,1)
w(3,3)
w(2,2)
w(3,2)
w(3,2)
w(1,1)
w(1,2)
w(3,1)
Mask coefficients
1 1
1
1
1
1
1
1
19
1
Example : moving averaging
The mask of the 3x3 moving average filter has all coefficients = 1/9
ISAN-DSP GROUP
Template, Window, and Mask Operation (cont.)The mask operation at each point is performed by:1. Move the reference point (center) of mask to the location to be computed 2. Compute sum of products between mask coefficients and pixels in subimage under the mask.
p(2,1)
p(3,2)p(2,2)
p(2,3)
p(2,1)
p(3,3)
p(1,1)
p(1,3)
p(3,1)
……
……
Subimage
w(2,1) w(3,1)
w(3,3)
w(2,2)
w(3,2)
w(3,2)
w(1,1)
w(1,2)
w(3,1)
Mask coefficients
N
i
M
j
jipjiwy1 1
),(),(
Mask frame
The reference pointof the mask
ISAN-DSP GROUP
Template, Window, and Mask Operation (cont.)
The mask operation on the whole image is given by:
1. Move the mask over the image at each location.
2. Compute sum of products between the mask coefficeintsand pixels inside subimage under the mask.
3. Store the results at the corresponding pixels of the output image.
4. Move the mask to the next location and go to step 2until all pixel locations have been used.
ISAN-DSP GROUP
Template, Window, and Mask Operation (cont.)
Examples of the masks
Sobel operators
0 1
1
0
0
2
-1
-2
-1
-2 -1
1
0
2
0
-1
0
1
dx
dP compute to
dy
dP compute to
1 1
1
1
1
1
1
1
19
1
3x3 moving average filter
-1 -1
-1
8
-1
-1
-1
-1
-19
1
3x3 sharpening filter