Greatest Common Divisor, GCD
1 개요
이미지를 스칼라 또는 다른 이미지와 최대공약수 연산을 수행하는 알고리즘입니다.
2 알고리즘 상세 설명
정수형 포맷 이미지에서 지원됩니다. 피연산자 값이 모두 0인 경우, 결과로 0을 출력합니다. 그 외의 경우, 피연산자 절댓값의 최대공약수를 계산하여 결과로 출력합니다.
Source Value | Operand Value | Destination Value |
---|---|---|
![]() |
![]() |
![]() |
Fig. Source, Operand and Destination Values of Greatest Common Divisor
3 예제 코드
Scalar 연산
COperationGreatestCommonDivisor operationGCD;
CFLImage fliSourceImage;
CFLImage fliDestinationImage;
CMultiVar<double> mvScalar;
operationGCD.SetSourceImage(fliSourceImage);
operationGCD.SetDestinationImage(fliDestinationImage);
operationGCD.SetOperationSource(EOperationSource_Scalar);
operationGCD.SetScalarValue(mvScalar);
operationGCD.Execute();
Image 연산
COperationGreatestCommonDivisor operationGCD;
CFLImage fliSourceImage;
CFLImage fliOperandImage;
CFLImage fliDestinationImage;
operationGCD.SetSourceImage(fliSourceImage);
operationGCD.SetOperandImage(fliOperandImage);
operationGCD.SetDestinationImage(fliDestinationImage);
operationGCD.SetOperationSource(EOperationSource_Image);
operationGCD.Execute();