0% found this document useful (0 votes)
22 views35 pages

Mpa 4

PPT of Digital Image Processing

Uploaded by

Shubham Mittal
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)
22 views35 pages

Mpa 4

PPT of Digital Image Processing

Uploaded by

Shubham Mittal
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/ 35

Digital Image Processing

Image Enhancement-
 An image whose pixels tend to occupy
the entire range of possible gray levels, in
addition, tend to be distributed uniformly,
will have an appearance of high contrast
and will exhibit a large variety of gray
tones.
Histogram Equalization
 Histogram equalization is a way of improving the
local contrast of an image without altering the
global contrast to a significant degree.
◦ This method is especially useful in images having large
regions of similar tone such as an image with a very
light background and dark foreground.
◦ Histogram equalization can expose hidden details in an
image by stretching out the contrast of local regions
and hence making the differences in the region more
pronounced and visible.
◦ Non-linear point processing technique that attempts to
flatten the histogram such that there are equal
numbers of each sample value in the image.
3
Histogram Equalization

s  T (r ) 0  r  L 1
a. T(r) is a strictly monotonically increasing function
in the interval 0  r  L -1;
b. 0  T (r )  L -1 for 0  r  L -1.

8/21/2024 4
How to implement histogram equalization?

Step 1:For images with discrete gray values, compute:

nk
pr (rk )  0  rk  1 0  k  L 1
n
L: Total number of gray levels
nk: Number of pixels with gray value rk

n: Total number of pixels in the image

Step 2: Based on CDF, compute the discrete version of the previous


transformation :

k
sk  T (rk )   pr (rj ) 0  k  L 1
j 0
Effect of applying the Histogram Equalization.

0.02

0.018

0.016

0.014

0.012

0.01

0.008

0.006

0.004

0.002

0
0 50 100 150 200 250

0.02

0.018

0.016

0.014

0.012

0.01

0.008

0.006

0.004

0.002

0
0 50 100 150 200 250
Another example highlighting the effectiveness of this technique

0.1

0.08

0.06

0.04

0.02

0
0 50 100 150 200 250

0.1

0.08

0.06

0.04

0.02

0
0 50 100 150 200 250
Histogram Equalization

Continuous case:
r
s  T (r )  ( L  1)  pr ( w)dw
0

Discrete values:
k
sk  T (rk )  ( L  1) pr (rj )
j 0
k nj L 1 k
 ( L  1)   nj k=0,1,..., L-1
j  0 MN MN j 0

8/21/2024 10
Example: Histogram Equalization

Suppose that a 3-bit image (L=8) of size 64 × 64 pixels (MN = 4096) has
the intensity distribution shown in following table.

Get the histogram equalization transformation function and give the p s(sk) for each
s k.

8/21/2024 11
Example: Histogram Equalization

0
s0  T (r0 )  7 pr (rj )  7  0.19  1.33 1
j 0
1
s1  T (r1 )  7 pr (rj )  7  (0.19  0.25)  3.08 3
j 0

s2  4.55  5 s3  5.67  6
s4  6.23  6 s5  6.65  7
s6  6.86  7 s7  7.00  7
8/21/2024 12
Example: Histogram Equalization

8/21/2024 13
Histogram Specification
(Histogram Matching)
 Histogram equalization yields an image whose pixels are (in
theory) uniformly distributed among all gray levels.

Sometimes, this may not be desirable. Instead, we may want a


transformation that yields an output image with a pre-specified
histogram. This technique is called histogram specification.
Given Information

(1) Input image from which we can compute its histogram .

(2) Desired histogram.

Goal

Derive a point operation, H(r), that maps the input image into an output image
that has the user-specified histogram.
For discrete gray levels, we have

k
sk  T (rk )   pin (r j ) 0  k  L 1
j 0
k
vk  G ( z k )   pout ( z j )  sk 0  k  L 1
j 0

z = G-1(v=s=T(r))

Input Uniform Output


Histogram Histogram Histogram
s=T(r) v=G(z)
Algorithm for histogram specification:

(1) Equalize input image to get an image with uniform gray values, using the
discrete equation:

k
sk  T (rk )   pin (rj ) 0  k  L 1
j 0

(2) Based on desired histogram to get an image with uniform gray values,
using the discrete equation:

k
vk  G( zk )   pout ( z j )  sk 0  k  L 1
j 0

1 1
(3)
  
z G ( v=s ) z G [T ( r )]
Example:

Consider an 8-level 64 x 64 previous image.

# pixels

Gray value
It is desired to transform this image into a new image, using a transformation
Z=H(r)= G-1[T(r)], with histogram as specified below:

# pixels

Gray values
The transformation T(r) was obtained earlier (reproduced
below):

Now we compute the transformation G as before.


Computer z=G-1 (s),Notice that G is not invertible.

G-1(0) = ?
G-1(1/7) = 3/7

G-1(2/7) = 4/7

G-1(3/7) = ?
G-1(4/7) = ?
G-1(5/7) = 5/7

G-1(6/7) = 6/7

G-1(1) = 1
Combining the two transformation T and G-1 , compute z=H(r)= G-1[v=s=T(r)]
Applying the transformation H to the original image yields an image with histogram
as below:

Again, the actual histogram of the output image does not exactly but only
approximately matches with the specified histogram. This is because we are dealing with
discrete histograms.
Original image and its histogram

Histogram specified image and its histogram


Example: Histogram Matching

8/21/2024 26
Example: Histogram Matching

8/21/2024 27
8/21/2024 28
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. Either histogram equalization or histogram
specification transformation function is obtained

Map the intensity of the pixel centered in the neighborhood

Move to the next location and repeat the procedure

8/21/2024 29
Local Enhancement

 The histogram processing methods discussed above are


global, in the sense that pixels are modified by a
transformation function based on the gray-level content
of an entire image.
 However, there are cases in which it is necessary to
enhance details over small areas in an image.

original global local


Local Histogram Processing: Example

8/21/2024 31
Use of Histogram Statistics for Image Enhancement

 Two uses of the mean and variance for


enhancement purposes:
◦ The global mean and variance (global means for the
entire image) are useful for adjusting overall contrast
and intensity.
◦ The mean and standard deviation for a local region
are useful for correcting for large-scale changes in
intensity and contrast. ( See equations 3.3-21 and 3.3-
22.)
Using Histogram Statistics for Image
Enhancement
Average Intensity L 1 M 1 N 1

m   ri p (ri )
1

MN
  f ( x, y )
x 0 y 0
i 0
L 1
un (r )   (ri  m) n p(ri )
i 0

Variance L 1 M 1 N 1
  u2 (r )   (ri
1
 m) p(ri )     f ( x, y )  m 
2 2 2

i 0
MN x 0 y 0

8/21/2024 33
Using Histogram Statistics for Image
Enhancement

Local average intensity


L 1
msxy   ri psxy (ri )
i 0

sxy denotes a neighborhood

Local variance
L 1
 2
sxy   (ri  msxy ) psxy (ri )
2

i 0

8/21/2024 34
Using Histogram Statistics for Image
Enhancement: Example

 E f ( x, y ), if msxy  k0 mG and k1 G   sxy  k2 G


g ( x, y )  
 f ( x, y ), otherwise

mG : global mean;  G : global standard deviation


k0  0.4; k1  0.02; k2  0.4; E  4

8/21/2024 35
Thank You

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy