【问题标题】:PCL not properly installed with vcpkgPCL 未使用 vcpkg 正确安装
【发布时间】:2021-03-09 11:29:17
【问题描述】:

我已经使用./vcpkg install pcl:x64-windows 安装了带有 vcpkg 的 PCL。
过了一会儿,我注意到 concave_hull.h、convex_hull.h 和 qhull.h 没有与库的其余部分一起安装。
我正在使用的其他信息:

  • vcpkg 标签 (2020.11.01)
  • 操作系统 Windows 10
  • VS 社区 16.8.3

为了完整起见,我已经包含了导致我遇到这个问题的代码:

#include <pcl/surface/concave_hull.h>
#include <pcl/point_cloud.h>
int main()
{
    using point_cloud_colored = pcl::PointCloud<pcl::PointXYZRGB>;
    //plane is generated from somewhere else and is not important for this issue
    point_cloud_colored::Ptr plane = load_cloud_from_somewhere(); 
    point_cloud_colored::Ptr hull_cloud(new point_cloud_colored);
    pcl::ConcaveHull<point_cloud_colored> chull;
    chull.setInputCloud(plane);
    chull.setAlpha(0.1);
    chull.reconstruct(*hull_cloud);
}

此代码产生以下错误消息:

严重性代码描述项目文件行抑制状态 错误 C1083 无法打开包含文件:'pcl/surface/concave_hull.h':没有这样的文件或目录 farrao_gui C:\Users\ ...\farrao\source\farrao_gui\farrao_gui.cpp 39

我已经尝试通过 vcpkg 重新安装,但没有成功。
有没有办法解决这个问题?

【问题讨论】:

    标签: c++ point-cloud-library vcpkg


    【解决方案1】:

    过了一会儿,我按照本指南切换到可重入 qhull 版本解决了这个问题:http://www.qhull.org/html/README_r.txt

    您必须将 concave_hull 代码复制到您自己项目中的文件(hpp、h 和 cpp)中。

    修复标题并删除每个文件中的 #ifdef HAVE_QHULL 并将这段代码添加到您的 hpp 文件中:

    extern "C"
    {
    #include <libqhull_r/qhull_ra.h>
    qhT qh_qh;
    qhT* qh = &qh_qh;
    }
    

    之后:

    • 将每个qh Makro 替换为qh-&gt;
    • 遍历每个qh_... 函数并将qh 指针添加为第一个参数(如果需要)
    • 遍历每个FOREACHvertex_i_ Makro 并添加qh 作为第一个参数

    这可能不是最好的解决方案,因为这个问题超出了我的范围,但算法确实会产生结果。它也可能适用于凸算法(因为它也不包含在 vcpkg 安装中)。
    我希望这个答案可能对遇到类似问题的人有所帮助。

    【讨论】:

    • 我用凸算法测试了这种方法,效果也很好。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-01-12
    • 2023-03-10
    • 1970-01-01
    • 2016-07-21
    • 2021-05-30
    • 2019-06-01
    • 2016-04-17
    相关资源
    最近更新 更多