Anda di halaman 1dari 62

CIIT/FA16-PCS-001/WAH.

Histogram - Introduction
Histogram
Finding out detailed information of
an image has been a craze for a Histogram:
long time. consists of
the number
The most popular technique of of pixels
satisfying this requirement is by &
obtaining histogram of the image intensity
levels
A histogram is a graphical of pixels
representation of numeric data present in
present in a two-dimensional object image.
such as image.
Histogram

(3, 8, 5)
To plot an image histogram

the intensity values or gray level values of


the pixels are plotted along x-axis
(horizontal axis)

while the frequency or the number of pixels


is plotted along y-axis (vertical axis).
To plot an image histogram
Histogram Formulae
The histogram of a digital image with gray levels in the
range
[0, L-1] is a discrete
function h(r ) = n ,
k k
where rk is the kth gray level and nk is the number of
pixels in the image having gray level rk.
Algo for Histogram

For each pixel of the image


value = Intensity(pixel)
histogram(value)++
end
Histogram & Bin Width
When constructing a histogram, it is
common to make all bars the same width.
One could also choose to make them all
have the same area.
These two options have complementary
strengths and weaknesses;
36 25 38 46 55 68 72 55 36 38
67 45 22 48 91 46 52 61 58 55

Bin Frequency Values in Bin

20-30 2 25,22
30-40 4 36,38,36,38
40-50 4 46,45,48,46
50-60 5 55,55,52,58,55
60-70 3 68,67,61
70-80 1 72
80-90 0 -
90-100 1 91

10
Pros & Cons of Bin Width
the equal-width histogram over smooth in
regions of high density, and is poor at
identifying sharp peaks.

the equal-area histogram over smooth in


regions of low density, and so does not
identify outliers.
variable bin-width histogram .
Recap (Histogram Def.)
An Image Histogram is a type of histogram
that:
acts as a graphical representation of the
lightness/color distribution in a digital
image.
number of times each grey level occurs
in the image.
Plots the number of pixels for each
value.
Histogram (What Can be Predicts?)

We can infer a great deal about the


appearance of an image from its histogram.
Histogram (What Can be Predicts?)
In a dark image, the grey levels (and hence
the histogram) would be clustered at the
lower end

In a uniformly bright image, the grey levels


would be clustered at the upper end

In a well contrasted image, the grey levels


would be well spread out over much of the
range
Histogram of 4 basic grey-level characteristics
4
x 10
16

14 Dark image
12

10

0 50 100 150 200 250


4
x 10

12

Bright image
10

0 50 100 150 200 250


Histogram of 4 basic grey-level characteristics
5
x 10

2 Low contrast image


1.5

0.5

0 50 100 150 200 250


4
x 10

8
High contrast image
7

0 50 100 150 200 250


Histogram - Applications
Histogram (Applications)
i. Firstly, histograms are used in image
analysis
ii. histogram is used in brightness and
contrast adjustment of an image.
iii.histograms help in detecting the problems
associated with image capturing like
exposure.
iv.histograms are used to detect various
defects in an image
Histogram (Applications)
v. Used in image segmentation .
vi.Used in background segmentation and its
application in traffic monitoring
vii.Monitor performance of optical channels
viii.To characterize video traffic behavior in
an Asynchronous Transfer Mode
ix. can be used in number plate
categorization .
Histogram - Equalization
Histogram Equalization
Histogram equalization is widely used for
contrast enhancement in a variety of
applications due to its simple function and
effectiveness.
Histogram equalization is a technique for
adjusting image intensities to enhance
contrast.
Histogram equalization
It achieves overall image contrast
enhancement by expanding the dynamics
range of the histogram using cumulative
distribution function (cdf) as a
transformation function
Examples include medical image processing
and radar signal processing.
Histogram Equalization Formulae
Let f be a given image represented as a mr
by mc matrix of integer pixel intensities
ranging from 0 to L 1.
L is the number of possible intensity
values, often 256. Let p denote the
normalized histogram of f with a bin for
each possible intensity. So Formula will be
as on next slide ..
Histogram Equalization Formulae
pn = number of pixels with intensity n
total number of pixels
Where n = 0, 1, ..., L 1.
The histogram equalized image g will be
defined by
g i,j = floor((L 1) )

where floor() rounds down to the nearest


integer. This is equivalent to transforming the
pixel intensities, k.
HE & Contrast Enhancement
Contrast enhancement is considered as
one of the important characteristic in the
field of image enhancement

Histogram equalization is a simple and well


known method for image contrast
enhancement, this method uses the
histogram of images in its processing.
Drawback of the HE
In spite of the fact that the HE technique is
broadly acknowledged however numerous
time histogram equalized image xperiences
the "mean shift issue, i.e. it moves the
mean force worth to the center dark level
of the gray range. So this method is not
helpful in circumstances, where mean
brightness preservation is needed.
Drawback of the HE
One drawback of the histogram equalization can
be found on the fact that the brightness of an
image can be changed after the histogram
equalization, which is mainly due to the
flattening property of the histogram equalization.

Thus, it is rarely utilized in consumer electronic


products such as TV where preserving original
input brightness may necessary in order not to
introduce unnecessary visual deterioration.
How To Defeat this Issue
Different Algo/Techniques of HE
brightness preserving bi-histogram
equalization (BBHE)

dualistic sub-image histogram equalization


(DSIHE)

recursive mean-separate histogram


equalization (RMSHE)
How To Defeat this Issue Cont..
Different Algo/Techniques of HE
recursive sub-image histogram equalization
(RSIHE)

Multi-Histogram Equalization Methods for


Contrast Enhancement and Brightness
Preserving

Dynamic HE (DHE)
How To Defeat this Issue Cont..
Different Algo/Techniques of HE
bi-histogram equalization plateau limit
(BHEPL)

bi-histogram equalization median plateau


limit(BHEPL-D)

quadrants dynamic histogram equalization


(QDHE)
How To Defeat this Issue Cont..
Different Algo/Techniques of HE
bi-histogram equalization plateau limit
(BHEPL)

bi-histogram equalization median plateau


limit(BHEPL-D)

quadrants dynamic histogram equalization


(QDHE)
BBHE(Brightness Preserving Bi-histogram Equalization )
Proposed by Kim in 1997
divides the image histogram into two parts
the separation intensity XT is presented by
the input mean brightness value
which is the average
intensity of all pixels that
construct the input image.
BBHE Cont..
After this separation process, these two
histograms are independently equalized.

By doing this, the mean brightness of the


resultant image will lie between the input
mean and the middle gray level.
DSIHE (Dualistic Sub-image Histogram Equalization)
proposed by Wan , similar to BBHE,
except that the histogram is separated into
two histograms based on the median value
instead of the mean value.
This criterion of XT will produce two
histograms with almost equal number of
pixels.
DSIHE Claim: better than BBHE in term of
preserving an images brightness and
entropy.
BBHE & DSIHE - Problem

These methods achieve good contrast


enhancement, but processed images
usually suffers with problems of brightness
shift and intensity saturation artifacts.
partitioning image histogram into large
number of non-overlapping sub-
histograms may preserve the image
brightness but lacks significant contrast
enhancement.
RMSHE (Recursive mean-separate histogram equalization)
proposed by Chen and Ramli
This technique iteratively utilizes the BBHE.
First, the technique separates the histogram
into two parts based on the average input
brightness
Then, the mean of each piece of the
resultant sub-histograms is calculated.
These sub-histograms are then further
divided into two parts based on this
average values.
RMSHE (Recursive mean-separate histogram equalization)
This process is repeated for r times
Then, each sub-histogram is equalized
independently.
RMSHE claimed: good brightness
preservation technique when the value of r
is large, because the output mean
converges to the input mean.
But when r is too large, the output
histogram will become exactly the input
histogram. There is no enhancement at all
RSIHE (Recursive sub-image histogram equalization )
Proposed By Sim
The method also produces 2r pieces of sub-
histogram,
but unlike RMSHE, the histogram is divided
based on median value, rather than the
mean value.
By using the median values, each sub
histogram will contain exactly the same
number of pixels
RSIHE (Recursive sub-image histogram equalization )
RSIHE Claimed: produces relatively better
image compared with RMSHE.
However, RSIHE shares the same problem
with RMSHE, which is, there will be no
enhancement could be obtained if we set a
very large value of r.
Thus, the weaknesses of RMSHE and RSIHE
are the difficulty to find the optimal value
of r.
MPHEBP(Multi Peak HE with Brightness Preserving)

Proposed by Wongsritong
In this scheme, the histogram is first
smoothed with one dimensional smoothing
filter.

Then, the histogram is divided based on the


local maximums of the smoothed
histogram.
MPHEBP(Multi Peak HE with Brightness Preserving)
Then the number of sub-histograms is
dependent to the number of the local
maximums.
Each sub histogram is then independently
equalized using histogram equalization.
Wongsritong claimed that the performance
of MPHEBP in maintaining the mean
brightness is better than BBHE.
RMSHE , RSIHE ,MPHEBP - problems
schemes based on dividing histogram into
several sub-histograms (i.e. RMSHE, RSIHE,
and MPHEBP) tends to not allow some
sections of the histogram to expand.
DHE (Dynamic histogram equalization)
Proposed by Wadud
the method first smooth the input
histogram by using a one dimension
smoothing filter.
However, in contrast to MPHEBP, the
histogram is divided based on the local
minimums
Before equalize the sub-histograms, each
section are mapped into a new dynamic
range.
DHE (Dynamic histogram equalization)
This mapping process is a function of the
number of pixels consists in that section,
thus the sections with larger number of
pixels will occupy bigger range of the
dynamic range.
DHE (Dynamic histogram equalization)
Problem, DHE does not put any constrain
on maintaining the mean brightness of the
image. Thus, this method may not be
suitable to be implemented in television, as
the saturation effect may occur in some
cases.
Solution to intensity saturation problems
Plateau Based Methods
In order to avoid intensity saturation problem, the plateau
based methods have been suggested. These methods
clip the peak of the histogram to some extent, so that the
intensity levels having high values (large population of
pixels having same value)can be prevented from
expanding to high range. By performing clipping process,
high probability regions of the histogram may be
prevented from dominating over its low probability
regions.
Can Images can be
constructed from
histograms ?
Histogram and Image Info
4
x 10

3.5

2.5

1.5

0.5

0 50 100 150 200 250

Histogram information reveals that image is under-exposed


Histogram and Image Info
7000

6000

5000

4000

3000

2000

1000

0 50 100 150 200 250

Over-exposed image
Histogram in MATLAB
h = imhist (f, b)

Where f, is the input image, h is the histogram, b is number of bins


(tick marks) used in forming the histogram (b = 255 is the default)

A bin, is simply, a subdivision of the intensity scale. For example, if


we are working with uint8 images and we let b = 2, then the intensity
scale is subdivided into two ranges: 0 127 and 128 255. the
resulting histograms will have two values: h(1) equals to the number
of pixels in the image with values in the interval [0,127], and h(2)
equal to the number of pixels with values in the interval [128 255].
Other ways to display
Histograms
Consider an image f. The simplest way to plot its histogram is to use
imhist with no output specified:
>> imhist (f);
Measure a histogram
For B-bit image, initialize 2B
counters with 0
Loop over all pixels x,y
When encountering gray level f [x,y]=i, increment
counter # i
Normalized histogram can be thought of as an estimate of the
probability distribution of the continuous signal amplitude
Histogram Equalization

Common Names: Histogram Modeling, Histogram Equalization


Histogram of Original Image
Histogram after Equalization
Original Image
Histogram

After applying
Equalized Code
Algorithm of Histogram
Equalization
It is the re-distribution of gray level values
uniformly. Lets consider a 2 dimensional
image which has values ranging between
0 and 255.
Algorithm of Histogram
Equalization
Algorithm of Histogram
Equalization
62

Anda mungkin juga menyukai