//--------------------------------------------------------------
void testApp::draw(){
    
    backdrop.draw(0,0, ofGetWidth(),ofGetHeight());
		//comment this next line out to hide the kinect output
	graySmall.draw(0,0);
    	// 100 can be set to change to find best distance for project
    createMasks(100);
    
	makeMasked(mask01, cutout);
}
Example #2
0
void Segmenter::segment()
{
  if( (!have_cloud) )//|| (!have_normals) )
  {
    char* error_message = new char[200];
    sprintf(error_message,"[%s::segment()]: I suggest you first set the point cloud.",ClassName.c_str()); // and normals
    throw std::runtime_error(error_message);
  }

v4r::TimeEstimationClass timeEstimationClass_All(CLOCK_THREAD_CPUTIME_ID);
v4r::TimeEstimationClass timeEstimationClass_Custom(CLOCK_THREAD_CPUTIME_ID);

timeEstimationClass_All.countingStart();

timeEstimationClass_Custom.countingStart();
  calculateNormals();
timeEstimationClass_Custom.countingEnd();
timeEstimates.time_normalsCalculation = timeEstimationClass_Custom.getWorkTimeInNanoseconds();

timeEstimationClass_Custom.countingStart();
  calculatePatches();
timeEstimationClass_Custom.countingEnd();
timeEstimates.time_patchesCalculation = timeEstimationClass_Custom.getWorkTimeInNanoseconds();

timeEstimationClass_Custom.countingStart();
//   v4r::View view;
  view.Reset();
  view.setPointCloud(pcl_cloud);
  view.normals = normals;
  view.setSurfaces(surfaces);
  surfaces = view.surfaces;

  view.createPatchImage();
timeEstimationClass_Custom.countingEnd();
timeEstimates.time_patchImageCalculation = timeEstimationClass_Custom.getWorkTimeInNanoseconds();

timeEstimationClass_Custom.countingStart();
  view.computeNeighbors();
timeEstimationClass_Custom.countingEnd();
timeEstimates.time_neighborsCalculation = timeEstimationClass_Custom.getWorkTimeInNanoseconds();

timeEstimationClass_Custom.countingStart();
  surfaces = view.surfaces;
  view.calculateBorders(view.cloud);
  ngbr3D_map = view.ngbr3D_map;
  ngbr2D_map = view.ngbr2D_map;
timeEstimationClass_Custom.countingEnd();
timeEstimates.time_borderCalculation = timeEstimationClass_Custom.getWorkTimeInNanoseconds();

timeEstimationClass_Custom.countingStart();
  preComputeRelations();
timeEstimationClass_Custom.countingEnd();
timeEstimates.time_relationsPreComputation = timeEstimationClass_Custom.getWorkTimeInNanoseconds();

timeEstimationClass_Custom.countingStart();
  initModelSurfaces();
timeEstimationClass_Custom.countingEnd();
timeEstimates.time_initModelSurfaces = timeEstimationClass_Custom.getWorkTimeInNanoseconds();

timeEstimationClass_Custom.countingStart();
  modelSurfaces();
timeEstimationClass_Custom.countingEnd();
timeEstimates.times_surfaceModelling.clear();
timeEstimates.times_surfaceModelling.push_back(timeEstimationClass_Custom.getWorkTimeInNanoseconds());

timeEstimationClass_Custom.countingStart();
  computeRelations();
timeEstimationClass_Custom.countingEnd();
timeEstimates.times_relationsComputation.clear();
timeEstimates.times_relationsComputation.push_back(timeEstimationClass_Custom.getWorkTimeInNanoseconds());

timeEstimationClass_Custom.countingStart();
  graphBasedSegmentation();
timeEstimationClass_Custom.countingEnd();
timeEstimates.times_graphBasedSegmentation.clear();
timeEstimates.times_graphBasedSegmentation.push_back(timeEstimationClass_Custom.getWorkTimeInNanoseconds());

timeEstimationClass_Custom.countingStart();
  createMasks();
timeEstimationClass_Custom.countingEnd();
timeEstimates.times_maskCreation.clear();
timeEstimates.times_maskCreation.push_back(timeEstimationClass_Custom.getWorkTimeInNanoseconds());

timeEstimationClass_All.countingEnd();
timeEstimates.time_total = timeEstimationClass_All.getWorkTimeInNanoseconds();
  
}