SlideShare a Scribd company logo
Point Processing
and Histogram
LE Thanh Sach
Point processing
Linear transformation
Logarithmic transformation
Exponential transformation
Power-law transformation
Histogram
Definition
Computation
Equalization
Specification
2.1
Chapter 2
Point Processing and Histogram
Image Processing and Computer Vision
LE Thanh Sach
Faculty of Computer Science and Engineering
Ho Chi Minh University of Technology, VNU-HCM
Point Processing
and Histogram
LE Thanh Sach
Point processing
Linear transformation
Logarithmic transformation
Exponential transformation
Power-law transformation
Histogram
Definition
Computation
Equalization
Specification
2.2
Overview
1 Point processing
Linear transformation
Logarithmic transformation
Exponential transformation
Power-law transformation
2 Histogram
Definition
Computation
Equalization
Specification
Point Processing
and Histogram
LE Thanh Sach
Point processing
Linear transformation
Logarithmic transformation
Exponential transformation
Power-law transformation
Histogram
Definition
Computation
Equalization
Specification
2.3
Point processing
Concepts
• Image: f(x, y)
1 x: discrete variable, in [0, 1, .., N]
2 y: discrete variable, in [0, 1, .., M]
3 f(x, y): discrete value, in [0, 1, .., 255]
• point ≡ pixel
• f(x, y): has M × N points (or pixels)
Point Processing
and Histogram
LE Thanh Sach
Point processing
Linear transformation
Logarithmic transformation
Exponential transformation
Power-law transformation
Histogram
Definition
Computation
Equalization
Specification
2.4
Point processing
Definition and Notation
• Point processing: Process each point by a function
that depends ONLY the pixel’s value and that does not
depend on the point’s neighbors.
• Pixel processing function:
• referred to as transfer function
• denoted as T[.]
• f(x, y): input image
• g(x, y) = T[f(x, y)]: output image
Point Processing
and Histogram
LE Thanh Sach
Point processing
Linear transformation
Logarithmic transformation
Exponential transformation
Power-law transformation
Histogram
Definition
Computation
Equalization
Specification
2.5
Point processing
Linear transformation: Math
• g(x, y) = a × f(x, y) + b
• Where, a and b: pre-defined parameters
Linear transformation: Applications
• General: Change the image’s intensity, cause the input
bighter or darker
• Users have to choose appropriate a and b (manually)
• Specific:
• Create negative images
• Convert to back-white image
Point Processing
and Histogram
LE Thanh Sach
Point processing
Linear transformation
Logarithmic transformation
Exponential transformation
Power-law transformation
Histogram
Definition
Computation
Equalization
Specification
2.6
Point processing
Linear transformation: with Matlab
%read input image
im = imread ( ’ cameraman . t i f ’ ) ;
%s e t parameters
a1 = 1 . 5 ; b1 = 20;
a2 = 1 . 5 ; b2 = 50;
a3 = 0 . 5 ; b3 = 0;
%transform the input
im1 = a1 ∗ im + b1 ; %c l i p p e d to [0 ,255] auto
im2 = a2 ∗ im + b2 ; %c l i p p e d to [0 ,255] auto
im3 = a3 ∗ im + b3 ; %c l i p p e d to [0 ,255] auto
Point Processing
and Histogram
LE Thanh Sach
Point processing
Linear transformation
Logarithmic transformation
Exponential transformation
Power-law transformation
Histogram
Definition
Computation
Equalization
Specification
2.7
Point processing
Linear transformation: with Matlab(continued)
%show output image
f i g u r e ;
subplot ( 2 , 2 , 1 ) ; imshow ( im ) ; t i t l e ( ’ i n p ut image ’ )
subplot ( 2 , 2 , 2 ) ; imshow ( im1 ) ;
t1 = s p r i n t f ( ’ output image [ a =%5.2f , b = %5.2 f ] ’ ,
a1 , b1 ) ;
t i t l e ( t1 )
subplot ( 2 , 2 , 3 ) ; imshow ( im2 ) ;
t2 = s p r i n t f ( ’ output image [ a =%5.2f , b = %5.2 f ] ’ ,
a2 , b2 ) ;
t i t l e ( t2 )
subplot ( 2 , 2 , 4 ) ; imshow ( im3 ) ;
t3 = s p r i n t f ( ’ output image [ a =%5.2f , b = %5.2 f ] ’ ,
a3 , b3 ) ;
t i t l e ( t3 )
s u p t i t l e ( ’ L i n e a r Transformation : output = a∗ i n pu t + b ’ ) ;
Point Processing
and Histogram
LE Thanh Sach
Point processing
Linear transformation
Logarithmic transformation
Exponential transformation
Power-law transformation
Histogram
Definition
Computation
Equalization
Specification
2.8
Point processing
Linear transformation: Illustration
Input image Output Image
[a = 1.5, b = 20]
Output Image Output Image
[a = 1.5, b = 50] [a = 0.5, b = 0]
Table: Linear Transformation: output = a * input + b
Point Processing
and Histogram
LE Thanh Sach
Point processing
Linear transformation
Logarithmic transformation
Exponential transformation
Power-law transformation
Histogram
Definition
Computation
Equalization
Specification
2.9
Point processing
Linear transformation: Illustration
Table: Creating negative image: output = a * input + b; where,
a = −1, b = 255
Point Processing
and Histogram
LE Thanh Sach
Point processing
Linear transformation
Logarithmic transformation
Exponential transformation
Power-law transformation
Histogram
Definition
Computation
Equalization
Specification
2.10
Point processing
Linear transformation: Illustration
Table: Creating negative image: output = a * input + b; where,
a = −1, b = 255
Point Processing
and Histogram
LE Thanh Sach
Point processing
Linear transformation
Logarithmic transformation
Exponential transformation
Power-law transformation
Histogram
Definition
Computation
Equalization
Specification
2.11
Point processing
Logarithmic transformation: Math
• g(x, y) = a × log[1 + f(x, y)] + b
• Where, a: a pre-defined parameter
Logarithm function
log2(x)
x
f(x) = log2(x)
• a large value (x) → mapped to a smaller value (log2 x)
• a large distance between two intensities in the input
image → mapped to a smaller distance in the output
Point Processing
and Histogram
LE Thanh Sach
Point processing
Linear transformation
Logarithmic transformation
Exponential transformation
Power-law transformation
Histogram
Definition
Computation
Equalization
Specification
2.12
Point processing
Logarithmic transformation: Applications
• Input image:
• have some regions with too dark intensities (near 0)
• have some regions with too bright intensities (near 255)
• Requirement:
• Make dark regions brighter while keeping the intensity
in bright regions lower than 255.
• Or, make bright regions darker while keeping the
intensity in dark regions lower than 0.
• Solution: use logarithmic transformation
• Often case:
• Should use logarithmic transformation to enhance the
result of FFT before displaying
Point Processing
and Histogram
LE Thanh Sach
Point processing
Linear transformation
Logarithmic transformation
Exponential transformation
Power-law transformation
Histogram
Definition
Computation
Equalization
Specification
2.13
Point processing
Logarithmic transformation: Illustration
Table: Samples
Point Processing
and Histogram
LE Thanh Sach
Point processing
Linear transformation
Logarithmic transformation
Exponential transformation
Power-law transformation
Histogram
Definition
Computation
Equalization
Specification
2.14
Point processing
(Inverse-log) Exponential transformation: Math
• g(x, y) = a × ef(x,y) + b
• Where, a and b: pre-defined parameters
Exponential function
−4 −2 2 4
2
4
6
8
10
y = ex
• a small value (x) → mapped to a larger value ex
• a small distance between two intensities in the input →
mapped to a larger distance in the output image
Point Processing
and Histogram
LE Thanh Sach
Point processing
Linear transformation
Logarithmic transformation
Exponential transformation
Power-law transformation
Histogram
Definition
Computation
Equalization
Specification
2.15
Point processing
Exponential transformation: Applications
• map small differences between two intensities in the
input to a larger differences in the output image
(contrast input images )
Exponential transformation: with Matlab
%read input image
path = ’ coffebean . png ’
im = imread ( path ) ; %range [0−>255]
%convert double image : [0−>1]
im = im2double ( im ) ;
%s e t parameters
a = 1; b = −1;
%transform input image
im1 = a ∗ exp ( im ) + b ;
%normalize the output , to [0−>1]
im1 = im1 ./max( im1 ( : ) ) ;
Point Processing
and Histogram
LE Thanh Sach
Point processing
Linear transformation
Logarithmic transformation
Exponential transformation
Power-law transformation
Histogram
Definition
Computation
Equalization
Specification
2.16
Point processing
Exponential transformation: with Matlab (continued)
%show image
figure ; imshow ( im ) ; t i t l e ( ’ input image ’ ) ;
figure ; imshow ( im1 ) ; t i t l e ( ’ output image ’ ) ;
Input image output image
Table: g(x, y) = a × ef(x,y)
+ b; where, a = 1, b = −1
Point Processing
and Histogram
LE Thanh Sach
Point processing
Linear transformation
Logarithmic transformation
Exponential transformation
Power-law transformation
Histogram
Definition
Computation
Equalization
Specification
2.17
Point processing
Power-law transformation: Math
• g(x, y) = a × f(x, y)γ + b
• Where, a and b: pre-defined parameters
Power function
Point Processing
and Histogram
LE Thanh Sach
Point processing
Linear transformation
Logarithmic transformation
Exponential transformation
Power-law transformation
Histogram
Definition
Computation
Equalization
Specification
2.18
Point processing
Power-law function: characteristics
• Depend on γ, power-law transformation can be either
1 linear transformation: for γ = 1
2 log transformation: for γ < 1
3 inverse-log transformation: for γ > 1
Point Processing
and Histogram
LE Thanh Sach
Point processing
Linear transformation
Logarithmic transformation
Exponential transformation
Power-law transformation
Histogram
Definition
Computation
Equalization
Specification
2.19
Point processing
Power-law transformation: Illustration
Point Processing
and Histogram
LE Thanh Sach
Point processing
Linear transformation
Logarithmic transformation
Exponential transformation
Power-law transformation
Histogram
Definition
Computation
Equalization
Specification
2.20
Histogram
Definition
Histogram computed for image I is a statistical quantity,
contains the following information
• number of pixels in I for each intensity (for each value
in [0,255]). This kind of histogram is referred to as
unnormalized histogram.
• Sum of all values in this kind of histogram = total
number of pixels in I
• probability distribution of intensities in image I. This
kind of histogram is referred to as normalized
histogram.
• Sum of all values in this kind of histogram = 1
Point Processing
and Histogram
LE Thanh Sach
Point processing
Linear transformation
Logarithmic transformation
Exponential transformation
Power-law transformation
Histogram
Definition
Computation
Equalization
Specification
2.21
Histogram
(a) An image (b) Its Histogram
• From histogram (b): almost of pixels in the image have
the intensity near 0. Therefore, the image is too dark,
confirmed by image (a).
Point Processing
and Histogram
LE Thanh Sach
Point processing
Linear transformation
Logarithmic transformation
Exponential transformation
Power-law transformation
Histogram
Definition
Computation
Equalization
Specification
2.22
Histogram
(a) An image (b) Its Histogram
• From histogram (b): almost of pixels in the image have
the intensity near 255. Therefore, the image is too
bright, confirmed by image (a).
Point Processing
and Histogram
LE Thanh Sach
Point processing
Linear transformation
Logarithmic transformation
Exponential transformation
Power-law transformation
Histogram
Definition
Computation
Equalization
Specification
2.23
Histogram
(a) An image (b) Its Histogram
• From histogram (b): almost of pixels in the image have
the intensity compacted in short range [100, 130].
Therefore, the image has very low contrast, confirmed
by image (a).
Point Processing
and Histogram
LE Thanh Sach
Point processing
Linear transformation
Logarithmic transformation
Exponential transformation
Power-law transformation
Histogram
Definition
Computation
Equalization
Specification
2.24
Histogram
(a) An image (b) Its Histogram
• From histogram (b): the pixels in the image are
distributed in a full range [0, 255]. Therefore, the image
is balanced (not to dark, not to bright) and has a high
contrast (preferred).
Point Processing
and Histogram
LE Thanh Sach
Point processing
Linear transformation
Logarithmic transformation
Exponential transformation
Power-law transformation
Histogram
Definition
Computation
Equalization
Specification
2.25
Histogram
Histogram: with C/C++/Java
Excercise:
• Write a function for computing the histogram
(unnormalized and normalized) of the input image
passed to the function.
Point Processing
and Histogram
LE Thanh Sach
Point processing
Linear transformation
Logarithmic transformation
Exponential transformation
Power-law transformation
Histogram
Definition
Computation
Equalization
Specification
2.26
Histogram
Histogram: with Matlab
• use functions: imhist
%read input images
path1 = ’ Fig3 .15( a ) 1 . jpg ’ ;
path2 = ’ Fig3 .15( a ) 2 . jpg ’ ;
path3 = ’ Fig3 .15( a ) 3 . jpg ’ ;
path4 = ’ Fig3 .15( a ) 4 . jpg ’ ;
im1 = imread ( path1 ) ;
im2 = imread ( path2 ) ;
im3 = imread ( path3 ) ;
im4 = imread ( path4 ) ;
%Compute histogram
[ count1 , x1 ] = i m h i s t ( im1 ) ;
[ count2 , x2 ] = i m h i s t ( im2 ) ;
[ count3 , x3 ] = i m h i s t ( im3 ) ;
[ count4 , x4 ] = i m h i s t ( im4 ) ;
Point Processing
and Histogram
LE Thanh Sach
Point processing
Linear transformation
Logarithmic transformation
Exponential transformation
Power-law transformation
Histogram
Definition
Computation
Equalization
Specification
2.27
Histogram
Histogram: with Matlab (continued)
%show input images
figure ; imshow ( im1 ) ; t i t l e ( ’ input image 1 ’ ) ;
figure ; imshow ( im2 ) ; t i t l e ( ’ input image 2 ’ ) ;
figure ; imshow ( im3 ) ; t i t l e ( ’ input image 3 ’ ) ;
figure ; imshow ( im4 ) ; t i t l e ( ’ input image 4 ’ ) ;
%draw histograms
figure ; stem( x1 , count1 , ’ . ’ ) ;
xlim ( [ 0 , 2 5 5 ] ) ; t i t l e ( ’ histogram 1 ’ ) ;
figure ; stem( x2 , count2 , ’ . ’ ) ;
xlim ( [ 0 , 2 5 5 ] ) ; t i t l e ( ’ histogram 2 ’ ) ;
figure ; stem( x3 , count3 , ’ . ’ ) ;
xlim ( [ 0 , 2 5 5 ] ) ; t i t l e ( ’ histogram 3 ’ ) ;
figure ; stem( x4 , count4 , ’ . ’ ) ;
xlim ( [ 0 , 2 5 5 ] ) ; t i t l e ( ’ histogram 4 ’ ) ;
Point Processing
and Histogram
LE Thanh Sach
Point processing
Linear transformation
Logarithmic transformation
Exponential transformation
Power-law transformation
Histogram
Definition
Computation
Equalization
Specification
2.28
Histogram: Equalization
Histogram Equalization: What?
Histogram Equalization is an operation to create an image
(from a given image) whose pixels’s value distributed
uniformly in [0, 255]
• Purpose of histogram equalization: to create image not
too dark, not too bright, and high contrast
(a) An image (b) Its normalized histogram
(not preferred) (not preferred)
Point Processing
and Histogram
LE Thanh Sach
Point processing
Linear transformation
Logarithmic transformation
Exponential transformation
Power-law transformation
Histogram
Definition
Computation
Equalization
Specification
2.29
Histogram: Equalization
Histogram Equalization: What?
Histogram Equalization is an operation to create an image
(from a given image) whose pixels’s value distributed
uniformly in [0, 255]
• Purpose of histogram equalization: to create image not
too dark, not too bright, and high contrast
(a) Image, preferred (b) Histogram, preferred
(after equalization) (after equalization)
Point Processing
and Histogram
LE Thanh Sach
Point processing
Linear transformation
Logarithmic transformation
Exponential transformation
Power-law transformation
Histogram
Definition
Computation
Equalization
Specification
2.30
Histogram: Equalization
Histogram Equalization: How?
Input:
1 Input image I
• So, compute the normalized-histogram of image I, to
obtain: px(x):
2 Expected normalized-histogram of the output image:
pz(z)
• with histogram equalization: pz(z) is a uniform
distribution over [0, 255]
• with histogram specification: pz(z) is specified by users
(interactively)
Point Processing
and Histogram
LE Thanh Sach
Point processing
Linear transformation
Logarithmic transformation
Exponential transformation
Power-law transformation
Histogram
Definition
Computation
Equalization
Specification
2.31
Histogram: Equalization
Histogram Equalization: How?
We can determine z (e.g., pixel value of the output image),
if we know:
1 x: pixel value of the input image
2 px(x): pdf of x
3 pz(z): pdf of z
Assume that z = f(x) has been determined, the output
image g(u, v) can be produced from the input f(u, v) as
follows:
• foreach point (u, v) in f(u, v):
• x = f(u, v) (get the value of the input pixel)
• z = f(x) (map to the output value)
• g(u, v) = z (assign to the output pixel)
Point Processing
and Histogram
LE Thanh Sach
Point processing
Linear transformation
Logarithmic transformation
Exponential transformation
Power-law transformation
Histogram
Definition
Computation
Equalization
Specification
2.32
Histogram: Equalization
Determination of z = f(x)
Let cx(x) and cz(z) be cumulative density functions of x
and z.
cx(x) =
x
X
i=0
px(i)
cz(z) =
z
X
i=0
pz(i)
Point Processing
and Histogram
LE Thanh Sach
Point processing
Linear transformation
Logarithmic transformation
Exponential transformation
Power-law transformation
Histogram
Definition
Computation
Equalization
Specification
2.33
Histogram: Equalization
z = f(x) be a non-decreasing function that map one-to-one
between x and z.
Determination of z = f(x)
• Assume that we have z1 = f(x1)
• Then, cz(z1) = cx(x1). This is because of one-one
mapping
• A value x < x1 will be mapped into z < z1
• Define w ≡ cx(x1), i.e., w ≡ cz(z1) ≡ cx(x1)
Therefore,
• z1 = c−1
z (w) ≡ c−1
z (cx(x1))
Mapping function f(x)
z = f(x) = c−1
z (cx(x))
Point Processing
and Histogram
LE Thanh Sach
Point processing
Linear transformation
Logarithmic transformation
Exponential transformation
Power-law transformation
Histogram
Definition
Computation
Equalization
Specification
2.34
Histogram: Equalization
Implemtation of z = f(x) = c−1
z (cx(x))
1 If we have closed-form of z = c−1
z (w) then can use this
function to determine z.
2 If we do not have closed-form of c−1
z (z)
• Create a lookup table at the beginning for mapping
z → c−1
z (p), for discrete values p. We can do this
because we know cz(z) in advance. This task is equal
to rasterize p = cz(z) and store pairs into lookup table
• Determine z according to the lookup table.

More Related Content

Similar to 2 - PointProcessing.pdf

2 transformation computer graphics
2 transformation computer graphics2 transformation computer graphics
2 transformation computer graphics
cairo university
 
Chapter 08
Chapter 08Chapter 08
Chapter 08
Tha Mike
 
Image Processing using Matlab . Useful for beginners to learn Image Processing
Image Processing using Matlab . Useful for beginners to learn Image ProcessingImage Processing using Matlab . Useful for beginners to learn Image Processing
Image Processing using Matlab . Useful for beginners to learn Image Processing
Ashok Kumar
 
A Dimension Abstraction Approach to Vectorization in Matlab
A Dimension Abstraction Approach to Vectorization in MatlabA Dimension Abstraction Approach to Vectorization in Matlab
A Dimension Abstraction Approach to Vectorization in Matlab
aiQUANT
 
Cgo2007 P3 3 Birkbeck
Cgo2007 P3 3 BirkbeckCgo2007 P3 3 Birkbeck
Cgo2007 P3 3 Birkbeck
aiQUANT
 
IRJET-Design and Implementation of LNS based Approximate Multiplier using Mit...
IRJET-Design and Implementation of LNS based Approximate Multiplier using Mit...IRJET-Design and Implementation of LNS based Approximate Multiplier using Mit...
IRJET-Design and Implementation of LNS based Approximate Multiplier using Mit...
IRJET Journal
 
Novel Parallel - Perfix Structure Binary to Residue Number System Conversion ...
Novel Parallel - Perfix Structure Binary to Residue Number System Conversion ...Novel Parallel - Perfix Structure Binary to Residue Number System Conversion ...
Novel Parallel - Perfix Structure Binary to Residue Number System Conversion ...
CSCJournals
 
Aistats RTD
Aistats RTDAistats RTD
Aistats RTD
Yuma Murakami
 
Small Signal Modelling and Controller Design of Boost Converter using MATLAB
Small Signal Modelling and Controller Design of Boost Converter using MATLABSmall Signal Modelling and Controller Design of Boost Converter using MATLAB
Small Signal Modelling and Controller Design of Boost Converter using MATLAB
Premier Publishers
 
Image Enhancement in Spatial Domain
Image Enhancement in Spatial DomainImage Enhancement in Spatial Domain
Image Enhancement in Spatial Domain
DEEPASHRI HK
 
Image processing using matlab
Image processing using matlab Image processing using matlab
Image processing using matlab
SangeethaSasi1
 
Image enhancement
Image enhancementImage enhancement
Intensity Transformation Functions of image with Matlab
Intensity Transformation Functions of image with Matlab Intensity Transformation Functions of image with Matlab
Intensity Transformation Functions of image with Matlab
Shafi Sourov
 
Convolutional Neural Network (CNN) presentation from theory to code in Theano
Convolutional Neural Network (CNN) presentation from theory to code in TheanoConvolutional Neural Network (CNN) presentation from theory to code in Theano
Convolutional Neural Network (CNN) presentation from theory to code in Theano
Seongwon Hwang
 
SlidesPartII_digital_control_power_electronics.pdf
SlidesPartII_digital_control_power_electronics.pdfSlidesPartII_digital_control_power_electronics.pdf
SlidesPartII_digital_control_power_electronics.pdf
ssuserb5b5f7
 
lesson15et438a.ppsx
lesson15et438a.ppsxlesson15et438a.ppsx
lesson15et438a.ppsx
NoumboCynthiaMegane
 
Image Processing Using MATLAB
Image Processing Using MATLABImage Processing Using MATLAB
Image Processing Using MATLAB
Amarjeetsingh Thakur
 
Image processing in MATLAB
Image processing in MATLABImage processing in MATLAB
Image processing in MATLAB
Amarjeetsingh Thakur
 
matlab_simulink_for_control082p.pdf
matlab_simulink_for_control082p.pdfmatlab_simulink_for_control082p.pdf
matlab_simulink_for_control082p.pdf
MUHAMMAD FAISAL RASHEED
 
Chapter 4: Combinational Logic
Chapter 4: Combinational LogicChapter 4: Combinational Logic
Chapter 4: Combinational Logic
Er. Nawaraj Bhandari
 

Similar to 2 - PointProcessing.pdf (20)

2 transformation computer graphics
2 transformation computer graphics2 transformation computer graphics
2 transformation computer graphics
 
Chapter 08
Chapter 08Chapter 08
Chapter 08
 
Image Processing using Matlab . Useful for beginners to learn Image Processing
Image Processing using Matlab . Useful for beginners to learn Image ProcessingImage Processing using Matlab . Useful for beginners to learn Image Processing
Image Processing using Matlab . Useful for beginners to learn Image Processing
 
A Dimension Abstraction Approach to Vectorization in Matlab
A Dimension Abstraction Approach to Vectorization in MatlabA Dimension Abstraction Approach to Vectorization in Matlab
A Dimension Abstraction Approach to Vectorization in Matlab
 
Cgo2007 P3 3 Birkbeck
Cgo2007 P3 3 BirkbeckCgo2007 P3 3 Birkbeck
Cgo2007 P3 3 Birkbeck
 
IRJET-Design and Implementation of LNS based Approximate Multiplier using Mit...
IRJET-Design and Implementation of LNS based Approximate Multiplier using Mit...IRJET-Design and Implementation of LNS based Approximate Multiplier using Mit...
IRJET-Design and Implementation of LNS based Approximate Multiplier using Mit...
 
Novel Parallel - Perfix Structure Binary to Residue Number System Conversion ...
Novel Parallel - Perfix Structure Binary to Residue Number System Conversion ...Novel Parallel - Perfix Structure Binary to Residue Number System Conversion ...
Novel Parallel - Perfix Structure Binary to Residue Number System Conversion ...
 
Aistats RTD
Aistats RTDAistats RTD
Aistats RTD
 
Small Signal Modelling and Controller Design of Boost Converter using MATLAB
Small Signal Modelling and Controller Design of Boost Converter using MATLABSmall Signal Modelling and Controller Design of Boost Converter using MATLAB
Small Signal Modelling and Controller Design of Boost Converter using MATLAB
 
Image Enhancement in Spatial Domain
Image Enhancement in Spatial DomainImage Enhancement in Spatial Domain
Image Enhancement in Spatial Domain
 
Image processing using matlab
Image processing using matlab Image processing using matlab
Image processing using matlab
 
Image enhancement
Image enhancementImage enhancement
Image enhancement
 
Intensity Transformation Functions of image with Matlab
Intensity Transformation Functions of image with Matlab Intensity Transformation Functions of image with Matlab
Intensity Transformation Functions of image with Matlab
 
Convolutional Neural Network (CNN) presentation from theory to code in Theano
Convolutional Neural Network (CNN) presentation from theory to code in TheanoConvolutional Neural Network (CNN) presentation from theory to code in Theano
Convolutional Neural Network (CNN) presentation from theory to code in Theano
 
SlidesPartII_digital_control_power_electronics.pdf
SlidesPartII_digital_control_power_electronics.pdfSlidesPartII_digital_control_power_electronics.pdf
SlidesPartII_digital_control_power_electronics.pdf
 
lesson15et438a.ppsx
lesson15et438a.ppsxlesson15et438a.ppsx
lesson15et438a.ppsx
 
Image Processing Using MATLAB
Image Processing Using MATLABImage Processing Using MATLAB
Image Processing Using MATLAB
 
Image processing in MATLAB
Image processing in MATLABImage processing in MATLAB
Image processing in MATLAB
 
matlab_simulink_for_control082p.pdf
matlab_simulink_for_control082p.pdfmatlab_simulink_for_control082p.pdf
matlab_simulink_for_control082p.pdf
 
Chapter 4: Combinational Logic
Chapter 4: Combinational LogicChapter 4: Combinational Logic
Chapter 4: Combinational Logic
 

Recently uploaded

STATATHON: Unleashing the Power of Statistics in a 48-Hour Knowledge Extravag...
STATATHON: Unleashing the Power of Statistics in a 48-Hour Knowledge Extravag...STATATHON: Unleashing the Power of Statistics in a 48-Hour Knowledge Extravag...
STATATHON: Unleashing the Power of Statistics in a 48-Hour Knowledge Extravag...
sameer shah
 
Intelligence supported media monitoring in veterinary medicine
Intelligence supported media monitoring in veterinary medicineIntelligence supported media monitoring in veterinary medicine
Intelligence supported media monitoring in veterinary medicine
AndrzejJarynowski
 
一比一原版兰加拉学院毕业证(Langara毕业证书)学历如何办理
一比一原版兰加拉学院毕业证(Langara毕业证书)学历如何办理一比一原版兰加拉学院毕业证(Langara毕业证书)学历如何办理
一比一原版兰加拉学院毕业证(Langara毕业证书)学历如何办理
hyfjgavov
 
Beyond the Basics of A/B Tests: Highly Innovative Experimentation Tactics You...
Beyond the Basics of A/B Tests: Highly Innovative Experimentation Tactics You...Beyond the Basics of A/B Tests: Highly Innovative Experimentation Tactics You...
Beyond the Basics of A/B Tests: Highly Innovative Experimentation Tactics You...
Aggregage
 
Predictably Improve Your B2B Tech Company's Performance by Leveraging Data
Predictably Improve Your B2B Tech Company's Performance by Leveraging DataPredictably Improve Your B2B Tech Company's Performance by Leveraging Data
Predictably Improve Your B2B Tech Company's Performance by Leveraging Data
Kiwi Creative
 
一比一原版(CU毕业证)卡尔顿大学毕业证如何办理
一比一原版(CU毕业证)卡尔顿大学毕业证如何办理一比一原版(CU毕业证)卡尔顿大学毕业证如何办理
一比一原版(CU毕业证)卡尔顿大学毕业证如何办理
bmucuha
 
原版一比一利兹贝克特大学毕业证(LeedsBeckett毕业证书)如何办理
原版一比一利兹贝克特大学毕业证(LeedsBeckett毕业证书)如何办理原版一比一利兹贝克特大学毕业证(LeedsBeckett毕业证书)如何办理
原版一比一利兹贝克特大学毕业证(LeedsBeckett毕业证书)如何办理
wyddcwye1
 
The Ipsos - AI - Monitor 2024 Report.pdf
The  Ipsos - AI - Monitor 2024 Report.pdfThe  Ipsos - AI - Monitor 2024 Report.pdf
The Ipsos - AI - Monitor 2024 Report.pdf
Social Samosa
 
一比一原版(harvard毕业证书)哈佛大学毕业证如何办理
一比一原版(harvard毕业证书)哈佛大学毕业证如何办理一比一原版(harvard毕业证书)哈佛大学毕业证如何办理
一比一原版(harvard毕业证书)哈佛大学毕业证如何办理
taqyea
 
ViewShift: Hassle-free Dynamic Policy Enforcement for Every Data Lake
ViewShift: Hassle-free Dynamic Policy Enforcement for Every Data LakeViewShift: Hassle-free Dynamic Policy Enforcement for Every Data Lake
ViewShift: Hassle-free Dynamic Policy Enforcement for Every Data Lake
Walaa Eldin Moustafa
 
一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
nuttdpt
 
UofT毕业证如何办理
UofT毕业证如何办理UofT毕业证如何办理
UofT毕业证如何办理
exukyp
 
Orchestrating the Future: Navigating Today's Data Workflow Challenges with Ai...
Orchestrating the Future: Navigating Today's Data Workflow Challenges with Ai...Orchestrating the Future: Navigating Today's Data Workflow Challenges with Ai...
Orchestrating the Future: Navigating Today's Data Workflow Challenges with Ai...
Kaxil Naik
 
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docxDATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
SaffaIbrahim1
 
University of New South Wales degree offer diploma Transcript
University of New South Wales degree offer diploma TranscriptUniversity of New South Wales degree offer diploma Transcript
University of New South Wales degree offer diploma Transcript
soxrziqu
 
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
ihavuls
 
一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理
bmucuha
 
Module 1 ppt BIG DATA ANALYTICS_NOTES FOR MCA
Module 1 ppt BIG DATA ANALYTICS_NOTES FOR MCAModule 1 ppt BIG DATA ANALYTICS_NOTES FOR MCA
Module 1 ppt BIG DATA ANALYTICS_NOTES FOR MCA
yuvarajkumar334
 
一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理
一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理
一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理
xclpvhuk
 
End-to-end pipeline agility - Berlin Buzzwords 2024
End-to-end pipeline agility - Berlin Buzzwords 2024End-to-end pipeline agility - Berlin Buzzwords 2024
End-to-end pipeline agility - Berlin Buzzwords 2024
Lars Albertsson
 

Recently uploaded (20)

STATATHON: Unleashing the Power of Statistics in a 48-Hour Knowledge Extravag...
STATATHON: Unleashing the Power of Statistics in a 48-Hour Knowledge Extravag...STATATHON: Unleashing the Power of Statistics in a 48-Hour Knowledge Extravag...
STATATHON: Unleashing the Power of Statistics in a 48-Hour Knowledge Extravag...
 
Intelligence supported media monitoring in veterinary medicine
Intelligence supported media monitoring in veterinary medicineIntelligence supported media monitoring in veterinary medicine
Intelligence supported media monitoring in veterinary medicine
 
一比一原版兰加拉学院毕业证(Langara毕业证书)学历如何办理
一比一原版兰加拉学院毕业证(Langara毕业证书)学历如何办理一比一原版兰加拉学院毕业证(Langara毕业证书)学历如何办理
一比一原版兰加拉学院毕业证(Langara毕业证书)学历如何办理
 
Beyond the Basics of A/B Tests: Highly Innovative Experimentation Tactics You...
Beyond the Basics of A/B Tests: Highly Innovative Experimentation Tactics You...Beyond the Basics of A/B Tests: Highly Innovative Experimentation Tactics You...
Beyond the Basics of A/B Tests: Highly Innovative Experimentation Tactics You...
 
Predictably Improve Your B2B Tech Company's Performance by Leveraging Data
Predictably Improve Your B2B Tech Company's Performance by Leveraging DataPredictably Improve Your B2B Tech Company's Performance by Leveraging Data
Predictably Improve Your B2B Tech Company's Performance by Leveraging Data
 
一比一原版(CU毕业证)卡尔顿大学毕业证如何办理
一比一原版(CU毕业证)卡尔顿大学毕业证如何办理一比一原版(CU毕业证)卡尔顿大学毕业证如何办理
一比一原版(CU毕业证)卡尔顿大学毕业证如何办理
 
原版一比一利兹贝克特大学毕业证(LeedsBeckett毕业证书)如何办理
原版一比一利兹贝克特大学毕业证(LeedsBeckett毕业证书)如何办理原版一比一利兹贝克特大学毕业证(LeedsBeckett毕业证书)如何办理
原版一比一利兹贝克特大学毕业证(LeedsBeckett毕业证书)如何办理
 
The Ipsos - AI - Monitor 2024 Report.pdf
The  Ipsos - AI - Monitor 2024 Report.pdfThe  Ipsos - AI - Monitor 2024 Report.pdf
The Ipsos - AI - Monitor 2024 Report.pdf
 
一比一原版(harvard毕业证书)哈佛大学毕业证如何办理
一比一原版(harvard毕业证书)哈佛大学毕业证如何办理一比一原版(harvard毕业证书)哈佛大学毕业证如何办理
一比一原版(harvard毕业证书)哈佛大学毕业证如何办理
 
ViewShift: Hassle-free Dynamic Policy Enforcement for Every Data Lake
ViewShift: Hassle-free Dynamic Policy Enforcement for Every Data LakeViewShift: Hassle-free Dynamic Policy Enforcement for Every Data Lake
ViewShift: Hassle-free Dynamic Policy Enforcement for Every Data Lake
 
一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
 
UofT毕业证如何办理
UofT毕业证如何办理UofT毕业证如何办理
UofT毕业证如何办理
 
Orchestrating the Future: Navigating Today's Data Workflow Challenges with Ai...
Orchestrating the Future: Navigating Today's Data Workflow Challenges with Ai...Orchestrating the Future: Navigating Today's Data Workflow Challenges with Ai...
Orchestrating the Future: Navigating Today's Data Workflow Challenges with Ai...
 
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docxDATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
 
University of New South Wales degree offer diploma Transcript
University of New South Wales degree offer diploma TranscriptUniversity of New South Wales degree offer diploma Transcript
University of New South Wales degree offer diploma Transcript
 
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
 
一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理
 
Module 1 ppt BIG DATA ANALYTICS_NOTES FOR MCA
Module 1 ppt BIG DATA ANALYTICS_NOTES FOR MCAModule 1 ppt BIG DATA ANALYTICS_NOTES FOR MCA
Module 1 ppt BIG DATA ANALYTICS_NOTES FOR MCA
 
一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理
一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理
一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理
 
End-to-end pipeline agility - Berlin Buzzwords 2024
End-to-end pipeline agility - Berlin Buzzwords 2024End-to-end pipeline agility - Berlin Buzzwords 2024
End-to-end pipeline agility - Berlin Buzzwords 2024
 

2 - PointProcessing.pdf

  • 1. Point Processing and Histogram LE Thanh Sach Point processing Linear transformation Logarithmic transformation Exponential transformation Power-law transformation Histogram Definition Computation Equalization Specification 2.1 Chapter 2 Point Processing and Histogram Image Processing and Computer Vision LE Thanh Sach Faculty of Computer Science and Engineering Ho Chi Minh University of Technology, VNU-HCM
  • 2. Point Processing and Histogram LE Thanh Sach Point processing Linear transformation Logarithmic transformation Exponential transformation Power-law transformation Histogram Definition Computation Equalization Specification 2.2 Overview 1 Point processing Linear transformation Logarithmic transformation Exponential transformation Power-law transformation 2 Histogram Definition Computation Equalization Specification
  • 3. Point Processing and Histogram LE Thanh Sach Point processing Linear transformation Logarithmic transformation Exponential transformation Power-law transformation Histogram Definition Computation Equalization Specification 2.3 Point processing Concepts • Image: f(x, y) 1 x: discrete variable, in [0, 1, .., N] 2 y: discrete variable, in [0, 1, .., M] 3 f(x, y): discrete value, in [0, 1, .., 255] • point ≡ pixel • f(x, y): has M × N points (or pixels)
  • 4. Point Processing and Histogram LE Thanh Sach Point processing Linear transformation Logarithmic transformation Exponential transformation Power-law transformation Histogram Definition Computation Equalization Specification 2.4 Point processing Definition and Notation • Point processing: Process each point by a function that depends ONLY the pixel’s value and that does not depend on the point’s neighbors. • Pixel processing function: • referred to as transfer function • denoted as T[.] • f(x, y): input image • g(x, y) = T[f(x, y)]: output image
  • 5. Point Processing and Histogram LE Thanh Sach Point processing Linear transformation Logarithmic transformation Exponential transformation Power-law transformation Histogram Definition Computation Equalization Specification 2.5 Point processing Linear transformation: Math • g(x, y) = a × f(x, y) + b • Where, a and b: pre-defined parameters Linear transformation: Applications • General: Change the image’s intensity, cause the input bighter or darker • Users have to choose appropriate a and b (manually) • Specific: • Create negative images • Convert to back-white image
  • 6. Point Processing and Histogram LE Thanh Sach Point processing Linear transformation Logarithmic transformation Exponential transformation Power-law transformation Histogram Definition Computation Equalization Specification 2.6 Point processing Linear transformation: with Matlab %read input image im = imread ( ’ cameraman . t i f ’ ) ; %s e t parameters a1 = 1 . 5 ; b1 = 20; a2 = 1 . 5 ; b2 = 50; a3 = 0 . 5 ; b3 = 0; %transform the input im1 = a1 ∗ im + b1 ; %c l i p p e d to [0 ,255] auto im2 = a2 ∗ im + b2 ; %c l i p p e d to [0 ,255] auto im3 = a3 ∗ im + b3 ; %c l i p p e d to [0 ,255] auto
  • 7. Point Processing and Histogram LE Thanh Sach Point processing Linear transformation Logarithmic transformation Exponential transformation Power-law transformation Histogram Definition Computation Equalization Specification 2.7 Point processing Linear transformation: with Matlab(continued) %show output image f i g u r e ; subplot ( 2 , 2 , 1 ) ; imshow ( im ) ; t i t l e ( ’ i n p ut image ’ ) subplot ( 2 , 2 , 2 ) ; imshow ( im1 ) ; t1 = s p r i n t f ( ’ output image [ a =%5.2f , b = %5.2 f ] ’ , a1 , b1 ) ; t i t l e ( t1 ) subplot ( 2 , 2 , 3 ) ; imshow ( im2 ) ; t2 = s p r i n t f ( ’ output image [ a =%5.2f , b = %5.2 f ] ’ , a2 , b2 ) ; t i t l e ( t2 ) subplot ( 2 , 2 , 4 ) ; imshow ( im3 ) ; t3 = s p r i n t f ( ’ output image [ a =%5.2f , b = %5.2 f ] ’ , a3 , b3 ) ; t i t l e ( t3 ) s u p t i t l e ( ’ L i n e a r Transformation : output = a∗ i n pu t + b ’ ) ;
  • 8. Point Processing and Histogram LE Thanh Sach Point processing Linear transformation Logarithmic transformation Exponential transformation Power-law transformation Histogram Definition Computation Equalization Specification 2.8 Point processing Linear transformation: Illustration Input image Output Image [a = 1.5, b = 20] Output Image Output Image [a = 1.5, b = 50] [a = 0.5, b = 0] Table: Linear Transformation: output = a * input + b
  • 9. Point Processing and Histogram LE Thanh Sach Point processing Linear transformation Logarithmic transformation Exponential transformation Power-law transformation Histogram Definition Computation Equalization Specification 2.9 Point processing Linear transformation: Illustration Table: Creating negative image: output = a * input + b; where, a = −1, b = 255
  • 10. Point Processing and Histogram LE Thanh Sach Point processing Linear transformation Logarithmic transformation Exponential transformation Power-law transformation Histogram Definition Computation Equalization Specification 2.10 Point processing Linear transformation: Illustration Table: Creating negative image: output = a * input + b; where, a = −1, b = 255
  • 11. Point Processing and Histogram LE Thanh Sach Point processing Linear transformation Logarithmic transformation Exponential transformation Power-law transformation Histogram Definition Computation Equalization Specification 2.11 Point processing Logarithmic transformation: Math • g(x, y) = a × log[1 + f(x, y)] + b • Where, a: a pre-defined parameter Logarithm function log2(x) x f(x) = log2(x) • a large value (x) → mapped to a smaller value (log2 x) • a large distance between two intensities in the input image → mapped to a smaller distance in the output
  • 12. Point Processing and Histogram LE Thanh Sach Point processing Linear transformation Logarithmic transformation Exponential transformation Power-law transformation Histogram Definition Computation Equalization Specification 2.12 Point processing Logarithmic transformation: Applications • Input image: • have some regions with too dark intensities (near 0) • have some regions with too bright intensities (near 255) • Requirement: • Make dark regions brighter while keeping the intensity in bright regions lower than 255. • Or, make bright regions darker while keeping the intensity in dark regions lower than 0. • Solution: use logarithmic transformation • Often case: • Should use logarithmic transformation to enhance the result of FFT before displaying
  • 13. Point Processing and Histogram LE Thanh Sach Point processing Linear transformation Logarithmic transformation Exponential transformation Power-law transformation Histogram Definition Computation Equalization Specification 2.13 Point processing Logarithmic transformation: Illustration Table: Samples
  • 14. Point Processing and Histogram LE Thanh Sach Point processing Linear transformation Logarithmic transformation Exponential transformation Power-law transformation Histogram Definition Computation Equalization Specification 2.14 Point processing (Inverse-log) Exponential transformation: Math • g(x, y) = a × ef(x,y) + b • Where, a and b: pre-defined parameters Exponential function −4 −2 2 4 2 4 6 8 10 y = ex • a small value (x) → mapped to a larger value ex • a small distance between two intensities in the input → mapped to a larger distance in the output image
  • 15. Point Processing and Histogram LE Thanh Sach Point processing Linear transformation Logarithmic transformation Exponential transformation Power-law transformation Histogram Definition Computation Equalization Specification 2.15 Point processing Exponential transformation: Applications • map small differences between two intensities in the input to a larger differences in the output image (contrast input images ) Exponential transformation: with Matlab %read input image path = ’ coffebean . png ’ im = imread ( path ) ; %range [0−>255] %convert double image : [0−>1] im = im2double ( im ) ; %s e t parameters a = 1; b = −1; %transform input image im1 = a ∗ exp ( im ) + b ; %normalize the output , to [0−>1] im1 = im1 ./max( im1 ( : ) ) ;
  • 16. Point Processing and Histogram LE Thanh Sach Point processing Linear transformation Logarithmic transformation Exponential transformation Power-law transformation Histogram Definition Computation Equalization Specification 2.16 Point processing Exponential transformation: with Matlab (continued) %show image figure ; imshow ( im ) ; t i t l e ( ’ input image ’ ) ; figure ; imshow ( im1 ) ; t i t l e ( ’ output image ’ ) ; Input image output image Table: g(x, y) = a × ef(x,y) + b; where, a = 1, b = −1
  • 17. Point Processing and Histogram LE Thanh Sach Point processing Linear transformation Logarithmic transformation Exponential transformation Power-law transformation Histogram Definition Computation Equalization Specification 2.17 Point processing Power-law transformation: Math • g(x, y) = a × f(x, y)γ + b • Where, a and b: pre-defined parameters Power function
  • 18. Point Processing and Histogram LE Thanh Sach Point processing Linear transformation Logarithmic transformation Exponential transformation Power-law transformation Histogram Definition Computation Equalization Specification 2.18 Point processing Power-law function: characteristics • Depend on γ, power-law transformation can be either 1 linear transformation: for γ = 1 2 log transformation: for γ < 1 3 inverse-log transformation: for γ > 1
  • 19. Point Processing and Histogram LE Thanh Sach Point processing Linear transformation Logarithmic transformation Exponential transformation Power-law transformation Histogram Definition Computation Equalization Specification 2.19 Point processing Power-law transformation: Illustration
  • 20. Point Processing and Histogram LE Thanh Sach Point processing Linear transformation Logarithmic transformation Exponential transformation Power-law transformation Histogram Definition Computation Equalization Specification 2.20 Histogram Definition Histogram computed for image I is a statistical quantity, contains the following information • number of pixels in I for each intensity (for each value in [0,255]). This kind of histogram is referred to as unnormalized histogram. • Sum of all values in this kind of histogram = total number of pixels in I • probability distribution of intensities in image I. This kind of histogram is referred to as normalized histogram. • Sum of all values in this kind of histogram = 1
  • 21. Point Processing and Histogram LE Thanh Sach Point processing Linear transformation Logarithmic transformation Exponential transformation Power-law transformation Histogram Definition Computation Equalization Specification 2.21 Histogram (a) An image (b) Its Histogram • From histogram (b): almost of pixels in the image have the intensity near 0. Therefore, the image is too dark, confirmed by image (a).
  • 22. Point Processing and Histogram LE Thanh Sach Point processing Linear transformation Logarithmic transformation Exponential transformation Power-law transformation Histogram Definition Computation Equalization Specification 2.22 Histogram (a) An image (b) Its Histogram • From histogram (b): almost of pixels in the image have the intensity near 255. Therefore, the image is too bright, confirmed by image (a).
  • 23. Point Processing and Histogram LE Thanh Sach Point processing Linear transformation Logarithmic transformation Exponential transformation Power-law transformation Histogram Definition Computation Equalization Specification 2.23 Histogram (a) An image (b) Its Histogram • From histogram (b): almost of pixels in the image have the intensity compacted in short range [100, 130]. Therefore, the image has very low contrast, confirmed by image (a).
  • 24. Point Processing and Histogram LE Thanh Sach Point processing Linear transformation Logarithmic transformation Exponential transformation Power-law transformation Histogram Definition Computation Equalization Specification 2.24 Histogram (a) An image (b) Its Histogram • From histogram (b): the pixels in the image are distributed in a full range [0, 255]. Therefore, the image is balanced (not to dark, not to bright) and has a high contrast (preferred).
  • 25. Point Processing and Histogram LE Thanh Sach Point processing Linear transformation Logarithmic transformation Exponential transformation Power-law transformation Histogram Definition Computation Equalization Specification 2.25 Histogram Histogram: with C/C++/Java Excercise: • Write a function for computing the histogram (unnormalized and normalized) of the input image passed to the function.
  • 26. Point Processing and Histogram LE Thanh Sach Point processing Linear transformation Logarithmic transformation Exponential transformation Power-law transformation Histogram Definition Computation Equalization Specification 2.26 Histogram Histogram: with Matlab • use functions: imhist %read input images path1 = ’ Fig3 .15( a ) 1 . jpg ’ ; path2 = ’ Fig3 .15( a ) 2 . jpg ’ ; path3 = ’ Fig3 .15( a ) 3 . jpg ’ ; path4 = ’ Fig3 .15( a ) 4 . jpg ’ ; im1 = imread ( path1 ) ; im2 = imread ( path2 ) ; im3 = imread ( path3 ) ; im4 = imread ( path4 ) ; %Compute histogram [ count1 , x1 ] = i m h i s t ( im1 ) ; [ count2 , x2 ] = i m h i s t ( im2 ) ; [ count3 , x3 ] = i m h i s t ( im3 ) ; [ count4 , x4 ] = i m h i s t ( im4 ) ;
  • 27. Point Processing and Histogram LE Thanh Sach Point processing Linear transformation Logarithmic transformation Exponential transformation Power-law transformation Histogram Definition Computation Equalization Specification 2.27 Histogram Histogram: with Matlab (continued) %show input images figure ; imshow ( im1 ) ; t i t l e ( ’ input image 1 ’ ) ; figure ; imshow ( im2 ) ; t i t l e ( ’ input image 2 ’ ) ; figure ; imshow ( im3 ) ; t i t l e ( ’ input image 3 ’ ) ; figure ; imshow ( im4 ) ; t i t l e ( ’ input image 4 ’ ) ; %draw histograms figure ; stem( x1 , count1 , ’ . ’ ) ; xlim ( [ 0 , 2 5 5 ] ) ; t i t l e ( ’ histogram 1 ’ ) ; figure ; stem( x2 , count2 , ’ . ’ ) ; xlim ( [ 0 , 2 5 5 ] ) ; t i t l e ( ’ histogram 2 ’ ) ; figure ; stem( x3 , count3 , ’ . ’ ) ; xlim ( [ 0 , 2 5 5 ] ) ; t i t l e ( ’ histogram 3 ’ ) ; figure ; stem( x4 , count4 , ’ . ’ ) ; xlim ( [ 0 , 2 5 5 ] ) ; t i t l e ( ’ histogram 4 ’ ) ;
  • 28. Point Processing and Histogram LE Thanh Sach Point processing Linear transformation Logarithmic transformation Exponential transformation Power-law transformation Histogram Definition Computation Equalization Specification 2.28 Histogram: Equalization Histogram Equalization: What? Histogram Equalization is an operation to create an image (from a given image) whose pixels’s value distributed uniformly in [0, 255] • Purpose of histogram equalization: to create image not too dark, not too bright, and high contrast (a) An image (b) Its normalized histogram (not preferred) (not preferred)
  • 29. Point Processing and Histogram LE Thanh Sach Point processing Linear transformation Logarithmic transformation Exponential transformation Power-law transformation Histogram Definition Computation Equalization Specification 2.29 Histogram: Equalization Histogram Equalization: What? Histogram Equalization is an operation to create an image (from a given image) whose pixels’s value distributed uniformly in [0, 255] • Purpose of histogram equalization: to create image not too dark, not too bright, and high contrast (a) Image, preferred (b) Histogram, preferred (after equalization) (after equalization)
  • 30. Point Processing and Histogram LE Thanh Sach Point processing Linear transformation Logarithmic transformation Exponential transformation Power-law transformation Histogram Definition Computation Equalization Specification 2.30 Histogram: Equalization Histogram Equalization: How? Input: 1 Input image I • So, compute the normalized-histogram of image I, to obtain: px(x): 2 Expected normalized-histogram of the output image: pz(z) • with histogram equalization: pz(z) is a uniform distribution over [0, 255] • with histogram specification: pz(z) is specified by users (interactively)
  • 31. Point Processing and Histogram LE Thanh Sach Point processing Linear transformation Logarithmic transformation Exponential transformation Power-law transformation Histogram Definition Computation Equalization Specification 2.31 Histogram: Equalization Histogram Equalization: How? We can determine z (e.g., pixel value of the output image), if we know: 1 x: pixel value of the input image 2 px(x): pdf of x 3 pz(z): pdf of z Assume that z = f(x) has been determined, the output image g(u, v) can be produced from the input f(u, v) as follows: • foreach point (u, v) in f(u, v): • x = f(u, v) (get the value of the input pixel) • z = f(x) (map to the output value) • g(u, v) = z (assign to the output pixel)
  • 32. Point Processing and Histogram LE Thanh Sach Point processing Linear transformation Logarithmic transformation Exponential transformation Power-law transformation Histogram Definition Computation Equalization Specification 2.32 Histogram: Equalization Determination of z = f(x) Let cx(x) and cz(z) be cumulative density functions of x and z. cx(x) = x X i=0 px(i) cz(z) = z X i=0 pz(i)
  • 33. Point Processing and Histogram LE Thanh Sach Point processing Linear transformation Logarithmic transformation Exponential transformation Power-law transformation Histogram Definition Computation Equalization Specification 2.33 Histogram: Equalization z = f(x) be a non-decreasing function that map one-to-one between x and z. Determination of z = f(x) • Assume that we have z1 = f(x1) • Then, cz(z1) = cx(x1). This is because of one-one mapping • A value x < x1 will be mapped into z < z1 • Define w ≡ cx(x1), i.e., w ≡ cz(z1) ≡ cx(x1) Therefore, • z1 = c−1 z (w) ≡ c−1 z (cx(x1)) Mapping function f(x) z = f(x) = c−1 z (cx(x))
  • 34. Point Processing and Histogram LE Thanh Sach Point processing Linear transformation Logarithmic transformation Exponential transformation Power-law transformation Histogram Definition Computation Equalization Specification 2.34 Histogram: Equalization Implemtation of z = f(x) = c−1 z (cx(x)) 1 If we have closed-form of z = c−1 z (w) then can use this function to determine z. 2 If we do not have closed-form of c−1 z (z) • Create a lookup table at the beginning for mapping z → c−1 z (p), for discrete values p. We can do this because we know cz(z) in advance. This task is equal to rasterize p = cz(z) and store pairs into lookup table • Determine z according to the lookup table.