Image Threshold
1 개요
Operand 이미지를 사용한 임곗값을 통해 이진화 연산을 수행하는 알고리즘
2 알고리즘 상세 설명
Operand 이미지 픽셀값을 임곗값으로 사용하여 이진화를 진행합니다.
원본 이미지 | Operand 이미지 | Image Threshold 결과 이미지 |
---|---|---|
![]() |
![]() |
![]() |
Fig. Normal 모드 결과
- Normal 이진화 연산
- 원본 이미지
- 피연산자 이미지
- 결과 이미지
- 오프셋 값
기본 Normal 모드에서는 각 원본 이미지 픽셀의 값이 Operand 이미지 픽셀값 - offset 값보다 크거나 같으면 범위 내값(Range Value), 작으면 범위 외값(Out of Range Value)을 출력합니다.
예시에 사용된 Operand Image는 원본 이미지에 FL Denoising Type1을 적용한 결과입니다. 특정 Denoising/Smoothing 계열 알고리즘 등의 결과로 Threshold 처리를 하여 알고리즘 사용성을 높일 수 있습니다.
원본 이미지 | Operand 이미지 | Image Threshold 결과 이미지 (offset = 3) |
---|---|---|
![]() |
![]() |
![]() |
Fig. Range 모드 결과
- Range 이진화 연산
- 원본 이미지
- 피연산자 이미지
- 결과 이미지
- 오프셋 값
Range 모드에서는 원본 이미지의 각 픽셀의 값과 Operand 이미지 픽셀값의 차이가 offset보다 작으면 범위 내값(Range Value), 크거나 같으면 범위 외값(Out of Range Value)을 출력합니다.
원본 이미지 | Channel Condition And | Channel Condition Or |
---|---|---|
![]() |
![]() |
![]() |
Fig. 채널 조건별 결과
다채널 이미지의 경우, 채널별 조건을 파라미터로 설정하여 최종 이진화 결과를 결정합니다.
3 파라미터 설정 및 사용 방법
-
SetThresholdOffset
- 임계치 식에 사용하는 오프셋을 설정합니다.
- Normal모드에서는 Source의 가중치, Range모드에서는 체크하는 범위의 역할을 수행합니다.
- 기본값은 채널별로 0입니다.
-
SetThresholdMethod
- 이진화 계산 방식을 결정합니다.
- 기본값은
EThresholdMethod_Normal
입니다. EThresholdMethod_Normal
- Normal 모드
EThresholdMethod_Range
- Range 모드
- 각 모드의 설명은 알고리즘 상세 설명에서 확인 가능합니다.
-
SetLogicalConditionOfChannels
- 각 채널의 논리 조건 결과를 처리할 방법을 설정합니다.
- 기본값은
ELogicalConditionOfChannels_And
입니다. ELogicalConditionOfChannels_And
- 각 채널 결과의 'And' 조건
ELogicalConditionOfChannels_Or
- 각 채널 결과의 'Or' 조건
-
SetRangeValue
- 조건이 참일 때의 이진화 출력값을 설정합니다.
- 설정하지 않을 경우 integer format의 경우 MAX 값, floating point format의 경우 1을 출력합니다.
-
SetOutOfRangeValue
- 조건이 거짓일 때의 이진화 출력값을 설정합니다.
- 설정하지 않을 경우 integer format의 경우 MIN 값, floating point format의 경우 0을 출력합니다.
4 예제 코드
CImageThreshold imageThreshold;
CFLImage fliSourceImage;
CFLImage fliOperandImage;
CFLImage fliDestinationImage;
imageThreshold.SetSourceImage(fliSourceImage);
imageThreshold.SetOperandImage(fliOperandImage);
imageThreshold.SetDestinationImage(fliDestinationImage);
imageThreshold.SetThresholdMethod(CImageThreshold::EThresholdMethod_Range);
CMultiVar<double> mvOffset(3.0);
imageThreshold.SetThresholdOffset(mvOffset);
imageThreshold.Execute();