static void cleanup(void) { free(gARTsaveImage); gARTsaveImage = NULL; arglCleanup(gArglSettings); arVideoCapStop(); arVideoClose(); }
ARSinglePublisher::~ARSinglePublisher (void) { //cvReleaseImage(&capture); //Don't know why but crash when release the image cvDestroyWindow("Video"); arVideoCapStop (); arVideoClose (); }
static void cleanup(void) { // Clean up the grayscale image. cvReleaseImageHeader(&calibImage); if (arIPI) { arImageProcFinal(arIPI); arIPI = NULL; } // Free space for results. if (corners) { free(corners); corners = NULL; } if (cornerSet) { free(cornerSet); cornerSet = NULL; } arVideoCapStop(); arVideoClose(); argCleanup(); if (cwd) { free(cwd); cwd = NULL; } exit(0); }
void Cleanup(void) { arVideoCapStop(); arVideoClose(); argCleanup(); }
/* cleanup function called when program exits */ static void cleanup(void) { arParamLTFree(&gCparamLT); arVideoCapStop(); arVideoClose(); argCleanup(); }
static void Quit(void) { arglCleanup(gArglSettings); arVideoCapStop(); arVideoClose(); exit(0); }
/* cleanup function called when program exits */ static void cleanup(void) { arVideoCapStop(); arVideoClose(); argCleanup(); //clean MyKinect g_MyKinect.Exit(); }
ARBundlePublisher::~ARBundlePublisher (void) { //cvReleaseImage(&capture_); //Don't know why but crash when release the image arVideoCapStop (); arVideoClose (); if(outputToFile) { output.close(); } }
/* cleanup function called when program exits */ static void cleanup(void) { closesocket(s); closesocket(s2); WSACleanup(); arVideoCapStop(); arVideoClose(); argCleanup(); }
/* cleanup function called when program exits */ static void cleanup(void) { arVideoCapStop(); arVideoClose(); argCleanup(); closedir (dp); }
static void Quit(void) { arglCleanup(gArglSettings); arVideoCapStop(); arVideoClose(); #ifdef _WIN32 CoUninitialize(); #endif exit(0); }
///=================================================================================================================== /// fin du prog ( touche esc) ///=================================================================================================================== static void cleanup() { printf("Extinction \n"); arVideoCapStop(); arVideoClose(); argCleanup(); /*FMOD_System_Close(systemSon); FMOD_System_Release(systemSon);*/ exit(0); }
void CleanUp(){ nyar_NyARTransMat_O2_free(nyobj); mqoDeleteModel(WallModel); for (int i=0;i<box_variey_num;i++){ mqoDeleteModel(Box[i]); } mqoCleanup(); arVideoCapStop(); arVideoClose(); argCleanup(); }
static void cleanup(void) { arglCleanup(gArglSettings); gArglSettings = NULL; arPattDetach(gARHandle); arPattDeleteHandle(gARPattHandle); arVideoCapStop(); ar3DDeleteHandle(&gAR3DHandle); arDeleteHandle(gARHandle); arParamLTFree(&gCparamLT); arVideoClose(); }
ARTApp::~ARTApp() { arPattDetach(arHandle); arPattDeleteHandle(pattHandle); arVideoCapStop(); ar3DDeleteHandle(&ar3DHandle); arDeleteHandle(arHandle); arParamLTFree(&cParam); arVideoClose(); if (objModel) glmDelete(objModel); }
//====================== // ライブラリの終了処理 //====================== void cARTK::cleanup( void ) { if( m_pARTImage ) { free( m_pARTImage ); m_pARTImage = NULL; } if( m_pArglSettings ) { arglCleanup( m_pArglSettings ); m_pArglSettings = NULL; } arVideoCapStop(); arVideoClose(); }
//====================== // ライブラリの終了処理 //====================== void cARTK::cleanup( void ) { if( m_pArglSettings ) { arglCleanup( m_pArglSettings ); m_pArglSettings = NULL; } if( m_pNyARInst ) { nyar_NyARTransMat_O2_free( m_pNyARInst ); m_pNyARInst = NULL; } arVideoCapStop(); arVideoClose(); }
static void cleanup(void) { if (gObjectData) { arPattDetach(gARHandle); arPattDeleteHandle(gObjectData->pattHandle); } arglCleanup(gArglSettings); gArglSettings = NULL; arVideoCapStop(); ar3DDeleteHandle(&gAR3DHandle); arDeleteHandle(gARHandle); arParamLTFree(&gCparamLT); arVideoClose(); #ifdef _WIN32 CoUninitialize(); #endif }
static void cleanup(void) { // Dispose of movie drawing structures, and stop and close the movie file. arglCleanup(gMovieArglSettings); gMovieArglSettings = NULL; if (gMovieVideo) { ar2VideoCapStop(gMovieVideo); ar2VideoClose(gMovieVideo); } arglCleanup(gArglSettings); gArglSettings = NULL; arPattDetach(gARHandle); arPattDeleteHandle(gARPattHandle); arVideoCapStop(); ar3DDeleteHandle(&gAR3DHandle); arDeleteHandle(gARHandle); arParamLTFree(&gCparamLT); arVideoClose(); }
static void cleanup(void) { VirtualEnvironmentFinal(); if (markersNFT) deleteMarkers(&markersNFT, &markersNFTCount); // NFT cleanup. unloadNFTData(); ARLOGd("Cleaning up ARToolKit NFT handles.\n"); ar2DeleteHandle(&ar2Handle); kpmDeleteHandle(&kpmHandle); arParamLTFree(&gCparamLT); // OpenGL cleanup. arglCleanup(gArglSettings); gArglSettings = NULL; // Camera cleanup. arVideoCapStop(); arVideoClose(); }
static void cleanup(void) { int i; arglCleanup(gArglSettings); gArglSettings = NULL; arPattDetach(gARHandle); for (i = 0; i < gMultiConfigCount; i++) { arMultiFreeConfig(gMultiConfigs[i]); } if (gARPattHandle) arPattDeleteHandle(gARPattHandle); arVideoCapStop(); arDeleteHandle(gARHandle); arParamLTFree(&gCparamLT); arVideoClose(); }
static void cleanup(void) { if (markersNFT) deleteMarkers(&markersNFT, &markersNFTCount); // NFT cleanup. unloadNFTData(); ARLOGd("Cleaning up ARToolKit NFT handles.\n"); ar2DeleteHandle(&ar2Handle); kpmDeleteHandle(&kpmHandle); arParamLTFree(&gCparamLT); // OpenGL cleanup. arglCleanup(gArglSettings); gArglSettings = NULL; // Camera cleanup. arVideoCapStop(); arVideoClose(); #ifdef _WIN32 CoUninitialize(); #endif }
static void cleanup(void) { VirtualEnvironmentFinal(); if (markersSquare) deleteMarkers(&markersSquare, &markersSquareCount, gARPattHandle); // Tracking cleanup. if (gARPattHandle) { arPattDetach(gARHandle); arPattDeleteHandle(gARPattHandle); } ar3DDeleteHandle(&gAR3DHandle); arDeleteHandle(gARHandle); arParamLTFree(&gCparamLT); // OpenGL cleanup. arglCleanup(gArglSettings); gArglSettings = NULL; // Camera cleanup. arVideoCapStop(); arVideoClose(); }
static void mouseEvent(int button, int state, int x, int y) { unsigned char *p, *p1; int ssx, ssy, eex, eey; int i, j, k; if( button == GLUT_RIGHT_BUTTON && state == GLUT_UP ) { if( status == 0 ) { arVideoCapStop(); arVideoClose(); if( patt.loop_num > 0 ) { calc_distortion( &patt, xsize, ysize, dist_factor ); printf("--------------\n"); printf("Center X: %f\n", dist_factor[0]); printf(" Y: %f\n", dist_factor[1]); printf("Dist Factor: %f\n", dist_factor[2]); printf("Size Adjust: %f\n", dist_factor[3]); printf("--------------\n"); status = 2; check_num = 0; print_comment(5); } else { glutDestroyWindow( win ); exit(0); } } else if( status == 1 ) { if( patt.loop_num == 0 ) {printf("error!!\n"); exit(0);} patt.loop_num--; free( patt.point[patt.loop_num] ); free( patt.savedImage[patt.loop_num] ); status = 0; point_num = 0; arVideoCapStart(); if( patt.loop_num == 0 ) print_comment(0); else print_comment(4); } } if( button == GLUT_LEFT_BUTTON && state == GLUT_DOWN ) { if( status == 1 && point_num < patt.h_num*patt.v_num ) { sx = ex = x; sy = ey = y; p = &(patt.savedImage[patt.loop_num-1][(y*xsize+x)*AR_PIX_SIZE]); p1 = &(clipImage[0]); #ifdef AR_PIX_FORMAT_BGRA k = (255*3 - (*(p+0) + *(p+1) + *(p+2))) / 3; if( k < thresh ) k = 0; else k = 255; *(p1+0) = *(p1+1) = *(p1+2) = k; #endif #ifdef AR_PIX_FORMAT_ABGR k = (255*3 - (*(p+1) + *(p+2) + *(p+3))) / 3; if( k < thresh ) k = 0; else k = 255; *(p1+1) = *(p1+2) = *(p1+3) = k; #endif #ifdef AR_PIX_FORMAT_BGR k = (255*3 - (*(p+0) + *(p+1) + *(p+2))) / 3; if( k < thresh ) k = 0; else k = 255; *(p1+0) = *(p1+1) = *(p1+2) = k; #endif #ifdef AR_PIX_FORMAT_RGBA k = (255*3 - (*(p+0) + *(p+1) + *(p+2))) / 3; if( k < thresh ) k = 0; else k = 255; *(p1+0) = *(p1+1) = *(p1+2) = k; #endif #ifdef AR_PIX_FORMAT_RGB k = (255*3 - (*(p+0) + *(p+1) + *(p+2))) / 3; if( k < thresh ) k = 0; else k = 255; *(p1+0) = *(p1+1) = *(p1+2) = k; #endif } } if( button == GLUT_LEFT_BUTTON && state == GLUT_UP ) { if( status == 0 && patt.loop_num < LOOP_MAX ) { while( (p = (unsigned char *)arVideoGetImage()) == NULL ) { arUtilSleep(2); } #ifdef USE_TEXMAP patt.savedImage[patt.loop_num] = (unsigned char *)malloc( xsize*tex1Ysize*AR_PIX_SIZE ); #else patt.savedImage[patt.loop_num] = (unsigned char *)malloc( xsize*ysize*AR_PIX_SIZE ); #endif if( patt.savedImage[patt.loop_num] == NULL ) exit(0); p1 = patt.savedImage[patt.loop_num]; for(i=0;i<xsize*ysize*AR_PIX_SIZE;i++) *(p1++) = *(p++); arVideoCapStop(); patt.point[patt.loop_num] = (CALIB_COORD_T *)malloc( sizeof(CALIB_COORD_T)*patt.h_num*patt.v_num ); if( patt.point[patt.loop_num] == NULL ) exit(0); patt.loop_num++; status = 1; sx = sy = ex= ey = -1; print_comment(1); } else if( status == 1 && point_num == patt.h_num*patt.v_num ) { status = 0; point_num = 0; arVideoCapStart(); printf("### No.%d ###\n", patt.loop_num); for( j = 0; j < patt.v_num; j++ ) { for( i = 0; i < patt.h_num; i++ ) { printf("%2d, %2d: %6.2f, %6.2f\n", i+1, j+1, patt.point[patt.loop_num-1][j*patt.h_num+i].x_coord, patt.point[patt.loop_num-1][j*patt.h_num+i].y_coord); } } printf("\n\n"); if( patt.loop_num < LOOP_MAX ) print_comment(4); else print_comment(6); } else if( status == 1 ) { if( sx < ex ) { ssx = sx; eex = ex; } else { ssx = ex; eex = sx; } if( sy < ey ) { ssy = sy; eey = ey; } else { ssy = ey; eey = sy; } patt.point[patt.loop_num-1][point_num].x_coord = 0.0; patt.point[patt.loop_num-1][point_num].y_coord = 0.0; p = clipImage; k = 0; for( j = 0; j < (eey-ssy+1); j++ ) { for( i = 0; i < (eex-ssx+1); i++ ) { patt.point[patt.loop_num-1][point_num].x_coord += i * *(p+1); patt.point[patt.loop_num-1][point_num].y_coord += j * *(p+1); k += *(p+1); p += AR_PIX_SIZE; } } if( k != 0 ) { patt.point[patt.loop_num-1][point_num].x_coord /= k; patt.point[patt.loop_num-1][point_num].y_coord /= k; patt.point[patt.loop_num-1][point_num].x_coord += ssx; patt.point[patt.loop_num-1][point_num].y_coord += ssy; point_num++; } sx = sy = ex= ey = -1; printf(" # %d/%d\n", point_num, patt.h_num*patt.v_num); if( point_num == patt.h_num*patt.v_num ) print_comment(2); } else if( status == 2 ) { check_num++; if( check_num == patt.loop_num ) { if(patt.loop_num >= 2) { if( calc_inp(&patt, dist_factor, xsize, ysize, mat) < 0 ) { printf("Calibration failed.\n"); exit(0); } save_param(); } glutDestroyWindow( win ); exit(0); } if( check_num+1 == patt.loop_num ) { printf("\nLeft Mouse Button: Next Step.\n"); } else { printf(" %d/%d.\n", check_num+1, patt.loop_num); } } } }
//======================================================= // 終了処理関数 //======================================================= void Cleanup(void) { arVideoCapStop(); // ビデオキャプチャの停止 arVideoClose(); // ビデオデバイスの終了 argCleanup(); // ARToolKitの終了処理 }
static void mouseEvent(int button, int state, int x, int y) { AR2VideoBufferT *buff; unsigned char *p, *p1; int ssx, ssy, eex, eey; int i, j, k; char line[256]; if( x < 0 ) x = 0; if( x >= xsize ) x = xsize-1; if( y < 0 ) y = 0; if( y >= ysize ) y = ysize-1; x *= SCALE; y *= SCALE; if( button == GLUT_RIGHT_BUTTON && state == GLUT_UP ) { if( status == 0 ) { arVideoCapStop(); arVideoClose(); if( patt.loop_num > 0 ) { calc_distortion( &patt, xsize, ysize, aspect_ratio, dist_factor, dist_function_version ); ARLOG("--------------\n"); if (dist_function_version == 3) { ARLOG("Center X: %f\n", dist_factor[0]); ARLOG(" Y: %f\n", dist_factor[1]); ARLOG("Size Adjust: %f\n", dist_factor[2]); ARLOG("Aspect Ratio: %f\n", dist_factor[3]); ARLOG("Dist Factor1: %f\n", dist_factor[4]); ARLOG("Dist Factor2: %f\n", dist_factor[5]); } else if (dist_function_version == 2) { ARLOG("Center X: %f\n", dist_factor[0]); ARLOG(" Y: %f\n", dist_factor[1]); ARLOG("Size Adjust: %f\n", dist_factor[2]); ARLOG("Dist Factor1: %f\n", dist_factor[3]); ARLOG("Dist Factor2: %f\n", dist_factor[4]); } else if (dist_function_version == 1) { ARLOG("Center X: %f\n", dist_factor[0]); ARLOG(" Y: %f\n", dist_factor[1]); ARLOG("Size Adjust: %f\n", dist_factor[2]); ARLOG("Dist Factor: %f\n", dist_factor[3]); } ARLOG("--------------\n"); status = 2; check_num = 0; print_comment(5); } else { exit(0); } } else if( status == 1 ) { if( patt.loop_num == 0 ) {ARLOGe("error!!\n"); exit(0);} patt.loop_num--; free( patt.point[patt.loop_num] ); free( patt.savedImage[patt.loop_num] ); status = 0; point_num = 0; arVideoCapStart(); if( patt.loop_num == 0 ) print_comment(0); else print_comment(4); } } if( button == GLUT_LEFT_BUTTON && state == GLUT_DOWN ) { if( status == 1 && point_num < patt.h_num*patt.v_num ) { sx = ex = x; sy = ey = y; p = &(patt.savedImage[patt.loop_num-1][(y*xsize+x)*pixelSize]); p1 = &(clipImage[0]); if (pixelFormat == AR_PIXEL_FORMAT_BGRA || pixelFormat == AR_PIXEL_FORMAT_RGBA) { k = (255*3 - (*(p+0) + *(p+1) + *(p+2))) / 3; if( k < thresh ) k = 0; else k = 255; *(p1+0) = *(p1+1) = *(p1+2) = k; } else if (pixelFormat == AR_PIXEL_FORMAT_ARGB || pixelFormat == AR_PIXEL_FORMAT_ABGR) { k = (255*3 - (*(p+1) + *(p+2) + *(p+3))) / 3; if( k < thresh ) k = 0; else k = 255; *(p1+1) = *(p1+2) = *(p1+3) = k; } else if (pixelFormat == AR_PIXEL_FORMAT_BGR || pixelFormat == AR_PIXEL_FORMAT_RGB) { k = (255*3 - (*(p+0) + *(p+1) + *(p+2))) / 3; if( k < thresh ) k = 0; else k = 255; *(p1+0) = *(p1+1) = *(p1+2) = k; } else if (pixelFormat == AR_PIXEL_FORMAT_MONO || pixelFormat == AR_PIXEL_FORMAT_420v || pixelFormat == AR_PIXEL_FORMAT_420f) { k = 255 - *p; if( k < thresh ) k = 0; else k = 255; *p1 = k; } else if (pixelFormat == AR_PIXEL_FORMAT_2vuy) { k = 255 - *(p+1); if( k < thresh ) k = 0; else k = 255; *(p1+1) = k; } else if (pixelFormat == AR_PIXEL_FORMAT_yuvs) { k = 255 - *p; if( k < thresh ) k = 0; else k = 255; *p1 = k; } } } if( button == GLUT_LEFT_BUTTON && state == GLUT_UP ) { if( status == 0 && patt.loop_num < LOOP_MAX ) { while (!(buff = arVideoGetImage()) || !buff->fillFlag) arUtilSleep(2); p = buff->buff; patt.savedImage[patt.loop_num] = (unsigned char *)malloc( xsize*ysize*pixelSize ); if( patt.savedImage[patt.loop_num] == NULL ) exit(0); p1 = patt.savedImage[patt.loop_num]; for(i=0;i<xsize*ysize*pixelSize;i++) *(p1++) = *(p++); arVideoCapStop(); patt.point[patt.loop_num] = (CALIB_COORD_T *)malloc( sizeof(CALIB_COORD_T)*patt.h_num*patt.v_num ); if( patt.point[patt.loop_num] == NULL ) exit(0); patt.loop_num++; status = 1; sx = sy = ex= ey = -1; print_comment(1); } else if( status == 1 && point_num == patt.h_num*patt.v_num ) { status = 0; point_num = 0; arVideoCapStart(); ARLOG("### No.%d ###\n", patt.loop_num); for( j = 0; j < patt.v_num; j++ ) { for( i = 0; i < patt.h_num; i++ ) { ARLOG("%2d, %2d: %6.2f, %6.2f\n", i+1, j+1, patt.point[patt.loop_num-1][j*patt.h_num+i].x_coord, patt.point[patt.loop_num-1][j*patt.h_num+i].y_coord); } } ARLOG("\n\n"); if( patt.loop_num < LOOP_MAX ) print_comment(4); else print_comment(6); } else if( status == 1 ) { if( sx < ex ) { ssx = sx; eex = ex; } else { ssx = ex; eex = sx; } if( sy < ey ) { ssy = sy; eey = ey; } else { ssy = ey; eey = sy; } patt.point[patt.loop_num-1][point_num].x_coord = 0.0; patt.point[patt.loop_num-1][point_num].y_coord = 0.0; p = clipImage; k = 0; for( j = 0; j < (eey-ssy+1); j++ ) { for( i = 0; i < (eex-ssx+1); i++ ) { if( pixelSize == 1 ) { patt.point[patt.loop_num-1][point_num].x_coord += i * *p; patt.point[patt.loop_num-1][point_num].y_coord += j * *p; k += *p; } else { patt.point[patt.loop_num-1][point_num].x_coord += i * *(p+1); patt.point[patt.loop_num-1][point_num].y_coord += j * *(p+1); k += *(p+1); } p += pixelSize; } } if( k != 0 ) { patt.point[patt.loop_num-1][point_num].x_coord /= k; patt.point[patt.loop_num-1][point_num].y_coord /= k; patt.point[patt.loop_num-1][point_num].x_coord += ssx; patt.point[patt.loop_num-1][point_num].y_coord += ssy; point_num++; } sx = sy = ex= ey = -1; ARLOG(" # %d/%d\n", point_num, patt.h_num*patt.v_num); if( point_num == patt.h_num*patt.v_num ) print_comment(2); } else if( status == 2 ) { check_num++; if( check_num == patt.loop_num ) { if(patt.loop_num >= 2) { if( calc_inp(&patt, dist_factor, xsize, ysize, mat, dist_function_version) < 0 ) { ARLOGe("Calibration failed.\n"); exit(0); } save_param(); if (dist_function_version == 3) { printf("Do you want to repeat again?"); scanf("%s", line); if( line[0] == 'y' ) { aspect_ratio *= mat[0][0] / mat[1][1]; ARLOG("New aspect ratio = %f\n", aspect_ratio); calc_distortion( &patt, xsize, ysize, aspect_ratio, dist_factor, dist_function_version ); ARLOG("--------------\n"); ARLOG("Center X: %f\n", dist_factor[0]); ARLOG(" Y: %f\n", dist_factor[1]); ARLOG("Size Adjust: %f\n", dist_factor[2]); ARLOG("Aspect Ratio: %f\n", dist_factor[3]); ARLOG("Dist Factor1: %f\n", dist_factor[4]); ARLOG("Dist Factor2: %f\n", dist_factor[5]); ARLOG("--------------\n"); status = 2; check_num = 0; print_comment(5); return; } } } exit(0); } if( check_num+1 == patt.loop_num ) { ARLOG("\nLeft Mouse Button: Next Step.\n"); } else { ARLOG(" %d/%d.\n", check_num+1, patt.loop_num); } } } return; }
static void cleanup(void) { // arglCleanup(gArglSettings); arVideoCapStop(); arVideoClose(); }
static void cleanup() { arVideoCapStop(); arVideoClose(); argCleanup(); }
ARMultiPublisher::~ARMultiPublisher (void) { //cvReleaseImage(&capture_); //Don't know why but crash when release the image arVideoCapStop (); arVideoClose (); }
ARPublisher::~ARPublisher (void) { arVideoCapStop (); arVideoClose (); }