Adaptive Threshold Median

1 개요

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

2 알고리즘 상세 설명

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

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

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

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

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

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

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

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

4 예제 코드

CAdaptiveThresholdMedian adaptiveThresholdMedian;

CFLImage fliSourceImage;
CFLImage fliDestinationImage;

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

adaptiveThresholdMedian.SetKernel(41, 41);

adaptiveThresholdMedian.Execute();

CAdaptiveThresholdMedian adaptiveThresholdMedian = new CAdaptiveThresholdMedian();

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

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

adaptiveThresholdMedian.SetKernel(41, 41);

adaptiveThresholdMedian.Execute();

5 관련 알고리즘

CAdaptiveThreshold, CMedianFilter