| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | ||||
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- #영어
- findContours
- Convolution Neural Network
- 완전탐색
- 딥러닝
- #실생활영어
- 영어
- #1일1영어
- convexhull
- word embedding
- object detection
- tokenizing
- #Android
- c언어
- python list
- keras
- opencv SURF
- #영어 명언
- python __init__
- TensorFlow
- #프로젝트
- #English
- text2img
- python 알고리즘
- 영어명언
- 이미지 생성
- #실생활 영어
- #일상영어
- tensorflow update
- #opencv
Archives
- Today
- Total
When will you grow up?
21. Perspective Transformation(투영변환) 본문
02. Study/Computer Vision(openframworks&opencv)
21. Perspective Transformation(투영변환)
미카이 2016. 11. 25. 17:29Perspective Transformation == Homography Matrix == Projective Transformation
(세 용어다 각각 차이점은 존재하지만 개념상 같은 개념이라고 생각을 해도 된다.)
Homograhpy
한 평면을 다른 평면에 투영(Projection) 시켰을 때, 투영된 대응점들 사이에서는 일정한 변환 관계가 성립한다. 이 변환 관계를 Homography라고 한다.
->카메라 위치 수정 이나 환자의 자세 등 이미지 일정 부분 확대시 이용하는 변환
4개의 점와 와핑된 이미지를 이용하여 변환행렬을 구해주면 된다.
결과
원본이미지
결과 이미지
원본 코드 입니다.
// 인풋 이미지 평면 좌표 입력
Point2f inputQuad[4];
// 출력 이미지 평면 좌표
Point2f outputQuad[4];
// Lambda Matrix
Mat lambda(2, 4, CV_32FC1);
//Mat 형식의 입력,출력 이미지
Mat input, output;
input = imread("LOL.jpg",1);
// Set the lambda matrix the same type and size as input
lambda = Mat::zeros(input.rows, input.cols, input.type());
// 4점 포인트를 시계방향으로 설정해준다
inputQuad[0] = Point2f(184, 35);//왼쪽위
inputQuad[1] = Point2f(413, 36);//오른쪽위
inputQuad[2] = Point2f(592, 242);//오른쪽아래
inputQuad[3] = Point2f(6, 264);//왼쪽아래
// 맵핑될 이미지를 시계방향으로 잡아준다.
outputQuad[0] = Point2f(0, 0);
outputQuad[1] = Point2f(input.cols - 1, 0);
outputQuad[2] = Point2f(input.cols - 1, input.rows - 1);
outputQuad[3] = Point2f(0, input.rows - 1);
// 입력,출력 Quad를 통해 getPerspectiveTransform함수를 이용하여 변환행렬을 구함
lambda = getPerspectiveTransform(inputQuad, outputQuad);
// 이미지 와핑
warpPerspective(input, output, lambda, output.size());//입력,출력,변환행렬,크기
//Display input and output
imshow("Input", input);
imshow("Output", output);
waitKey(0);
레퍼런스
: http://blog.daum.net/shksjy/240
: http://miatistory.tistory.com/5
: opencv 도큐먼트
'02. Study > Computer Vision(openframworks&opencv)' 카테고리의 다른 글
| 22. 관심점 검출(Harris corner detector) (0) | 2016.12.02 |
|---|---|
| opencv로 Panorama Image 만들기 (0) | 2016.11.26 |
| 20.Affine Transformation (0) | 2016.11.13 |
| 19_1.Convex Hull (Graham's Scan 알고리즘 활용) (0) | 2016.11.08 |
| 19.convexHull (0) | 2016.11.07 |
Comments