open3d连线可视化

发布时间:2024年01月05日

写在前面

1、本文内容
open3d

2、平台/环境
windows10, visual studio 2019
通过cmake构建项目,跨平台通用;open3d
3、转载请注明出处:
https://blog.csdn.net/qq_41102371/article/details/135407857

准备

编译open3d:
https://blog.csdn.net/qq_41102371/article/details/121014372

代码

#include <iostream>
#include <chrono>

#include <open3d/Open3D.h>

int main(int argc, char *argv[])
{

    auto coordinate_1 = open3d::geometry::TriangleMesh::CreateCoordinateFrame(0.1);
    auto coordinate_2 = open3d::geometry::TriangleMesh::CreateCoordinateFrame(0.2);
    Eigen::Matrix4d trans_mat = Eigen::Matrix4d::Identity();
    trans_mat(0, 3) = 0.5;
    coordinate_2->Transform(trans_mat);/// a coordinate on (0, 0, 0.5)

    std::shared_ptr<open3d::geometry::LineSet> lineset_0(new open3d::geometry::LineSet);
    /// pointset
    lineset_0->points_.push_back({0, 0, 0});
    lineset_0->points_.push_back({0.5, 0, 0});
    lineset_0->points_.push_back({0.5, 0.5, 0});
    /// connect point to line
    lineset_0->lines_.push_back({0, 1});
    lineset_0->lines_.push_back({0, 2});
    lineset_0->lines_.push_back({1, 2});
    /// color for all lineset
    lineset_0->PaintUniformColor({1, 0, 0});
    /// color for line0
    lineset_0->colors_[0] = Eigen::Vector3d({1, 1, 0});
    /// visualize
    open3d::visualization::DrawGeometries({coordinate_1, coordinate_2, lineset_0}, "lineset visualize");

    return 0;
}

运行结果

在这里插入图片描述

参考

文中已列出

主要做激光/影像三维重建,配准、分割等常用点云算法,技术交流、咨询可私信

文章来源:https://blog.csdn.net/qq_41102371/article/details/135407857
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。