AI Engineering Topic/Digital Image Processing

Digital Image Processing ch 3 Histogram matching [3]

Young_Metal 2022. 4. 12. 13:15

1 Histogram matching

- Histogram matching을 위해 prespecified histogram을 이용해서 T로 flat하게 만들고 G의 역함수로 equalized image를 넣어서 user specified image를 만들어낸다. 

A. Continuous grey levels r, z

B. Discrete gray levels r_k, z_k

 

 - r -> s 로 가는 T(r) 그래프와, z->v로 가는 G(z) 그래프를 그리는데, 대신 G^(-1)을 위해 보는 방향은 v->z로 본다

 - s=T(r)이 I보다 위에 있는 건 bright하는 건데, 모든 것이 밝아지면 정보가 적어딘다 그래서 matching을 한다. 

 - G part를 알고 그거에 대해서 I의 대칭을 통해 G-1을 찾고 그걸로 output histogram을 그리면 밝았던 것보다 넓은 range의 high contrast image를 얻는다. 

 

Example : 7-greylevel 64x64 image histogram

 - 진짜 결과 이미지의 histogram은 specified랑 똑같지는 않지만 비슷하다(approximately match)

 

1-1 Enhancement using Local Histogram

 - global approach : 모든 이미지가 하나의 알고리즘으로 작동

 - local approach : subblock으로 나눠서 각각에 inforamtion을 최대한 살리는 알고리즘을 적용한다. 

 대부분의 경우 local 이 훨 낫다

 

local enhancement

: using histogram equalization  compute local histogram statistics based on the gray level distribution in the neighborhood pixels.

mean, std, variance를 이용해서 subblock을 measure한다. 

- 평균 : average gray level을 계산한다

- 표준편차 : 그래프가 좁으면 contrast가 낮고, 그래프가 멀리 퍼져있으면(high variance) contrast가 높다

 

Example : SEM

어떤 부분은 쉽게 discernable하지 않다. 너무 어둡고 contrast가 낮아서다. 그렇다면 그 부분만...!

1. 글로벌 평균보다 부분의 평균이 낮거나

2. global std의 min보다는 크지만 k2보다 작은 사이에 있으면 dark and low contrast regiob이 된다. 

 

그래서 그런 부분은 E라는 것을 곱해줘서 (bright)하게 만들어준다. 

 

-> 여기까진 하나의 pixel에 대해서만 적용하는 방법이었다

 

2. Spatial filtering

center pixel에 대해서 3x3이면 주변 neighborhood가 있고 weighted sum을 이용해서 filter mask를 이동시킨다. 그러다보면 perfectly mask가 있고 아닌곳이 있는데 그런 곳은 zero padding을 통해 해결한다

 

Correlation vs Convolution

Correlation이랑 Convolution은 같은 filter를 쓰는데 correlation은 순서 그대로고 convolution은 flipped filter를 쓴다. 

 

Generating Filter masks

1. Average filter : 그냥 모든 mask의 weight이 동일

2. Gaussian filter : smoothing filter : 중앙에 좀 더 큰 weight를 준다.