0% found this document useful (0 votes)
16 views46 pages

Histograms P

Histograms processing
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)
16 views46 pages

Histograms P

Histograms processing
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/ 46

HISTOGRAMS

Dr. K.V.Sridhar
Histogram

• graphical representation of the number of pixels in an image as a


function of their intensity.
• function showing, for each gray level, the number of pixels in the image
that have that gray level.
• Represents the relative frequency of occurrence of various gray levels
in an image.
• Pprovides a global description of the appearance of an image.
• Normalized histogram (probability):
nk = hist[k ] = 
( )
1
f x, y =k

p = nk / N
k
Dr. K.V.S_NITW 2 2
The Grey-level Histogram-GLH
• Two methods of representation:

Dr. K.V.S_NITW 3
If the histogram h is normalized (i.e. the bins are divided by
the pixel number M×N), then it can be seen as a discrete
probability density function p

Dr. K.V.S_NITW 4
gives a global information

•These two images have the same histogram.

Dr. K.V.S_NITW 5
Histogram - Examples

Dr. K.V.S_NITW 6 6
Dr. K.V.S_NITW 7
Histogram transformations
• Consists in applying a mathematical function to the intensity distribution.
• Useful to improve the visual quality of an image.
• The transform, denoted T, is applied on the pixel intensities to change
their values: j=T(i)
• where j and i are respectively the intensities of the new and the
original image.

Dr. K.V.S_NITW 8
Negative image

Negative image: the gray levels are reversed.

Dr. K.V.S_NITW 9
Gamma correction

Gamma correction modifies the coulours of an image acquired by an electronic system, it is used to
take into account the non-linear sensibility of human eyes to the light. Here, γ=0.4
Dr. K.V.S_NITW 10
Histogram spreading where imin and imax are respectively the minimum and
maximum intensities in the image.

Histogram spreading enhances the contrast by Dr.


“dilating”
K.V.S_NITW
the histogram to the whole 11
intensity interval.
Histogram Stretching
• In histogram stretching, contrast of an image is increased.
• If we want to increase the contrast of an image, histogram of that image will be
fully stretched and covered the dynamic range of the histogram.
• From histogram of an image, we can check that the image has low or high
contrast.

Dr. K.V.S_NITW 12
Example

Dr. K.V.S_NITW 13 13
Histogram Equalization
• Used for equalizing all the pixel values of an image. Transformation is done in such a
way that uniform flattened histogram is produced.
• Increases the dynamic range of pixel values and makes an equal count of pixels at
each level which produces a flat histogram with high contrast image.
• The shape of histogram remains the same whereas in Histogram equalization, the
shape of histogram changes and it generates only one image.

Dr. K.V.S_NITW 14
Histogram equalization
• where M and N are the image size and nk is the
number of pixels with intensity k.

Histogram equalization is
another contrast enhancing and
tend to make the details more
visible.

Dr. K.V.S_NITW 15
Histogram Equalization
Enhances visibility of gradients

When image histogram has a few peaks separated by


wide valleys, the variation of brightness values of pixels
that correspond to the peaks may not be visible on the
display

Equalization spreads the peaks out and makes the


differences between those pixels more evident.

Neighborhood equalization provides for local contrast


enhancement by modifying the brightness of each pixel
according to brightnesses of neighboring pixels.

Dr. K.V.S_NITW 16
Histogram Equalization

Dr. K.V.S_NITW 17
HISTOGRAM METHODS

Dr. K.V.S_NITW 18
Grey Level Histogram Equalisation
• A non-linear grey scale transformation redistributes the
grey levels, producing an image with a flattened
histogram.
• This can result in a striking contrast improvement.

Dr. K.V.S_NITW 19
Histogram equalization
• Why and when do we want to use HE?

Dr. K.V.S_NITW 20 20
HE – Example 2

Dr. K.V.S_NITW 21
Dr. K.V.S_NITW 22
Dr. K.V.S_NITW 23
Original Dendrite image. Equalized Dendrite image.

Original Histogram. Equalized Histogram


Dr. K.V.S_NITW 24
Histogram Equalization

Dr. K.V.S_NITW 25
Local Enhancement

Original Bone Marrow image.


Local Equalization.

Original Fingerprint image. Dr. K.V.S_NITW


Local Equalization 26
A dark image
Histogram
Dr. K.V.S_NITW 27
After HE

Dr. K.V.S_NITW 28
Dr. K.V.S_NITW 29
Original Equalized
Not exactly flat due to the factDr.that we’re discretizing.
K.V.S_NITW 30
Histogram for Local Enhancement

Dr. K.V.S_NITW 31
HE – Derivation (572)
T(r) is single-valued and monotonically
increasing within range of r
T(r) has the same range as r [0, 1]

=  pr (rj )
k nj k
sk = T (rk ) = 
j =0 n j =0

r
s = T (r ) =  pr (w )dw
0

pr (r ) pr (r )
ps (s ) = = =1
ds pr (r )
dr
Dr. K.V.S_NITW 32
Histogram equalization
• Transformation function
s = T (r ) =  pr (w)dw
r
0  r 1
0

• pr(w) is the probability density function (pdf)


• The transformation function is the cumulative distribution
function (CDF)
• To make the pdf of the transformed image uniform, i.e. to
make the histogram of the transformed image uniform

Dr. K.V.S_NITW 33
HE – Discrete case
=  pr (rj )
k nj k
sk = T (rk ) = 
j =0 n j =0

r hist(r) r s s

0 10 0 10 10 10
hist(s)
1 70 1 80 80 70

2 15 2 95 95 15

3 5 3 100 100 5

Dr. K.V.S_NITW 34
Dr. K.V.S_NITW 35
Dr. K.V.S_NITW 36
Most of scene features are discriminable. But the image still is rather dark.
choose new limits in which we take pixels between 5 and 45 and expand
these to 0 to 255. This stretch results in the following histogram and image

Dr. K.V.S_NITW 37
Dr. K.V.S_NITW 38
Histogram specification
• Histogram specification is an image processing technique that
transforms an image to match a specified histogram.
• It's a generalized version of histogram equalization, which is a
standard image processing technique.
• While the goal of histogram equalization is to produce an output
image that has a flattened histogram, the goal of histogram matching
is to take an input image and generate an output image that is based
upon the shape of a specific (or reference) histogram.
• Histogram matching is also known as histogram specification.

Dr. K.V.S_NITW 39
Histogram matching/SPECIFICATION
• process where a time series, image, or higher dimension scalar data is modified such that its
histogram matches that of another (reference) dataset.

Reference image Image to be adjusted Histogram matched image

Dr. K.V.S_NITW 40
Histogram of reference image Histogram of image to be adjusted Histogram of matched image
*Histogram specification
• Step1: Equalize the levels of the original image
• Step2: Specify the desired pdf and obtain the
transformation function
• Step3: Apply the inverse transformation function to the
levels obtained in step 1

Dr. K.V.S_NITW 41 41
HS - Example

r hist(r) r s
0 10 0 10
1 70 1 80 r z
2 15 2 95 0 10
3 5 3 100 1 30
2 60
z hist(z) z G(z) 3 65
Specified 10 10 10 10
histogram 15 20 15 30
30 50 30 80
60 15 60 95
Dr. K.V.S_NITW 42
Dr. K.V.S_NITW 43
Dr. K.V.S_NITW 44
Dr. K.V.S_NITW 45
Comparison (HE vs. HM/HS)

Dr. K.V.S_NITW 46 46

You might also like