180 likes | 335 Views
9. Spatial Filters. Spatial filter operating over a local neighborhood about a pixel convolution is a kind of spatial filters convolution: linear filter non-linear filter 도 사용됨. 9.1 Blurring. Blurring neighborhood averaging low-pass filtering (smoothing filter)
E N D
9. Spatial Filters • Spatial filter • operating over a local neighborhood about a pixel • convolution is a kind of spatial filters • convolution: linear filter • non-linear filter도사용됨
9.1 Blurring • Blurring • neighborhood averaging • low-pass filtering (smoothing filter) • a weighted sum of all pixels in a neighborhood, divided by some scaling amount • 적용 예 • Figure 9-1 (Mandrill image) • 4가지 kernel 사용 • average • lp1 • lp2 • lp3
9.1 Blurring • kernels • average 1/9 1/9 1/9 1/9 1/9 1/9 1/9 1/9 1/9 • lp1 1/10 1/10 1/10 1/10 2/10 1/10 1/10 1/10 1/10 • lp2 1/12 1/12 1/12 1/12 4/12 1/12 1/12 1/12 1/12 • lp3 1/20 1/20 1/20 1/20 12/20 1/20 1/20 1/20 1/20
9.1 Blurring • effect of blurring • average -- lp1 -- lp2 -- lp3 less blurry (why ?) • noise removal 효과 • edge blurring • Gaussian filter • Gaussian PDF (nornal density) • gaussian(x,y,xc,yc, )=(1/2 2) ….. • (xc,yc) = mean • = standard deviation • 예) Figure 9-2 • (xc,yc) = (0,0) • = 3
9.1 Blurring • Gaussian kernel • 3*3 (normalize by dividing each element by 16.0) 1 2 1 2 4 2 1 2 1 • 7*7 (normalize by dividing each element by 140.0) 1 1 2 2 2 1 1 1 2 2 4 2 2 1 2 2 4 8 4 2 2 2 4 8 16 8 4 2 2 2 4 8 4 2 2 1 2 2 4 2 2 1 1 1 2 2 2 1 1 • 적용 예 • Figure 9-3 • Pentium 133MHz, 128*128 image, 7*7 kernel 4 seconds
9.2 Median Filtering • Median (중간값) • 주어진 list의 ascending order sorting 후 중간 위치 값 • 예) (3 5 4 9 8) (3 4 5 8 9) median=5 (7 5 3 8 9) (3 5 7 8 9) median=7 • Median filtering • n*n median filter를 영상 각 화소에 적용 • n2개값 중 median 값을 그 화소의 새로운 값으로 대치 • median filtering 위한 kernel 예 (3*3) 010 111 111 111 010 111
9.2 Median Filtering • 통계에서의 median • outlier (noise) 제거 효과 • 예) 학생 과제 점수 (0 85 90 87 100) • average (mean) = 72 • median = 87 • 학생을 평가하는데 어느 것이 보다 합리적일까? • Median filter 구현 • sorting 필요 (sorting은 computationally intensive) • quickSort method • edge 에서 처리: boundary pixel 희생 • Median filter 효과 • removing salt-and-pepper noise (shot noise)
9.2 Median Filtering • 3*3 kernels • Figure 9.4, 9.5,and 9.6 • left image of Figure 9.4 • saltAndPepper(100): 128*128 영상에 흑 100개와 백 100개 noise 첨가 • right image of Figure 9.4 • medianCross3x3적용 010 111 010 • noise removal, but not completely removed
9.2 Median Filtering • 3*3 kernels (continued) • right image of Figure 9.5 • medianSquare3x3적용 111 111 111 • more aggressive than medianCross3x3 • complete noise removal, but more edge blurring • right image of Figure 9.6 • gauss3*3 적용 121 242 * 1/16 121 • noise blurring (not removal) • “a tradeoff between noise reduction and blurring”
9.2 Median Filtering • 5*5 kernels • Figure 9.7 and 9.8 • left image of Figure 9.7 • saltAndPepper(1000): 128*128 영상에 흑 1000개와 백 1000개 noise 첨가 (약 12% 화소에 noise 발생) • right image of Figure 9.4 • medianSquare5x5적용 11111 11111 11111 11111 11111 • noise removal, but blurring increased (loss of details, e.g., pupils) • posterization (gray level 수 감소)
9.2 Median Filtering • 5*5 kernels (continued) • right image of Figure 9.8 • medianOctagon5x5적용 01110 11111 11111 11111 01110 • less aggressive than medianSquare5x5 • noise removal, but still blurring and posterization
9.2 Median Filtering • 7*7 kernels • Figure 9.9, 9.10, and 9.11 • left image of Figure 9.9 • saltAndPepper(4000): 128*128 영상에 흑 4000개와 백 4000개 noise 첨가 (약 25% 화소에 noise 발생) • right image of Figure 9.9 • medianCross7x7적용 0001000 0001000 0001000 1111111 0001000 0001000 0001000 • not clean noise removal
9.2 Median Filtering • 7*7 kernels (continued) • right image of Figure 9.9 • medianDiamond7x7적용 0001000 0011100 0111110 1111111 0111110 0011100 0001000 • clean noise removal, but some noise not removed • blurring and posterization
9.2 Median Filtering • 7*7 kernels (continued) • right image of Figure 9.10 • hybrid median filter • medianDiamond7x7적용 후 medianSquare5x5적용 • complete noise removal • more blurring and more posterization • edges not moved, but detail 없어짐 (ㄷ.ㅎ., pupil removed)
9.2 Median Filtering • Adaptive median filtering • 지역 (또는 화소) 별로 median filtering 적용 여부 결정 후 적용 • sample variance • 식 9-3 • DAHM detector (outlier detector) • coefficient of variation 이용 (식 9-4) • coefficient of variation이 임계값 넘으면 true • true면 median filter 적용 • Figure 9-13 (right image) • adaptive median filtering 결과
9.3 High-pass Filtering • high-pass filtering (sharpening) • low-pass filtering (smoothing, blurring in Section 9.1) 반대 효과 • 명암 대비 높임 • detail 강조 • edge crispening • noise emphasis
9.3 High-pass Filtering • sharpening kernels • hp1: Figure 9.14 0 -1 0 -1 10 -1 * 1/6 0 -1 0 • hp2: Figure 9.15 0 -1 0 -1 8 -1 * 1/4 0 -1 0 • hp3: Figure 9.16 0 -1 0 -1 5 -1 * 1/1 0 -1 0 • sharpening 효과 • hp3>hp2>hp1 • hp4 & hp5: Figure 9.17