当前位置: 首页>>代码示例>>C++>>正文


C++ KeyboardEvent::getKeyCode方法代码示例

本文整理汇总了C++中pcl::visualization::KeyboardEvent::getKeyCode方法的典型用法代码示例。如果您正苦于以下问题:C++ KeyboardEvent::getKeyCode方法的具体用法?C++ KeyboardEvent::getKeyCode怎么用?C++ KeyboardEvent::getKeyCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pcl::visualization::KeyboardEvent的用法示例。


在下文中一共展示了KeyboardEvent::getKeyCode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: keyboard_callback

void SimpleOpenNIViewer::keyboard_callback (const pcl::visualization::KeyboardEvent& event, void* cookie)
{

	unsigned char key = 0;
	

	string* message = (string*)cookie;
	cout << (*message) << " :: ";
	if (event.getKeyCode())
	{
		key = event.getKeyCode();
		//cout << "the key \'" << event.getKeyCode() << "\' (" << (int)event.getKeyCode() << ") was";
	}
	else
		;//cout << "the special key \'" << event.getKeySym() << "\' was";


	if (event.keyDown())
		;//cout << " pressed" << endl;
	else
	{
		if(key )
		{
			proc_key(key);

			//cout << " released" << endl;
			
		}

		
		

		
	}
}
开发者ID:dalek7,项目名称:Algorithms,代码行数:35,代码来源:openni_grabber.cpp

示例2: keyboardEventCloudViewer

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);
    }
  }
}
开发者ID:bbferka,项目名称:robosherlock,代码行数:26,代码来源:visualizer.cpp

示例3: atoi

    void 
    keyboard_callback (const pcl::visualization::KeyboardEvent& event, void* cookie)
    {
      AGASTDemo* obj = static_cast<AGASTDemo*> (cookie);
      
      if (event.getKeyCode ())
      {
        std::stringstream ss; ss << event.getKeyCode ();
        obj->detector_type_ = atoi (ss.str ().c_str ());
        return;
      }

      if (event.getKeySym () == "Up")
      {
        if (obj->threshold_ <= 0.9)
        {
          PCL_INFO ("[keyboard_callback] Increase AGAST threshold from %f to %f.\n", obj->threshold_, obj->threshold_ + 0.01);
          obj->threshold_ += 0.01;
          return;
        }
        PCL_INFO ("[keyboard_callback] Increase AGAST threshold from %f to %f.\n", obj->threshold_, obj->threshold_ + 1);
        obj->threshold_ += 1;
        return;
      }

      if (event.getKeySym () == "Down")
      {
        if (obj->threshold_ <= 0)
          return;
        if (obj->threshold_ <= 1)
        {
          PCL_INFO ("[keyboard_callback] Decrease AGAST threshold from %f to %f.\n", obj->threshold_, obj->threshold_ - 0.01);
          obj->threshold_ -= 0.01;
          return;
        }
        PCL_INFO ("[keyboard_callback] Decrease AGAST threshold from %f to %f.\n", obj->threshold_, obj->threshold_ - 1);
        obj->threshold_ -= 1;
        return;
      }

      if (event.getKeySym () == "Right")
      {
        PCL_INFO ("[keyboard_callback] Increase AGAST BMAX from %f to %f.\n", obj->bmax_, obj->bmax_ + 1);
        obj->bmax_ += 1;
        return;
      }

      if (event.getKeySym () == "Left")
      {
        if (obj->bmax_ <= 0)
          return;
        PCL_INFO ("[keyboard_callback] Decrease AGAST BMAX from %f to %f.\n", obj->bmax_, obj->bmax_ - 1);
        obj->bmax_ -= 1;
        return;
      }
    }
开发者ID:PointCloudLibrary,项目名称:pcl,代码行数:56,代码来源:ni_agast.cpp

示例4:

 void
 keyboard_callback (const pcl::visualization::KeyboardEvent& event, void* cookie)
 {
     string* message = static_cast<string*> (cookie);
     cout << (*message) << " :: ";
     if (event.getKeyCode ())
         cout << "the key \'" << event.getKeyCode () << "\' (" << event.getKeyCode () << ") was";
     else
         cout << "the special key \'" << event.getKeySym () << "\' was";
     if (event.keyDown ())
         cout << " pressed" << endl;
     else
         cout << " released" << endl;
 }
开发者ID:lloves,项目名称:PCL-1,代码行数:14,代码来源:openni_image.cpp

示例5: keyboardCallback

void Inspector::keyboardCallback(const pcl::visualization::KeyboardEvent& event, void* cookie)
{
  if(event.keyDown()) {
    if(event.getKeyCode() == 'm') {
      toggleModel();
    }
    else if(event.getKeyCode() == 'c') {
      pcd_vis_.removeAllShapes();
    }
    else if(event.getKeyCode() == 27) {
      quitting_ = true;
    }
  }
}
开发者ID:RaresAmbrus,项目名称:clams,代码行数:14,代码来源:inspect.cpp

示例6: switch

/** \brief callback function for the PCLvisualizer */
void
keyboard_callback (const pcl::visualization::KeyboardEvent &event, void *cookie)
{
    if (event.keyDown())
    {
        switch (event.getKeyCode())
        {
        case 27:
        case (int)'q':
        case (int)'Q':
        case (int)'e':
        case (int)'E':
            cout << "Exiting program" << endl;
            quit = true;
            break;
        case (int)'s':
        case (int)'S':
            cout << "Saving volume and cloud" << endl;
            save = true;
            break;
        default:
            break;
        }
    }
}
开发者ID:hitsjt,项目名称:StanfordPCL,代码行数:26,代码来源:record_tsdfvolume.cpp

示例7: switch

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;
    }
  }
}
开发者ID:Bardo91,项目名称:pcl,代码行数:31,代码来源:pcd_organized_edge_detection.cpp

示例8:

void 
keyboard_callback (const pcl::visualization::KeyboardEvent& event, void*)
{
  /// If SPACE is pressed, trigger new cloud callback (only works if framerate is set to 0)
  if (event.getKeyCode() == ' ' && grabber)
    grabber->trigger ();
}
开发者ID:Nerei,项目名称:pcl,代码行数:7,代码来源:image_grabber_viewer.cpp

示例9: keyboard_callback

 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;
     }
   }
 }
开发者ID:2php,项目名称:pcl,代码行数:34,代码来源:pcd_organized_multi_plane_segmentation.cpp

示例10: keyboardCallback

 void keyboardCallback(const pcl::visualization::KeyboardEvent &event, void *) {
     std::string special_key = event.getKeyCode() ? "" : "special ";
     if (event.keyDown())
         Logger::log(Logger::INFO, "The %skey %c was pressed.", special_key.c_str(), event.getKeyCode());
     else
         Logger::log(Logger::INFO, "The %skey %c was released.", special_key.c_str(), event.getKeyCode());
 }
开发者ID:leaveitout,项目名称:pcl_multithreaded_processing,代码行数:7,代码来源:CloudViewer.hpp

示例11: lock

 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 ());
     }
   }
 }
开发者ID:BITVoyager,项目名称:pcl,代码行数:17,代码来源:openni_klt.cpp

示例12: if

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 ();
  }
}
开发者ID:hobu,项目名称:pcl,代码行数:18,代码来源:obj_rec_ransac_accepted_hypotheses.cpp

示例13: switch

 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;
     }
   }
 }
开发者ID:Bardo91,项目名称:pcl,代码行数:16,代码来源:openni_grab_frame.cpp

示例14: sprintf

void
keyboardEventOccurred (const pcl::visualization::KeyboardEvent &event, void* stop_void)
{
  bool *stop;
  char *keyPressed = new char[50];

  // Copy the pressed key inside a var
  sprintf (keyPressed, "%c", event.getKeyCode ());
  stop = static_cast<bool *> (stop_void);

  // Check if 0 is pressed and return the value
  if (strpbrk ("0", keyPressed))
  {
    *stop = 1;
    //std::cout << "found " << *stop << std::endl;
  }
}
开发者ID:kasertim,项目名称:urban-environment-point-cloud,代码行数:17,代码来源:object_classification_v2.cpp

示例15: switch

 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;
         }
       }	
     }
开发者ID:FRC-Team-4143,项目名称:4143pclpyramid,代码行数:18,代码来源:4143pclpyramid.cpp


注:本文中的pcl::visualization::KeyboardEvent::getKeyCode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。