当前位置:文档之家› 数字图像处理-灰度变换

数字图像处理-灰度变换


1000
800
600
400
200
0
0
50
100
150
200
250
4
Gray-Level Transformation
The principal objective of image enhancement is to create a better image representation with unwanted information suppressed/removed and wanted information enhanced. This can be achieved in the spatial domain by graylevel transformation which maps the original set of gray-levels in an image Where T denotes the transformation or mapping function which can be either a linear or non-linear function. It is useful to visualize the transformation in two dimensions with the x-axis representing the old gray-levels and the y-axis the new gray-levels. For example, if the slope of the transformation function equals 1 , then gout T(gin)
gin
5
Gray-Level Transformation
if the slope of the transformation function is greater or less than 1 , then
T(gin) with slope>1 gout T(gin) with slope<1
数字图像处理-灰度变换
1
Displaying Gray-Level Information
There are a number of useful Matlab functions for displaying the graylevel/color information of an image (a) Pixel information An interactive display of pixel co-ordinate and gray/color information in the current figure can be turned on or off by entering pixval on and pixval off
12
Bit-plane Slicing
The image is thought of as a stack of bit-planes and each bit-plane represents the contribution made by a particular bit to the overall image appearance.
14
Bit-plane Slicing
load imdemos bit7=bitget(flower,8);imshow(bit7>0) bit6=bitget(flower,7);imshow(bit6>0) bit5=bitget(flower,6);imshow(bit5>0) bit1=bitget(flower,2);imshow(bit1>0) bit0=bitget(flower,1);imshow(bit0>0)
gout
1
T(gin)
TL
TU
gin
11
Gray-level slicing
load imdemos A=double(alumgrns)/255; B= (img>0.5)& (img<0.8);
AA= (1-(img>0.5)& (img<0.8)).*img; imshow(AA) imshow(AA+B);
top 1
gamma<1 gamma>1
bottom low high 1
gin
8
Gray-level slicing
The essentially perform a double thresholding operation to highlight a particular range of gray-levels in an image. Two approaches are possible depending on whether it is desirable to remove other features in the image. (a) Double thresholding with background removed This approach produces a binary image with all gray levels in the range of interest mapped to white and all other gray levels mapped to black. That is
7
Gamma Correction
The input-output relationship of an image acquisition or display system is generally non-linear and is frequently of the form
G out cG in

where c is constant, and is an exponent (known as the gamma of the system) varying in practice between about 0.5 to nearly 3 The camera, the display and the eye all have non-unity gammas. In Matlab, the effect can be inversely compensated by using B = IMADJUST(A,[LOW_IN HIGH_IN],[LOW_OUT HIGH_OUT],GAMMA) gout
1 B(i, j ) A(i, j ) TL A(i, j ) T otherwise
U
Where A(i,j) and B(i,j) denote respectively the gray-level of input image A and output image B at point (i,j) and TL and TU denote the lower and upper threshold as shown below
0 1 2 3 4
1 2 3 4 5
2 3 -plane 2(MSB) Bit-plane 1 Bit-plane 0(LSB)
Image with 8 gray-levels
3 Bit-planes representation
13
Bit-plane Slicing
1
T(gin)
Tl
TU
gin
9
Gray-level slicing
load imdemos imshow(alumgrns) imhist(alumgrns)
imshow((alumgrns>128)& (alumgrns<192))
10
Gray-level slicing
(b) Double thresholding with background preserved This approach brightness all gray levels in the range of interest with all other gray levels remained at their original values. That is
190
180
170
160
150
140
130
120
110
100
0
10
20
30 40 Dis tance a long profile
50
60
70
3
Displaying Gray-Level Information
(c) Image Information The distribution of the gray-level/color values in an image can be displayed and computed using Matlab function imhist
gin
6
Gray-Level Transformation
The transformation function can be either a continuous function or piecewise continuous function with different expressions over different intervals. For example, if the contrast of an image in the middle range is to be stretched at the expense of compressing the contrast for high and low gray-levels, then
T(gin) gout gout T(gin)
相关主题