16.1.2 Rotation

1 개요

이미지의 회전 변환을 수행하는 알고리즘입니다.

2 알고리즘 상세 설명

[xdstxcydstyc1]=[cosθsinθ0sinθcosθ0001][xsrcxcysrcyc1]\begin{bmatrix} x_{dst} - x_{c} \\ y_{dst} - y_{c} \\ 1 \\ \end{bmatrix} = \begin{bmatrix} \cos{\theta} & -\sin{\theta} & 0 \\ \sin{\theta} & \cos{\theta} & 0 \\ 0 & 0 & 1 \\ \end{bmatrix} \begin{bmatrix} x_{src} - x_{c} \\ y_{src} - y_{c} \\ 1 \\ \end{bmatrix}

설정한 Angle 값만큼 원본 이미지를 중심점으로부터 회전한 결과 이미지를 반환합니다. Resize 모드를 설정하여 회전 변환한 결과 이미지의 전체 영역이 출력될 수 있도록 결과 이미지를 재조정할 수 있습니다.

Source Resize Method
Normal Resize
Rotation Source Rotation Result Normal Rotation Result Resize
Fig. Resize 모드에 따른 결과 비교 (Angle: 30)

3 파라미터 설정 및 사용 방법

API

const CResult SetAngle(double f64Angle = 0.)
virtual CResult^ SetAngle(double f64Angle)	

중심점으로부터 회전할 각도를 설정합니다.

const CResult SetInterpolationMethod(EInterpolationMethod eInterpolationMethod = EInterpolationMethod_Bilinear)
virtual CResult^ SetInterpolationMethod(EInterpolationMethod eInterpolationMethod)

보간법을 설정합니다.

const CResult SetResizeMethod(const EResizeMethod eResizeMethod = EResizeMethod_Normal)	
virtual CResult^ SetResizeMethod(EResizeMethod eResizeMethod)	

이미지 Resize 모드를 설정합니다.

const CResult SetROICalculateMethod(const EROICalculateMethod eROICalculateMethod = EROICalculateMethod_Fast)		
virtual CResult^ SetROICalculateMethod(EROICalculateMethod eROICalculateMethod)	

이미지 ROI 계산 방식을 설정합니다.

Normal 모드는 ROIUtility의 연산을 수행하여 ROI를 계산합니다.

Fast모드는 ROIUtility의 연산을 수행하지 않고, 연산 영역을 간단하고 빠르게 구하여 연산합니다. Src ROI와 Dst ROI가 모두 회전 없는 rect인 경우에만 해당 모드가 유효하며, 그 이외의 ROI의 경우에는 Fast모드를 설정해도 Normal 모드로 연산합니다.

Fast모드는 ROIUtility의 복잡한 연산을 생략하기 때문에 Normal 모드와 1픽셀 정도 출력 영역에 차이가 있을 수 있습니다.

예제 코드

CRotation rotation;

CFLImage fliSourceImage;
rotation.SetSourceImage(fliSourceImage);

rotation.SetAngle(30.);
rotation.SetResizeMethod(EResizeMethod_Resize);

rotation.Execute();
CRotation rotation = new CRotation();

CFLImage fliSourceImage = new CFLImage();
rotation.SetSourceImage(ref fliSourceImage);

rotation.SetAngle(30.0);
rotation.SetResizeMethod(EResizeMethod.Resize);

rotation.Execute();