You are on page 1of 18

copyright by Charnchai Pluempitiwiriyawej 4

What is an image?
An image is a picture that represents some information
copyright by Charnchai Pluempitiwiriyawej 5
Digital Image Processing (DIP)
Manipulation of digital images by mean of
computers
for storage, transmission, and representation for
autonomous machine perception
Image Compression, Representation, etc.
to improve pictorial information for human
interpretation
Image Enhancement, Restoration, Segmentation, etc.
copyright by Charnchai Pluempitiwiriyawej 6
History: First Image Transmission
Newspaper Industry:
Bartlane cable picture transmission system
(submarine cable between London and New York)
Reduced the time required to transport a picture across the Atlantic form
more than a week to less than 3 hours.
copyright by Charnchai Pluempitiwiriyawej 7
History: Image Coding
Improved visual
quality both in
tonal quality and
in resolution
Increase the
capability of coding
images for 5 gray
levels to 15 levels in
1929
copyright by Charnchai Pluempitiwiriyawej 8
History: Image Correction
Geometric corrections of image distortion
inherent in the on-board television camera
copyright by Charnchai Pluempitiwiriyawej 9
Image Processing Tasks
Image
Acquisition
Image
Pre-processing
Image
Segmentation
Image
Interpretation
Knowledge
based
Image Enhancement
Image Restoration
copyright by Charnchai Pluempitiwiriyawej 10
Computerized Processes
Low level processing
Noise reduction, Contrast enhancement, Image sharpening
both inputs and outputs are images
Mid-level
Image segmentation, Image classification
Outputs =attributes extracted from the input image
High level
Making senseof the ensemble of the recognized objects
visual cognition
copyright by Charnchai Pluempitiwiriyawej 11
Related Fields
Image
Processing
Image
Analysis
Computer
Vision
copyright by Charnchai Pluempitiwiriyawej 12
X-Ray Image Enhancement
Original Chast X-Ray Image After Image Enhancement
copyright by Charnchai Pluempitiwiriyawej 13
SAR Image Denoising
Original SAR Image
After Image Denoising
copyright by Charnchai Pluempitiwiriyawej 14
Example of Image Restoration
Original Image
After Restoration
copyright by Charnchai Pluempitiwiriyawej 15
Cardiac MR Image Segmentation
Find the volume of
the heart chamber
and the thickness
of the heart wall
Image Acquisition
Different Image Modalities & Applications
Sampling vs. Quantization
Spatial vs. Gray Scale Resolutions
copyright by Charnchai Pluempitiwiriyawej 17
How do we perceive an image?
adjusts the focus
regulates the amount of
light into the eyes
consists of rods & cones (nerve cells)
Is light the only
source that can
produce an image?
copyright by Charnchai Pluempitiwiriyawej 18
Electromagnetic Spectrum
copyright by Charnchai Pluempitiwiriyawej 19
Different Image Modalities
The principal energy source for images in use today is
the electromagnetic energy spectrum
Other energy sources include acoustic, ultrasonic, and
electronic
Synthetic images generated by computer.
copyright by Charnchai Pluempitiwiriyawej 20
Gamma-Ray Imaging
(a) Bone Scan
(b) Positron Emission
Tomography (PET) scan
showing tumors in brain
and lung
(c) Cygnus Loop: A
superheated stationary
gas cloud
(d) Gamma radiation from
reactor valve
a b
c d
copyright by Charnchai Pluempitiwiriyawej 21
X-Ray Imaging
(a) Chest X-ray
(b) Angiography: An X-ray
contrast agent is injected to
enhance contrast of blood
vessels
(c) Computerized Axial
Tomography (CAT
scans)3D rendition
(d) X-rays are used to detect
flaws in manufacturing of
circuit board
(e) Cygnus Loop: X-ray band
image
a
b
c
d
e
copyright by Charnchai Pluempitiwiriyawej 22
Imaging in Ultraviolet Band
(a) Normal corn
(b) Smut corn
(c) Cygnus loop:
Ultraviolet band
a
b
c
Ultraviolet light is used in
fluorescence microscopy
copyright by Charnchai Pluempitiwiriyawej 23
Multi-spectral imaging (infrared +visible)
Geography
Weather prediction
Infrared Satellite images
Nighttime Lights of the World data set
inventory of human settlements
Visible Band
Automated license plate reading
Fingerprint detection
Paper currency tracking
Traffic monitoring and surveillance
Quality controls in manufactures
Imaging in Visible & Infrared Band
copyright by Charnchai Pluempitiwiriyawej 24
Light Microscopy
copyright by Charnchai Pluempitiwiriyawej 25
Thematic bands NASAs LANDSAT
copyright by Charnchai Pluempitiwiriyawej 26
Thematic bands NASAs LANDSAT
copyright by Charnchai Pluempitiwiriyawej 27
Weather Prediction
copyright by Charnchai Pluempitiwiriyawej 28
Infrared Imaging
copyright by Charnchai Pluempitiwiriyawej 29
Automated Visual Inspection
(a) Missing part (black square)
(b) Look for missing pills
(c) Unacceptable level of filling up
(d) A clear plastic part with unacceptable
number of air pockets
(e) Cereal (color and anomalies
inspection)
(f) An intraocular implant (replacement of
lens for human eyes)
a
b
c
d
f e
copyright by Charnchai Pluempitiwiriyawej 30
Imaging in Visible Band
(a) A thumb print
the automated search of a
database for potential match
(b) A paper currency
automated counting
reading of serial numbers
(c) and (d) automated license
plate reading.
a b
c
d
copyright by Charnchai Pluempitiwiriyawej 31
Imaging in Microwave Band
Radar Image
Synthetic Aperture Radar (SAR) Space borne Radar Image of
mountains in southeast Tibet
copyright by Charnchai Pluempitiwiriyawej 32
Imaging in Microwave Band
Magnetic Resonance Imaging (MRI)
MR image of a knee MR image of a spine
copyright by Charnchai Pluempitiwiriyawej 33
Imaging Using Sound
Medicine
Ultrasound imaging
(1-5MHz)
Geology
Seismic model for
mineral and oil
exploration
copyright by Charnchai Pluempitiwiriyawej 34
Electron Microscopy
Transmission electron microscope (TEM)
Works like a slide projector
Scanning Electron Microscope (SEM)
Works much like a TV camera
2500x SEM image of damaged IC
250x SEM image of tungsten filament
after thermal failure copyright by Charnchai Pluempitiwiriyawej 35
Synthetic Images
copyright by Charnchai Pluempitiwiriyawej 36
How is an image represented?
We
Digital Image
Processing
copyright by Charnchai Pluempitiwiriyawej 37
Vector vs. Raster Images
Image information may be stored in two different
formats:
As a collection of lines or vectors vector image
Can be magnified to any desired size without losing any
sharpness
Good for text & geometric shapes
But not suitable for natural scene
e.g., Adobe PostScript (.ps)
As a collection of dots raster image
e.g., .J PEG, TIFF, GIF, BMP, PNG, HDF, PCX, XWD, ICO,
CUR, DICOM (read p. 29-37 in McAndrew)
copyright by Charnchai Pluempitiwiriyawej 38
Representing a Raster Image
An image can be represented as a 2D function
) , ( y x f
Intensity
(Gray Level)
Spatial
Coordinates
For a digital image,
x, y, and f are all finite and discrete.
copyright by Charnchai Pluempitiwiriyawej 39
Pixel
Picture element or image element is called a
pixel (or pel)
(3,0) (2,0) (1,0) (0,0)
(3,1) (2,1) (1,1) (0,1)
(3,2) (2,2) (1,2) (0,2)
(3,3) (2,3) (1,3) (0,3)
x
y
y (column)
(4,4) (4,3) (4,2) (4,2)
(3,4) (3,3) (3,2) (3,1)
(2,4) (2,3) (2,2) (2,1)
(1,4) (1,3) (1,2) (1,1)
x (row)
copyright by Charnchai Pluempitiwiriyawej 40
Voxel
Voxel =Volumetric +Pixel
represents the picture element in 3D space
mostly applied for medical images
copyright by Charnchai Pluempitiwiriyawej 41
Single Imaging Sensor
SAR
copyright by Charnchai Pluempitiwiriyawej 42
Line Imaging Sensors
Scanner
CTX
copyright by Charnchai Pluempitiwiriyawej 43
Array Imaging Sensor
Digital
Camera
copyright by Charnchai Pluempitiwiriyawej 44
Sampling vs. Quantization (Line)
copyright by Charnchai Pluempitiwiriyawej 45
Sampling vs. Quantization (Array)
Sampling
Quantization
p(i, j)
copyright by Charnchai Pluempitiwiriyawej 46
Resolution
is how much we can see the details of the image
depends on
the sampling rate (spatial resolution) and
the number of gray levels (gray level resolution)
The larger the sampling rate and gray scale, the
better the approximation of the digitized image
from the original, but also the bigger the size of
the digitized image.
copyright by Charnchai Pluempitiwiriyawej 47
Spatial Resolution
Sub-sampling
copyright by Charnchai Pluempitiwiriyawej 48
Shanons Sampling Theorem
Nyquist Criterion: a continuous function can be
reconstructed from its samples if the sampling
frequency is at least twice its maximum frequency.
Aliasing may occur in a undersampled data
copyright by Charnchai Pluempitiwiriyawej 49
Aliasing
An image with high enough
sampling rate
An aliased image due to not
enough spatial resolution
copyright by Charnchai Pluempitiwiriyawej 50
Zooming / Image Scaling
Zooming requires 2 steps
Creation of new pixel locations
Assignment of gray-levels to those new locations
interpolation
Nearest neighbor interpolation
Assigns the gray level of the closest pixel to the new location
Fast but produces checkerboard effect
Bilinear interpolation
Uses 4 nearest neighbors
Bicubic interpolation
Uses 16 nearest neighbors
copyright by Charnchai Pluempitiwiriyawej 51
Nearest Neighbor vs. Bilinear
+ + + =
4 3 2 1
w w w w
b
b 1
a a 1
) 1 ( a b ba ) 1 )( 1 ( a b a b) 1 (
copyright by Charnchai Pluempitiwiriyawej 52
Checkerboard Effect / Pixelization
copyright by Charnchai Pluempitiwiriyawej 53
Bilinear Interpolations
copyright by Charnchai Pluempitiwiriyawej 54
Gray Level Resolution
How many grey levels can you distinguish?
32 64
copyright by Charnchai Pluempitiwiriyawej 55
Reducing Gray Level Resolution
Reducing the number of
gray levels from 256 (k=8)
to 128 (k=7), while
keeping the number of
samples constant
a
c
b
d
(a) 256 Gray levels
(b) 128 Gray levels
(c) 64 Gray levels
(d) 32 Gray levels
copyright by Charnchai Pluempitiwiriyawej 56
False Contouring
False contouring occurs in
the smooth area of the
image because the gray
levels are not fine enough
e
f
g
h
(e) 16 Gray levels
(f) 8 Gray levels
(g) 4 Gray levels
(h) 2 Gray levels
copyright by Charnchai Pluempitiwiriyawej 57
Image Dithering
Dithering is a technique used in computer graphics
to create the illusion of color depth in images with
a limited color palette (color quantization).
e.g., printers, fax machines
Halftoning represents an image with only 2 colors
copyright by Charnchai Pluempitiwiriyawej 58
Halftoning
We may represent 5 different gray levels with just
black & white pixels (black =0, white =1)
Dark gray Mid gray
Light gray
copyright by Charnchai Pluempitiwiriyawej 59
Floyd-Steinberg Error Diffusion
Spread the quantizing error over the neighboring pixels
Procedure (to quantize 256 gray levels to 2 levels)
Moving through the image pixel by pixel, starting from the top
left moving to the right, row by row
Quantize each pixel p(i, j) then calculate the error
Spread the error e over to the pixels on the right & below as
p(i, j)


<
=
128 ) , ( if 255 ) , (
128 ) , ( if ) , (
j i p j i p
j i p j i p
e
e
16
7
+
e
16
3
+ e
16
5
+ e
16
1
+
copyright by Charnchai Pluempitiwiriyawej 60
Floyd-Steinberg Dithering: Example
256 colors
16 colors no dithering
16 colors with dithering
Display Images with
MATLAB
copyright by Charnchai Pluempitiwiriyawej 62
Different Image Types
Binary image : R
2
{0,1}
Grayscale (Intensity) image: R
2
R
True Color image: R
2
R
3
Indexed image: data Matrix +color map
R
2
NR
3
copyright by Charnchai Pluempitiwiriyawej 63
Binary Image (Black & White Image)
f(50,95)
=1
f(50,94)
=0
f(50,93)
=0
f(50,92)
=0
f(50,91)
=0
f(49,95)
=1
f(49,94)
=1
f(49,93)
=0
f(49,92)
=0
f(49,91)
=0
f(48,95)
=1
f(48,94)
=1
f(48,93)
=0
f(48,92)
=0
f(48,91)
=0
f(47,95)
=1
f(47,94)
=1
f(47,93)
=1
f(47,92)
=1
f(47,91)
=0
f(46,95)
=1
f(46,94)
=1
f(46,93)
=1
f(46,92)
=1
f(46,91)
=1
Pixel (46,95) is on
Pixel (50,94) is off
only 1 bit for each
pixel is needed
f : R
2
{0,1}
copyright by Charnchai Pluempitiwiriyawej 64
Gray Scale Image (Intensity Image)
f(28,28)
=200
f(28,27)
=235
f(28,26)
=245
f(28,25)
=245
f(28,24)
=255
f(27,28)
=150
f(27,27)
=200
f(27,26)
=240
f(27,25)
=230
f(27,24)
=201
f(26,28)
=100
f(26,27)
=155
f(26,26)
=230
f(26,25)
=150
f(26,24)
=100
f(25,28)
=150
f(25,27)
=240
f(25,26)
=80
f(25,25)
=30
f(25,24)
=50
f(24,28)
=200
f(24,27)
=100
f(24,26)
=30
f(24,25)
=5
f(24,24)
=0
Image
Intensity
Or Gray
Level
n bit-depth
= 2
n
gray levels
f : R
2
R
copyright by Charnchai Pluempitiwiriyawej 65
True Color Image
R=255
G=0
B=0

=
0
255
0
) 35 , 24 ( f
R=250
G=250
B=0
R = 0
G = 0
B = 255
f : R
2
R
3
The intensity value for pixel
(24,35) is a vector with
3 components (channels)
How many colors can a 24-bit-color image represent? 16,777,216
copyright by Charnchai Pluempitiwiriyawej 66
Indexed Image
f(50,95)
=5
f(50,94)
=6
f(50,93)
=6
f(50,92)
=5
f(50,91)
=5
f(49,95)
=5
f(49,94)
=5
f(49,93)
=6
f(49,92)
=5
f(49,91)
=4
f(48,95)
=2
f(48,94)
=2
f(48,93)
=3
f(48,92)
=4
f(48,91)
=4
f(47,95)
=2
f(47,94)
=5
f(47,93)
=1
f(47,92)
=5
f(47,91)
=5
f(46,95)
=5
f(46,94)
=5
f(46,93)
=1
f(46,92)
=1
f(46,91)
=5
250 250 0 6
255 255 255 5
255 0 0 4
0 0 0 3
0 0 255 2
0 255 0 1
B G R
f : R
2
N
NR
3
Color Map
copyright by Charnchai Pluempitiwiriyawej 67
Basic MATLAB commands
Some general MATLAB commands
help, lookfor, who, whos, diary, tic, toc
Image display commands
imread, imwrite
Imfinfo, getfield
imshow, pixval, imview, impixel
image, truesize, axis off, colormap
copyright by Charnchai Pluempitiwiriyawej 68
Data Types
MATLAB supports different data types for images
But many arithmetic operations must be in double
>>double, unit8 vs. im2double, im2uint8
65535
32767
255
127
Max Value
Machine Specific Double precision real number double
0 8-bit unsigned integer unit16
32768 8-bit integer int16
0 8-bit unsigned integer uint8
128 8-bit integer int8
Min Value Description Data Type
copyright by Charnchai Pluempitiwiriyawej 69
Converting Images in MATLAB
y =ind2rgb[x,map] ind2rgb
[y, cmap] =rgb2ind rgb2ind
y =rgb2gray(x) rgb2gray
[y cmap] =gray2ind(x) gray2ind
y =ind2gray(x, cmap) ind2gray
Syntax Function
copyright by Charnchai Pluempitiwiriyawej 70
MATLAB: Gray Scale / Binary
>>help imdemos
>>imfinfo(cell.tif)
>>img1 =imread(cell.tif);
>>whos
>>imshow(img1); pixval;
>>imview(img1);
>>impixel(img1, 34,35)
>>img2 =img1(58:145, 7:94);
>>figure; imshow(img2)
>>fname =text.png
>>img3 =imread(fname);
>>imshow(img3); pixval
>>imfinfo(fname)
What ColorType is it?
What is its BitDepth?
What Type of image is it?
copyright by Charnchai Pluempitiwiriyawej 71
MATLAB: True Color Image
Read the image tissue.png into img4
>>R =img4; R(:,:,2) =0; R(:,:,3) =0;
>>G =img4; G(:,:,1) =0; G(:,:,3) =0;
>>B =img4; B(:,:,1) =0; B(:,:,2) =0;
>>figure; subplot(231); imshow(R);
>>subplot(232); imshow(G);
>>subplot(233); imshow(B);
>>subplot(234); imshow(img4(:,:,1));
>>subplot(235); imshow(img4(:,:,2));
>>subplot(236); imshow(img4(:,:,3));
copyright by Charnchai Pluempitiwiriyawej 72
MATLAB: Indexed Image
>>fname =canoe.tif;
>>getfield(imfinfo(fname),ColorType)
>>[Canoe Cmap] =imread(fname);
>>size(Canoe)
>>figure; imshow(Canoe, Cmap); Cmap
>>figure; imshow(Canoe)
>>CanoeRGB =ind2rgb(Canoe, Cmap);
>>imwrite(CanoeRGB, canoergb.tif);
Compare the sizes of canoe and canoergb
copyright by Charnchai Pluempitiwiriyawej 73
Display Using image
>>c =imread(cameraman.tif);
What ColorType is this image? (Use imfinfo)
>>image(c)
What color is the image shown on screen? Why?
>>L =length(unique(c)) %% get the #of gray levels
>>image(c), truesize, axis off, colormap(jet(L))
>>colormap(pink(L)); colorbar;
Use help to learn more about colormap.

You might also like