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); }
int arDeleteHandle( ARHandle *handle ) { if( handle == NULL ) return -1; if (handle->arImageProcInfo) { arImageProcFinal(handle->arImageProcInfo); handle->arImageProcInfo = NULL; } //if( handle->arParamLT != NULL ) arParamLTFree( &handle->arParamLT ); free( handle->labelInfo.labelImage ); #if !AR_DISABLE_LABELING_DEBUG_MODE if (handle->labelInfo.bwImage) free( handle->labelInfo.bwImage ); #endif free( handle ); return 0; }
int arSetLabelingThreshMode(ARHandle *handle, const AR_LABELING_THRESH_MODE mode) { AR_LABELING_THRESH_MODE mode1; if (!handle) return (-1); if (handle->arLabelingThreshMode != mode) { if (handle->arImageProcInfo) { arImageProcFinal(handle->arImageProcInfo); handle->arImageProcInfo = NULL; } mode1 = mode; switch (mode) { case AR_LABELING_THRESH_MODE_AUTO_MEDIAN: case AR_LABELING_THRESH_MODE_AUTO_OTSU: #if !AR_DISABLE_THRESH_MODE_AUTO_ADAPTIVE case AR_LABELING_THRESH_MODE_AUTO_ADAPTIVE: #endif handle->arImageProcInfo = arImageProcInit(handle->xsize, handle->ysize); break; case AR_LABELING_THRESH_MODE_AUTO_BRACKETING: handle->arLabelingThreshAutoBracketOver = handle->arLabelingThreshAutoBracketUnder = 1; break; case AR_LABELING_THRESH_MODE_MANUAL: break; // Do nothing. default: ARLOGe("Unknown or unsupported labeling threshold mode requested. Set to manual.\n"); mode1 = AR_LABELING_THRESH_MODE_MANUAL; } handle->arLabelingThreshMode = mode1; if (handle->arDebug == AR_DEBUG_ENABLE) { const char *modeDescs[] = { "MANUAL", "AUTO_MEDIAN", "AUTO_OTSU", "AUTO_ADAPTIVE", "AUTO_BRACKETING" }; ARLOGe("Labeling threshold mode set to %s.\n", modeDescs[mode1]); } } return (0); }