C# EmguCV 이미지 투시 변환
using Emgu.CV;
using Emgu.CV.CvEnum;
using Emgu.CV.Structure;
public void ImagePerspectiveTransformation()
{
// 이미지 로딩
Image<Bgr, byte> image = new Image<Bgr, byte>("image.jpg");
// 원근 변환을 위한 좌표 설정
PointF[] sourcePoints = new PointF[]
{
new PointF(100, 100),
new PointF(200, 100),
new PointF(200, 200),
new PointF(100, 200)
};
PointF[] destinationPoints = new PointF[]
{
new PointF(0, 0),
new PointF(300, 0),
new PointF(300, 300),
new PointF(0, 300)
};
// 투시 변환 행렬 계산
Mat transformationMatrix = CvInvoke.GetPerspectiveTransform(sourcePoints, destinationPoints);
// 이미지 투시 변환
Image<Bgr, byte> transformedImage = image.WarpPerspective(transformationMatrix, image.Size);
// 결과 이미지 표시
ImageViewer viewer = new ImageViewer(transformedImage, "Perspective Transformation");
viewer.ShowDialog();
}
'C# OpenCV and EmguCV' 카테고리의 다른 글
C# EmguCV 이미지 텍스트 인식 (0) | 2023.05.23 |
---|---|
C# EmguCV 이미지 잡음 제거 (0) | 2023.05.23 |
C# EmguCV 색공간 변환과 색상 추출 (0) | 2023.05.23 |
C# EmguCV 이미지 필터링과 컨볼루션 (0) | 2023.05.23 |
C# EmguCV 템플릿 매칭 (0) | 2023.05.23 |