Пример #1
0
void 
keyboard_callback (const pcl::visualization::KeyboardEvent& event, void*)
{
  double opacity;
  if (event.keyUp())
  {
    switch (event.getKeyCode())
    {
      case '1':
        viewer.getPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_OPACITY, opacity, "nan boundary edges");
        viewer.setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_OPACITY, 1.0-opacity, "nan boundary edges");
        break;
      case '2':
        viewer.getPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_OPACITY, opacity, "occluding edges");
        viewer.setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_OPACITY, 1.0-opacity, "occluding edges");
        break;
      case '3':
        viewer.getPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_OPACITY, opacity, "occluded edges");
        viewer.setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_OPACITY, 1.0-opacity, "occluded edges");
        break;
      case '4':
        viewer.getPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_OPACITY, opacity, "high curvature edges");
        viewer.setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_OPACITY, 1.0-opacity, "high curvature edges");
        break;
      case '5':
        viewer.getPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_OPACITY, opacity, "rgb edges");
        viewer.setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_OPACITY, 1.0-opacity, "rgb edges");
        break;
    }
  }
}
 void keyboard_callback (const pcl::visualization::KeyboardEvent& event, void*)
 {
   // do stuff and visualize here
   if (event.keyUp ())
   {
     switch (event.getKeyCode ())
     {
       case 'b':
       case 'B':
         if (threshold_ < 0.1f)
           threshold_ += 0.001f;
         process ();
         break;
       case 'v':
       case 'V':
         if (threshold_ > 0.001f)
           threshold_ -= 0.001f;
         process ();
         break;
         
       case 'n':
       case 'N':
         depth_dependent_ = !depth_dependent_;
         process ();
         break;
         
       case 'm':
       case 'M':
         polygon_refinement_ = !polygon_refinement_;
         process ();
         break;
     }
   }
 }
void keyboardCallback(const pcl::visualization::KeyboardEvent &event) {
	if(event.getKeySym() == "v" && event.keyUp()) {
		std::cout << "Saving...";
		pcl::io::savePCDFile("capture.pcd", *cloud);
		std::cout << "done" << std::endl;
	}
}
Пример #4
0
void Visualizer::keyboardEventCloudViewer(const pcl::visualization::KeyboardEvent &event, void *)
{
  if(event.keyUp())
  {
    if(event.getKeySym() == "Left")
    {
      nextAnnotator();
    }
    else if(event.getKeySym() == "Right")
    {
      prevAnnotator();
    }
    else if(event.getKeySym() == "Escape")
    {
      shutdown();
    }
    else if(event.getKeySym() == "Insert")
    {
      save = true;
    }
    else if(event.getKeyCode() > 0)
    {
      callbackKeyHandler(event.getKeyCode(), DrawingAnnotator::CLOUD_VIEWER);
    }
  }
}
Пример #5
0
//---------------------------------------------------------------------------------------------------------------------
void Gui::keyboardEventOccurred(const pcl::visualization::KeyboardEvent &_event, void* _viewer_void){
	boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer = *static_cast<boost::shared_ptr<pcl::visualization::PCLVisualizer> *> (_viewer_void);
	std::cout << _event.getKeySym() << " was pressed";
	if ((_event.getKeySym() == "1") && _event.keyUp()) {
		std::cout << " => guess visualization toggled" << std::endl;
		mShowGuess = !mShowGuess;
	}
	if ((_event.getKeySym() == "2") && _event.keyUp()) {
		std::cout << " => icp result visualization toggled" << std::endl;
		mShowIcpResult = !mShowIcpResult;
	}
	if ((_event.getKeySym() == "3") && _event.keyUp()) {
		std::cout << " => candidate visualization toggled" << std::endl;
		mShowCandidates = !mShowCandidates;
	} else {
		std::cout << std::endl;
	}
}
void
keyboardCB (const pcl::visualization::KeyboardEvent &event, void* params_void)
{
  CallbackParameters* params = static_cast<CallbackParameters*> (params_void);

  if (event.getKeyCode () == 13 /*enter*/ && event.keyUp ())
    update (params);
  else if ( event.getKeyCode () == '1' && event.keyUp () )
  {
    // Switch models visibility
    params->show_models_ = !params->show_models_;

    for ( list<vtkActor*>::iterator it = params->model_actors_.begin () ; it != params->model_actors_.end () ; ++it )
      (*it)->SetVisibility (static_cast<int> (params->show_models_));

    params->viz_.getRenderWindow ()->Render ();
  }
}
Пример #7
0
void keyboardCB (const pcl::visualization::KeyboardEvent &event, void* params_void)
{
    CallbackParameters* params = static_cast<CallbackParameters*> (params_void);

    if (event.getKeySym () == "Left" && event.keyUp ())
    {
        if (params->leaf_ == params->octree_.getFullLeaves ().begin ())
            params->leaf_ = params->octree_.getFullLeaves ().end ();

        updateViewer(params->octree_, params->viz_, --params->leaf_);
    }
    else if (event.getKeySym () == "Right" && event.keyUp ())
    {
        ++params->leaf_;
        if (params->leaf_ == params->octree_.getFullLeaves ().end ())
            params->leaf_ = params->octree_.getFullLeaves ().begin ();

        updateViewer (params->octree_, params->viz_, params->leaf_);
    }
}
Пример #8
0
 void 
 keyboard_callback (const pcl::visualization::KeyboardEvent& event, void*)
 {
   if (event.keyUp ())
   {
     switch (event.getKeyCode ())
     {
       case 27:
       case 'Q':
       case 'q': quit_ = true; visualizer_->close ();
         break;
       case ' ': continuous_ = !continuous_;
         break;
     }
   }
 }
Пример #9
0
 void
 keyboard_callback (const pcl::visualization::KeyboardEvent& event, void*)
 {
   static pcl::PCDWriter writer;
   static std::ostringstream frame;
   if (event.keyUp ())
   {
     if ((event.getKeyCode () == 's') || (event.getKeyCode () == 'S'))
     {
       boost::mutex::scoped_lock lock (cloud_mutex_);
       frame.str ("frame-");
       frame << boost::posix_time::to_iso_string (boost::posix_time::microsec_clock::local_time ()) << ".pcd";
       writer.writeBinaryCompressed (frame.str (), *cloud_);
       PCL_INFO ("Written cloud %s.\n", frame.str ().c_str ());
     }
   }
 }
 void
     keyboard_callback (const pcl::visualization::KeyboardEvent& event, void *)
     {
       if (event.keyUp ())
       {
         switch (event.getKeyCode())
         {
           case 's':
           case 'S':
             saveCloud = true; // save pcd file
             break;
           case 't':
           case 'T':
             ++toggleView  %= 2; 
             break;
         }
       }	
     }
Пример #11
0
 static void 
 keyboardCallback(const pcl::visualization::KeyboardEvent &e, void *cookie)
 {
   OpenNIShoter* recorder = reinterpret_cast<OpenNIShoter*> (cookie);
   
   int key = e.getKeyCode ();
   
   if (e.keyUp())
   {
     if ((key == 'q') || (key == 'Q'))
     {
       recorder->exit_ = true;
     }
     else if ((key == 's') || (key == 'S'))
     {
       recorder->get_image_ = true;
     }
   }
 }
Пример #12
0
/** \brief Callback for setting options in the visualizer via keyboard.
 *  \param[in] event Registered keyboard event  */
void 
keyboard_callback (const pcl::visualization::KeyboardEvent& event, void*)
{
  int key = event.getKeyCode ();
  
  if (event.keyUp ())    
    switch (key)
    {
      case (int)'1': show_voxel_centroids = !show_voxel_centroids; break;
      case (int)'2': show_supervoxels = !show_supervoxels; break;
      case (int)'3': show_graph = !show_graph; break;
      case (int)'4': show_normals = !show_normals; break;
      case (int)'5': show_supervoxel_normals = !show_supervoxel_normals; break;
      case (int)'0': show_refined = !show_refined; break;
      case (int)'h': case (int)'H': show_help = !show_help; break;
      default: break;
    }
    
}
Пример #13
0
void ICCVTutorial<FeatureType>::keyboard_callback (const pcl::visualization::KeyboardEvent& event, void*)
{
  if (event.keyUp())
  {
    switch (event.getKeyCode())
    {
      case '1':
        if (!visualizer_.removePointCloud("source_points"))
        {
          visualizer_.addPointCloud(source_, "source_points");
        }
        break;

      case '2':
        if (!visualizer_.removePointCloud("target_points"))
        {
          visualizer_.addPointCloud(target_, "target_points");
        }
        break;

      case '3':
        if (!visualizer_.removePointCloud("source_segmented"))
        {
          visualizer_.addPointCloud(source_segmented_, "source_segmented");
        }
        break;

      case '4':
        if (!visualizer_.removePointCloud("target_segmented"))
        {
          visualizer_.addPointCloud(target_segmented_, "target_segmented");
        }
        break;

      case '5':
        if (!visualizer_.removePointCloud("source_keypoints"))
        {
          pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZI> keypoint_color (source_keypoints_, 0, 0, 255);
          //pcl::visualization::PointCloudColorHandlerGenericField<pcl::PointXYZI> keypoint_color (source_keypoints_, "intensity");
          visualizer_.addPointCloud(source_keypoints_, keypoint_color, "source_keypoints");
        }
        break;

      case '6':
        if (!visualizer_.removePointCloud("target_keypoints"))
        {
          //pcl::visualization::PointCloudColorHandlerGenericField<pcl::PointXYZI> keypoint_color (target_keypoints_, "intensity");
          pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZI> keypoint_color (target_keypoints_, 255, 0, 0);
          visualizer_.addPointCloud(target_keypoints_, keypoint_color, "target_keypoints");
        }
        break;

      case '7':
        if (!show_source2target_)
          visualizer_.addCorrespondences<pcl::PointXYZI>(source_keypoints_, target_keypoints_, source2target_, "source2target");
        else
          visualizer_.removeCorrespondences("source2target");

        show_source2target_ = !show_source2target_;
        break;

      case '8':
        if (!show_target2source_)
          visualizer_.addCorrespondences<pcl::PointXYZI>(target_keypoints_, source_keypoints_, target2source_, "target2source");
        else
          visualizer_.removeCorrespondences("target2source");

        show_target2source_ = !show_target2source_;
        break;

      case '9':
        if (!show_correspondences)
          visualizer_.addCorrespondences<pcl::PointXYZI>(source_keypoints_, target_keypoints_, *correspondences_, "correspondences");
        else
          visualizer_.removeCorrespondences("correspondences");
        show_correspondences = !show_correspondences;
        break;

      case 'i':
      case 'I':
        if (!visualizer_.removePointCloud("transformed"))
          visualizer_.addPointCloud(source_transformed_, "transformed");
        break;

      case 'r':
      case 'R':
        if (!visualizer_.removePointCloud("registered"))
          visualizer_.addPointCloud(source_registered_, "registered");
        break;

      case 't':
      case 'T':
          visualizer_.addPolygonMesh(surface_, "surface");
        break;
    }
  }
}
Пример #14
0
void
keyboardCB (const pcl::visualization::KeyboardEvent &event, void* params_void)
{
  if (event.getKeyCode () == 13 /*enter*/ && event.keyUp ())
    update (static_cast<CallbackParameters*> (params_void));
}