예제 #1
0
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;
}
예제 #2
0
/////////////////////////////////////////////////////////
// processGrayImage
//
/////////////////////////////////////////////////////////
void pix_fiducialtrack :: processGrayImage(imageStruct &image)
{
  if(image.xsize!=m_width || image.ysize!=m_height)
    deinit_segmenter();

  m_width =image.xsize;
  m_height=image.ysize;

  if(!initialized){
    initialize_segmenter( &segmenter, m_width, m_height, treeidmap.max_adjacencies );
    initialized=true;
  }

  step_segmenter( &segmenter, image.data);
  int count = find_fiducialsX( fiducials, MAX_FIDUCIAL_COUNT,  
                               &fidtrackerx , 
                               &segmenter, 
                               m_width, m_height);

  int i;
  for(i=0;i< count;i++) {
    if(fiducials[i].id!=INVALID_FIDUCIAL_ID){
      SETFLOAT((m_outlist+0), (fiducials[i].id));         // id (as in treeidmap)
      SETFLOAT((m_outlist+1), (fiducials[i].x/m_width));  // x (normalized)
      SETFLOAT((m_outlist+2), (fiducials[i].y/m_height)); // y (normalized)
      SETFLOAT((m_outlist+3), (fiducials[i].angle));      // phi (radiant)
      outlet_list(m_infoOut, gensym("list"), 4, m_outlist);
    }
  }
}
bool FidtrackFinderClassic::init(int w, int h, int sb, int db) {
	
	FiducialFinder::init(w,h,sb,db);
	
	if (db!=1) {
		printf("target buffer must be grayscale");
		return false;
	}
	
	initialize_segmenter( &segmenter, width, height, 8 );

	return true;
}
예제 #4
0
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 );
}