Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 22

Adaptive median filter

 Median filter works well for


impulse noise probabilities (Pa, Pb)
less than 0.2

 Adaptive median filtering can


handle impulse noise larger than
the above

 It preserves the detail while


smoothing non-impulsive noise

 It can change the size of the Sx,y


during filter operation
1
A numerical example
255 241 251 255 16 245 245 255 244 239 255
250 255 255 0 255 244 255 254 254 6 255
238 253 255 255 255 254 255 229 246 251 238
255 252 240 245 228 4 244 255 255 255 251
1 247 252 250 255 254 5 244 243 233 250
12 251 245 255 252 247 6 253 255 239 255
255 255 1 252 246 251 255 254 248 240 246
251 254 249 234 255 245 255 239 255 0 255
254 240 255 254 242 255 243 252 251 252 251
255 15 255 254 7 254 254 248 242 255 250
247 244 255 228 246 235 1 245 1 251 246

Sxy
228 4 244
255 254 5
252 247 62
Adaptive median filter algorithm

Notations

3
Adaptive median filter algorithm

purpose
 Remove salt and pepper noise,
 To reduce distortion such as excessive thinning
or thickening of object boundaries

4
Adaptive median filter algorithm

5
A numerical example
255 241 251 255 16 245 245 255 244 239 255
250 255 255 0 255 244 255 254 254 6 255
238 253 255 255 255 254 255 229 246 251 238
255 252 240 245 228 4 244 255 255 255 251
1 247 252 250 255 254 5 244 243 233 250
12 251 245 255 252 247 6 253 255 239 255
255 255 1 252 246 251 255 254 248 240 246
251 254 249 234 255 245 255 239 255 0 255
254 240 255 254 242 255 243 252 251 252 251
255 15 255 254 7 254 254 248 242 255 250
247 244 255 228 246 235 1 245 1 251 246

Sxy
228 4 244
255 254 5
252 247 66
Sxy
228 4 244
254
255 (Zxy) 5
252 247 6
 Zmed =244
 Zmin=4,
 Zmax=255
 A1 = Zmed –Zmin =244 -4
 A2 = Zmed –Zmax = 244 – 255
 If A1 > 0 AND A2 < 0, go to stage B
 B1 = Zxy – Zmin = 254 – 4 =250
 B2 =Zxy – Zmax = 254 – 255 = -1
 If B1 > 0 AND B2 < 0 output Zxy =254
7
Sxy
251 255 16
255 0 255
255 255 255
 Zmed =255
 Zmin=0,
 Zmax=255
 A1 = Zmed –Zmin =255 -0
 A2 = Zmed –Zmax = 255 – 255
 If A1 > 0 AND A2 < 0, go to stage B
 B1 = Zxy – Zmin = 0 – 0 =0
 B2 =Zxy – Zmax = 0 – 255 = -255
 If B1 > 0 AND B2 < 0 output Zxy
 Else Zmed
8
Sxy
254 242 255
254 7 254
228 246 235
 Zmed =246
 Zmin=7,
 Zmax=255
 A1 = Zmed –Zmin =246 -7
 A2 = Zmed –Zmax = 246 – 255
 If A1 > 0 AND A2 < 0, go to stage B
 B1 = Zxy – Zmin = 7 – 7 =0
 B2 =Zxy – Zmax = 7 – 255 = -248
 If B1 > 0 AND B2 < 0 output Zxy
 Else Zmed
9
An example of using adaptive median filter

10
Image compression

11
Need for image compression
 Amount of data required to represent a two-hour
standard definition television movie using
720×480×24 bit pixel arrays

 A digital movie is a sequence of video frames and


video players display the frames at a rate of 30
frames/second

 30 fps ×720×480 pixels/frame×3 bytes/pixel


=31,104,000 bytes/sec
 A 2 hr movie consists of ~ 2.24 ×1011 bytes

12
Image compression
 Images occupy a large amount of space. A k-bit
image which has M x N pixels requires M x N x k
bits of storage space.

 How to reduce this?

 Any picture contains information. This can be


compressed by removing the redundancy.

e.g. of redundancy in language


I explained and told the group what we would discuss
next.
He's an athiest who doesn't believe in God.
Courtesy https://www.quora.com/What-are-some-examples-of-redundant-sentences 13
Image compression

 Compression in daily life : Abbreviation

 BITS, CGPA, ASAP, SMS, LOL

 So in general, compression is achieved by


encoding the information contained in the
source symbols into code words.

14
Image compression

 For storage purposes, we compress it and at a later


stage, it can be uncompressed.

 Sometimes a given code word may not be uniquely


decodable!

 Eg: WWF : World Wildlife Fund


World Wrestling Federation

15
 The aim of coding is to reduce the amount of
redundancy in the message (image).

Then why do we have redundancy in the first


place?

Error correction, detection, insurance against


failures

16
Redundancies in daily life:

Repetition in lecture:

Students who doze off for a minute can “get


back” into the lecture

Redundancy in movies: You can miss half


the movie and still understand the story!

17
 Many of the compression techniques can be
applied to all kinds of information

 How do we convey information?

 Data is the means by which we convey


information. Various amounts of data maybe used
to convey the same information. Hence
compression is possible.

18
 An Example of various amounts of data used to
convey the same information :

 My friend is a teacher. He works in an


university as a lecturer. He teaches digital
image processing course.

 My friend is a lecturer at an university where he


teaches digital image processing course.

19
How to measure Redundancy?
  

20
A code is a rule which assigns to each source
symbol a code word.

A 00001

B 00010

C 00011

D 00100

E 00101

21
Uniquely decodable code (UDC):
Example of a code which is not a UDC

Source symbol Code word


A 00
B 10
C 101
D 110
E 1001

Try decoding 10110


22

You might also like