Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 78 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
78
Dung lượng
3,47 MB
Nội dung
Prof Duong Anh Duc To process an image so that output is “visually better” than the input, for a specific application Enhancement is therefore, very much dependent on the particular problem/image at hand Enhancement can be done in either: o Spatial domain: operate on the original image g (m, n) = T [f (m, n)] o Frequency domain: operate on the DFT of the original image G (u, v) = T [F (u, v)] where F(u, v) = F [f(m, n)], and G(u, v) = F [g(m, n)] Image Enhancement Techniques Point Operations • • • • • • • Image Negative Contrast Stretching Compression of dynamic range Graylevel slicing Image Subtraction Image Averaging Histogram operations Mask Operations • • • • • Smoothing operations Median Filtering Sharpening operations Derivative operations Histogram operations Transform Operations • • • • • Low pass Filtering Hi pass Filtering Band pass Filtering Homomorphic Filtering Histogram operations Coloring Operations • • False Coloring Full color Processing Output pixel value g(m, n) at pixel (m, n) depends only on the input pixel value at f(m, n) at (m, n) (and not on the neighboring pixel values) We normally write s = T(r), where s is the output pixel value and r is the input pixel value T is any increasing function that maps [0,1] into [0,1] T(r) = s = L – – r, L: max grayvalue Increase the dynamic range of grayvalues in the input image Suppose you are interested in stretching the input intensity values in the interval [r1, r2]: Note that (r1 – r2) < (s1 – s2) The grayvalues in the range [r1, r2] is stretched into the range [s1, s2] Special cases: o Thresholding or binarization r1 = r2 , s1 = and s2 = o Useful when we are only interested in the shape of the objects and on their actual grayvalues Special cases (cont.): o Gamma correction: 0, r r1 g r r1 s1 = 0, s2 = and T r r r , r1 r r2 1, r r2 10 If the transformation zk G(zk) is one-to-one, the inverse transformation sk G– 1(sk), can be easily determined, since we are dealing with a small set of discrete grayvalues In practice, this is not usually the case (i.e., zk G(zk) is not one-toone) and we assign grayvalues to match the given histogram, as closely as possible 64 Consider the previous 8-graylevel 64 x 64 image histogram: k rk 1/7 2/7 3/7 4/7 5/7 6/7 nk 790 1023 850 656 329 245 122 81 p(rk)=nk/n 0.19 0.25 0.21 0.16 0.08 0.06 0.03 0.02 65 It is desired to transform this image into a new image, using a transformation z=H(r)= G– 1[T(r)], with histogram as specified below: k zk 1/7 2/7 3/7 4/7 5/7 6/7 pout(zk) 0.00 0.00 0.00 0.15 0.20 0.30 0.20 0.15 66 The transformation T(r) was obtained earlier (reproduced below): r i s k nk p(sk) r0 s0 = 1/7 790 0.19 r1 s1 = 3/7 1023 0.25 r2 s2 = 5/7 850 0.21 r3,r4 s3 = 6/7 985 0.24 r5, r6,r7 s4=1 448 0.11 67 Next we compute the transformation G as before G z0 pout zi pout z0 0.00 i 0 G z1 pout zi pout z0 pout z1 0.00 i 0 G z pout zi pout z0 pout z1 pout z 0.00 i 0 G z3 pout zi pout z0 pout z1 pout z3 0.15 i 0 G z pout zi pout z0 pout z1 pout z 0.35 i 0 G z5 pout zi pout z0 pout z1 pout z5 0.65 i 0 G z6 pout zi pout z0 pout z1 pout z6 0.85 i 0 G z7 pout zi pout z0 pout z1 pout z7 1.00 i 0 68 Notice that G is not invertible But we will the best possible by setting o G– (0) = ? (This does not matter since s0) o G– (1/7) = 3/7 o G– (2/7) = 4/7 (This does not matter since s2/7) o G– (3/7) = 4/7 (This is not defined, but we use a close match) o G– (4/7) = ? (This does not matter since s4/7) o G– (5/7) = 5/7 o G– (6/7) = 6/7 o G– (1) = 69 Combining the two transformation T and G– 1, we get our required transformation H rT(r)=s r0 = 1/7 r1 = 1/7 3/7 r2 = 2/7 5/7 r3 = 3/7 6/7 r4 = 4/7 6/7 r5 = 5/7 r6 = 6/7 r7 = sG–1(s)=z 0? 1/7 3/7 2/7 4/7 3/7 4/7 4/7 ? 5/7 5/7 6/7 6/7 1 rG–1 [T(r)]=H(r)=z r0 = z3= 3/7 r1 = 1/7 z4= 4/7 r2 = 2/7 z5= 5/7 r3 = 3/7 z6= 6/7 r4 = 4/7 z6= 6/7 r5 = 5/7 z7= r6 = 6/7 z7= r7 = z7= 70 Applying the transformation H to the original image yields an image with histogram as below: k zk nk 1/7 2/7 3/7 4/7 5/7 6/7 0 790 1023 850 985 448 nk/n pout(zk) (actual hist.) (spec hist.) 0.00 0.00 0.00 0.00 0.00 0.00 0.19 0.15 0.25 0.20 0.21 0.30 0.24 0.20 0.11 0.15 71 72 Again, the actual histogram of the output image does not exactly but only approximately matches with the specified histogram This is because we are dealing with discrete histograms 73 Original image and its histogram 74 Histogram equalized image Actual histogram of output 75 Histogram specified image, Actual Histogram, and Specified Histogram 76 Used to enhance details over small portions of the image Define a square or rectangular neighborhood, whose center moves from pixel to pixel Compute local histogram based on the chosen neighborhood for each point and apply a histogram equalization or histogram specification transformation to the center pixel Non-overlapping neighborhoods can also be used to reduce computations But this usually results in some artifacts (checkerboard like pattern) 77 Another use of histogram information in image enhancement is the statistical moments associated with the histogram (recall that the histogram can be thought of as a probability density function) For example, we can use the local mean and variance to determine the local brightness/contrast of a pixel This information can then be used to determine what, if any transformation to apply to that pixel Note that local histogram based operations are non-uniform in the sense that a different transformation is applied to each pixel 78 ... – f2(m, n) It has applications in image segmentation and enhancement 18 f1(m, n): Image before dye injection f2(m, n): Image after dye injection g(m, n): Image after dye injection, followed... enhancement 30 The shape of a histogram provides useful information for contrast enhancement 31 The original image displayed The histogram of the original image 10000 5000 0 The stretched image. .. Saturn Image Mag Spectrum Mag Spectrum in log scale 13 Graylevel Slicing: Highlight a specific range of grayvalues 14 Example: Highlighted Image (no background) Original Image Highlighted Image