Files
QD4C-firmware/app/gl_transform_table.c

26 lines
556 B
C
Raw Normal View History

#include "zf_common_headfile.h"
#include "gl_headfile.h"
float H_inv[3][3] = {};
// 逆变换,俯视->原图
void transform(float X, float Y, int* x, int* y) {
// Apply inverse transformation
double p[3] = {X, Y, 1.0};
double q[3] = {0.0, 0.0, 0.0};
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
q[i] += H_inv[i][j] * p[j];
}
}
*x =(int) (q[0] / q[2]);
*y = (int) (q[1] / q[2]);
}
const float UndistInverseMapH[90][140] = {};
const float UndistInverseMapW[90][140] = {};