You are on page 1of 20

Digital Image Processing, 3rd ed.

Gonzalez & Woods


www.ImageProcessingPlace.com

Image Enhancement - 2

Computer Vision Image enhancement - 2


Bartolomeo Montrucchio Politecnico di Torino
Dipartimento di Automatica e Informatica (DAUIN) Torino - Italy

bartolomeo.montrucchio@polito.it

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Spatial domain
Spatial domain g(x) = T[f(x,y)] the neighborhood can also be 1x1

Image Enhancement - 2

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Thresholding

Image Enhancement - 2

darkening below k and brightening above k

thresholding

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Transformation functions
s=T(r) menu curves in image processing software see example with Moon image see p.675 [Zakia] for the quadrant diagram in photography

Image Enhancement - 2

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Log transformation

Image Enhancement - 2

19922008 R. C. Gonzalez & R. E. Woods

s = c log(1+r) where c is a constant and r >= 0 a narrow range of low-level values in the input image is mapped in a wide range of output levels at right the spectrum values are now more similar and easier to be represented

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Gamma correction
A CRT monitor has a gamma value of 1.8-2.5

Image Enhancement - 2

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Gamma correction CRT


Here gamma correction means (for the CRT) to apply s=r^(1/2.5)

Image Enhancement - 2

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Gamma correction

Image Enhancement - 2

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Gamma correction

Image Enhancement - 2

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Contrast stretching

Image Enhancement - 2

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Specific range highlighting

Image Enhancement - 2

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Specific range highlighting

Image Enhancement - 2

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Bit-plane slicing

Image Enhancement - 2

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Bit-plane slicing

Image Enhancement - 2

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Bit-plane slicing

Image Enhancement - 2

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Histograms
The histogram is a discrete function h(rk)=nk where rk is the kth gray level and nk is the number of pixels having gray level rk Usually is normalized p(rk)=nk/n where n is the total number of pixels Over/under-exposure are easily seen in the histogram in the digital camera display

Image Enhancement - 2

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Histogram equalization (I)


Spreading out the frequencies (grays levels should have a uniform density) in an image (or equalising the image) can be done for improving the image The formula for histogram equalisation is given where
rk: input intensity sk: processed intensity k: the intensity range (e.g 0.0 1.0) nj: the frequency of intensity j n: the sum of all frequencies

Image Enhancement - 2

sk = T (rk )
= ! pr ( r j )
j =1 k

=!
19922008 R. C. Gonzalez & R. E. Woods

nj n

j =1

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Histogram equalization (II)


given a probability density function (PDF) it is possible to produce a resulting uniform PDF

Image Enhancement - 2

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Histogram equalization (III)

Image Enhancement - 2

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Histogram equalization (IV)

Image Enhancement - 2

19922008 R. C. Gonzalez & R. E. Woods

10

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Histogram equalization (V)

Image Enhancement - 2

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Histogram specification

Image Enhancement - 2

19922008 R. C. Gonzalez & R. E. Woods

11

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Histogram specification
1. Mapping of the levels in the original image into sk, starting from the histogram of the original image sk= T(rk) 2. Computes G function vk=G(zk ) starting from the desired histogram as a T(zk) like sk (please note that after both applying T to the original image or G to the desired and unknown image, results should be the same) 3. Computes G-1 4. Computes the desidered levels of the image applying G-1 zk=G-1[T(rk)] zk=G-1(sk)
19922008 R. C. Gonzalez & R. E. Woods

Image Enhancement - 2

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Histogram specification

Image Enhancement - 2

19922008 R. C. Gonzalez & R. E. Woods

12

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Histogram specification

Image Enhancement - 2

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Histogram specification

Image Enhancement - 2

The function in (b),(2) is the inverse of that in (b),(1) It can be obtained (geometrically) reflecting the graph across the line y = x (not always it is possible)
19922008 R. C. Gonzalez & R. E. Woods

13

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Image Enhancement - 2

Global and local histogram equalization

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Image Enhancement - 2

Global and local histogram equalization

19922008 R. C. Gonzalez & R. E. Woods

14

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Image Enhancement - 2

Mathematical operations
Image subtraction used in segmentation and enhancement Image addition Image division multiplication of one image by the reciprocal of the other (e.g. for uneven illumination) Image averaging used for contrasting noise (e.g. in astronomy)
19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Image Enhancement - 2

Linear spatial filtering


Given a linear, position invariant operator h(x,y): 1. Point Spread Function (PSF) h(x,y) is the response of the system to the impulse (a point of light) 2. Fourier transform of h(x,y) is H(u,v) and is the optical transfer function h(x,y) is also referred as a spatial convolution mask (only if symmetric)
19922008 R. C. Gonzalez & R. E. Woods

15

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Image Enhancement - 2

Linear spatial filtering


Correlation
+%

Convolution
+%

f (x) o g(x) =

&
$%

f " (# )g(x + # )d#

f (x) " g(x) =

&
$%

f (# )g(x $ # )d#

f* is the complex coniugate of f (imaginery part has opposite sign)

f (x, y) o g(x, y) " F(u,v)G(u,v) f # (x, y)g(x, y) " F(u,v) o G(u,v)

Convolution theorem
f (x) " g(x) # F(u)G(u) f (x)g(x) # F(u) " G(u)

Correlation Theorem (in 2D)

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Image Enhancement - 2

Linear spatial filtering

19922008 R. C. Gonzalez & R. E. Woods

16

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Image Enhancement - 2

Linear spatial filtering

g(x, y) =

# # w(s,t) f (x + s, y + t)
s="a t="b

Example of convolution mask, where the image f has size MxN, the filter mask has size mxn, a=(m-1)/2, b=(n-1)/2 Linear spatial filtering is often referred as convolving a mask with ! an image

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Image Enhancement - 2

Linear spatial filtering


Please note that in photography, the resulting image at the sensor level is the convolution of the original (perfect) image with the finite aperture of the lens (diaphragm) if the original image is a very little point (e.g. 1 m) the result is as in figure if the lens is out of focus the result is much larger (so called bokeh) In figure there is the PSF of an optical system (a telescope with f=2500 mm and d=120mm), given as input a point of light (an artificial star of 35m at more than 15m)

112.5 m (core is 22.5 m) for a ~f20 lens, seen through a 3.75m pixel-wide CCD
19922008 R. C. Gonzalez & R. E. Woods

17

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Image Enhancement - 2

Averaring filter masks

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Image Enhancement - 2

Averaring filter masks

19922008 R. C. Gonzalez & R. E. Woods

18

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Image Enhancement - 2

Averaring filter masks

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Image Enhancement - 2

Non linear filtering Median filter

median is the numerical value separating the higher half from the lower half median lter computes the median under the mask (here 3x3) and uses it as a resulting value it is very effective for some images
19922008 R. C. Gonzalez & R. E. Woods

19

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Image Enhancement - 2

Derivatives

19922008 R. C. Gonzalez & R. E. Woods

20

You might also like