/* * ===================================================================================== * * Filename: main_eccv_data.cpp * * Description: plays back depth mocap data for ECCV 2012 * Version: 1.0 * Created: 11/10/2012 * Author: Varun Ganapathi (varung@gmail.com), * * * USAGE: pass prefix of data files, e.g., seq_a, and it will play back all * items in that sequences, i.e., seq_a_0.bin, seq_1.bin, and so on. * * on ubuntu: * COMPILE: g++ main_eccv_data.cpp -lglut * ===================================================================================== */ #include #include #include #include #include #ifdef __APPLE__ & __MACH__ #define OSX #endif #ifdef OSX #include #else // NOTE: you can change this to the standard GL headers if you don't have GLEW //#include #include #include //#include #endif using namespace std; int paused = false; float amp_lo = 4000; float x_angle = 0, y_angle = 0; int cur_file=0; char *data_set_dir = NULL; extern float color_map[][3]; extern int color_map_size; float intrinsic[] = { 2.844376,0.000000,0.000000,0.000000, 0.000000,2.327216,0.000000,0.000000, 0.000000,0.000000,-1.000020,-1.000000, 0.000000,0.000000,-0.200002,0.000000 }; #include "eccv.h" int win_h() { return glutGet(GLUT_WINDOW_HEIGHT); } int win_w() { return glutGet(GLUT_WINDOW_WIDTH); } void reshape( int w, int h ){ glutPostRedisplay(); } inline float clamp( float x, float lo, float hi){ if(x < lo) return lo; if(x > hi) return hi; return x; } Frame frame; ifstream points_ifs, markers_ifs, joints_ifs; void draw( Frame& f ) { glMatrixMode(GL_PROJECTION); glLoadIdentity(); glLoadMatrixf(intrinsic); // draw sensor glEnable(GL_DEPTH_TEST); glPointSize(4.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0,0,-2); glRotatef(y_angle, 0, 1.0, 0); glRotatef(x_angle, 1.0, 0, 0); glTranslatef(0,0,2); glColor3f( .7, .3, .3 ); glBegin(GL_POINTS); for (int i=0; i