Esempio n. 1
0
bool ofxArtool5::initNFT(ARParamLT * cparamLT, AR_PIXEL_FORMAT pixFormat){
    kpmHandle = kpmCreateHandle(cparamLT, pixFormat);
    if (!kpmHandle) {
        ofLogError("ofxArtool5::initNFT","kpmCreateHandle");
        return false;
    }
    
    if((ar2Handle = ar2CreateHandle(cparamLT, pixFormat, AR2_TRACKING_DEFAULT_THREAD_NUM))==NULL){
        ofLogError("ofxArtool5::initNFT","ar2CreateHandle");
        kpmDeleteHandle(&kpmHandle);
        return false;
    }
    
    if(threadGetCPU()<=1){
        ofLogWarning("ofxArtool5::initNFT","Using NFT settings for a single CPU");
        ar2SetTrackingThresh(ar2Handle, 5.0);
        ar2SetSimThresh(ar2Handle, 0.50);
        ar2SetSearchFeatureNum(ar2Handle, 16);
        ar2SetSearchSize(ar2Handle, 6);
        ar2SetTemplateSize1(ar2Handle, 6);
        ar2SetTemplateSize2(ar2Handle, 6);
    }else{
        cout<<"ofxArtool5::initNFT: Using NFT settings for multi CPU"<<endl;
        ar2SetTrackingThresh(ar2Handle, 5.0);
        ar2SetSimThresh(ar2Handle, 0.50);
        ar2SetSearchFeatureNum(ar2Handle, 16);
        ar2SetSearchSize(ar2Handle, 12);
        ar2SetTemplateSize1(ar2Handle, 6);
        ar2SetTemplateSize2(ar2Handle, 6);
    }
    
    return true;
}
Esempio n. 2
0
// Modifies globals: kpmHandle, ar2Handle.
static int initNFT(ARParamLT *cparamLT, AR_PIXEL_FORMAT pixFormat)
{
#ifdef DEBUG
    LOGE("Initialising NFT.\n");
#endif
    //
    // NFT init.
    //
    
    // KPM init.
    kpmHandle = kpmCreateHandle(cparamLT, pixFormat);
    if (!kpmHandle) {
        LOGE("Error: kpmCreatHandle.\n");
        return (false);
    }
    //kpmSetProcMode( kpmHandle, KpmProcHalfSize );
    
    // AR2 init.
    if( (ar2Handle = ar2CreateHandle(cparamLT, pixFormat, AR2_TRACKING_DEFAULT_THREAD_NUM)) == NULL ) {
        LOGE("Error: ar2CreateHandle.\n");
        kpmDeleteHandle(&kpmHandle);
        return (false);
    }
    if (threadGetCPU() <= 1) {
#ifdef DEBUG
        LOGE("Using NFT tracking settings for a single CPU.\n");
#endif
        ar2SetTrackingThresh( ar2Handle, 5.0 );
        ar2SetSimThresh( ar2Handle, 0.50 );
        ar2SetSearchFeatureNum(ar2Handle, 16);
        ar2SetSearchSize(ar2Handle, 6);
        ar2SetTemplateSize1(ar2Handle, 6);
        ar2SetTemplateSize2(ar2Handle, 6);
    } else {
#ifdef DEBUG
        LOGE("Using NFT tracking settings for more than one CPU.\n");
#endif
        ar2SetTrackingThresh( ar2Handle, 5.0 );
        ar2SetSimThresh( ar2Handle, 0.50 );
        ar2SetSearchFeatureNum(ar2Handle, 16);
        ar2SetSearchSize(ar2Handle, 12);
        ar2SetTemplateSize1(ar2Handle, 6);
        ar2SetTemplateSize2(ar2Handle, 6);
    }
    // NFT dataset loading will happen later.
#ifdef DEBUG
    LOGE("NFT initialised OK.\n");
#endif
    return (true);
}