-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathunwrap.cpp
More file actions
26 lines (22 loc) · 748 Bytes
/
unwrap.cpp
File metadata and controls
26 lines (22 loc) · 748 Bytes
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
#include "opencv2/opencv.hpp"
#include <iostream>
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "unwrap.h"
using namespace std;
using namespace cv;
void unwrap_frame(Mat& src, Mat& dst)
{
cv::Point2f src_points[4];
cv::Point2f dst_points[4];
src_points[0] = cv::Point2f(290, 230);
src_points[1] = cv::Point2f(350, 230);
src_points[2] = cv::Point2f(520, 340);
src_points[3] = cv::Point2f(130, 340);
dst_points[0] = cv::Point2f(130, 0);
dst_points[1] = cv::Point2f(520, 0);
dst_points[2] = cv::Point2f(520, 360);
dst_points[3] = cv::Point2f(130, 360);
Mat trans_points = getPerspectiveTransform(dst_points, src_points);
warpPerspective(src, dst, trans_points, src.size(), cv::INTER_LINEAR);
}