pcl
pcl copied to clipboard
[io] `OctreePointCloudCompression` only supports types pre-baked in `io/src/compression.cpp`
System: Ubuntu18.04LTS PCL1.9.1 I am compiling the source file in the tutorial pcl-pcl-1.9.1/doc/tutorials/content/sources/point_cloud_compression. By default it works well. The readthedocs said the compression supports any point types, but when I want to compress the point type pcl::PointXYZI, then it goes wrong when I am executing 'make'. The error message is as follows, How to compress pcl::PointXYZI?
CMakeFiles/point_cloud_compression.dir/point_cloud_compression.cpp.o: In function `SimpleOpenNIViewer::cloud_cb_(boost::shared_ptr<pcl::PointCloud<pcl::PointXYZI> const> const&)':
point_cloud_compression.cpp:(.text._ZN18SimpleOpenNIViewer9cloud_cb_ERKN5boost10shared_ptrIKN3pcl10PointCloudINS2_9PointXYZIEEEEE[_ZN18SimpleOpenNIViewer9cloud_cb_ERKN5boost10shared_ptrIKN3pcl10PointCloudINS2_9PointXYZIEEEEE]+0xb7): undefined reference to `pcl::io::OctreePointCloudCompression<pcl::PointXYZI, pcl::octree::OctreeContainerPointIndices, pcl::octree::OctreeContainerEmpty, pcl::octree::Octree2BufBase<pcl::octree::OctreeContainerPointIndices, pcl::octree::OctreeContainerEmpty> >::encodePointCloud(boost::shared_ptr<pcl::PointCloud<pcl::PointXYZI> const> const&, std::ostream&)'
point_cloud_compression.cpp:(.text._ZN18SimpleOpenNIViewer9cloud_cb_ERKN5boost10shared_ptrIKN3pcl10PointCloudINS2_9PointXYZIEEEEE[_ZN18SimpleOpenNIViewer9cloud_cb_ERKN5boost10shared_ptrIKN3pcl10PointCloudINS2_9PointXYZIEEEEE]+0xdb): undefined reference to `pcl::io::OctreePointCloudCompression<pcl::PointXYZI, pcl::octree::OctreeContainerPointIndices, pcl::octree::OctreeContainerEmpty, pcl::octree::Octree2BufBase<pcl::octree::OctreeContainerPointIndices, pcl::octree::OctreeContainerEmpty> >::decodePointCloud(std::istream&, boost::shared_ptr<pcl::PointCloud<pcl::PointXYZI> >&)'
CMakeFiles/point_cloud_compression.dir/point_cloud_compression.cpp.o:(.data.rel.ro._ZTVN3pcl2io27OctreePointCloudCompressionINS_9PointXYZIENS_6octree27OctreeContainerPointIndicesENS3_20OctreeContainerEmptyENS3_14Octree2BufBaseIS4_S5_EEEE[_ZTVN3pcl2io27OctreePointCloudCompressionINS_9PointXYZIENS_6octree27OctreeContainerPointIndicesENS3_20OctreeContainerEmptyENS3_14Octree2BufBaseIS4_S5_EEEE]+0x20): undefined reference to `pcl::io::OctreePointCloudCompression<pcl::PointXYZI, pcl::octree::OctreeContainerPointIndices, pcl::octree::OctreeContainerEmpty, pcl::octree::Octree2BufBase<pcl::octree::OctreeContainerPointIndices, pcl::octree::OctreeContainerEmpty> >::serializeTreeCallback(pcl::octree::OctreeContainerPointIndices&, pcl::octree::OctreeKey const&)'
CMakeFiles/point_cloud_compression.dir/point_cloud_compression.cpp.o:(.data.rel.ro._ZTVN3pcl2io27OctreePointCloudCompressionINS_9PointXYZIENS_6octree27OctreeContainerPointIndicesENS3_20OctreeContainerEmptyENS3_14Octree2BufBaseIS4_S5_EEEE[_ZTVN3pcl2io27OctreePointCloudCompressionINS_9PointXYZIENS_6octree27OctreeContainerPointIndicesENS3_20OctreeContainerEmptyENS3_14Octree2BufBaseIS4_S5_EEEE]+0x28): undefined reference to `pcl::io::OctreePointCloudCompression<pcl::PointXYZI, pcl::octree::OctreeContainerPointIndices, pcl::octree::OctreeContainerEmpty, pcl::octree::Octree2BufBase<pcl::octree::OctreeContainerPointIndices, pcl::octree::OctreeContainerEmpty> >::deserializeTreeCallback(pcl::octree::OctreeContainerPointIndices&, pcl::octree::OctreeKey const&)'
collect2: error: ld returned 1 exit status
CMakeFiles/point_cloud_compression.dir/build.make:323: recipe for target 'point_cloud_compression' failed
make[2]: *** [point_cloud_compression] Error 1
CMakeFiles/Makefile2:94: recipe for target 'CMakeFiles/point_cloud_compression.dir/all' failed
make[1]: *** [CMakeFiles/point_cloud_compression.dir/all] Error 2
Makefile:102: recipe for target 'all' failed
make: *** [all] Error 2
Hi @synsin0 PCL by default presumes you're using limited point types (else the library would get quite large). You can see that in io/src/compression.cpp
For custom extensions, please define PCL_NO_PRECOMPILE
before including the relevant header(s)
Hello, I add the macro PCL_NO_PRECOMPILE before all the header but the problems are as usual. I add the line as follow:
#define PCL_NO_PRECOMPILE
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/io/openni_grabber.h>
#include <pcl/visualization/cloud_viewer.h>
#include <pcl/compression/octree_pointcloud_compression.h>
but the error is like following:
CMakeFiles/point_cloud_compression.dir/point_cloud_compression.cpp.o: In function `SimpleOpenNIViewer::cloud_cb_(boost::shared_ptr<pcl::PointCloud<pcl::PointXYZI> const> const&)':
point_cloud_compression.cpp:(.text._ZN18SimpleOpenNIViewer9cloud_cb_ERKN5boost10shared_ptrIKN3pcl10PointCloudINS2_9PointXYZIEEEEE[_ZN18SimpleOpenNIViewer9cloud_cb_ERKN5boost10shared_ptrIKN3pcl10PointCloudINS2_9PointXYZIEEEEE]+0xb7): undefined reference to `pcl::io::OctreePointCloudCompression<pcl::PointXYZI, pcl::octree::OctreeContainerPointIndices, pcl::octree::OctreeContainerEmpty, pcl::octree::Octree2BufBase<pcl::octree::OctreeContainerPointIndices, pcl::octree::OctreeContainerEmpty> >::encodePointCloud(boost::shared_ptr<pcl::PointCloud<pcl::PointXYZI> const> const&, std::ostream&)'
point_cloud_compression.cpp:(.text._ZN18SimpleOpenNIViewer9cloud_cb_ERKN5boost10shared_ptrIKN3pcl10PointCloudINS2_9PointXYZIEEEEE[_ZN18SimpleOpenNIViewer9cloud_cb_ERKN5boost10shared_ptrIKN3pcl10PointCloudINS2_9PointXYZIEEEEE]+0xdb): undefined reference to `pcl::io::OctreePointCloudCompression<pcl::PointXYZI, pcl::octree::OctreeContainerPointIndices, pcl::octree::OctreeContainerEmpty, pcl::octree::Octree2BufBase<pcl::octree::OctreeContainerPointIndices, pcl::octree::OctreeContainerEmpty> >::decodePointCloud(std::istream&, boost::shared_ptr<pcl::PointCloud<pcl::PointXYZI> >&)'
CMakeFiles/point_cloud_compression.dir/point_cloud_compression.cpp.o:(.data.rel.ro._ZTVN3pcl2io27OctreePointCloudCompressionINS_9PointXYZIENS_6octree27OctreeContainerPointIndicesENS3_20OctreeContainerEmptyENS3_14Octree2BufBaseIS4_S5_EEEE[_ZTVN3pcl2io27OctreePointCloudCompressionINS_9PointXYZIENS_6octree27OctreeContainerPointIndicesENS3_20OctreeContainerEmptyENS3_14Octree2BufBaseIS4_S5_EEEE]+0x20): undefined reference to `pcl::io::OctreePointCloudCompression<pcl::PointXYZI, pcl::octree::OctreeContainerPointIndices, pcl::octree::OctreeContainerEmpty, pcl::octree::Octree2BufBase<pcl::octree::OctreeContainerPointIndices, pcl::octree::OctreeContainerEmpty> >::serializeTreeCallback(pcl::octree::OctreeContainerPointIndices&, pcl::octree::OctreeKey const&)'
CMakeFiles/point_cloud_compression.dir/point_cloud_compression.cpp.o:(.data.rel.ro._ZTVN3pcl2io27OctreePointCloudCompressionINS_9PointXYZIENS_6octree27OctreeContainerPointIndicesENS3_20OctreeContainerEmptyENS3_14Octree2BufBaseIS4_S5_EEEE[_ZTVN3pcl2io27OctreePointCloudCompressionINS_9PointXYZIENS_6octree27OctreeContainerPointIndicesENS3_20OctreeContainerEmptyENS3_14Octree2BufBaseIS4_S5_EEEE]+0x28): undefined reference to `pcl::io::OctreePointCloudCompression<pcl::PointXYZI, pcl::octree::OctreeContainerPointIndices, pcl::octree::OctreeContainerEmpty, pcl::octree::Octree2BufBase<pcl::octree::OctreeContainerPointIndices, pcl::octree::OctreeContainerEmpty> >::deserializeTreeCallback(pcl::octree::OctreeContainerPointIndices&, pcl::octree::OctreeKey const&)'
collect2: error: ld returned 1 exit status
CMakeFiles/point_cloud_compression.dir/build.make:323: recipe for target 'point_cloud_compression' failed
make[2]: *** [point_cloud_compression] Error 1
CMakeFiles/Makefile2:94: recipe for target 'CMakeFiles/point_cloud_compression.dir/all' failed
make[1]: *** [CMakeFiles/point_cloud_compression.dir/all] Error 2
Makefile:102: recipe for target 'all' failed
make: *** [all] Error 2
Did you perform a clean rebuild?
Well, I have deleted all the cmake files and rebuild, the errors are as usual. By the way, pcl::PointXYZI is defined officially in point_types.h, it is not a customed type.
Sorry if I implies XYZI was a custom type. I meant types that the library authors considered as uncommon
I understand what you mean, now my problem is like that: now that I have written #define PCL_NO_PRECOMPILE and cleanly rebuild, but the compression still does not support point type pcl::PointXYZI. You may test it in docs/tutorials/content/sources/point_cloud_compression by changing all pcl::PointXYZRGBA into pcl::PointXYZI.
The thing is that octree_pointcloud_compression.h does not use PCL_NO_PRECOMPILE
(no conditional include of octree_pointcloud_compression.hpp), like other files do. @kunaltyagi Perhaps we should change that. @synsin0 For now, you can try to include both the .h and the .hpp file, although I am not sure if the compression algorithm works for PointXYZI.
@synsin0 if you're able to test the PCL from my PR (or the branch on my fork), please see if this fixes part of the issue.
If you're unable, I'll test it, but I have limited cycles till Dec 15th
Hi, i realise that this was a while ago, but was this ever resolved? I am also looking to perform octree compression on the XYZI type. Is this even possible within PCL?
Hi, i realise that this was a while ago, but was this ever resolved? I am also looking to perform octree compression on the XYZI type. Is this even possible within PCL?
Hi, there is one pull request, but it had no further update after 11/2020. I am also facing this issue in my own project, and I am currently doing the compression using XYZRGB type, by storing the intensity(uint8 in my case) into the R value. I would also appreciate it, if XYZI type could be supported in the future.
@Yuchen-Tao I did the same thing! So hopefully its not too bad of a work around
Currently only PointXYZ, PointXYZRGB, and PointXYZRGBA are supported. To support PointXYZI, we would need something similar to ColorCoding
, ideally something generic that works for other fields than just intensity.
Storing the intensity into R
seems like a good workaround.
Hi @mvieth and @Yuchen-Tao , I am wondering if the issue that PointXYZI type cannot be compressed has been solved?
And in which file can I store the intensity into R
. I only peek into the octree_pointcloud_compressed.hpp
, and cannot find deeper info. Thank you.
@oldtimerzhy The situation is still the same: nobody implemented compression for PointXYZI yet. "Storing the intensity into R" means using PointXYZRGB or PointXYZRGBA instead of PointXYZI, and copying the intensity value into the red (r
) field of PointXYZRGB or PointXYZRGBA
@mvieth thanks for the kindly and quickly responsing! I got the idea that "storing the intensity into R", however I have tried some times to realize it but failed.
I modified in point_types.hpp as following:
struct EIGEN_ALIGN16 _PointXYZRGB
{
PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
//PCL_ADD_INTENSITY_8U;
std::uint8_t intensity;
PCL_ADD_RGB;
PCL_MAKE_ALIGNED_OPERATOR_NEW
};
You can see I try to add "PCL_ADD_INTENSITY_8U
" or just "std::uint8_t intensity
" in _PointXYZRGB struct. Meanwhile, I also modified the constructor in PointXYZRGB struct ccorrespondingly. However, when using loadPCDFile
, the new type of PointXYZRGB
cannot fetch the intensity value. (for avoiding some data error, I have used PointXYZI
type to load the same file, intensity value can be shown).
According to above, in conversions.h
, I print the field.name when "converting message to template point cloud". There is no name of intensity compared to PointXYZI
. It seems that, my changing in PointXYZRGB
is not "registered".
Have you meet such problems or maybe you have better solution? :)