本文整理汇总了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;
}
}
}
示例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);
}
}
}
示例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;
}
}
示例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;
}
示例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;
}
}
}
示例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;
}
}
}
示例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;
}
}
}
示例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 ();
}
示例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;
}
}
}
示例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());
}
示例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 ());
}
}
}
示例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 ();
}
}
示例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;
}
}
}
示例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;
}
}
示例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;
}
}
}