งานนำเสนอกำลังจะดาวน์โหลด โปรดรอ

งานนำเสนอกำลังจะดาวน์โหลด โปรดรอ

Digital Image Processing

งานนำเสนอที่คล้ายกัน


งานนำเสนอเรื่อง: "Digital Image Processing"— ใบสำเนางานนำเสนอ:

1 Digital Image Processing
Chapter 3: Image Enhancement in the Spatial Domain 15 June 2007

2 Spatial Domain หมายถึง ที่ตั้งอยู่หรือระนาบของ pixel ที่ประกอบขึ้นเป็น image ซึ่งสามารถระบุ ตำแหน่งของ pixel ในความหมายของระยะทางได้ กล่าวคือ ใน spatial domain เราสามารถแทน image ด้วย f(x,y) เมื่อ x และ y คือระยะทางในแนวแกนตั้งและแกนนอนวัดจากจุด Origin ตัวอย่างที่เป็นของคู่กันคือ Spatial Domain กับ Frequency Domain เมื่อแปลงภาพโดยใช้ Fourier Transform ความหมายของ ระยะทางจะหายไป แต่จะเกิดความ หมายในเชิงความถี่ขึ้นมาแทน ซึ่ง ข้อมูลนี้จะอยู่ใน Frequency domain รูปภาพใน Spatial Domain คือรูปภาพที่อยู่ในระนาบ xy ที่เรา เห็นกันตามปกติ ใน Domain นี้ เราใช้ระยะทางในการกำหนดตำแหน่ง

3 Image Enhancement หมายถึงการปรับปรุงภาพให้เหมาะสมกับงานเฉพาะทาง
ด้านต่างๆ เช่นการทำให้ภาพชัดเจนขึ้น (ในสายตามนุษย์) ตัวอย่าง หมายเหตุ: วิธีการปรับปรุงภาพที่เหมาะสำหรับงานอย่างหนึ่งไม่จำเป็นต้องเหมาะสมกับ งานอีกอย่างหนึ่งเสมอไป (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

4 ภาพที่ปรับปรุงแล้วโดยใช้
Image Enhancement Example ภาพตั้งต้น ภาพที่ปรับปรุงแล้วโดยใช้ Gamma correction (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

5 Image Enhancement in the Spatial Domain
เมื่อ f(x,y) คือภาพตั้งต้น, g(x,y) คือภาพผลลัพธ์ และ T[ ] คือ Function ที่ถูกกำหนดในพื้นที่รอบๆจุด (x,y) หมายเหตุ: T[ ] อาจจะรับ input เป็นค่า pixel ที่ตำแหน่ง (x,y) อย่างเดียว หรือ input จะเป็นค่า pixel ใน Neighbors ของจุด (x,y) ขนาดใดๆก็ได้ ตามแต่ลักษณะของ Function นั้นๆเช่น การปรับความสว่างของภาพ มี input เป็นค่าของ pixel (x,y) อย่างเดียว การทำภาพเบลอโดยใช้ smoothing filter ต้องใช้ input จาก pixel หลายๆ pixel รอบๆจุด (x,y)

6 Types of Image Enhancement in the Spatial Domain
- Single pixel methods - Gray level transformations Example - Historgram equalization - Contrast stretching - Arithmetic/logic operations Examples - Image subtraction - Image averaging - Multiple pixel methods Spatial filtering - Smoothing filters - Sharpening filters

7 Gray Level Transformation
รูปแบบ: เป็นการแปลง intensity ของภาพตั้งต้นไปเป็น intensity ของภาพผลลัพธ์ โดยใช้ function: โดย r คือ input intensity และ s คือ output intensity ตัวอย่าง : Contrast enhancement (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

8 L = จำนวนระดับของสีเทา
Image Negative ขาว L-1 Original digital mammogram Output intensity Negative digital mammogram ดำ L-1 ดำ Input intensity ขาว L = จำนวนระดับของสีเทา (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

9 Log Transformations Application Fourier spectrum Log Tr. of Fourier
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

10 Power-Law Transformations
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

11 ภาพที่อยาก ให้เป็น ภาพที่แสดงที่ Monitor โดยตรง ภาพที่แสดงที่
Power-Law Transformations : Gamma Correction Application ภาพที่อยาก ให้เป็น ภาพที่แสดงที่ Monitor โดยตรง ภาพที่แสดงที่ Monitor ภายหลัง เมื่อปรับ Gamma correction (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

12 Power-Law Transformations : Gamma Correction Application
ภาพ MRI ที่ผ่าน Gamma Correction โดยใช้ค่า Gamma ค่าต่างๆ (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

13 Power-Law Transformations : Gamma Correction Application
ภาพถ่ายทางอากาศที่ ผ่าน Gamma Correction โดยใช้ค่า Gamma ค่าต่างๆ (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

14 Contrast หมายถึงความแตกต่างระหว่าง
Contrast Stretching Before contrast enhancement Contrast หมายถึงความแตกต่างระหว่าง สีที่มืดที่สุดในภาพกับสีที่สว่างที่สุดในภาพ After (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

15 How to know where the contrast is enhanced ?
ดูที่ Slope ของ T(r) ถ้า Slope > 1  Contrast เพิ่ม ถ้า Slope < 1  Contrast ลดลง ถ้า Slope = 1  Contrast คงที่ Ds Dr Dr แคบๆ ได้ Ds กว้างๆ แสดงว่า Contrast เพิ่ม (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

16 Gray Level Slicing (Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.

17 Bit-plane Slicing Bit 7 Bit 6 Bit 5 Bit 3 Bit 2 Bit 1
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

18 Histogram หมายถึงกราฟแสดงความถี่ของประชากรในช่วงต่างๆ
เกรดวิชา 178 xxx

19 หมายถึงเป็นกราฟที่แสดงจำนวน pixel ของสี หรือintensity ค่าต่างๆ
Histogram of an Image หมายถึงเป็นกราฟที่แสดงจำนวน pixel ของสี หรือintensity ค่าต่างๆ ภาพที่มืด จะมี histogram กองอยู่ไปทางซ้าย จำนวน pixel ภาพที่สว่าง จะมี histogram กองอยู่ไปทางขวา จำนวน pixel (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

20 Histogram of an Image (cont.)
ภาพที่ low contrast จะมี histogram กระจุกกันอยุ่ใน ช่วงแคบๆ ภาพที่ high contrast จะมี histogram กระจายกันอยุ่ ในช่วงกว้างๆ (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

21 หมายถึงกระบวนการปรับปรุง intensity ของรูปภาพเพื่อให้ได้ histogram
Histogram Processing หมายถึงกระบวนการปรับปรุง intensity ของรูปภาพเพื่อให้ได้ histogram ที่มีลักษณะตามต้องการ - Histogram equalization เป็นการทำให้ histogram กระจายกันอย่างสม่ำเสมอตลอด - Histogram matching เป็นการทำให้ histogram มีลักษณะเหมือนกราฟที่กำหนดไว้

22 Monotonically Increasing Function
หมายถึง Function ที่เมื่อ r เพิ่มขึ้นแล้ว T(r) จะมีค่าเพิ่มขึ้นหรือคงที่เท่านั้นไม่มีการลดลง Histogram processing จะเป็น function ที่มีรูปแบบดังนี้ 1. เป็น Monotonically increasing function 2.

23 Probability Density Function
Histogram จะมีความหมายใกล้เคียงกับ Probability Density Function (PDF) ซึ่งแสดงถึงค่าความหนาแน่นของค่าของตัวแปรค่าต่างๆ ให้ s และ r เป็น Random variables ที่มี PDF เป็น ps(s) และ pr(r ) ตามลำดับ และให้ความสัมพันธ์ระหว่าง s และ r เป็น จะได้ว่า

24 Histogram Equalization
กำหนดให้ จะได้ว่า !

25 Histogram Equalization
สูตรในหน้าที่แล้วใช้สำหรับ Continuous PDF สำหรับ Histogram ของ Digital Image จะใช้สูตร nj = the number of pixels with intensity = j N = the number of total pixels

26 Histogram Equalization Example
Intensity # pixels 20 1 5 2 25 3 10 4 15 6 7 Total 100 Accumulative Sum of Pr 20/100 = 0.2 (20+5)/100 = 0.25 ( )/100 = 0.5 ( )/100 = 0.6 ( )/100 = 0.75 ( )/100 = 0.8 ( )/100 = 0.9 ( )/100 = 1.0 1.0

27 Histogram Equalization Example (cont.)
Intensity (r) No. of Pixels (nj) Acc Sum of Pr Output value Quantized Output (s) 20 0.2 0.2x7 = 1.4 1 5 0.25 0.25*7 = 1.75 2 25 0.5 0.5*7 = 3.5 3 10 0.6 0.6*7 = 4.2 4 15 0.75 0.75*7 = 5.25 0.8 0.8*7 = 5.6 6 0.9 0.9*7 = 6.3 7 1.0 1.0x7 = 7 Total 100

28 Histogram Equalization
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

29 Histogram Equalization (cont.)
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

30 Histogram Equalization (cont.)
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

31 Histogram Equalization (cont.)
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

32 ภาพหลังทำ Histogram Eq.
Histogram Equalization (cont.) ภาพตั้งต้น ภาพหลังทำ Histogram Eq. ปัญหาในข้อนี้: ภาพหลังการทำ Histogram equalization กลายเป็นภาพ Low Contrast ไป (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

33 Histogram Matching : Algorithm
หลักการ : จาก Histogram equalization เรามี ได้ ps(s) = 1 User ต้องการให้ output image มี PDF เป็น pz(z) เราสามารถใช้สูตรเดียวกันนี้กับ pz(z) จะได้ ซึ่งจะได้ ได้ pv(v) = 1 เนื่องจาก ps(s) = pv(v) = 1 ซึ่งเสมือนว่า s กับ v เป็นตัวแปรเดียวกัน T( ) G-1( ) ดังนั้นเราสามารถแปลง r ไปเป็น z ได้จาก r s z

34 Histogram Matching : Algorithm (cont.)
s = T(r) v = G(z) 2 1 3 z = G-1(v) 4 (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

35 Histogram Matching Example
input image เป็นดังนี้ ต้องการให้ Histogram ของ output image เป็นดังนี้ โจทย์ตัวอย่าง Intensity ( s ) # pixels 20 1 5 2 25 3 10 4 15 6 7 Total 100 Intensity ( z ) # pixels 5 1 10 2 15 3 20 4 6 7 Total 100 ข้อมูลตั้งต้น User เป็นผู้กำหนด

36 Histogram Matching Example (cont.)
1. ทำ Histogram Equalization ทั้งสองตาราง r (nj) SPr s 20 0.2 1 5 0.25 2 25 0.5 3 10 0.6 4 15 0.75 0.8 6 0.9 7 1.0 z (nj) SPz v 5 0.05 1 10 0.15 2 15 0.3 3 20 0.5 4 0.7 0.85 6 0.95 7 1.0 sk = T(rk) vk = G(zk)

37 Histogram Matching Example (cont.)
2. ได้ตาราง Map Actual Output Histogram ได้เป็น r  s v  z r s 1 2 3 4 5 6 7 s  v v z 1 2 4 3 5 6 7 r z 1 2 3 4 5 6 7 z # Pixels 1 20 2 30 3 10 4 15 5 6 7 sk = T(rk) zk = G-1(vk)

38 Histogram Matching Example (cont.)
Desired histogram Transfer function Actual histogram (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

39 Histogram Matching Example (cont.)
After histogram equalization After histogram matching Original image

40 Local Enhancement : Local Histogram Equalization
Concept: Perform histogram equalization in a small neighborhood After Local Hist Eq. In 7x7 neighborhood Orignal image After Hist Eq. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

41 Local Enhancement : Histogram Statistic for Image Enhancement
เราสามารถนำค่าทางสถิติเช่น Mean, Variance ของ Local area มาใช้งานได้ ภาพไส้หลอดไฟถ่ายโดยกล้องจุลทัศน์อิเล็กตรอน มุมขวาล่างจะมีภาพไส้หลอดไฟที่อยู่ด้านหลัง ซึ่งค่อนข้างมืด เราต้องการเพิ่มความสว่างให้ใส้หลอดด้านหลัง ถ้าปรับความสว่างทั้งภาพ แล้วไส้หลอดด้านหน้า จะสว่างเกินไป (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

42 ตัวอย่างสูตร Local enhancement (พิเศษเฉพาะงานนี้)
Local Variance image Multiplication factor Original image (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

43 Local Enhancement Output image
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

44 AND OR Logic Operations Application: ใช้ตัดพื้นที่ที่สนใจ
ใน Image ออกมา AND OR Original image Image mask ได้ผลลัพธ์เป็น ROI: Region of Interest (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

45 Arithmetic Operation: Subtraction
Application: Error measurement Error image (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

46 Arithmetic Operation: Subtraction (cont.)
Application: Mask mode radiography in angiography work (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

47 Arithmetic Operation: Image Averaging
Application : Noise reduction Degraded image (noise) Image averaging การทำ average จะทำให้ Variance ของ noise ลดลง (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

48 Arithmetic Operation: Image Averaging (cont.)
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

49 Basics of Spatial Filtering
Sometime we need to manipulate values obtained from neighboring pixels Example: How can we compute an average value of pixels in a 3x3 region center at a pixel z? Pixel z 2 4 1 2 6 2 9 2 3 4 4 4 7 2 9 7 6 7 5 2 3 6 1 5 7 4 2 5 1 2 2 5 2 3 2 8 Image

50 Basics of Spatial Filtering (cont.)
Step 1. Selected only needed pixels Pixel z 2 4 1 2 6 2 9 2 3 4 4 4 3 4 4 7 2 9 7 6 7 9 7 6 5 2 3 6 1 5 3 6 1 7 4 2 5 1 2 2 5 2 3 2 8

51 Basics of Spatial Filtering (cont.)
Step 2. Multiply every pixel by 1/9 and then sum up the values 4 6 7 9 1 3 X 1 Mask or Window or Template

52 Basics of Spatial Filtering (cont.)
Question: How to compute the 3x3 average values at every pixels? Solution: Imagine that we have a 3x3 window that can be placed everywhere on the image 2 4 1 2 6 2 9 2 3 4 4 4 7 2 9 7 6 7 5 2 3 6 1 5 7 4 2 5 1 2 Masking Window

53 Basics of Spatial Filtering (cont.)
Step 1: Move the window to the first location where we want to compute the average value and then select only pixels inside the window. Step 2: Compute the average value 4 6 7 1 9 2 5 3 4 1 9 2 3 7 Sub image p Step 3: Place the result at the pixel in the output image Original image 4.3 Step 4: Move the window to the next location and go to Step 2 Output image

54 Example : moving averaging
Basics of Spatial Filtering (cont.) The 3x3 averaging method is one example of the mask operation or Spatial filtering. w The mask operation has the corresponding mask (sometimes called window or template). w The mask contains coefficients to be multiplied with pixel values. Example : moving averaging w(2,1) w(3,1) w(3,3) w(2,2) w(3,2) w(1,1) w(1,2) 1 Mask coefficients The mask of the 3x3 moving average filter has all coefficients = 1/9

55 Basics of Spatial Filtering (cont.)
The mask operation at each point is performed by: 1. Move the reference point (center) of mask to the location to be computed 2. Compute sum of products between mask coefficients and pixels in subimage under the mask. Mask frame p(2,1) p(3,2) p(2,2) p(2,3) p(3,3) p(1,1) p(1,3) p(3,1) w(2,1) w(3,1) w(3,3) w(2,2) w(3,2) w(1,1) w(1,2) Mask coefficients Subimage The reference point of the mask

56 Basics of Spatial Filtering (cont.)
The spatial filtering on the whole image is given by: Move the mask over the image at each location. Compute sum of products between the mask coefficeints and pixels inside subimage under the mask. Store the results at the corresponding pixels of the output image. Move the mask to the next location and go to step 2 until all pixel locations have been used.

57 3x3 moving average filter
Examples of Spatial Filtering Masks Examples of the masks Sobel operators 3x3 moving average filter 1 2 -1 -2 -2 -1 1 2 1 3x3 sharpening filter -1 8

58 Smoothing Linear Filter : Moving Average
Application : noise reduction and image smoothing Disadvantage: lose sharp details (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

59 Smoothing Linear Filter (cont.)
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

60 Order-Statistic Filters
Original image subimage Statistic parameters Mean, Median, Mode, Min, Max, Etc. Moving window Output image

61 Order-Statistic Filters: Median Filter
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

62 Sharpening Spatial Filters
There are intensity discontinuities near object edges in an image (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

63 Laplacian Sharpening : How it works
Intensity profile Edge p(x) 1st derivative 2nd derivative

64 Laplacian Sharpening : How it works (cont.)
p(x) Laplacian sharpening results in larger intensity discontinuity near the edge.

65 Laplacian Sharpening : How it works (cont.)
Before sharpening p(x) After sharpening

66 Laplacian Masks Used for estimating image Laplacian -1 8 -1 4 The center of the mask is positive or 1 -8 1 -4 The center of the mask is negative Application: Enhance edge, line, point Disadvantage: Enhance noise

67 Laplacian Sharpening Example
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

68 Laplacian Sharpening (cont.)
Mask for -1 5 -1 9 or Mask for 1 -8 or 1 -4 (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

69 Unsharp Masking and High-Boost Filtering
-1 k+8 -1 k+4 Equation: The center of the mask is negative The center of the mask is positive

70 Unsharp Masking and High-Boost Filtering (cont.)
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

71 First Order Derivative
Intensity profile 20 40 60 80 100 120 140 160 180 200 0.5 1 50 150 -0.2 0.2 0.1 p(x) Edges 1st derivative 2nd derivative

72 First Order Partial Derivative:
Sobel operators 1 2 -1 -2 -2 -1 1 2 P

73 First Order Partial Derivative: Image Gradient
Gradient magnitude A gradient image emphasizes edges (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

74 First Order Partial Derivative: Image Gradient

75 Image Enhancement in the Spatial Domain : Mix things up !
B smooth A - + Sharpening C (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. E

76 Image Enhancement in the Spatial Domain : Mix things up !
Power Law Tr. G C E S F A Multiplication (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. H


ดาวน์โหลด ppt Digital Image Processing

งานนำเสนอที่คล้ายกัน


Ads by Google