我想将使用 PCL API 的 PCLHistogramVisualizer 获得的相同图像保存在文件中。
这是我需要在点 [0] 处保存的带有直方图的变量。
pcl::PointCloud<Histogram<100> > hist;
我认为这可以通过使用来完成
pcl::io::savePNGFile(path, *hist);
但这是我得到的错误
warning: ‘void pcl::io::savePNGFile(const string&, const pcl::PointCloud<PointT>&) [with T = pcl::Histogram<50>, std::string = std::basic_string<char>]’ is deprecated (declared at /usr/local/include/pcl-1.7/pcl/io/png_io.h:123): pcl::io::savePNGFile<typename T> (file_name, cloud) is deprecated, please use a new generic function pcl::io::savePNGFile (file_name, cloud, field_name) with "rgb" as the field name. [-Wdeprecated-declarations]
/usr/local/include/pcl-1.7/pcl/io/png_io.h:129:9: error: ‘const struct pcl::Histogram<50>’ has no member named ‘r’
/usr/local/include/pcl-1.7/pcl/io/png_io.h:130:9: error: ‘const struct pcl::Histogram<50>’ has no member named ‘g’
/usr/local/include/pcl-1.7/pcl/io/png_io.h:131:9: error: ‘const struct pcl::Histogram<50>’ has no member named ‘b’
所以我不能这样做,因为它没有任何 rgb 字段,但我真的需要保存大量的直方图,我不能一直截图。
最佳答案
我推荐你使用PCL mailing list对于那个具体问题。开发人员很可能会在那里回答。
关于c++ - 如何将 pcl::Histogram 保存为 PNG 或 JPG 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21663770/