Image Processing
2. Point Processes
Computer Engineering, Sejong University
Dongil Han
2/60
Spatial domain processing
g(x,y) = T[f(x,y)]
f(x,y) : input imageg(x,y) : processed imageT[.] : operator on f, defined over some neighborhood of (x, y)
3/60
Point Processes
The simplest form of T[.]•• processed output depends only on the value of f at (x, y)
s = T(r)
r : gray-level of f(x,y)s : gray-level of g(x,y)T[.] : operator on f, becomes a gray-level mapping function
4/60
Some basic point processing techniques
• Arithmetic operations
•
• Look-up table processing
• Histogram
• Contrast stretching
• Intensity transform
Point Processes
5/60
Arithmetic Operations
Addition, Subtraction, Multiplication, Division operations over pixels by a constant value
•
g(x,y) = f(x,y) + c
• multiplication, division operations : adjusting the contrast
g(x,y) = a * f(x,y)
6/60
<Original> <Original+50> <Original-60>
Addition, Subtraction Operations•• Subtracting to a pixel : darkens the image• Nothing to increase/decrease the local contrast
e.g.) g(x,y) = f(x,y) + 50, g(x,y) = f(x,y) - 60
Arithmetic Operations
7/60
Multiplication, Division Operations•• Multiplication : increase the local contrast • Division : decrease the local contrast
e.g.) g(x,y) = 1.5 * f(x,y), g(x,y) = f(x,y)/1.5
<Original> <Original *1.5> <Original/1.5>
Arithmetic Operations
8/60
Problems•• Subtraction : : can exceeds the min. value of image range• Multiplication : can exceeds the max. value of image range
=> simple solution: clampinge.g.) negative value : set to 0, greater than 255: set to
255 => may generates saturated image
original saturated
Arithmetic Operations
9/60
Logical Operations
XOR (Exclusive OR) Operation
AND Operation
OR Operation
A XOR B A = 0 A = 1
B = 0
B = 1
0
1
1
0
A AND B A = 0 A = 1
B = 0
B = 1
0
0
0
1
A OR B A = 0 A = 1
B = 0
B = 1
0
1
1
1
10/60
XOR operation in image processing• used to find all pixels of a certain value•
if f(x,y) = c then g(x,y) = 0 else g(x,y) = f(x,y)
• application example- generates cursor- extracts certain value in an image- Pseudo-color image processing
Logical Operations
11/60
<ORIGINAL> <ORIGINAL XOR 128>
<ORIGINAL XOR 250>
Logical Operations
12/60
Pseudo color image processing
13/60
Look-up Table
Look-up Table(LUT)•• array index : current pixel value• array output : generated new pixel value
advantage• easy to use(Software : array, Hardware : Memory)• complex mathematical expression : just LUT
programming (e.g.: y = sin x, y = log x)
14/60
Graphical representation of LUT• x axis : index of array (input pixel value)•• y axis : LUT output (processed pixel value)
x
y
0 1 2 3 4 5 6 7input image
output image
76543210
Look-up Table
15/60
LUT example : Gamma correction
Look-up Table
16/60
Gamma correction• CRT devices have a non-linear intensity-to-voltage response•• low voltage region : darker than intended• gamma correction : the process used to correct this response
voltage(gray-level)
brightness
display characteristics
of CRT
Look-up Table
17/60
Gamma correction
•
• Inverse response curve is adapted in camera system(L : luminance, V : output voltage of camera, : determines the gain)
10812.0099.1
)099.0(
VforV
L
0812.005.4
VforV
L
1018.0099.0099.1 )/1( LforLV
018.00500.4 LforLV
Look-up Table
18/60
Display gamma
Camera gamma
Gamma correction
• variations of response dependent on the gamma value
Final display characteristics
Look-up Table
19/60
Gamma correction• Gamma > 1 : darker image
=>
• Gamma < 1 : brighter image=> intentionally adjusted characteristics of Camera
• Gamma = 1 : normal image=> final display image
Gamma > 1darker image
Gamma = 1normal image
Gamma < 1brighter image
Look-up Table
20/60
display before gamma
correction
original image
gamma correction(Camera)
display after gamma
correction
Look-up Table
Gamma correction
21/60
Broadcasting block diagram using gamma correction
Look-up Table
22/60
• separate gamma correction for R, G, B signal in color TV• incorrect gamma correction may generate unintended color
signal for gray images
Look-up Table
23/60
Problems of gamma correction
• Each display device has different gamma characteristics=>
• PDP : linear curve between input voltage and output luminance
• camera signal renders gamma corrected signal : PDP needs inverse gamma response
input voltage
luminance
input voltage
luminanceCRT PDP
Look-up Table
24/60
Image enhancement using gamma curve
Look-up Table
25/60
Image enhancement using LUT
Look-up Table
26/60
Image enhancement using LUT
Look-up Table
27/60
Histogram
imagehistogram
Mathematical definition• graphical representation of the distribution data•
Histogram in image processing• graphical representation used to view the intensity profile
of an image- X-axis : possible pixel intensity values- Y-axis : number of occurrences for each intensity
28/60
Mathematical representation of histogram•
nk = h(rk), rk : kth level, 0 < k < 255
Here, nk can have values between 0 < nk < 64x64(4096)
Histogram Normalization• histogram is divided by the total number of pixels
If we let the total number of pixels be n
nk/n = p(rk), rk : kth level, 0 < k < 255
Here, p(rk) can be considered probability density function
Histogram
29/60
Properties of Histogram• renders the intensity profile of an image• can estimate the contrast information of an image•• brightness image : Histograms are right shifted• contrast is low: Histograms are crowded in a narrow area• contrast is high: Histograms are extended out in a wide area
Histogram
30/60
Histogram vs. Arithmetic Operation• addition operation: brightens the image
=> • subtraction operation : darkens the image
=> Histogram : shift left
originalOriginal + 40 Original - 40
Histogram
31/60
Histogram vs. Arithmetic Operation• multiplication operation : increase the local contrast
=> • division operation : decrease the local contrast
=> Histogram : shrink narrower
originalOriginal * 1.2 Original / 1.2
Histogram
32/60
Color image histogram• histogram processing is conducted in each R, G, B signal
Histogram
33/60
Cumulative Distribution Function(CDF:누적 분포 함수)•
w : dummy variable for integrationr : random variable of CDF
Mathematical Properties of CDF T(r)• monotone increasing function in region
•
•
• may not have an inverse function
r
010 ,)( r(w) dwprTs r
10 r
1010 rfor T(r)
11 )T(
Histogram
34/60
Properties of CDF T(r)• dark image =>
• bright image => bends downwards
0 1
1
0 1
0
1
0 1
1
0 1
1
“histogram”
“histogram”
“CDF curve”
“CDF curve”
0
0 0
Histogram
35/60
Histogram
Image correction using CDF• use CDF as a LUT
36/60
Image correction using CDF• dark image => LUT =>
• bright image => LUT => increase the dark portion
0 1
1
0 1
0
1
0 1
1
0 1
1
“histogram”
“histogram”
“CDF curve”
“CDF curve”
0
0 0
Histogram
37/60
Histogram Equalization
Histogram Equalization(HE)• goal : obtain a uniform histogram by redistribution of
original histogram- HE example
38/60
Histogram Equalization process1.2. calculate normalized sum of histogram(CDF)3. transform input image to output image using CDF
1 2 3
Histogram Equalization
39/60
Histogram Equalization
40/60
Histogram Equalization
41/60
Histogram Equalization
42/60
Properties of HE•• mostly, generates images with maximum contrast• work well on images with fine details in dark region• can not change the frequency of each luminance level• Automatic!! : Good quality images can be degraded by
HE
Histogram Equalization
43/60
Histogram Equalization
44/60
Histogram Specification
desiredhistogram
Histogram Specification• The method used to generate a processed image that has a
specified histogram• can lighten or darken an image or make more contrast of an
image•• histogram equalization + inverse histogram equalization• also called “Histogram matching”
45/60
The procedure of Histogram Specification1.2. calculate normalized sum of histogram(CDF) T(r)
3. calculate normalized sum of desired histogram G(z) that it has G(z)-1
4. perform histogram equalization using an input image, after that, perform inverse histogram equalization using the CDF of the desired histogram
r
r dwwprTs0
.)()(
z
z dwwpzGv0
.)()(
)(1 sGz )]([1 rTGz
Histogram Specification
46/60
Histogram Specification
47/60
Histogram Specification
48/60
Contrast Stretching
Contrast•
lowhigh
lowhighContrast
Contrast stretching• stretch a histogram to fill the full dynamic range of
image• good contrast image exhibits a wide range of pixel
values
low contrast high contrast
49/60
Basic contrast stretching•• works best on images that have all pixels concentrated
in one part of the histogram
Contrast Stretching
50/60
End-In-Search• must specify that a certain percentage of the pixels must
be saturated to full white or full black•• High : converted to full white
Contrast Stretching
51/60
Original Image
Original Image
Basic Contrast Stretching
End-in Search
Contrast Stretching
52/60
Piecewise-Linear Stretching• transform function is divided into several piecewise linear
function•• parameter setting: clamping, thresholding, etc.• clamping : • thresholding :
Lubvbu
buavau
auu
v
LvLuufv
b
a
)(
)(
0,
],0[],,0[)(
0 ],[ bautba
Contrast Stretching
53/60
5.0
5.0
5.1
5.1
5.0
5.0
5.0
5.1
5.0
Piecewise-Linear Stretching
Contrast Stretching, a = 80, b= 160
Contrast Stretching
54/60
Contrast Stretching
Piecewise-Linear Stretching
55/60
Intensity Transform
Intensity Transform• converts an old pixel into a new pixel based on some
predefined function•
Simple intensity transform example• null transform
y = x
• negative transformy = 255 - x
• gamma correction
• stretching
56/60
Intensity Transform
57/60
Intensity transform example • compression
-- reduce the dynamic range of an image
• posterizing- reduce the number of gray levels in an image- can reduce the size of an image
• thresholding- posterizing with the number of gray levels is reduced 2- generates binary images
Intensity Transform
58/60
Intensity Transform
59/60
Intensity transform example • bounded thresholding
-- treats the other input pixels as null transforms
• iso-intensity contouring- sets particular input intensity values to black or white- uses to find certain intensity level
• solarizing- negative transform for the bright part of an image
Intensity Transform
60/60
Intensity Transform