18

Dr. Praveen · PDF fileDr. Praveen Sankaran Department of ECE ... Image sampling, quantization and associated problems. ... DIP Winter 2013 December 28,

  • Upload
    vunhan

  • View
    219

  • Download
    4

Embed Size (px)

Citation preview

Page 1: Dr. Praveen  · PDF fileDr. Praveen Sankaran Department of ECE ... Image sampling, quantization and associated problems. ... DIP Winter 2013 December 28,

Dr. Praveen Sankaran

Department of ECE

NIT Calicut

December 28, 2012

Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 December 28, 2012 1 / 18

Page 2: Dr. Praveen  · PDF fileDr. Praveen Sankaran Department of ECE ... Image sampling, quantization and associated problems. ... DIP Winter 2013 December 28,

Outline

1 Piecewise-Linear FunctionsReviewContrast Stretching

2 Histogram ProcessingWhat is a Histogram?

Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 December 28, 2012 2 / 18

Page 3: Dr. Praveen  · PDF fileDr. Praveen Sankaran Department of ECE ... Image sampling, quantization and associated problems. ... DIP Winter 2013 December 28,

Piecewise-Linear Functions Review

Outline

1 Piecewise-Linear FunctionsReviewContrast Stretching

2 Histogram ProcessingWhat is a Histogram?

Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 December 28, 2012 3 / 18

Page 4: Dr. Praveen  · PDF fileDr. Praveen Sankaran Department of ECE ... Image sampling, quantization and associated problems. ... DIP Winter 2013 December 28,

Piecewise-Linear Functions Review

Review Summary

Image sampling, quantization and associated problems.

Image formats examples.

.pgm and .ppm formats.

Looked at a code to read an image and compute mean.

Integer and �oat values for computed Image mean di�er, why?

Spatial domain operations.

Intensity transformation functions that work on single pixel values.

Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 December 28, 2012 4 / 18

Page 5: Dr. Praveen  · PDF fileDr. Praveen Sankaran Department of ECE ... Image sampling, quantization and associated problems. ... DIP Winter 2013 December 28,

Piecewise-Linear Functions Contrast Stretching

Outline

1 Piecewise-Linear FunctionsReviewContrast Stretching

2 Histogram ProcessingWhat is a Histogram?

Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 December 28, 2012 5 / 18

Page 6: Dr. Praveen  · PDF fileDr. Praveen Sankaran Department of ECE ... Image sampling, quantization and associated problems. ... DIP Winter 2013 December 28,

Piecewise-Linear Functions Contrast Stretching

Contrast

De�ned as the di�erence in intensity between the highest and thelowest intensity levels in an image.

Also can be explained as - the di�erence in luminance and/or colorthat makes an object (or its representation in an image or display)distinguishable.1

1http://en.wikipedia.org/wiki/Contrast_%28vision%29Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 December 28, 2012 6 / 18

Page 7: Dr. Praveen  · PDF fileDr. Praveen Sankaran Department of ECE ... Image sampling, quantization and associated problems. ... DIP Winter 2013 December 28,

Piecewise-Linear Functions Contrast Stretching

Low Contrast

Poor scene illumination - absense of higher valued gray levels.

Lack of dynamic range(?) in the imaging sensor.

Dynamic range is the ratio between the largest and smallest possible

values of a changeable quantity, such as in signals like sound and light.2

Dynamic range of scene → luminance range of the scene being

photographed.

Dynamic range of sensor → de�nes max and min value of luminance a

sensor can capture.

Small dynamic range of sensor would result in image with lowest and

highest intensity levels close together.

Wrong lens aperture during imaging.

2http://en.wikipedia.org/wiki/Dynamic_rangeDr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 December 28, 2012 7 / 18

Page 8: Dr. Praveen  · PDF fileDr. Praveen Sankaran Department of ECE ... Image sampling, quantization and associated problems. ... DIP Winter 2013 December 28,

Piecewise-Linear Functions Contrast Stretching

Some Calculations - Contrast

How do we set up a calculation for this?

Let g be an M×N digital image with l = 0,1, ...,L−1 possible graylevels.

Image contrast relates to the global amount of image gray leveldispersion (variation about the mean gray level).

Dispersion → Image pixel value variance.

‖g −g‖2 = 1

MN∑M−1m=0 ∑

N−1n=0

(g [m,n]−g)2

g = 1

MN∑M−1m=0 ∑

N−1n=0

g [m,n]

Units are squared here.

Contrast = ‖g −g‖=√‖g −g‖2 → standard deviation.

Note that it would take an order O (MN) algorithm to �nd this.

Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 December 28, 2012 8 / 18

Page 9: Dr. Praveen  · PDF fileDr. Praveen Sankaran Department of ECE ... Image sampling, quantization and associated problems. ... DIP Winter 2013 December 28,

Piecewise-Linear Functions Contrast Stretching

Contrast Stretching

Idea → expand the range of intensity levels in an image so that it spans thefull intensity range of the recording medium or display device.

Position of (r1,s1) and(r2,s2) controls thefunction.

r1 ≤ r2 and s1 ≤ s2.

Single valued,monotonically increasing.

Speci�c case here →(r1,s1) = (rmin,0) and(r2,s2) = (rmax ,L−1)

Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 December 28, 2012 9 / 18

Page 10: Dr. Praveen  · PDF fileDr. Praveen Sankaran Department of ECE ... Image sampling, quantization and associated problems. ... DIP Winter 2013 December 28,

Piecewise-Linear Functions Contrast Stretching

Intensity Level Slicing

Idea → Highlight a speci�c range of intensity levels by using a window.

Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 December 28, 2012 10 / 18

Page 11: Dr. Praveen  · PDF fileDr. Praveen Sankaran Department of ECE ... Image sampling, quantization and associated problems. ... DIP Winter 2013 December 28,

Piecewise-Linear Functions Contrast Stretching

Bit-plane Slicing

Idea → Each pixel value (e.g. between 0 and 255) is represented by 8 bits.

Remember → each of the planes would have a set of 0's and 1's.

Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 December 28, 2012 11 / 18

Page 12: Dr. Praveen  · PDF fileDr. Praveen Sankaran Department of ECE ... Image sampling, quantization and associated problems. ... DIP Winter 2013 December 28,

Piecewise-Linear Functions Contrast Stretching

Bit-planes - Visual Information

Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 December 28, 2012 12 / 18

Page 13: Dr. Praveen  · PDF fileDr. Praveen Sankaran Department of ECE ... Image sampling, quantization and associated problems. ... DIP Winter 2013 December 28,

Histogram Processing What is a Histogram?

Outline

1 Piecewise-Linear FunctionsReviewContrast Stretching

2 Histogram ProcessingWhat is a Histogram?

Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 December 28, 2012 13 / 18

Page 14: Dr. Praveen  · PDF fileDr. Praveen Sankaran Department of ECE ... Image sampling, quantization and associated problems. ... DIP Winter 2013 December 28,

Histogram Processing What is a Histogram?

Histogram

Let g be an M×N digital image with l = 0,1, ...,L−1 possible graylevels.

c [l ] =the number of pixels with gray level l .

De�ne relative frequency

p [l ] = c[l ]MN

, ∑L−1l=0

p [l ] = 1

→ digital image gray level distribution.

The probability that a randomly selected pixel has value l .

Note that the computation would take an algorithm with orderO (L+MN).

Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 December 28, 2012 14 / 18

Page 15: Dr. Praveen  · PDF fileDr. Praveen Sankaran Department of ECE ... Image sampling, quantization and associated problems. ... DIP Winter 2013 December 28,

Histogram Processing What is a Histogram?

Histogram - Example

Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 December 28, 2012 15 / 18

Page 16: Dr. Praveen  · PDF fileDr. Praveen Sankaran Department of ECE ... Image sampling, quantization and associated problems. ... DIP Winter 2013 December 28,

Histogram Processing What is a Histogram?

Some More Calculations - Contrast

∑M−1m=0 ∑

N−1n=0 g [m,n] = ∑

L−1l=0

lc [l ].

∑M−1m=0 ∑

N−1n=0 g

2 [m,n] = ∑L−1l=0

l2c [l ].

Note that l ≪MN. So if we have the gray level distribution model,we can speed things up!

random selection of a small sub-set of a large image to obtain gray

level distribution.

not accurate, but could live with it! especially if we are sure about the

randomness.

g = ∑L−1l=0

lp [l ]

‖g −g‖=√

∑L−1l=0

(l −g)2 p [l ]

Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 December 28, 2012 16 / 18

Page 17: Dr. Praveen  · PDF fileDr. Praveen Sankaran Department of ECE ... Image sampling, quantization and associated problems. ... DIP Winter 2013 December 28,

Histogram Processing What is a Histogram?

Summary

Contrast?

image standard deviation.

Contrast stretching.

Intensity slicing, bit-plane slicing.

Gray level distribution, histogram.

Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 December 28, 2012 17 / 18

Page 18: Dr. Praveen  · PDF fileDr. Praveen Sankaran Department of ECE ... Image sampling, quantization and associated problems. ... DIP Winter 2013 December 28,

Histogram Processing What is a Histogram?

Questions

3.1, 3.2, 3.3, 3.4, 3.5

Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 December 28, 2012 18 / 18