0% found this document useful (0 votes)
108 views14 pages

Cumulative Histogram Equalization

The document describes the steps for image processing using histogram equalization. It loads an image, calculates the image size and histogram. It then finds the cumulative distribution function and uses a formula to build a new image with replaced gray values. Finally, it shows the new histogram and graphics results to compare with the original image. It also describes performing local histogram equalization on a sample image matrix by calculating probabilities and cumulative distributions within a sliding window.

Uploaded by

Ankit Prajapati
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
108 views14 pages

Cumulative Histogram Equalization

The document describes the steps for image processing using histogram equalization. It loads an image, calculates the image size and histogram. It then finds the cumulative distribution function and uses a formula to build a new image with replaced gray values. Finally, it shows the new histogram and graphics results to compare with the original image. It also describes performing local histogram equalization on a sample image matrix by calculating probabilities and cumulative distributions within a sliding window.

Uploaded by

Ankit Prajapati
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 14

Lab-: Image Processing

Start

Load Image

Get Image size

Get Image Histogram

Get Cumulative Distribution Function

Build New image By replacing original gray value with the new gray level

Calculate New Values via general Histogram equalization Formula

Get The Histogram and Cumulative histogram of new image to compare them with originals

Show Graphics Results

End

Step-1 Load Image


1 4 4 2 1 2 2 2 4 3 5 2 5 0 0 0

Step-2 Get Image Size


y [m n]= size (I); y M=4 y N=4

Step-3 Get Image Histogram


No of Pixel
6 5 4 3 2 1 0 0 1 2 3 4 5 No of Pixel

Step-4 Find Probability


y For 0=3/16 y For 1=2/16 y For 2=5/16 y For 3=1/16 y For 4=3/16 y For 5=2/16 y For 6=0/16 y For 7=0/16

Step-5 Find CDF:


y For 0=3/16 y For 1=2/16+3/16=5/16 y For 2=5/16+5/16=10/16 y For 3=1/16+10/16=11/16 y For 4=3/16+11/16=14/16 y For 5=2/16+14/16=16/16 y For 6=0/16+16/16=16/16 y For 7=0/16+16/16=16/16

Formula:
S  S min * ( L  1)  0.5 S ' ! round 1  S min
L=No of Intensity Level Here L=8 Here S min = 0

Cumulative Histogram
Old Intensity 0 1 2 3 4 5 6 7 New Intensity 2 3 5 5 7 7 7 7 3 7 7 5

New Image

3 5 5 5

7 5 7 5

7 2 2 2

New Histogram
No of Pixel
6 5 4 3 2 1 0 0 1 2 3 4 5 6 7 No of Pixel

Last step
y Show Graphic Result

Local Histogram Equalization


Consider a matrix(Image)

2 1 0 0 1 3 A! 4 1 4
Intensity Range 0-4

y Copy matrix A in to another Matrix B and Pad it with

zero on all side

B!

0 0 0 0 0 0 2 1 0 0 0 0 1 3 0 0 4 1 4 0 0 0 0 0 0

y Now Consider a window of size 3 by 3.it start tracing

from the first position (1,1)

B!

0 0 0 0 0 0 2 1 0 0 0 0 1 3 0 0 4 1 4 0 0 0 0 0 0

y Find the probability density of each value inside the y y y y y

matrix For 0=6/9 For 1=2/9 For 2=1/9 For 3=0 For 4=0

y Find Cumulative Distribution of each value y For 0= 6/9*4=3 y For 1=6/9+2/9=8/9*4=4 y For 2=9/9*4=4 y For 3=4 y For 4=4

y Find the middle element in the window:

B!

0 0 0 0 0

0 2 0 4 0

0 1 1 1 0

0 0 3 4 0

0 0 0 0 0

y Replace the value of two with the value obtained by CDF.

It is 4 . Similarly the computation done for whole matrix.

Final Result
4 3 3 2 2 4 4 3 4

You might also like