Adaptive Threshold Gaussian

1 개요

Gaussian Filter를 사용한 적응형 임계값을 통해 이진화 연산을 수행하는 알고리즘

2 알고리즘 상세 설명

각 픽셀을 기준으로 커널 사이즈 영역 내부의 가우시안 값을 계산하여 그 값을 임계값으로 사용하여 이진화를 진행합니다.

원본 이미지 Gaussian filter 결과 Adaptive Threshold Gaussian 결과 이미지
Adaptive Threshold Gaussian Normal Source Gaussian Filter Result Adaptive Threshold Gaussian Normal Destination
Fig. Normal모드 결과

기본 Normal모드에서는 각 픽셀의 값이 가우시안 값 - 오프셋 값보다 크거나 같으면 범위 내값(Range Value), 작으면 범위 외값(Out of Range Value)을 출력합니다.

최종적으로 Source와 같은 format으로 출력하는 일반 Gaussian Filter와는 다르게 format별로 지정된 부동 소수점 타입에서 가우시안 값의 계산과 임계값 비교를 전부 진행합니다.

원본 이미지 Gaussian filter 결과 Adaptive Threshold Gaussian 결과 이미지 (offset = 3)
Adaptive Threshold Gaussian Range Source Gaussian Filter Result Adaptive Threshold Gaussian Range Destination
Fig. Range모드 결과

Range 모드에서는 각 픽셀의 값과 가우시안 값의 차이가 offset보다 작으면 범위 내값(Range Value), 크거나 같으면 범위 외값(Out of Range Value)을 출력합니다.

원본 이미지 Channel Condition And Channel Condition Or
Adaptive Threshold Gaussian Channel Source Adaptive Threshold Gaussian Channel And Result Adaptive Threshold Gaussian Channel Or Result
Fig. 채널 조건별 결과

다채널 이미지의 경우 채널별 조건을 파라미터로 설정하여 최종 이진화 결과를 결정합니다.

3 파라미터 설정 및 사용 방법

4 예제 코드

CAdaptiveThresholdGaussian adaptiveThresholdGaussian;

CFLImage fliSourceImage;
CFLImage fliDestinationImage;

adaptiveThresholdGaussian.SetSourceImage(fliSourceImage);
adaptiveThresholdGaussian.SetDestinationImage(fliDestinationImage);

adaptiveThresholdGaussian.SetKernel(51);

adaptiveThresholdGaussian.Execute();

CAdaptiveThresholdGaussian adaptiveThresholdGaussian = new CAdaptiveThresholdGaussian();

CFLImage fliSourceImage = new CFLImage();
CFLImage fliDestinationImage = new CFLImage();

adaptiveThresholdGaussian.SetSourceImage(ref fliSourceImage);
adaptiveThresholdGaussian.SetDestinationImage(ref fliDestinationImage);

adaptiveThresholdGaussian.SetKernel(51);

adaptiveThresholdGaussian.Execute();

5 관련 알고리즘

CAdaptiveThreshold, CGaussianFilter