what is an image? - gunadarma
TRANSCRIPT
1
Bernd Girod: EE368 Digital Image Processing Pixel Operations no. 1
What is an image?
Definition: An image is a 2-dimensional light intensity function, f(x,y), where x and y are spatial coordinates, and fat (x,y) is related to the brightness of the image at that point.Definition: A digital image is the representation of a continuous image f(x,y) by a 2-d array of discrete samples. The amplitude of each sample is quantized to be represented by a finite number of bits. Definition: Each element of the 2-d array of samples is called a pixel or pel (from „picture element“)
Bernd Girod: EE368 Digital Image Processing Pixel Operations no. 2
A digital image can be written as a matrix
Note: For a color image, f(x,y) might be one of the components.
f x, y( ) =
f (0,0) f (0,1) L f (0, N −1)f (1,0) f (1,1) L f (1, N −1)
M M M
f (L −1,0) f (L −1,1) L f (L −1, N −1)
2
Bernd Girod: EE368 Digital Image Processing Pixel Operations no. 3
Image Size and Resolution
200x200 100x100 50x50 25x25
• These images were produced by simply picking every n-th sample horizontally and vertically and replicating that value nxn times.
Bernd Girod: EE368 Digital Image Processing Pixel Operations no. 4
Color Components
Red R(x,y) Green G(x,y) Blue B(x,y)
Monochrome image
R(x,y) = G(x,y) = B(x,y)
3
Bernd Girod: EE368 Digital Image Processing Pixel Operations no. 5
Different numbers of gray levels
256 32 16
8 4 2
„Contouring“
Bernd Girod: EE368 Digital Image Processing Pixel Operations no. 6
How many gray levels are required?
Contouring is most visible for a ramp
Digital images typically are quantized to 256 gray levels.
32 levels
64 levels
128 levels
256 levels
4
Bernd Girod: EE368 Digital Image Processing Pixel Operations no. 7
Storage requirements for digital images
Image LxN pixels, 2B gray levels, c color components
Size = LxNxBxc
– Example: L=N=512, B=8, c=1 (i.e., monochrome)Size = 2,097,152 bits (or 256 kByte)
– Example: LxN=1024x1280, B=8, c=3 (24 bit RGB image)Size = 31,457,280 bits (or 3.75 MByte)
Much less with (lossy) compression!
Bernd Girod: EE368 Digital Image Processing Pixel Operations no. 8
130129128127126125
Brightness discrimination experiment
Can you see the circle?
Visibility threshold
I
I + ∆I
∆I I ≈ const. ≈ 1K2% „Weber fraction“„Weber‘s Law“
Note: I is luminance,
measured in cd m2
5
Bernd Girod: EE368 Digital Image Processing Pixel Operations no. 9
Contrast with 8 Bits According to Weber‘s Law
Assume that the luminance difference between two successive representative levels is just at visibility threshold
For
Typical display contrastCathode ray tube 100:1Print on paper 10:1
Suggests uniform quantization in the log(I) domain
Imax
Imin
= 1+ const.( )255
const. = 0.01L0.02
Imax
Imin
= 13L156
Bernd Girod: EE368 Digital Image Processing Pixel Operations no. 10
Cathode ray tubes (CRT) are nonlinear
Cameras contain γ -predistortion circuit
Gamma characteristic
γ = 2.0 . . . 2.3
Luminance
I
Voltage U, rep. level f
I ~ U γ
U ~ I1 γ
6
Bernd Girod: EE368 Digital Image Processing Pixel Operations no. 11
log vs. γ-predistortion
Similar enough for most practical applications
U
I
U ~ I1 γ
U ~ log(I)
Imax
Imin
= 100
Bernd Girod: EE368 Digital Image Processing Pixel Operations no. 12
Image Scaling
Original image Scaled image
f x, y( ) a ⋅ f x,y( )
Scaling in the γ-domain is equivalent to scaling the linear luminance domain
. . . same effect as adjusting camera exposure time.
I ~ a ⋅ f x, y( )( )γ= aγ ⋅ f x, y( )( )γ
7
Bernd Girod: EE368 Digital Image Processing Pixel Operations no. 13
Adjusting γ
Original image γ increased by 50%
f x, y( ) a ⋅ f x,y( )( )γ with γ = 1.5
. . . same effect as using a different photographic film . . .
Bernd Girod: EE368 Digital Image Processing Pixel Operations no. 14
Photographic film
γ measures film contrastGeneral purpose films: γ = -0.7 . . . -1.0High-contrast films: γ = -1.5 . . . -10
Lower speed films tend to have higher absolute γ
slope -γ
log E
E is exposure
dens
ity d
shoulder
toe
„linear“ region
I = I0 ⋅10−d
= I0 ⋅10− −γ log E+ d0( )
= I0 ⋅10−d0 ⋅ Eγ
Luminance
Hurter & Driffield curve (H&D curve)for photographic negative
d0
0
2.0
1.0
8
Bernd Girod: EE368 Digital Image Processing Pixel Operations no. 15
Changing gradation by γ-adjustment
Original ramp γ0
Scaled ramp 2γ0
Scaled ramp 0.5γ0
Scaling chosen toapproximately preservebrightness of mid-gray
Bernd Girod: EE368 Digital Image Processing Pixel Operations no. 16
Histograms
Distribution of gray-levels can be judged by measuring a histogram:
For B-bit image, initialize 2B counters with 0
Loop over all pixels x,yWhen encountering gray level f(x,y)=i, increment counter #ι
Histogram can be interpreted as an estimate of the probability density function (pdf) of the underlying random process.You can also use fewer, larger bins to trade off amplitude resolution against sample size.
9
Bernd Girod: EE368 Digital Image Processing Pixel Operations no. 17
Example histogram
gray level
#pix
els
Cameramanimage
Bernd Girod: EE368 Digital Image Processing Pixel Operations no. 18
Example histogram
gray level
#pix
els
Poutimage
10
Bernd Girod: EE368 Digital Image Processing Pixel Operations no. 19
Histogram equalization
Idea: find a non-linear transformation
to be applied to each pixel of the input image f(x,y), such that a uniform distribution of gray levels in the entire range results for the output image g(x,y).Analyse ideal, continuous case first, assuming
T(f) is strictly monotonically increasing, i.e., there exists
Goal: pdf pg(g) = const. over the range
0 ≤ f ≤1
f = T −1 g( )
g = T f( )
0 ≤ g ≤1
0 ≤ g ≤1
Bernd Girod: EE368 Digital Image Processing Pixel Operations no. 20
Histogram equalization for continuous case
From basic probability theory
Consider the transformation function
Then . . .
pg g( ) = pf f( )dfdg
f =T −1 g( )
g = T f( ) = pf α( )0
f
∫ dα 0 ≤ f ≤ 1
dgdf
= pf f( )
pg g( ) = pf f( )dfdg
f =T −1 g( )
= pf f( ) 1pf f( )
f =T −1 g( )
= 1 0 ≤ g ≤1
11
Bernd Girod: EE368 Digital Image Processing Pixel Operations no. 21
Histogram equalization for discrete case
Now, f only assumes discrete amplitude values with probabilities
Discrete approximation of
The resulting values gk are in the range [0,1] and need to be scaled and rounded appropriately.
f0, f1,L, fL−1
P0 =
n0
n P1 =
n1
n L PL −1 =
nL −1
n
g = T f( ) = pf α( )0
f
∫ dα
gk = T fk( )= Pii= 0
k
∑
Bernd Girod: EE368 Digital Image Processing Pixel Operations no. 22
Histogram equalization example
Original image Pout Pout after histogram equalization
12
Bernd Girod: EE368 Digital Image Processing Pixel Operations no. 23
Histogram equalization example
Original image Pout . . . after histogram equalization
gray level
#pix
els
gray level
#pix
els
Bernd Girod: EE368 Digital Image Processing Pixel Operations no. 24
Histogram equalization example
Original image Cameraman
Cameramanafter histogram equalization
13
Bernd Girod: EE368 Digital Image Processing Pixel Operations no. 25
Histogram equalization example
Original image Cameraman . . . after histogram equalization
gray level
#pix
els
gray level
#pix
els
Bernd Girod: EE368 Digital Image Processing Pixel Operations no. 26
Histogram equalization example
Original image Moon Moonafter histogram equalization
14
Bernd Girod: EE368 Digital Image Processing Pixel Operations no. 27
Histogram equalization example
Original image Moon . . . after histogram equalization
gray level
#pix
els
gray level
#pix
els
Bernd Girod: EE368 Digital Image Processing Pixel Operations no. 28
Luminance-based segmentation
Original imagePeter f(x,y)
Thresholded Peter m(x,y)
const. ⋅ f (x,y) ⋅m(x,y)
Holes could befilled by morphologicalimage processing algorithms
15
Bernd Girod: EE368 Digital Image Processing Pixel Operations no. 29
Chroma key
Color is more powerful for pixel-wise segmentation: 3-d vs. 1-d spaceTake picture in front of a blue screen (or green, or orange)
Bernd Girod: EE368 Digital Image Processing Pixel Operations no. 30
Soft chroma key
α
1 −α∑
Extract„blueness“
for each pixelα
16
Bernd Girod: EE368 Digital Image Processing Pixel Operations no. 31
Landsat image processing
Original Landsat imagefalse color picture out of bands 4,5,6
Water area segmented and enhancedto show sediments
Source: US Geological Survey USGS, http://sfbay.wr.usgs.gov/