简体   繁体   English

从pcl注册中抑制cout输出

[英]Suppress cout output from pcl registration

From this question: Redirecting function output to /dev/null I have tried to employ the following code: 从这个问题: 重定向函数输出到/ dev / null我试图使用以下代码:

 std::ofstream catchPCLStream("/dev/null");
 std::streambuf *originalOutputBuffer = std::cout.rdbuf();
 std::cout.rdbuf(catchPCLStream.rdbuf());
 std::cerr.rdbuf(catchPCLStream.rdbuf());

 icp_.align(dataCloudTransformedByIcp_, icpInternalUpdatePose_);

 std::cout.rdbuf(originalOutputBuffer);
 std::cerr.rdbuf(originalOutputBuffer);

But I still get a huge amount of output from the registration library: 但是我仍然从注册库中获得了大量的输出:

[pcl::IterativeClosestPoint::computeTransformation] Not enough correspondences found. Relax your threshold parameters.

Is there something different about this output that stops it from being caught by this? 这个输出有什么不同之处可以阻止它被它捕获吗? Is it not going to cout or cerr ? 是不是要coutcerr

Due to the multi-threaded nature of PCL, the standard pipe cout and cerr away wont work. 由于PCL的多线程性质,标准管道coutcerr不会工作。 Instead you need to use the in-built functions provided by PCL to turn off the console printing. 相反,您需要使用PCL提供的内置功能来关闭控制台打印。

Using the command: 使用命令:

pcl::console::setVerbosityLevel(pcl::console::L_ALWAYS)

Will turn everything off. 会把一切都关掉。 There are also other levels and more information can be found on the pcl::console namespace page: 还有其他级别,可以在pcl::console命名空间页面上找到更多信息:

http://docs.pointclouds.org/trunk/a02895.html#a1c1202ab693383b98842cb4f72ae625c http://docs.pointclouds.org/trunk/a02895.html#a1c1202ab693383b98842cb4f72ae625c

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM