//------------------------------------------------------------------------------ int main(int argc, char** argv) { switch( TRAJECTORY ) { case TRAJECTORY_LINE: default: lineTest(); break; case TRAJECTORY_CIRCLE: circleTest(); break; case TRAJECTORY_SINE: sineTest(); break; case TRAJECTORY_DBLSINE: compressedsineandsineTest(); break; case TRAJECTORY_IMMELMANN: immelmannTest(); break; case TRAJECTORY_DBLIMMELMANN: dblimmelmannTest(); break; case TRAJECTORY_LOOP: loopTest(); break; } glutInit(&argc, argv); glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB |GLUT_DEPTH); glutInitWindowSize (600, 600); glutInitWindowPosition (100, 100); glutCreateWindow ( title.c_str() ); catmullrom_s = CubicSpline::linearly_interpolate_arclength( CUBIC_SPLINE_CATMULLROM, actor.trajectory.controlpoints ); catmullrom_M = CubicSpline::basisCatmullRom(); catmullrom_arclength_map = CubicSpline::map_spline( CUBIC_SPLINE_CATMULLROM, actor.trajectory.controlpoints ); std::cout << "catmullrom arclength s:" << catmullrom_s << std::endl; bspline_s = CubicSpline::linearly_interpolate_arclength( CUBIC_SPLINE_B, actor.trajectory.controlpoints ); bspline_M = CubicSpline::basisUniformNonrationalBSpline(); bspline_arclength_map = CubicSpline::map_spline( CUBIC_SPLINE_B, actor.trajectory.controlpoints ); std::cout << "bspline arclength s:" << bspline_s << std::endl; camera.project(); init (); glutDisplayFunc(display); glutReshapeFunc(reshape); glutKeyboardFunc(keyboard); glutIdleFunc(idle); glutMainLoop(); return 0; }
void renderFrame() { //perform HSI converison GL_CHECK(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)); GLuint programID = hsi->programID(); GL_CHECK(glUseProgram(programID)); DrawQuad(programID); GL_CHECK(glUseProgram(0)); *frame = window.Capture(); //perform dilation GL_CHECK(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)); programID = dilation->programID(); GL_CHECK(glUseProgram(programID)); DrawQuad(programID); GL_CHECK(glUseProgram(0)); *frame = window.Capture(); dilate = false; //perform erosion GL_CHECK(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)); programID = erosion->programID(); GL_CHECK(glUseProgram(programID)); DrawQuad(programID); GL_CHECK(glUseProgram(0)); *frame = window.Capture(); Blob* boundaries[BASE_SIZE]; int nBlob = 0; memset(boundaries,0,sizeof(boundaries)); sf::Image *labels = new sf::Image(frame->GetWidth(), frame->GetHeight()); LabelRegions(frame, labels, boundaries, &nBlob); //printf("%d\n", nBlob); // draw rectangles for (int i=1; i<= nBlob; i++){ // find the points BlobPoint ll, ur; ll.x = 99999; ll.y = 99999; ur.x = 0; ur.y = 0; Blob* blob = boundaries[i]; BlobPoint* next = blob->points; printf("%d\n", blob->numPoints); while(next != NULL) { if(next->x < ll.x) ll.x = next->x; if(next->y < ll.y) ll.y = next->y; if(next->x > ur.x) ur.x = next->x; if(next->y > ur.y) ur.y = next->y; next = next->nextPoint; } ll.x -= 2; ll.y -= 2; ur.x += 2; ur.y += 2; bool fillBlack = false; if (!circleTest(blob)) { fillBlack = true; } drawRectangle(frame, ll, ur, sf::Color(0,0,255), fillBlack); } GL_CHECK(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)); programID = dead->programID(); GL_CHECK(glUseProgram(programID)); DrawQuad(programID); GL_CHECK(glUseProgram(0)); FreeAllRegions(boundaries, nBlob); }