Professional Documents
Culture Documents
BT09ECE042 (Sr. No. 26) (6.8 Noise in Color Images, 6.9 Color Image Compression)
BT09ECE042 (Sr. No. 26) (6.8 Noise in Color Images, 6.9 Color Image Compression)
BT09ECE042 (Sr. No. 26) (6.8 Noise in Color Images, 6.9 Color Image Compression)
Noise In Color
Images
imaging goes
Beyond visible spectrum
Micro-scale (microscopic imaging)
Macro-scale (astronomical imaging)
What is Noise?
Wiki definition: noisemeans any unwanted
signal
One persons signal is another ones noise
Noise is not always random and
randomness is an artificial term
Noise is not always bad (see stochastic
resonance example in the next slide)
Stochastic Resonance
no noise
light noise
heavy noise
5
Image Denoising
Visually unpleasant
Bad for compression
Bad for analysis
6
thermal imaging
electrical interference
physical interference
ultrasound imaging
Spatially dependent
Periodic noise
Noise Removal
Techniques
Linear filtering
Nonlinear filtering
Recall
Linear system
Image Denoising
Introduction
Impulse noise removal
Median filtering
Y (i, j )
255
0
X (i, j )
1 i H ,1 j W
noisy pixels
clean pixels
Note: in some applications, noisy pixels are not simply black or white,
which makes the impulse noise removal problem more difficult
11
Numerical Example
P=0.1
128 128 128 128 128 128 128 128 128
128 128 255
0 128 128 128 128 128
128
128
128 128 128 128 128 128 128 128 128
128 128 128 128
0 128 128 128 128
128
0
128 128 128 128 128 128 128 128 128
128 128 128 128 128 128 128 128 128
128
128
128 128 128 128 128 128 128 128 128
128 128
0 128 128 128 128 128 128
128
128
128 128 128 128 128 128 128 128 128
128 128 128 128 128 128 128 128 128
128
128
128 128 128 128 128 128 128 128 128
128 128 128 128 128 128 128 128 128
128
128
128 128 128 128 X128 128 128 128 128
128 128 128 128 Y128 128 128 128 128
128
128
128
128
128
128
128
128
128
128
128
0
128
128of128
128 are
255 contaminated
128 128 128
Noise level p=0.1 means that approximately
10%
pixels
128
128
salt
pepper
noise
by red 128
color)
128or128
128 128
128 (highlighted
128 128 128 128
128 128 128 128 128 128 128 128
128
255
128 128 128 128 128 128 128 128 128
128 128 128 128 128 128 128 255 128
128
128
12
MATLAB Command
>Y = IMNOISE(X,'salt & pepper',p)
Notes:
The intensity of input images is assumed to be normalized to [0,1].
If X is double, you need to do normalization first, i.e., X=X/255;
If X is uint8, MATLAB would do the normalization automatically
The default value of p is 0.05 (i.e., 5 percent of pixels are contaminated)
imnoise function can produce other types of noise as well (you need to
change the noise type salt & pepper)
13
filtering
algorithm
Noisy image Y
denoised ^
X
image
^
Can we make the denoised image X as close
to the noise-free image X as possible?
14
Median Operator
Given a sequence of numbers {y1,,yN}
Mean: average of N numbers
Min: minimum of N numbers
Max: maximum of N numbers
Median: half-way of N numbers
y
[50,0,52,255,54,55,56]
Example
y
sorted [0,50,52,54,55,56,255]
median( y ) 54
15
1D Median Filtering
y(n)
W=2T+1
16
Numerical Example
y [50,T=1:
0,52,255,54,55,56]
Boundary
Padding
y [50,50,0,52,255,54,55,56,56]
x [50,50,52,54,54,55,55]
17
2D Median Filtering
x(m,n)
W: (2T+1)-by-(2T+1) window
18
Numerical Example
225
226
225
226
226
255
255
226
225
255
255
226
226
228
226
226
0 226 226
225 224
Y
226
226
0 225
0
225
225
226
226
225
225
225
226
225
225
226
226
225
226
226
225
226
226
226
225
226
226
226
226
226
226
226
226
226 226
226 226
226 226
226
225
225
225
226
225
225
225
226
225
226
226
226
226
226
226
226
226
226
226
226
226
226
226
226
^
X
226
226
226
226
19
Image Example
P=0.1
Noisy image Y
denoised ^
X
image
3-by-3 window
20
noisy
(p=0.2)
clean
3-by-3 window
5-by-5 window
21
Reflections
What is good about median operation?
Since we know impulse noise appears as black
(minimum) or white (maximum) dots, taking
median effectively suppresses the noise
What is bad about median operation?
It affects clean pixels as well
Noticeable edge blurring after median filtering
22
23
Median filtering
x=medfilt2(y,[2*T+1,2*T+1]);
Noise detection
C=(y==0)|(y==255);
Obtain filtering results
xx=c.*x+(1-c).*y;
24
Image Example
clean
w/o
noise
detection
noisy
(p=0.2)
with
noise
detection
25
Image Denoising
Introduction
Impulse noise removal
Median filtering
Numerical Example
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
2 =1
128
126
128
128
127
129
129
128
128
128
128
129
127
130
128
128
129
128
128
127
128
127
129
130
127
129
129
126
127
129
128
129
129
129
129
129
129
127
128
128
126
128
127
129
127
129
128
127
126
128
127
129
129
130
129
127
128
127
128
128
128
128
129
126
28
MATLAB Command
>Y = IMNOISE(X,gaussian',m,v)
or
>Y = X+m+randn(size(X))*v;
rand() generates random numbers uniformly distributed over [0,1]
Note:
Image Denoising
filtering
algorithm
Noisy image Y
denoised ^
X
image
30
1D Linear Filtering
f(n)
g ( n)
h(n)
g(n)
See review section
h( k ) f ( n k ) h( n) f ( n) f ( n) h( n)
Linear convolution
f (n n0 ) g (n n0 )
31
Fourier Series
forward
F ( w) f (n)e jwn
inverse
1
f ( n)
2
time-domain convolution
f ( n) h( n)
F ( w)e jwn dw
frequency-domain multiplication
F ( w) H ( w)
32
Filter Examples
Low-pass (LP)
|H(w)|
2
h(n)=[1,1]
1.8
HP
LP
1.6
1.4
|h(w)|=2cos(w/2)
1.2
1
High-pass (LP)
0.8
0.6
h(n)=[1,-1]
0.4
0.2
0
|h(w)|=2sin(w/2)
0.5
1.5
2.5
3.5
w
33
y (k ) x(n)WNkn
n0
Properties
- periodic
Proof:
inverse transform
N 1
x(n) y (k )WN kn
n 0
y (k N ) y (k )
N 1
N 1
n 0
n 0
WN exp{
j 2
}
N
y (k N ) xnWN( k N ) n xnWNkn y (k )
*
y
(
N
k
)
y
(k )
- conjugate symmetric
Proof:
N 1
N 1
n 0
n 0
y ( N k ) xnWN( N k ) n xnWN kn y * (k )
34
Matrix Representation of 1D
DFT
A NN
a11
...
a
...
...
a
NN
N1
1
akl
WNkl ,
N
WN e
2
N
, WNN 1
yk akl xl
Im
l 1
DFT:
1
yk
N
Re
xW
l 1
kl
N
WN
35
yk xnWNkn
n 0
N-point DFT
k 2m
x
W
2m N
n2m
km
k
x
W
W
2m N / 2 N
n2m
N/2-point DFT
k ( 2 m 1)
x
W
2m1 N
n 2 m 1
km
x
W
2m1 N / 2
n 2 m 1
N/2-point DFT
O(N2) to O(Nlog2N)
36
h(n)
g(n)
g ( n) f ( n) h( n)
F(k)
DFT
H(k)
G(k)
G (k ) F (k ) H (k )
37
2D Linear Filtering
f(m,n)
g (m, n)
h(m,n)
g(m,n)
k ,l
2D convolution
MATLAB function: C = CONV2(A, B)
38
2D Filtering=Two
Sequential 1D Filtering
Just as we have observed with 2D
Numerical Example
1D filter
h1(m)=[1,1], h1(n)=[1,-1]
h1 (m) h1 (n)
h1 (n) h1 (m)
1 1
1 1
MATLAB command:
>h1=[1,1];h2=[1,-1];
>conv2(h1,h2)
>conv2(h2,h1)
40
m n
spatial-domain convolution
f (m, n) h(m, n)
frequency-domain multiplication
F ( w1 , w2 ) H ( w1 , w2 )
41
Filter Examples
|h(w1,w2)|
Low-pass (LP)
h1(n)=[1,1]
1D
|h1(w)|=2cos(w/2)
h(n)=[1,1;1,1]
2D
|h(w1,w2)|=4cos(w1/2)cos(w2/2)
w2
w1
42
choice 1: Y=fft2(X)
43
choice 1: Y=fft2(X)
choice 2: Y=fftshift(fft2(X))
Low-frequency at the center
Gaussian Filter
FT
h(m, n) exp(
m2 n2
2
w12 w22
H ( w1 , w2 ) exp(
)
2
2
Image Example
noisy
PSNR=20.2dB
(=25)
denoised
denoised
PSNR=24.4dB
(=1)
PSNR=22.8dB
(=1.5)
Gaussian Filter=Heat
Diffusion
Linear Heat Flow Equation:
I ( x, y, t )
2 I ( x, y , t ) 2 I ( x, y , t )
I ( x, y, t )
2
t
x
y 2
A Gaussian filter
with zero mean
and variance of t
47
x
image I
Diffusion should be anisotropic
instead of isotropic
image I viewed as a 3D surface (x,y,I(x,y))
48
Experimental Results
noisy
PSNR=20.2dB
(=25)
linear diffusion
PSNR=24.4dB
(Gaussian filtering)
nonlinear diffusion
PSNR=27.5dB
(TV filtering)
49
Image Denoising
Introduction
Impulse noise removal
Median filtering
Periodic Noise
Source: electrical or electromechanical
Processing method
Suppressing noise component in frequency
domain
51
Image Example
spatial
W
W
2
2
0 D w1 w2 D
H ( w1 , w2 )
2
2
1
otherwise
w2
w1
53
Image Example
Before filtering
After filtering
54
E I
s I
N I I i 1, j I i , j
S I I i 1, j I i , j
E I I i , j 1 I i , j
W I I i , j 1 I i , j
cd g (|| d I ||), d N , S , E , W
I it,j1 I it, j [c N N I cS S I cE E I cW W I ]
Basic idea: from linear diffusion (equivalent to Gaussian filtering)
to nonlinear diffusion (with implicit edge-stopping criterion)
55
Image Compression
Input image
Source encoder
Source decoder
Encoder
Decoder
Channel encoder
Channel decoder
Channel
Data Redundancies
Coding redundancy
Interpixel redundancy
Psychovisual redundancy
1
MSE 2
N
N 1 N 1
[ g( x , y ) f ( x , y )]
x 0 y0
N 1 N 1
1/ 2
g ( x, y )
x0 y 0
( SNR) rms
N 1 N 1
x 0 y 0
2
[
g
(
x
,
y
)
f
(
x
,
y
)]
Huffman Coding
Huffman coding is an entropy encoding algorithm
(1)Create a leaf node for each symbol and add it to the priority
queue. While there is more than one node in the queue, remove
the node of highest priority (lowest probability) twice to get two
nodes.
(2)Create a new internal node with these two nodes as children
and with probability equal to the sum of the two nodes'
probabilities. Add the new node to the queue.
(3)Repeat step 2 until the remaining node is the root and the tree
is complete.
Example of RLE
Let us take a hypothetical single scan line, with B
Predictive Coding
DM (Delta Modulation)
Common Predictive
Coding
Predictive coding
model
II
The predictor :
f n F ( f n 1 , f n 2 , , f n k )
n f n fn
n 1
a
k l
f k , ak 1
Delta Modulation I
Delta modulation (DM or -modulation) is an analog-todigital and digital-to-analog signal conversion technique
used for transmission of voice information where quality
is not of primary importance. DM is the simplest form of
differential pulse-code modulation (DPCM) where the
difference between successive samples is encoded into nbit data streams. In delta modulation, the transmitted
data is reduced to a 1-bit data stream.
Delta Modulation II
Quantify the bands
Slope overload
Granular noise
Coding output
Transform Coding I
Transform coding is a type of data compression for
Transform Coding II
Joint
Picture
Expert
Group
Steps of JPEG
The image is subdivided into pixel blocks of size 8 * 8, which are
processed left to right, top to bottom. As each 8 * 8 block or subimage is
encountered, its 64 pixels are level shifted by subtracting the quantity
2n-1, where 2n is the maximum number of gray levels.
1.
The 2-D discrete cosine transform of the block is then computed,
quantized and reordered.
2.
Use the zigzag pattern, to form a 1-D sequence of quantized
coefficients.
3.
Use the DPCM (differential pulse code modulation) code the DC
coefficients.
4.
The nozero AC coefficients are coded using a run-length encoding.
5.
Entropy coding
JPEG Model
Image block
DCT-based encoder
Quantizer
Entropy coder
Compressed image data
JPEG2000
JPEG 2000 is a wavelet-based image compression standard. It was