我想从旋转角度和到物体的距离开始计算透视变换(warpPerspective函数的矩阵).
怎么做?
我在OE上找到了代码.示例程序如下:
#include <opencv2/objdetect/objdetect.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <iostream>
#include <math.h>
using namespace std;
using namespace cv;
Mat frame;
int alpha_int;
int dist_int;
int f_int;
double w;
double h;
double alpha;
double dist;
double f;
void redraw() {
alpha = (double)alpha_int/1000.;
//dist = 1./(dist_int+1);
//dist = dist_int+1;
dist = dist_int-50;
f = f_int+1;
cout << "alpha = " << alpha << endl;
cout << "dist = " << dist << endl;
cout << "f = " << f …
Run Code Online (Sandbox Code Playgroud)