0% found this document useful (0 votes)
21 views61 pages

03 - JKD - Image Enhancement Spatial Domain

The document provides an overview of image enhancement techniques, including spatial domain methods such as intensity transformation and spatial filtering, as well as frequency domain operations. It discusses various intensity transformation functions, histogram processing, and different types of filters used for smoothing and sharpening images. Additionally, it covers histogram equalization and matching as essential techniques for improving image quality.

Uploaded by

tarunvaka6767
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views61 pages

03 - JKD - Image Enhancement Spatial Domain

The document provides an overview of image enhancement techniques, including spatial domain methods such as intensity transformation and spatial filtering, as well as frequency domain operations. It discusses various intensity transformation functions, histogram processing, and different types of filters used for smoothing and sharpening images. Additionally, it covers histogram equalization and matching as essential techniques for improving image quality.

Uploaded by

tarunvaka6767
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 61

Image Enhancement

Jatindra Kumar Dash


[email protected]
+91-9437368464
Image Enhancement
• What is Image enhancement and its
necessity?
• Spatial domain technique (Intensity transformation and spatial filters)
– Point processing (Local processing)
– Mask processing
– Histogram based techniques (Global processing)
• Frequency Domain operations
Representing digital image

Value f(x,y) at each x, y is called intensity level or gray level


Example
Spatial Domain Techniques
g(x,y)=T[f(x,y)]
f(x,y) – input image,
g(x,y) – output image
T is an operator on f(x,y) defined over a neighborhood of
point (x,y)
Intensity Transformation (point operation)
• 1 x 1 is the smallest possible neighborhood.
• In this case g depends only on value of f at a
single point (x,y)
• We call T an intensity (gray-level mapping)
transformation and write
s = T(r)
where s and r denotes respectively the
intensity of g and f at any point (x, y).
-7-

Intensity transformation (point operation)


• Map a given gray or color level r to a new
level s, Where s = T(r) r, s=0, 1, 2, …, 255

• Memory-less, direction-less operation


s
– output at (x, y) only depend on the input
intensity at the same point

output gray level


– Pixels of the same intensity gets the same
transformation
• Does not bring in new information, may
cause loss of information
• But can improve visual appearance or make r input gray level

features easier to detect


-8-

Intensity transformation (point operation)


• Image negative
• Log/inverse Log transform (dynamic range
compression
• Power law (gamma) transformation
– Gamma correction
s
• Contrast stretching (piece-wise linear)

output gray level


• Thresholding
• Intensity level slicing
• Bit-plane slicing

r input gray level


Some Intensity Transformation
Functions
Image Negatives
Denote [0, L-1] intensity levels of the image.

Image negative is obtained by s= L-1-r

The appearance of photographic negatives

Lena Image Negative


Application: Image negative
Log Transformations and its inverse
s = c log(1+r), c is a const, r ≥ 0
Maps a narrow range of low intensity values in the input into a wider range of
output levels. The opposite is true for higher values of input levels.

Stretch, compress
Example: log transform

lena

FFT(lena)

Dynamic range compression?


-13-
Power–Law (Gamma) transformation
s = crγ, c,γ –positive constants
curve the grayscale components either to brighten the intensity
(when γ < 1) or darken the intensity (when γ > 1).

brighten

Family of graphs can be


obtained varying gamma

darken
Power –Law (Gamma) transformation
Power –Law (Gamma) transformation
gamma correction

-17-
Contrast stretching (Piece-wise linear transformation)
Contrast stretching is a process that expands the range of intensity levels in a image
so that it spans the full intensity range of the recording medium or display device.
Contrast-stretching transformations increase the contrast between the darks and the lights

Threshoding
Thresholding function
Intensity-level slicing
Highlighting a specific range of gray levels in an image
Image bit-planes

-21-
Bitplanes slicing

• Depend on relative importance of bits


• How much to slice depend on image content
• Useful in image compression, e.g. JPEG2000
-22-
Image reconstruction
Spatial filtering (neighborhoods operations)

-24-
kernel operator / filter masks
TN (.)  w(.)
Spatial g
f Filtering

kernel

a b
g(x, y)   w(i, j) f (x i,y j)
ia j b

1 1
g(x, y)   w(i, j) f (x i,y j) For a 3x3 mask
i1 j 1

-25-
Spatial Filtering/Mask operation
• Smoothing Filters
– Linear spatial filtering
• Averaging
• Weighted averaging
– Non-linear spatial filtering
• Median filtering
• Min filtering
• Max filtering
• Sharpening Filters
– Second order derivative (Laplacian)
– Unsharp Masking and High boost filtering
– First order derivative
Linear smoothing operator
Smoothing: Image Averaging

Weighted averaging
Averaging
(Gaussian)

a b
1
g(x,y)  a b  w(i, j) f (x i,y j)
 w(i, j)
ia j b
ia j b

smoothing
operator

Low-pass filter, leads to


softened edges
-27-
Spatial averaging can suppress noise
• image with noise y(m,n) = x(m,n) + N(m,n)
G Slides (created by M.Wu & R.Liu © 2002)

• averaging
v(m,n) = (1/Nw)  x(m-k, n-l) + (1/Nw)  N(m-k, n-l)
• Nw: number of pixels in the averaging window
– Noise variance reduced by a factor of Nw
– SNR improved by a factor of Nw
– Window size is limited to avoid excessive blurring
UMCP ENEE408G

-28-
smoothing operator of different sizes

original 3x3

5x5 9x9

15x15 35x35

-29-
directional smoothing
G Slides (created by M.Wu & R.Liu © 2002)

• Problems with simple spatial averaging mask



– Edges get blurred
• Improvement W
– Restrict smoothing to along edge direction
– Avoid filtering across edges

• Directional smoothing
– Compute spatial average along several directions
UMCP ENEE408G

– Take the result from the direction giving the smallest changes before &
after filtering

• Other solutions
– Use more explicit edge detection and adapt filtering accordingly

-30-
Non-linear smoothing operator
• Median filtering
– Based on order statistics (response depends upon ordering
of intensity value)
– Reduces blurring effect
– Algorithm
• Take a mask of any size (3X3, 5X5, 7X7)
• Order the intensity values of all pixel in the window in some order
• Take the median value as the filter response
• For even-sized windows take the average of two middle values as
output
– Nonlinear
• median{ x(m) + y(m) }  median{x(m)} + median{y(m)}
•-31- Other order statistics: min, max etc.
Median filter example
• Median filtering
– Resilient to statistical outliers
– Incurs less blurring
– Simple to implement

-32-
Order statistics filters

g ( x, y )  median{ f ( s, t )}
( s ,t )W( x , y )

g ( x, y )  max { f ( s, t )}
( s ,t )W( x , y )

original

g ( x, y )  min { f ( s, t )}
( s ,t )W( x , y )

-33-
Sharpening (Image derivative)
• First order

• Second order

-34-
Second derivative in 2D

Image Laplacian:

-35-
Result of Laplacian

These images can be added to


original image to enhance the edged
in the image (Composite mask)

http://flickr.com/photos/starfish235/388557119/
-36-
Unsharp masking
• Unsharp masking is an image manipulation technique for increasing the
apparent sharpness of photographic images.
• The "unsharp" of the name derives from the fact that the technique uses a
blurred, or "unsharp", positive to create a "mask" of the original image.
The unsharped mask is then combined with the negative, creating a
resulting image sharper than the original.

Steps 
Blur the image 
Subtract the blurred 
version from the original
(this is called the mask)
Add the “mask” to the 
original

-37-
High-boost filtering

Avg.

-
+

+ f hb ( x, y )  Af ( x, y )  f lp ( x, y )
Unsharp mask:
high-boost with A=1
-38-
Unsharp mask example

-39-
Edge detection operators
Image gradient:

 f 
Gx   x 
f      f 
G y   
 y 
f  G x  G y

Robert’s
operator

Sobel’s
operator

-40-
Edge detection example

Roberts

Sobel

-41- http://flickr.com/photos/reneemarie11/97326485/
Gray-level image histogram
• Represents the relative frequency of occurrence of the
various gray levels in the image
– For each gray level, count the number of pixels having that level
– Can group nearby levels to form a big bin & count #pixels in it

-42-
Histogram and its processing
The histogram of a digital image with
gray levels in the range [0, L-1] is a discrete
function h(rk)=nk , where rk is the kth gray
level and nk is the number of pixels in the
image having gray level rk.

It is common practice to normalize a


histogram by dividing each of its values by
the total number of pixels in the image,
denoted by the product MN.

Thus, a normalized histogram is given by


h(rk)=nk/MN

The sum of all components of a


normalized histogram is equal to 1.
More about histogram
• Statistical features for recognition
– Provides only statistical information
– Does not provide spatial information
• Image segmentation (thresholding)
• Image compression
Histogram Equalization

• Histogram equalization can be used to improve the


visual appearance of an image.

• Histogram equalization automatically determines a


transformation function that produce and output
image that has a near uniform histogram
Histogram Equalization
• Let rk, k[0..L-1] be intensity levels and let
p(rk) be its normalized histogram function.
• The intensity transformation function for
histogram equalization is
k
sk  T (rk )  ( L  1) pr (rj )
j 0

L 1 k
 
MN j 0
n j , k  0,1,2,..., L  1
Histogram Equalization - Example
• Let f be an image with size 64x64 pixels and L=8 and let f has the intensity
distribution as shown in the table
0
rk nk p r(rk )=nk/MN s0  T (r0 )  7 pr (r j )  7 pr (r0 )  1.33
0 790 0.19 j 0
1

1 1023 0.25 s1  T (r1 )  7 pr (rj )  7( pr (r0 )  pr (r1 ))  3.08


j 0
2 850 0.21 s2  4.55, s3  5.67, s4  6.23, s5  6.65, s6  6.86, s7  7.00.
3 656 0.16
round the values to the nearest integer
4 329 0.08
5 245 0.06
6 122 0.03
7 81 0.02
Local histogram Processing
Define a neighborhood and move its center from pixel to pixel. At each
location, the histogram of the points in the neighborhood is computed and
histogram equalization transformation is obtained.
Histogram matching (specification)

r
s  T (r )  ( L  1)  pr ( w)dw
0
z
G ( z )  ( L  1)  p z (t )dt  s
0

z  G 1 ( s )  G 1[T (r )]

p z (z ) is the desired PDF


Histogram matching (specification)

k k nj
sk  T (rk )  ( L  1) pr (rj )  ( L  1) , k  0,1,2,..., L  1
j 0 j 0 n
k
vk  G ( z k )  ( L  1) p z ( zi ) sk , k  0,1,2,..., L  1
i 0

zk  G 1[T (rk )], k  0,1,2,..., L  1


Algorithm (Histogram matching)

• Histogram matching
– Obtain the histogram of the given image, T(r)
– Precompute a mapped level sk for each level rk
– Obtain the transformation function G from
the given p z (z )
– Precompute z k for each value of sk
– Map rk to its corresponding level sk ; then
map level sk into the final level z k
Summary
• Spatial transformation and filtering are popular
methods for image enhancement
• Intensity Transformation
– Intensity transformation functions (negative, log, gamma),
intensity and bit-place slicing, contrast stretching
– Histograms: equalization, matching, local processing
• Spatial Filtering
– smoothing filters
– Median filters
– Order statistic filters
– Sharpening filters
• Second order derivative: Laplacian, unsharp masking, high boost
filtering
• First order derivative: Robert’s cross gradiant operator, Sobel
-61-
operator

You might also like