Least Common Multiple
1 개요
스칼라 또는 이미지와의 최소 공배수(Least Common Multiple, LCM) 연산을 수행하는 알고리즘입니다.
2 알고리즘 상세 설명
Source 와 Operand 간의 각 채널 별 LCM 값을 계산하여 출력합니다.
- : destination 의 번째 채널 값
- : Source 의 번째 채널 값
- : operand 의 번째 채널 값
Source Image | Operand Image | Destination Image |
---|---|---|
![]() |
![]() |
![]() |
Fig. Source, Operand and Destination images of LCM, (Clamping)
Source 와 Operand 중 하나 이상이 0 인 경우, 출력은 0 입니다. Scalar 값이 음수인 경우, 절댓값 처리하여 양수로 취급합니다. 정수 구간에서 동작하므로 Scalar 값으로 실수를 제공한 경우 내림 처리합니다. 부동 소숫점 타입으로 제공된 Scalar 값의 절댓값이 uint64_t 의 표현 범위를 벗어난 경우, 연산 시 사용하는 Scalar 값은 uint64_t 표현 범위의 최대치로 Clamping 됩니다.
3 파라미터 설정 및 사용 방법
Scalar 연산 모드 활성화 및 Scalar Value 설정
-
const CResult SetOperationSource(EOperationSource eOperationSource = EOperationSource_Scalar)
Scalar 연산 모드 또는 Operand Image 연산 모드를 활성화 합니다.eOperationSource
:
EOperationSource_Scalar
인 경우 Scalar Value 가 연산에 사용됩니다.
EOperationSource_Image
인 경우 Operand Image 가 연산에 사용됩니다.
-
const CResult SetScalarValue(const Base::CMultiVar<Type> flmvScalarValue)
(Type: int32_t, uint32_t, int64_t, uint64_t, float, double)
사용할 Scalar Value 를 설정합니다.flmvScalarValue
: 연산에 사용 될 Scalar Value
4 예제 코드
Scalar 연산
COperationLeastCommonMultiple lcm;
CFLImage fliSourceImage;
CFLImage fliDestinationImage;
CMultiVar<uint64_t> mvScalar;
lcm.SetSourceImage(fliSourceImage);
lcm.SetDestinationImage(fliDestinationImage);
lcm.SetOperationSource(EOperationSource_Scalar);
lcm.SetScalarValue(mvScalar);
lcm.Execute();
Image 연산
COperationLeastCommonMultiple lcm;
CFLImage fliSourceImage;
CFLImage fliOperandImage;
CFLImage fliDestinationImage;
lcm.SetSourceImage(fliSourceImage);
lcm.SetDestinationImage(fliDestinationImage);
lcm.SetOperationSource(EOperationSource_Image);
lcm.SetOperandImage(fliOperandImage);
lcm.Execute();
5 기타 사항
Supported Feature
- Image
- Source Image
- Operand Image/Scalar Value
- Destination Image
- ROI
- Source ROI
- Operand ROI
- Destination ROI
- Pivot
- Source Pivot
- Operand Pivot
- Destination Pivot
- Overflow Method
- Clamping
- Wrapping
- Blank Color
- Figure Transform
- Batch Processing
Supported Format
- Source
- Channel
- 1-10
- Combined, Separated
- Value Type & Depth
- Signed: 8, 9-16, 32, 64
- Unsigned: 4, 8, 9-16, 32, 64
- Floating: 미지원
- Channel
- Operand
- Channel
- Source 와 일치하는 경우 지원
- Value Type & Depth
- Signed: 8, 9-16, 32, 64
- Unsigned: 4, 8, 9-16, 32, 64
- Floating: 미지원
- Channel
- Destination
- Channel
- Source 와 일치하는 경우 지원
- Value Type & Depth
- Destination 이미지가 있는 경우, Source 와 달라도 지원, Floating 타입 미지원
- Destination 이미지를 생성하는 경우, Source 추종
- Channel
Overflow Method
Destination 타입에 의해 출력 범위가 제한되는 경우, 설정된 overflow method 에 의해 처리됩니다. 기본 값은 Clamping 입니다.