Operation - Lesser
1 개요
스칼라 또는 이미지와의 Lesser 연산을 수행하는 알고리즘입니다. 이미지의 픽셀 값을 비교해 스칼라 또는 대응하는 이미지의 픽셀 값보다 작은 경우와 작지 않은 경우로 나눠서 사용자가 설정한 값으로 이미지를 이진화합니다.
2 알고리즘 상세 설명
Source | Scalar Value : (128, 128, 128) Range Value : (255, 255, 255) Out of Range Value : (0, 0, 0) |
|
---|---|---|
And | Or | |
![]() |
![]() |
![]() |
Fig. Logical condition of channels에 따른 결과 비교
Lesser 알고리즘은 각 채널에 대해 Lesser 연산을 한 후, 각 채널들의 결과들을 사용자가 지정한 조건으로 Logical 연산을 수행합니다. 위와 같이 Logical 연산 결과가 True이면 Range Value로 결과 픽셀을 출력하고, False이면 Out of Range Value로 결과 픽셀을 출력합니다.
위의 예시에서는 하나의 채널이 128보다 큰 146이기 때문에 And에서는 False이고, Or에서는 True가 되어 Logical condition 연산에 따라 다른 결과를 출력합니다.
Source | Scalar Value : 64 Range Value : 127 Out of Range Value : -128 |
|
---|---|---|
Default | Absolute mode | |
![]() |
![]() |
![]() |
Fig. Absolute mode 활성화 여부에 따른 동작 결과
또한, Lesser 알고리즘은 Absolute mode를 지원합니다. Absolute mode를 활성화하면, 위와 같이 픽셀과 Scalar의 절대값으로 Lesser 연산을 하여 결과를 얻을 수 있습니다.
3 파라미터 설정 및 사용 방법
SetRangeValue(CMultiVar<double>& mvFillInRangeValue)
: Source 픽셀의 각 채널에 대해 Lesser 연산을 한 후, 사용자가 설정한 Logical condition에 따라 결과가 True일 때 출력할 값을 설정합니다.SetOutOfRangeValue(CMultiVar<double>& mvFillOutOfRangeValue)
: Source 픽셀의 각 채널에 대해 Lesser 연산을 한 후, 사용자가 설정한 Logical condition에 따라 결과가 False일 때 출력할 값을 설정합니다.EnableAbsoluteMode(bool bAbsoluteMode = false)
: Absolute mode를 활성화 여부를 설정합니다. True일 때, Absolute 모드로 Lesser 연산을 수행합니다.SetLogicalConditionOfChannels(ELogicalConditionOfChannels eCondition = ELogicalConditionOfChannels_And)
: 채널별 결과들을 어떤 논리 연산 방식으로 처리할지 설정합니다. And를 선택하면 모든 채널이 전부 Lesser 연산 결과가 True인 경우 최종 결과가 True가 되고, Or를 선택하면 하나의 채널이라도 Lesser 연산 결과 True라면 최종 결과가 True가 됩니다.SetTermOrder(ETermOrder eTermOrder = ETermOrder_SourceOperand)
: Source와 Operand의 순서를 설정합니다.- ETermOrder_SourceOperand : Source < Operand인 경우 true
- ETermOrder_OperandSource : Operand < Source인 경우 true
Scalar 연산
COperationLesser operationLesser;
CFLImage fliSourceImage;
CFLImage fliDestinationImage;
CMultiVar<double> mvScalar(100.0);
CMultiVar<double> mvRangeValue(200.0);
CMultiVar<double> mvOutOfRangeValue(50.0);
operationLesser.SetSourceImage(fliSourceImage);
operationLesser.SetDestinationImage(fliDestinationImage);
operationLesser.SetOperationSource(EOperationSource_Scalar);
operationLesser.SetScalarValue(mvScalar);
operationLesser.SetRangeValue(mvRangeValue);
operationLesser.SetOutOfRangeValue(mvOutOfRangeValue);
operationLesser.SetTermOrder(ETermOrder_OperandSource);
operationLesser.Execute();
Image 연산
COperationLesser operationLesser;
CFLImage fliSourceImage;
CFLImage fliOperandImage;
CFLImage fliDestinationImage;
CMultiVar<double> mvRangeValue(200.0);
CMultiVar<double> mvOutOfRangeValue(50.0);
operationLesser.SetSourceImage(fliSourceImage);
operationLesser.SetOperandImage(fliOperandImage);
operationLesser.SetDestinationImage(fliDestinationImage);
operationLesser.SetOperationSource(EOperationSource_Image);
operationLesser.SetRangeValue(mvRangeValue);
operationLesser.SetOutOfRangeValue(mvOutOfRangeValue);
operationLesser.SetTermOrder(ETermOrder_OperandSource);
operationLesser.Execute();