static void Keyboard(unsigned char key, int x, int y) { switch (key) { case 0x1B: // Quit. case 'Q': case 'q': cleanup(); exit(0); break; case 'T': case 't': printf("Enter new threshold value (default = 100): "); scanf("%d", &gARTThreshhold); while (getchar()!='\n'); printf("\n"); break; case '?': case '/': printf("Keys:\n"); printf(" q or [esc] Quit demo.\n"); printf(" t Enter new binarization threshold value.\n"); printf(" ? or / Show this help.\n"); printf("\nAdditionally, the ARVideo library supplied the following help text:\n"); arVideoDispOption(); break; default: break; } }
static void Keyboard(unsigned char key, int x, int y) { int mode; switch (key) { case 0x1B: // Quit. case 'r': knight->Reset(); case 'x': knight->TranslateX(0.1); break; case 'y': knight->TranslateY(0.1); break; case 'z': knight->TranslateZ(0.1); break; case 'Q': case 'q': Quit(); break; case ' ': gDrawRotate = !gDrawRotate; break; case 'C': case 'c': mode = arglDrawModeGet(gArglSettings); if (mode == AR_DRAW_BY_GL_DRAW_PIXELS) { arglDrawModeSet(gArglSettings, AR_DRAW_BY_TEXTURE_MAPPING); arglTexmapModeSet(gArglSettings, AR_DRAW_TEXTURE_FULL_IMAGE); } else { mode = arglTexmapModeGet(gArglSettings); if (mode == AR_DRAW_TEXTURE_FULL_IMAGE) arglTexmapModeSet(gArglSettings, AR_DRAW_TEXTURE_HALF_IMAGE); else arglDrawModeSet(gArglSettings, AR_DRAW_BY_GL_DRAW_PIXELS); } fprintf(stderr, "*** Camera - %f (frame/sec)\n", (double)gCallCountMarkerDetect/arUtilTimer()); gCallCountMarkerDetect = 0; arUtilTimerReset(); debugReportMode(); break; case 'D': case 'd': arDebug = !arDebug; break; case '?': case '/': printf("Keys:\n"); printf(" q or [esc] Quit demo.\n"); printf(" c Change arglDrawMode and arglTexmapMode.\n"); printf(" d Activate / deactivate debug mode.\n"); printf(" ? or / Show this help.\n"); printf("\nAdditionally, the ARVideo library supplied the following help text:\n"); arVideoDispOption(); break; default: break; } }
static void Keyboard(unsigned char key, int x, int y) { switch (key) { case 0x1B: // Quit. case 'Q': case 'q': cleanup(); exit(0); break; case '?': case '/': ARLOG("Keys:\n"); ARLOG(" q or [esc] Quit demo.\n"); ARLOG(" ? or / Show this help.\n"); ARLOG("\nAdditionally, the ARVideo library supplied the following help text:\n"); arVideoDispOption(); break; default: break; } }
static void Keyboard(unsigned char key, int x, int y) { int mode, threshChange = 0; switch (key) { case 0x1B: // Quit. case 'Q': case 'q': cleanup(); exit(0); break; case ' ': gDrawRotate = !gDrawRotate; break; // case 'C': // case 'c': // mode = arglDrawModeGet(gArglSettings); // if (mode == AR_DRAW_BY_GL_DRAW_PIXELS) { // arglDrawModeSet(gArglSettings, AR_DRAW_BY_TEXTURE_MAPPING); // arglTexmapModeSet(gArglSettings, AR_DRAW_TEXTURE_FULL_IMAGE); // } else { // mode = arglTexmapModeGet(gArglSettings); // if (mode == AR_DRAW_TEXTURE_FULL_IMAGE) arglTexmapModeSet(gArglSettings, AR_DRAW_TEXTURE_HALF_IMAGE); // else arglDrawModeSet(gArglSettings, AR_DRAW_BY_GL_DRAW_PIXELS); // } // fprintf(stderr, "*** Camera - %f (frame/sec)\n", (double)gCallCountMarkerDetect/arUtilTimer()); // gCallCountMarkerDetect = 0; // arUtilTimerReset(); // debugReportMode(gArglSettings); // break; case '-': threshChange = -5; break; case '+': case '=': threshChange = +5; break; case 'D': case 'd': arDebug = !arDebug; break; case '?': case '/': printf("Keys:\n"); printf(" q or [esc] Quit demo.\n"); printf(" c Change arglDrawMode and arglTexmapMode.\n"); printf(" - and + Adjust threshhold.\n"); printf(" d Activate / deactivate debug mode.\n"); printf(" ? or / Show this help.\n"); printf("\nAdditionally, the ARVideo library supplied the following help text:\n"); arVideoDispOption(); break; default: break; } if (threshChange) { gARTThreshhold += threshChange; if (gARTThreshhold < 0) gARTThreshhold = 0; if (gARTThreshhold > 255) gARTThreshhold = 255; printf("Threshhold changed to %d.\n", gARTThreshhold); } }
static void Keyboard(unsigned char key, int x, int y) { int mode, threshChange = 0; switch (key) { case 0x1B: // Quit. case 'Q': case 'q': cleanup(); exit(0); break; case ' ': gDrawRotate = !gDrawRotate; break; case 'C': case 'c': ARLOGe("*** Camera - %f (frame/sec)\n", (double)gCallCountMarkerDetect/arUtilTimer()); gCallCountMarkerDetect = 0; arUtilTimerReset(); debugReportMode(gARHandle); break; case '-': threshChange = -5; break; case '+': case '=': threshChange = +5; break; case 'D': case 'd': arGetDebugMode(gARHandle, &mode); arSetDebugMode(gARHandle, !mode); break; case 'B': case 'b': arGetLabelingMode(gARHandle, &mode); if (mode == AR_LABELING_BLACK_REGION) arSetLabelingMode(gARHandle, AR_LABELING_WHITE_REGION); else arSetLabelingMode(gARHandle, AR_LABELING_BLACK_REGION); break; case '?': case '/': ARLOG("Keys:\n"); ARLOG(" q or [esc] Quit demo.\n"); ARLOG(" c Calulcate frame rate.\n"); ARLOG(" - and + Adjust threshhold.\n"); ARLOG(" d Activate / deactivate debug mode.\n"); ARLOG(" b Toggle between detection of black markers and white markers.\n"); ARLOG(" ? or / Show this help.\n"); ARLOG("\nAdditionally, the ARVideo library supplied the following help text:\n"); arVideoDispOption(); break; default: break; } if (threshChange) { int threshhold; arGetLabelingThresh(gARHandle, &threshhold); threshhold += threshChange; if (threshhold < 0) threshhold = 0; if (threshhold > 255) threshhold = 255; arSetLabelingThresh(gARHandle, threshhold); ARLOG("Threshhold changed to %d.\n", threshhold); } }
AR2VideoParamT *ar2VideoOpen( char *config ) { AR2VideoParamT *vid; char *a, line[256]; int i; arMalloc( vid, AR2VideoParamT, 1 ); vid->did = 0; vid->format = AR_VIDEO_INTERLEAVED; vid->packing = AR_VIDEO_RGB_8; if( DEFAULT_VIDEO_SIZE == VIDEO_FULL ) { vid->zoom = AR_VIDEO_1_P_1; } else { vid->zoom = AR_VIDEO_1_P_2; } vid->buf_size = -1; a = config; if( a != NULL) { for(;;) { while( *a == ' ' || *a == '\t' ) a++; if( *a == '\0' ) break; if( strncmp( a, "-size=", 6 ) == 0 ) { if( strncmp( &a[6], "FULL", 4 ) == 0 ) vid->zoom = AR_VIDEO_1_P_1; else if( strncmp( &a[6], "HALF", 4 ) == 0 ) vid->zoom = AR_VIDEO_1_P_2; else { arVideoDispOption(); free( vid ); return 0; } } else if( strncmp( a, "-device=", 8 ) == 0 ) { sscanf( a, "%s", line ); if( sscanf( &line[8], "%d", &vid->did ) == 0 ) { arVideoDispOption(); free( vid ); return 0; } } else if( strncmp( a, "-bufsize=", 9 ) == 0 ) { sscanf( a, "%s", line ); if( sscanf( &line[9], "%d", &vid->buf_size ) == 0 ) { arVideoDispOption(); free( vid ); return 0; } } else { arVideoDispOption(); free( vid ); return 0; } while( *a != ' ' && *a != '\t' && *a != '\0') a++; } } if( init == 0 ) { if( arVideoOpen2() < 0 ) { free( vid ); return 0; } init = 1; } if( arVideoSetupDevice2(vid->did, vid->format, vid->packing, vid->zoom) < 0 ) { free( vid ); return 0; } if( vid->buf_size > 0 ) { arVideoSetBufferSize2( vid->did, vid->buf_size ); } return vid; }