本文整理汇总了C++中pcl::visualization::KeyboardEvent::keyDown方法的典型用法代码示例。如果您正苦于以下问题:C++ KeyboardEvent::keyDown方法的具体用法?C++ KeyboardEvent::keyDown怎么用?C++ KeyboardEvent::keyDown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pcl::visualization::KeyboardEvent
的用法示例。
在下文中一共展示了KeyboardEvent::keyDown方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: showModel
void showModel(const pcl::visualization::KeyboardEvent &event, void* viewer_void)
{
boost::shared_ptr<visualization::PCLVisualizer> viewer = *static_cast<boost::shared_ptr<visualization::PCLVisualizer> *> (viewer_void);
if (event.getKeySym () == "m" && event.keyDown ())
{
if(show == true)
{
viewer->removeAllShapes();
show = false;
reshow = false;
}
else
{
show = true;
reshow = true;
}
}
if (event.getKeySym () == "b" && event.keyDown ())
{
if(skel == true)
{
viewer->removeAllShapes();
skel = false;
reshow = true;
}
else
{
viewer->removeAllShapes();
skel = true;
reshow = true;
}
}
}
示例2: keyboardEventOccurred
void keyboardEventOccurred (const pcl::visualization::KeyboardEvent &event, void* viewer_void)
{
if (event.getKeySym () == "r" && event.keyDown ())
{
boost::mutex::scoped_lock startLock(updateOnlineMutex);
std::cout << "r was pressed => starting construction " << std::endl;
PointCloud<pcl::PointXYZRGB>::Ptr deep_copy (new PointCloud<pcl::PointXYZRGB>( *onlineView ) );
if(noFrames == 0)
{
cloudA = deep_copy;
boost::thread workerThread(alignFrames);
cout << "Started recording --> " << endl;
start = true;
}
noFrames++;
startLock.unlock();
}else if (event.getKeySym () == "p" && event.keyDown ())
{
stop = true;
condQ.notify_one();
//surfaceConst.fastTranguilation(global);
}else if(event.getKeySym() == "s" && event.keyDown())
{
boost::mutex::scoped_lock saveLock(updateOnlineMutex);
std::cout << "s was pressed => saving" << std::endl;
PointCloud<pcl::PointXYZRGB>::Ptr deep_copy (new PointCloud<pcl::PointXYZRGB>( *onlineView ) );
std::stringstream tmp;
tmp << noFrames << ".pcd";
pcl::io::savePCDFileBinary(tmp.str() , *deep_copy);
noFrames++;
saveLock.unlock();
}
}
示例3:
void
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);
if(event.getKeySym() == "d" && event.keyDown())
cout << "d";
if(event.getKeySym() == "n" && event.keyDown())
viewer->removeAllPointClouds();
}
示例4: chCameraViewPoint
// change camera view point
void chCameraViewPoint (const pcl::visualization::KeyboardEvent &event, void* viewer_void)
{
boost::shared_ptr<visualization::PCLVisualizer> viewer = *static_cast<boost::shared_ptr<visualization::PCLVisualizer> *> (viewer_void);
if (event.getKeySym () == "a" && event.keyDown ())
viewer->setCameraPosition(camera_left[0], camera_left[1], camera_left[2], camera_left[3], camera_left[4], camera_left[5]);
if (event.getKeySym () == "s" && event.keyDown ())
viewer->setCameraPosition(camera_front[0], camera_front[1], camera_front[2], camera_front[3], camera_front[4], camera_front[5]);
if (event.getKeySym () == "d" && event.keyDown ())
viewer->setCameraPosition(camera_right[0], camera_right[1], camera_right[2], camera_right[3], camera_right[4], camera_right[5]);
}
示例5: keyboardEventOccurred
void keyboardEventOccurred (const pcl::visualization::KeyboardEvent &event, void* viewer_void)
{
if ( (event.getKeySym () == "r" || event.getKeySym () == "R") && event.keyDown ())
{
cout << "r was pressed => change between regular/graph representation" << endl;
graphRepresentation = !graphRepresentation;
}
else if ( (event.getKeySym () == "p" || event.getKeySym () == "P") && event.keyDown ())
showPointCloud = !showPointCloud;
else if ( (event.getKeySym () == "l" || event.getKeySym () == "L") && event.keyDown ())
showPbMap = !showPbMap;
}
示例6: myCallback
void myCallback (const pcl::visualization::KeyboardEvent& event, void* cookie)
{
if(event.getKeySym () == "q" && event.keyDown ())
{
pressedQ=true;
}
else if(event.getKeySym () == "a" && event.keyDown ())
{
pressedA=true;
}
else
return;
}
示例7: 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());
}
示例8:
void
KeyboardEventOccurred(const pcl::visualization::KeyboardEvent &event, void * data)
{
R200Grabber * g = (R200Grabber*)data;
std::shared_ptr<DSAPI> p = g->getDSAPI();
if(event.keyDown())
{
if(event.getKeySym() == "o")
{
p->accessHardware()->setDepthControlParameters(DSGetDepthControlPreset(DS_DEPTHCONTROL_PRESET_OFF));
std::cout << "activated DS_DEPTHCONTROL_PRESET_OFF" << std::endl;
}
if(event.getKeySym() == "p")
{
p->accessHardware()->setDepthControlParameters(DSGetDepthControlPreset(DS_DEPTHCONTROL_PRESET_LOW));
std::cout << "activated DS_DEPTHCONTROL_PRESET_LOW" << std::endl;
}
if(event.getKeySym() == "k")
{
p->accessHardware()->setDepthControlParameters(DSGetDepthControlPreset(DS_DEPTHCONTROL_PRESET_MEDIUM));
std::cout << "activated DS_DEPTHCONTROL_PRESET_MEDIUM" << std::endl;
}
if(event.getKeySym() == "l")
{
p->accessHardware()->setDepthControlParameters(DSGetDepthControlPreset(DS_DEPTHCONTROL_PRESET_HIGH));
std::cout << "activated DS_DEPTHCONTROL_PRESET_HIGH" << std::endl;
}
if(event.getKeySym() == "m")
{
p->accessHardware()->setDepthControlParameters(DSGetDepthControlPreset(DS_DEPTHCONTROL_PRESET_OPTIMIZED));
std::cout << "activated DS_DEPTHCONTROL_PRESET_OPTIMIZED" << std::endl;
}
}
}
示例9: keyboardEventOccurred
void keyboardEventOccurred (const pcl::visualization::KeyboardEvent &event, void* viewer_void)
{
if ( (event.getKeySym () == "r" || event.getKeySym () == "R") && event.keyDown ())
{
graphRepresentation = !graphRepresentation;
}
}
示例10: 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;
}
}
}
示例11: keyboardEventOccurred
void keyboardEventOccurred (const pcl::visualization::KeyboardEvent &event, void* cookie)
{
if (event.getKeySym () == "space" && event.keyDown ()) // Save annotation file
{
viewer->spinOnce();
}
}
示例12: keyboard_cb
void keyboard_cb(const pcl::visualization::KeyboardEvent &event, void* viewer_void) {
if (event.getKeySym () == "q" && event.keyDown ()) {
std::cout << "Exiting." << std::endl;
viewer.close();
}
if (event.getKeySym () == "s" && event.keyDown ()) {
if (running) {
running = false;
std::cout << "Stopping modelling." << std::endl;
} else {
running = true;
std::cout << "Starting modelling." << std::endl;
}
}
}
示例13:
void
keyboardEventOccurred (const pcl::visualization::KeyboardEvent& event,
void* nothing)
{
if (event.getKeySym () == "space" && event.keyDown ())
next_iteration = true;
}
示例14:
void
KeyboardEventOccurred(const pcl::visualization::KeyboardEvent &event, void * data)
{
std::string pressed;
pressed = event.getKeySym();
PlySaver * s = (PlySaver*)data;
if(event.keyDown())
{
if(pressed == "s")
{
pcl::PLYWriter writer;
std::chrono::high_resolution_clock::time_point p = std::chrono::high_resolution_clock::now();
std::string now = std::to_string((long)std::chrono::duration_cast<std::chrono::milliseconds>(p.time_since_epoch()).count());
cv::Mat color;
for(size_t i = 0; i < s->kinects_.size(); ++i){
writer.write ("cloud_"+ std::to_string(i) + "_" + now + ".ply", *(s->clouds_[i]), s->binary_, s->use_camera_);
s->kinects_[i]->getColor(color);
cv::imwrite("color_" + std::to_string(i) + "_" + now + ".jpg", color);
}
std::cout << "saved " << "cloud and color " + now << std::endl;
}
if(pressed == "x")
{
for(auto & k : s->kinects_){
k->storeParameters();
}
std::cout << "stored calibration parameters" << std::endl;
}
}
}
示例15: 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;
}
}
}