点云库中从专有格式转换为浮点数;没有找到匹配的函数
我有一个关于 点云库 从专有数据类型到浮点数的转换的相当基本的问题。我认为我的问题来自于缺乏模板、数据类型和 C++ 的经验。
执行此转换的函数是 copyToFloatArray,文档中定义为:
virtual void pcl::DefaultPointRepresentation< FPFHSignature33 >::copyToFloatArray ( const FPFHSignature33 & p, 浮动 * 出
) const [内联、虚拟]将点数据从输入点复制到浮点数组。
必须在所有子类中重写此方法。
参数:
p 输入点
out 指向浮点数组的指针。
实现 pcl::PointRepresentation< FPFHSignature33>.
我尝试按如下方式实现它:
pcl::PointCloud<pcl::FPFHSignature33>::Ptr fpfhs (new pcl::PointCloud<pcl::FPFHSignature33> ());
// populate fpfh...
float **myArray;
pcl::DefaultPointRepresentation< pcl::FPFHSignature33 >::copyToFloatArray ( &fpfhs, &**myArray);
编译时抛出的错误如下:
/home/bc/PCL/pcd_read.cpp: In function ‘int main(int, char**)’:
/home/bc/PCL/pcd_read.cpp:68: error: no matching function for call to
‘pcl::DefaultPointRepresentation<pcl::FPFHSignature33>::copyToFloatArray(boost::shared_ptr<pcl::PointCloud<pcl::FPFHSignature33> >*, float*)’
/usr/include/pcl-1.2/pcl/point_representation.h:254: note: candidates are:
virtual void pcl::DefaultPointRepresentation<pcl::FPFHSignature33>::copyToFloatArray(const pcl::FPFHSignature33&, float*) const
make[2]: *** [CMakeFiles/pcd_read.dir/pcd_read.cpp.o] Error 1
make[1]: *** [CMakeFiles/pcd_read.dir/all] Error 2
make: *** [all] Error 2
问题似乎出在传递给函数的第一个参数中,但我似乎无法创建 const FPFHSignature33 & p 对象。
有谁知道这些怀疑是否正确,如果是,我可能会采取什么方向来开始解决这个问题?
感谢您的任何帮助。
I have what I think is a fairly basic question about a conversion in the point cloud library from a proprietry data type to float. My issue I think comes from a lack of experience with templates, data types and C++ in general.
The function that should perform this conversion is copyToFloatArray, defined in the documentation as:
virtual void pcl::DefaultPointRepresentation< FPFHSignature33 >::copyToFloatArray ( const FPFHSignature33 & p,
float * out
) const [inline, virtual]Copy point data from input point to a float array.
This method must be overriden in all subclasses.
Parameters:
p The input point
out A pointer to a float array.
Implements pcl::PointRepresentation< FPFHSignature33 >.
I have attempted to implement it as follows:
pcl::PointCloud<pcl::FPFHSignature33>::Ptr fpfhs (new pcl::PointCloud<pcl::FPFHSignature33> ());
// populate fpfh...
float **myArray;
pcl::DefaultPointRepresentation< pcl::FPFHSignature33 >::copyToFloatArray ( &fpfhs, &**myArray);
The error that's thrown up at compilation time is as follows:
/home/bc/PCL/pcd_read.cpp: In function ‘int main(int, char**)’:
/home/bc/PCL/pcd_read.cpp:68: error: no matching function for call to
‘pcl::DefaultPointRepresentation<pcl::FPFHSignature33>::copyToFloatArray(boost::shared_ptr<pcl::PointCloud<pcl::FPFHSignature33> >*, float*)’
/usr/include/pcl-1.2/pcl/point_representation.h:254: note: candidates are:
virtual void pcl::DefaultPointRepresentation<pcl::FPFHSignature33>::copyToFloatArray(const pcl::FPFHSignature33&, float*) const
make[2]: *** [CMakeFiles/pcd_read.dir/pcd_read.cpp.o] Error 1
make[1]: *** [CMakeFiles/pcd_read.dir/all] Error 2
make: *** [all] Error 2
It appears that the issue is in the first argument being passed to the function, but I can't seem to create a const FPFHSignature33 & p
object.
Does anyone have any idea if these suspicions are correct, and if so what direction I might take to start to resolve the issue?
Thanks for any help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,您需要在 floatArray 中分配内存。
然后,您需要使用 * 取消引用 fpfhs ptr。最后,那里不需要双指针数组。
这是更正后的代码:
First, you need to allocate memory in your floatArray.
Then, you need to derefence the fpfhs ptr using *. finally, there is no need for a double pointer array there.
Here is the corrected code :