bool FidtrackFinder::init(int w, int h, int sb, int db) { FiducialFinder::init(w,h,sb,db); if (db!=1) { printf("target buffer must be grayscale\n"); return false; } help_text.push_back( "FidtrackFinder:"); help_text.push_back( " f - adjust finger size & sensitivity"); if (strcmp(tree_config,"none")!=0) { initialize_treeidmap_from_file( &treeidmap, tree_config ); } else initialize_treeidmap( &treeidmap ); initialize_fidtrackerX( &fidtrackerx, &treeidmap, dmap); initialize_segmenter( &segmenter, width, height, treeidmap.max_adjacencies ); //finger_buffer = new unsigned char[64*64]; average_leaf_size = 4.0f; average_fiducial_size = 48.0f; //obj_analyzer = new ObjectAnalyzer(); //obj_analyzer->init(w,h,sb,db); setFingerSize = false; setFingerSensitivity = false; return true; }
void pix_fiducialtrack :: addMess(t_symbol*s) { error("on-the-fly adding of fiducials not yet implemented!"); #if 0 std::string fn = findFile(s->s_name); m_treefile=fn.c_str(); initialize_treeidmap_from_file( &treeidmap, m_treefile ); initialize_fidtrackerX( &fidtrackerx, &treeidmap, NULL); deinit_segmenter(); #endif }
///////////////////////////////////////////////////////// // read a treeidmap from file // ///////////////////////////////////////////////////////// void pix_fiducialtrack :: treeMess(t_symbol*s) { if(NULL==s || NULL==s->s_name || &s_==s)return; std::string fn = findFile(s->s_name); snprintf(m_treefile, MAXPDSTRING, "%s", fn.c_str()); terminate_fidtrackerX(&fidtrackerx); terminate_treeidmap (&treeidmap); deinit_segmenter(); initialize_treeidmap_from_file( &treeidmap, m_treefile ); initialize_fidtrackerX( &fidtrackerx, &treeidmap, NULL); if(treeidmap.max_adjacencies<=0){ error("could not load TreeIdMap from '%s'", s->s_name); } }
void moFiducialTrackerModule::allocateBuffers() { IplImage* src = (IplImage*)(this->input->getData()); this->output_buffer = cvCreateImage(cvGetSize(src), src->depth, 3); // only one channel LOG(MO_DEBUG, "allocated output buffer for FiducialTracker module."); // first time, initialize fids fiducials_data_t *fids = (fiducials_data_t *)this->internal; //initialize_treeidmap_from_file( &treeidmap, tree_config ); initialize_treeidmap( &fids->treeidmap ); fids->dmap = new ShortPoint[src->height*src->width]; for ( int y = 0; y < src->height; y++ ) { for ( int x = 0; x < src->width; x++ ) { fids->dmap[y*src->width+x].x = x; fids->dmap[y*src->width+x].y = y; } } initialize_fidtrackerX( &fids->fidtrackerx, &fids->treeidmap, fids->dmap); initialize_segmenter( &fids->segmenter, src->width, src->height, fids->treeidmap.max_adjacencies ); }