AI Engineering Topic/Digital Image Processing

Digital Image Processing ch3 Smoothing & Sharpening spatial filter [3]

Young_Metal 2022. 4. 12. 22:10

smoothing spatial filter 

: used for blurring and for noise reduction 

(i) smoothing by linear filtering

 : sharp transition을 줄이지만 edge를 blur하게 만드는 단점이 있다. 즉 detail을 잃는다. 

normalizing을 하면서 average filter를 사용한다.  moving average

smoothing filter 중에 center pixel을 강조하는 kernel도 있다. 

 

Example) 3x3, 5x5... 25x25로 갈 수록 더 smoothing해진다. 더 noise를 줄인다. blurring이 된다. 

 

Blurring

moving average 는 noise를 없에주기도 하지만 small object를 blend해서 작은 것들은 보이지가 않음

그래서 어떤 filter size를 선택하냐에 따라서 어떤 크기의 object를 고를지 정할 수 있음.

 

(ii) Smoothing by non-linear spatial filters

median filter : robust estimator of mean  for smoothing impulse noise(salt and pepper noise) 왜냐면 얜 sorting하니까

median filter : less blurring still reduction on noise but takes longer than linear operation 

 

Example) less noise but significant blurring을 하는게 moving average

less noise less blurring인게 median filter 

 

그럼 무조건 median filter가 최고냐?

 

아니다. median은 salt and pepper 문제에서만 좋다

 

Sharpening Spatial Filter

blurring과 반대되는 개념으로 blurring은 integration이라면 sharphening은 differentiate다. 

 

First order derivative를 하면 non zero location을 찾을 수 있고, 

second order derivative를 하면 zero crossing을 찾을 수 있다 

 

1) 2'nd derivatives for enhancement : Laplacian filter

isotropic derivative operator로서 diagonal이나 horizontal and vertical쪽에서 찾을 수 있다. 즉

 - Edge enhancement를 x,y축에 대해서나 diagonal에서 진행할 수 있다. 

 - Unsharp masking : signal-blur = non-blur signal then signal +unsharp mask : enhance

 - Highboost filtering : g_mask(x,)-f(x,y)-f_avg(x,y)

 

2) 1'st order derivatives : Sobel operator

3x3 evaluate center column 에 강조를 한다. 

 

Flow chart of image enhancement

1. Input image가 들어간다. 

Gradient(Sobel)을 계산하고, Laplacian을 계산한다. Laplacian 계산 후에 sharpend image랑 더한다. 

Gradient계산 후에 averaging filter를 해서 smoothed gradient를 만들어낸다. 이건 detail을 strong한 부분에서 남기면서 flat한 부분에서는 nosie를 줄인다. 라플라시안은 fine detail을 살리는 데 강하다. 그래도 gradient보다 noise를 만들지만, 결국 두개의 결과가 multiple이 되서 mask image를 만들어내고 원래 input이랑 더해져서 나중에 PWR-Law trnasformation 처리를 해서 output을 만들어낸다.