16.1.2 Rotation
1 개요
이미지의 회전 변환을 수행하는 알고리즘입니다.
2 알고리즘 상세 설명
- : 회전각
- : source 이미지 중심 x 좌표
- : source 이미지 중심 y 좌표
- : source 픽셀 x 좌표
- : source 픽셀 y 좌표
- : destination 픽셀 x 좌표
- : destination 픽셀 y 좌표
설정한 Angle 값만큼 원본 이미지를 중심점으로부터 회전한 결과 이미지를 반환합니다. Resize
모드를 설정하여 회전 변환한 결과 이미지의 전체 영역이 출력될 수 있도록 결과 이미지를 재조정할 수 있습니다.
Source | Resize Method | |
---|---|---|
Normal | Resize | |
![]() |
![]() |
![]() |
Fig. Resize 모드에 따른 결과 비교 (Angle: 30)
3 파라미터 설정 및 사용 방법
API
const CResult SetAngle(double f64Angle = 0.)
중심점으로부터 회전할 각도를 설정합니다.
const CResult SetInterpolationMethod(EInterpolationMethod eInterpolationMethod = EInterpolationMethod_Bilinear)
보간법을 설정합니다.
EInterpolationMethod_Bilinear
: 쌍선형(Bilinear) 보간법EInterpolationMethod_NearestNeighbor
: 최근접(Nearest neighbor) 보간법EInterpolationMethod_Bicubic
: 쌍입방(Bicubic) 보간법EInterpolationMethod_Lanczos
: 란초스(Lanczos) 보간법
const CResult SetResizeMethod(const EResizeMethod eResizeMethod = EResizeMethod_Normal)
이미지 Resize 모드를 설정합니다.
EResizeMethod_Normal
: Normal 모드EResizeMethod_Resize
: Resize 모드
const CResult SetROICalculateMethod(const EROICalculateMethod eROICalculateMethod = EROICalculateMethod_Fast)
이미지 ROI 계산 방식을 설정합니다.
Normal 모드는 ROIUtility의 연산을 수행하여 ROI를 계산합니다.
Fast모드는 ROIUtility의 연산을 수행하지 않고, 연산 영역을 간단하고 빠르게 구하여 연산합니다. Src ROI와 Dst ROI가 모두 회전 없는 rect인 경우에만 해당 모드가 유효하며, 그 이외의 ROI의 경우에는 Fast모드를 설정해도 Normal 모드로 연산합니다.
Fast모드는 ROIUtility의 복잡한 연산을 생략하기 때문에 Normal 모드와 1픽셀 정도 출력 영역에 차이가 있을 수 있습니다.
EROICalculateMethod_Fast
: Fast 모드EROICalculateMethod_Normal
: Normal 모드
예제 코드
CRotation rotation;
CFLImage fliSourceImage;
rotation.SetSourceImage(fliSourceImage);
rotation.SetAngle(30.);
rotation.SetResizeMethod(EResizeMethod_Resize);
rotation.Execute();