void frustrum(View *v, Real l, Real b, Real r, Real t, Real near, Real far) { setview(v); setprojection(PERSPECTIVE); setviewdistance(near); setviewdepth(near,far); setwindow((l+r)/2, (b+t)/2, (r-l)/2, (t-b)/2); makeviewC(); makeviewP(); }
void orthographic(View *v, Real l, Real b, Real r, Real t, Real near, Real far) { setview(v); setprojection(ORTHOGRAPHIC); setviewdistance(near); setviewdepth(near,far); setwindow((l+r)/2, (b+t)/2, (r-l)/2, (t-b)/2); makeviewC(); makeviewO(); }
void setviewdefaults(void) { setviewpoint(0.0,-5.0,0.0); setviewnormal(0.0,1.0,0.0); setviewup(0.0,0.0,1.0); setviewdistance(1.0); setviewdepth(1.0,100000.0); setwindow(0.0,0.0,0.41421356,0.31066017); setprojection(PERSPECTIVE); setviewport(0.,0.,320.,240.,-32768.,32767.); }
void perspective(View *v, Real fov, Real ar, Real near, Real far) { setview(v); setprojection(PERSPECTIVE); setviewdistance(near); setviewdepth(near,far); if (ar < ROUNDOFF) error("illegal aspect ratio"); setwindow(0, 0, tan(fov/2) * near, (tan(fov/2) * near)/ar); makeviewC(); makeviewP(); }
int main(int argc, char **argv) { #ifdef WIN32 SetPriorityClass( GetCurrentProcess(), REALTIME_PRIORITY_CLASS ); //! set priority to windows #endif if (argc<2) { cout << "Usage : roadtrac [image file] [titlefile] [annotationfile]" << endl; cout << "exp : roadtrac template.jpg [label.txt] [annotations.txt]" << endl; exit(0); } else { char paperlist[100]; sprintf_s(paperlist,100, "paperlist.%s.txt", argv[1]); ifstream paperfile(paperlist); if (!paperfile) //if doesnt exist { IplImage *templ = cvLoadImage(argv[1]); reg.ExtractRegions(templ); m_tracker.CreateBlobSeq(®); m_tracker.SaveBlobSeq(paperlist); reg.Clear(); m_tracker.Clear(); } m_tracker.LoadBlobSeq(paperlist); if (argv[2]) m_tracker.LoadBlobName(argv[2]); if (argv[3]) m_tracker.LoadBlobLabels(argv[3]); } cap = cvCaptureFromCAM(CAMERAID); cvSetCaptureProperty(cap,CV_CAP_PROP_FRAME_WIDTH, IMG_WIDTH); cvSetCaptureProperty(cap,CV_CAP_PROP_FRAME_HEIGHT, IMG_HEIGHT); if (!cap) return 0; glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE| GLUT_RGBA | GLUT_DEPTH | GLUT_MULTISAMPLE); glutInitWindowPosition(100, 100); glutInitWindowSize(IMG_WIDTH, IMG_HEIGHT); if (argv[1]) wid = glutCreateWindow(argv[1]); else wid = glutCreateWindow("RoadTrac"); texture = new GLuint[1]; glGenTextures(1, texture); glBindTexture(GL_TEXTURE_2D, texture[0]); glPixelStorei(GL_UNPACK_ALIGNMENT, 4); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, FRAMESIZE, FRAMESIZE, 0, GL_BGR_EXT, GL_UNSIGNED_BYTE, 0); glutReshapeFunc(resize); glutDisplayFunc(display); m_text.t3dInit(DATA_CHARSET); glutIdleFunc(idle); glutKeyboardFunc(keyboard); setprojection(); if (LIGHT) setlight(); glutMainLoop(); close(); return 0; }