-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcoordinate_system.cpp
61 lines (48 loc) · 1.77 KB
/
coordinate_system.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include "functions.h"
int main(int argc, char** argv)
{
int th, max, min; float mult;
th = 250; max = 160; min=35; mult=1.6;
cali.init("Calibrar_Prueba.wmv",th, max, min, mult);
//th = 250; max = 150; min=25; mult=2.;
//cali.init("Prueba.wmv",th, max, min, mult);
cali.read_intrinsic_data("data");
cali.get_intrinsic(intrinsics, distortion);
//FileStorage fs;
/*fs.open(filename, FileStorage::READ);
// read camera matrix and distortion coefficients from file
fs["Camera_Matrix"] >> intrinsics;
fs["Distortion_Coefficients"] >> distortion;
fs.release();*/
//generate vectors for the points on the chessboard
for (int i=0; i<boardWidth; i++)
{
for (int j=0; j<boardHeight; j++)
{
//boardPoints.push_back( Point3d( double(i), double(j), 0.0) );
boardPoints.push_back( Point3d( double(67.5 * i), double(67.5 * j), 0.0f) );
cout<<Point3d( double(67.5 * i), double(67.5 * j), 0.0f) <<endl;
}
}
//generate points in the reference frame
framePoints.push_back( Point3d( 0.0, 0.0, 0.0 ) );
framePoints.push_back( Point3d( 5.0, 0.0, 0.0 ) );
framePoints.push_back( Point3d( 0.0, 5.0, 0.0 ) );
framePoints.push_back( Point3d( 0.0, 0.0, -5.0 ) );
//VideoCapture capture;
capture.open(0);
capture.set(CV_CAP_PROP_FRAME_WIDTH,FRAME_WIDTH);
capture.set(CV_CAP_PROP_FRAME_HEIGHT,FRAME_HEIGHT);
namedWindow("OpenCV Webcam", 0);
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowPosition( GL_WIN_INITIAL_X, GL_WIN_INITIAL_Y );
glutInitWindowSize( FRAME_WIDTH, FRAME_HEIGHT );
glutCreateWindow("OpenGL");
glClearColor(0.0,0.0,0.0,0.0);
glutDisplayFunc(glutDisplay); //glutDisplayFunc(display);
glutReshapeFunc(glutResize);
glutIdleFunc(myidle);
glutMainLoop();
return 0;
}