Академический Документы
Профессиональный Документы
Культура Документы
Lecture Notes: Lecture Notes: The Point Processing of Images Richard Alan Peters II Department of Electrical Engineering and Computer Science Fall Semester 2011
This work is licensed under the Creative Commons Attribution-Noncommercial 2.5 License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/2.5/ or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.
In a digital image, point = pixel. Point processing transforms a pixels value as function of its value alone; it does not depend on the values of the pixels neighbors.
2011-09-06
Brightness and contrast adjustment Gamma correction Histogram equalization Histogram matching Color correction.
2011-09-06
Point Processing
- gamma
- brightness
original
+ brightness
+ gamma
histogram mod
2011-09-06
- contrast
original
2000-2011 Richard Alan Peters II
+ contrast
histogram EQ
4
Let I be a 1-band (grayscale) image. I(r,c) is an 8-bit integer between 0 and 255. Histogram, hI, of I:
a 256-element array, hI hI(g), for g = 1, 2, 3, , 256, is an integer hI(g) = number of pixels in I that have value g-1.
2011-09-06
2011-09-06
2011-09-06
2011-09-06
Luminosity
2011-09-06
If I is a 3-band image (truecolor, 24-bit) then I(r,c,b) is an integer between 0 and 255. Either I has 3 histograms:
hR( g +1) = # of pixels in I(:,:,1) with intensity value g hG( g +1) = # of pixels in I(:,:,2) with intensity value g hB( g +1) = # of pixels in I(:,:,3) with intensity value g h( g +1,1,1) = # of pixels in I with red intensity value g h( g +1,1,2) = # of pixels in I with green intensity value g h( g +1,1,3) = # of pixels in I with blue intensity value g
2011-09-06
10
2011-09-06
11
2011-09-06
12
Where R, G, and B are the red, green, and blue bands of I. The luminance histogram of I is the histogram of the luminance image,
L (r , c) = 0.299 R (r , c) + 0.587 G (r , c) + 0.114 B (r , c)
2011-09-06
2000-2011 Richard Alan Peters II
13
Value Histogram
Value image, V.
2011-09-06
14
Luminance Histogram
Luminance image, L.
2011-09-06
15
R,G,B,&V histograms
2011-09-06
2000-2011 Richard Alan Peters II
2011-09-06
17
18
I
Input
, point
operator
J
Output
J = F[ I ]
Pixel:
I(r,c)
function, f
J(r,c)
If I (r , c) = g and f ( g ) = k
The transformation of image I into image J is then J (r , c) = k . accomplished by replacing each input intensity, g, with a specific output intensity, k, at every location (r,c) where I(r,c) = g. The rule that associates k with g is usually specified with a function, f, so that f (g) = k.
2011-09-06
2000-2011 Richard Alan Peters II
19
Three-band Image
2011-09-06
20
Three-band Image
21
then the LUT that implements f is a 256x1 array whose (g +1)th value is k = f (g).
22
2011-09-06
23
255
255
2011-09-06
Look-Up Tables
contents
. . .
output
. . .
2011-09-06
25
(x ; a ) =
Or in Matlab:
255 1 + e a ( x 127 ) / 32
2011-09-06
Kinkaku-ji ( Temple of the Golden Pavilion), also known as Rokuon-ji ( Deer Garden Temple), is a Zen Buddhist temple in Kyoto, Japan.
Photo by Richard Alan Peters II, August 1993.
Luminance Histogram
2011-09-06
27
J ( r , c , b) =
127
255
g
saturation point
0 0 127 255
transform mapping
28
2011-09-06
255
zero point
255-g
J ( r , c , b) =
if I (r , c, b) - g < 0 0, I (r , c, b) - g , if I (r , c, b) - g > 0
0 0 127 255
127
transform mapping
29
2011-09-06
Here, s = 127
T( r , c , b ) = a [ I ( r , c , b) - s ] + s ,
s is the where 0 a < 1.0, center of s {0,1, 2, , 255} , and the contrast function. b { 1, 2,3 } .
2000-2011 Richard Alan Peters II
127 0
255
127
255
transform mapping
30
2011-09-06
255
zero point
Here, s = 127
T ( r , c , b ) = a [ I ( r , c , b) - s ] + s
0, J (r , c, b) = T ( r , c, b) , 255, a > 1, s {0,, 255} ,
2011-09-06
127
sat. point
0 0 127 255
b { 1, 2 ,3 }
transform mapping
31
MJ
255 127
zero point
Let mI = min [I (r , c)] , M I = max [I (r , c)], mJ = min [ J (r , c)] , M J = max [ J (r , c)]. Then, J (r , c) = ( M J - mJ )
center point
I (r , c) - mI + mJ . M I - mI
mJ
sat. point
0 127 mI MI 255 transform mapping
2011-09-06
32
histograms
lo-c
hi-c
2011-09-06
33
orig
lo-c rest
orig
hi-c rest
2011-09-06
34
127 0
255
127
255
transform mapping
35
2011-09-06
255
36
2011-09-06
37
Note that since hI k ( g + 1) is the number of pixels in I k (the kth color band of image I ) with value g , A is the number of pixels in I. That is if I is R rows by C columns then A = R C.
38
2011-09-06
39
h h
g =0 g =0 255
Ik
(g + 1)
,
Ik
(g + 1)
This is the probability that any given pixel from Ik has value less than or equal to g.
2011-09-06
40
h h
g =0 g =0 255
Ik
(g + 1)
,
Ik
(g + 1)
This is the probability that any given pixel from Ik has value less than or equal to g.
2011-09-06
41
42
function of I.
J (r , c, b) = 255 PI [I (r , c, b) + 1].
The CDF itself is used as the LUT.
2011-09-06
before
after
44
Histogram EQ
CDF
2011-09-06
45
Histogram EQ
LUT
2011-09-06
46
Histogram EQ
LUT
2011-09-06
47
Histogram EQ
2011-09-06
48
function of I.
49
50
Matching Percentiles
Recall: The CDF of image I is such that 0 PI ( gI ) 1. PI ( gI +1) = c means that c is the fraction of pixels in I that have a value less than or equal to gI . 100c is the percentile of pixels in I that are less than or equal to gI . To match percentiles, replace all occurrences of value gI in image I with the value, gJ, from image J whose percentile in J most closely matches the percentile of gI in image I.
2011-09-06
2000-2011 Richard Alan Peters II
51
Matching Percentiles
So, to create an image, K, from image I such that K has nearly the same CDF as image J do the following: If I(r,c) = gI then let K(r,c) = gJ where gJ is such that
gI
2011-09-06
2000-2011 Richard Alan Peters II
gJ
52
end K = K + [ g J ( I == g I )] end
2011-09-06
2011-09-06
54
g
*a.k.a Cumulative Distribution Function, CDFI. 2011-09-06
2000-2011 Richard Alan Peters II
55
2011-09-06
56
g
*a.k.a Cumulative Distribution Function, CDFJ. 2011-09-06
2000-2011 Richard Alan Peters II
57
In Matlab if the LUT is a 256 1 matrix with values from 0 to 255 and if image I is of type uint8, it can be remapped with the following code:
K = uint8(LUT(I+1));
2011-09-06
2000-2011 Richard Alan Peters II
58
LUT Creation
Image CDF Target CDF
LUT
10
2011-09-06
59
for gI = 0 to 255 while PJ ( g J + 1) < PI ( g I + 1) AND g J < 255 g J = g J + 1; end LUT ( g I + 1) = g J ; end
2011-09-06
60
Target
LUT ( g )
g
2011-09-06
2000-2011 Richard Alan Peters II
PK ( g )
LUT
Result
g
61
original
2011-09-06
target
2000-2011 Richard Alan Peters II
remapped
62
Atlas-Mercury
2011-09-06
63
2011-09-06
64
TechnoTrousers
2011-09-06
65
2011-09-06
66
original
2011-09-06
target
2000-2011 Richard Alan Peters II
luminosity remapped
67
2011-09-06
68
Before
2011-09-06
2000-2011 Richard Alan Peters II
After
69
Before
2011-09-06
2000-2011 Richard Alan Peters II
After
70
original
2011-09-06
target
2000-2011 Richard Alan Peters II
R, G, & B remapped
71
2011-09-06
72
Before
2011-09-06
2000-2011 Richard Alan Peters II
After
73
Before
2011-09-06
2000-2011 Richard Alan Peters II
After
74
Remap an Image:
original
G&B
B&R
R&G
2011-09-06
75