0% found this document useful (0 votes)
4 views13 pages

Lecture 3

The document discusses histogram processing in digital image enhancement, explaining how histograms represent the frequency distribution of gray levels in an image. It covers properties of histograms, types, and applications such as thresholding and image enhancement, along with methods for histogram modification including stretching and equalization. Examples illustrate the processes of histogram stretching and equalization to improve image quality.

Uploaded by

azasfrz10
Copyright
© © All Rights Reserved
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)
4 views13 pages

Lecture 3

The document discusses histogram processing in digital image enhancement, explaining how histograms represent the frequency distribution of gray levels in an image. It covers properties of histograms, types, and applications such as thresholding and image enhancement, along with methods for histogram modification including stretching and equalization. Examples illustrate the processes of histogram stretching and equalization to improve image quality.

Uploaded by

azasfrz10
Copyright
© © All Rights Reserved
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/ 13

Digital Image Processing

Lecture: (3)
Image Enhancement (histogram processing)

Eng: Ghania Abdullah

2025-2024
Histogram processing:
• the histogram of image records the frequency distribution of gray levels in the image.
• Histogram plots how many times(frequency) each intensity value in image occurs.
• A graph indicating the number of times each grey level occurs in the image.
count Pixel
Ex: value
7 0
6 1
8 2
6 3
4 4
2 5
3 6
36 Total
Properties of histogram:
• Let for k=0,1,2,…..,L-1, represent the intensities of an L-level image
• The unnormalized histogram of is defined as
• Where is the number of pixels of with intensity .
• The subdivisions of the intensity scale are called histogram bins.
• The normalized histogram of is defined as
• Where as usual, M and N are the number of rows and columns.
• The sum of for all values of k is always (1).

• The components of are the probabilities of intensity levels in the


image.
Histograms of the image contrast:
• low-contrast: histogram with narrow intensity range.
• High-contrast: histogram with broad intensity ranges.
Note that:
• Histograms: only statistical information
• No indication of location of pixels
• Different images can have same histogram
• 3 images below have same histogram

 Same histogram = same statistics


 Distribution of intensities could be different

Can we reconstruct image from histogram?


Types of histogram:
1. If the histogram values are concentrated toward the
left, the image is darker .
2. If the histogram values are concentrated toward the
right, the image is lighter .
3. A histogram in which the pixel counts that are
restricted to a smaller range indicate low contrast.
4. A histogram in which the pixel counts evenly cover a
broad range of grayscale levels indicates an image
with good contrast .
Applications of histogram:
1. Thresholding A grayscale image can be converted into a
black-and-white image by choosing a threshold and
converting all values above the threshold to the maximum
intensity and all values below the threshold to the
minimum intensity. A histogram is a convenient means of
identifying an appropriate threshold.
2. Image Enhancement Image enhancement refers to the
process of transforming an image so as to make it more
visually appealing or to facilitate further analysis. An image
histogram can help us to quickly identify processing
operations that are appropriate for a particular image. The
gray level histogram of an image is the distribution of the
gray level in an image. The histogram can be modified b
Histogram modification:
The gray level histogram of an image is the distribution of the gray
level in an image.
The histogram can be modified by mapping functions, which will
1. Stretch,
2. Shrink (compress),
3. Slide the histogram

Stretch histogram
The mapping function for histogram stretch can be found by
the following equation:
[MAX-MIN]+MIN.
Where: I(r, c) max is the largest gray- level in the image I(r, c).
I(r, c) min is the smallest gray- level in the image I(r, c).
max and min the maximum and minimum gray – level values
possible (for an 8-bit image these are 255 and 0).
Example : Suppose you have the following sub of image. Perform the Stretch histogram

7 8 12 7
Answer:
I(r,c)max = 12 , I(r,c)min = 1 , Max = 63 , Min = 0 4 6 9 11

[MAX-MIN]+MIN.
5 1 5 10

7−1
𝐼 ( 𝑥 , 𝑦 )= ⌊ ⌋ [ 63 − 0 ]+ 0 =
12−1
I( r, c) = ((7-1)/(12-1) ) * (63-0)+0 = (6/11)*63 = 34.36 40. 34.
63
09 36
I( r, c) = ((12-1)/(12-1) ) * (63-0)+0 = 63
I( r, c) = ((8-1)/(12-1) ) * (63-0)+0 = (7/11)*63 = 34.36
A piecewise linear stretching function
Using it to find the pixel values in the image between ai and ai+1.
Since the line between the coordinates (ai,bi) and (ai+1,bi+1) has the equation:

Histogram Equalization:
Is a popular technique for improving the appearance of a poor image.
It's a function is similar to that of a histogram stretch but often provides more visually pleasing results a cross a wide rang
of images.
The histogram equalization process for digital images consists of four steps:
1. Find the running sum of the histogram values
2. Normalize the values from step1 by dividing by total number of pixels.
3. Multiply the values from step2 by the maximum gray level value and round.
4. Map the gray-level values to the results from step 3, using a one-to-one correspondence.
Example : - We have an image with 3 bit /pixel, so the possible range of values is 0 to 7 . We have an image with the
following histogram

7 6 5 4 3 2 1 0 Gray level value

No. of Pixel histogram


2 5 1 14 2 9 8 10 value

Answer :
Step 1: create a running sum of histogram values. This means that the first
values is 10, The second is 10+8=18, next is 10+8+9=27, and soon. Here we get
10,18,29,43,44,49,51.
7 6 5 4 3 2 1 0 Gray level value

No. of Pixel histogram


2 5 1 14 2 9 8 10 value

51 49 44 43 29 27 18 10 Run sum
Step 2: Normalize by dividing by total number of pixels. The total number of pixels is 10+8+9+2+14+1+5+2=51.

7 6 5 4 3 2 1 0 Gray level value


2 5 1 14 2 9 8 10 No. of Pixel histogram value
51 49 44 43 29 27 18 10 Run sum
51/5 49/5 44/5 43/5 29/5 27/5 18/5
10/51 Normalize
1 1 1 1 1 1 1

Step 3: Multiply these values by the maximum gray level values in this case 7 , and then round the result to the closet
integer. After this is done, we obtain 1,2,4,4,6,6,7,7.

7 6 5 4 3 2 1 0 Gray level value


2 5 1 14 2 9 8 10 No. of Pixel histogram value
51 49 44 43 29 27 18 10 Run sum
51/5 49/5 44/5 43/5 29/5 27/5 18/5
10/51 Normalize
1 1 1 1 1 1 1
7 7 6 6 4 4 2 1 Multiply by 7
Step 4: Map the original values to the results from step 3 by a one–to-one correspondence.
7 6 5 4 3 2 1 0 Old
7 7 6 6 4 4 2 1 New

All pixel in the original image with gray level 0 are set to 1, values of 1 are set to 2,
and values 2 set to 4, and values 3 set to 4, and so on. Histogram equalization,
you can see the original histogram and the resulting histogram equalized
histogram. Although the result is not flat, it is closer to being flat than the original
Before Histogram Equalization
7 6 5 4 3 2 1 0 Gray level value
1 No. of Pixel histogram
2 5 1 2 9 8 10 value
4

After Histogram Equalization


7 6 5 4 3 2 1 0 Gray level value
1 No. of Pixel histogram
7 15 0 0 8 10 0 value
1

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