-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwrap.cpp
27 lines (25 loc) · 904 Bytes
/
wrap.cpp
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
#include "wrap.h"
#include "opencv2/opencv.hpp"
#include <iostream>
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
using namespace std;
using namespace cv;
/*void birdview_frame(cuda::GpuMat& src, cuda::GpuMat& dst)*/
void birdview_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);
// to points
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(src_points, dst_points);
/*cuda::warpPerspective(src, dst, trans_points, src.size(), cv::INTER_LINEAR);*/
warpPerspective(src, dst, trans_points, src.size(), cv::INTER_LINEAR);
}