SlideShare a Scribd company logo
1 of 34
Download to read offline
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 graphicscairo university
 
Chapter 08
Chapter 08Chapter 08
Chapter 08Tha 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 ProcessingAshok Kumar
 
Cgo2007 P3 3 Birkbeck
Cgo2007 P3 3 BirkbeckCgo2007 P3 3 Birkbeck
Cgo2007 P3 3 BirkbeckaiQUANT
 
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 MatlabaiQUANT
 
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
 
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 MATLABPremier Publishers
 
Image Enhancement in Spatial Domain
Image Enhancement in Spatial DomainImage Enhancement in Spatial Domain
Image Enhancement in Spatial DomainDEEPASHRI HK
 
Image processing using matlab
Image processing using matlab Image processing using matlab
Image processing using matlab SangeethaSasi1
 
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 TheanoSeongwon Hwang
 
image_enhancement_spatial
 image_enhancement_spatial image_enhancement_spatial
image_enhancement_spatialhoneyjecrc
 

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
 
Cgo2007 P3 3 Birkbeck
Cgo2007 P3 3 BirkbeckCgo2007 P3 3 Birkbeck
Cgo2007 P3 3 Birkbeck
 
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
 
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
 
lesson15et438a.ppsx
lesson15et438a.ppsxlesson15et438a.ppsx
lesson15et438a.ppsx
 
Image processing in MATLAB
Image processing in MATLABImage processing in MATLAB
Image processing in MATLAB
 
Image Processing Using MATLAB
Image Processing Using MATLABImage Processing Using MATLAB
Image Processing Using 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
 
image_enhancement_spatial
 image_enhancement_spatial image_enhancement_spatial
image_enhancement_spatial
 

Recently uploaded

Call Girls In Noida City Center Metro 24/7✡️9711147426✡️ Escorts Service
Call Girls In Noida City Center Metro 24/7✡️9711147426✡️ Escorts ServiceCall Girls In Noida City Center Metro 24/7✡️9711147426✡️ Escorts Service
Call Girls In Noida City Center Metro 24/7✡️9711147426✡️ Escorts Servicejennyeacort
 
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...Suhani Kapoor
 
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service AmravatiVIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service AmravatiSuhani Kapoor
 
Ukraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSUkraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSAishani27
 
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Data Science Jobs and Salaries Analysis.pptx
Data Science Jobs and Salaries Analysis.pptxData Science Jobs and Salaries Analysis.pptx
Data Science Jobs and Salaries Analysis.pptxFurkanTasci3
 
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Callshivangimorya083
 
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
Unveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystUnveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystSamantha Rae Coolbeth
 
VIP High Class Call Girls Bikaner Anushka 8250192130 Independent Escort Servi...
VIP High Class Call Girls Bikaner Anushka 8250192130 Independent Escort Servi...VIP High Class Call Girls Bikaner Anushka 8250192130 Independent Escort Servi...
VIP High Class Call Girls Bikaner Anushka 8250192130 Independent Escort Servi...Suhani Kapoor
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...Jack DiGiovanna
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfLars Albertsson
 
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...soniya singh
 
From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...Florian Roscheck
 
RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998YohFuh
 

Recently uploaded (20)

Call Girls In Noida City Center Metro 24/7✡️9711147426✡️ Escorts Service
Call Girls In Noida City Center Metro 24/7✡️9711147426✡️ Escorts ServiceCall Girls In Noida City Center Metro 24/7✡️9711147426✡️ Escorts Service
Call Girls In Noida City Center Metro 24/7✡️9711147426✡️ Escorts Service
 
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
 
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service AmravatiVIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
 
Ukraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSUkraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICS
 
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
 
Data Science Jobs and Salaries Analysis.pptx
Data Science Jobs and Salaries Analysis.pptxData Science Jobs and Salaries Analysis.pptx
Data Science Jobs and Salaries Analysis.pptx
 
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Kishangarh
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in  KishangarhDelhi 99530 vip 56974 Genuine Escort Service Call Girls in  Kishangarh
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Kishangarh
 
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
 
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
 
Unveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystUnveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data Analyst
 
VIP High Class Call Girls Bikaner Anushka 8250192130 Independent Escort Servi...
VIP High Class Call Girls Bikaner Anushka 8250192130 Independent Escort Servi...VIP High Class Call Girls Bikaner Anushka 8250192130 Independent Escort Servi...
VIP High Class Call Girls Bikaner Anushka 8250192130 Independent Escort Servi...
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
E-Commerce Order PredictionShraddha Kamble.pptx
E-Commerce Order PredictionShraddha Kamble.pptxE-Commerce Order PredictionShraddha Kamble.pptx
E-Commerce Order PredictionShraddha Kamble.pptx
 
Russian Call Girls Dwarka Sector 15 💓 Delhi 9999965857 @Sabina Modi VVIP MODE...
Russian Call Girls Dwarka Sector 15 💓 Delhi 9999965857 @Sabina Modi VVIP MODE...Russian Call Girls Dwarka Sector 15 💓 Delhi 9999965857 @Sabina Modi VVIP MODE...
Russian Call Girls Dwarka Sector 15 💓 Delhi 9999965857 @Sabina Modi VVIP MODE...
 
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdf
 
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
 
From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...
 
RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998
 

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.