zoukankan      html  css  js  c++  java
  • 02 PCD文件格式

    pcd文件数据举例

    # .PCD v.7 - Point Cloud Data file format
    VERSION .7                                # 版本号
    FIELDS x y z rgb                #  指定一个点可以有的每一个维度和字段的名字
    SIZE 4 4 4 4                                # 用字节数指定每一个维度的大小。例如:
    TYPE F FFF                                    # 用一个字符指定每一个维度的类型 int uint folat
    COUNT 1 1 1 1                        # 指定每一个维度包含的元素数目
    WIDTH 640                               # 像图像一样的有序结构,有640行和480列,
    HEIGHT 480                          # 这样该数据集中共有640*480=307200个点
    VIEWPOINT 0 0 0 1 0 0 0            # 指定数据集中点云的获取视点 视点信息被指定为平移(txtytz)+四元数(qwqxqyqz)
    POINTS 307200                        # 指定点云中点的总数。从0.7版本开始,该字段就有点多余了
    DATA ascii                                        # 指定存储点云数据的数据类型。支持两种数据类型:ascii和二进制
    0.93773 0.33763 0 4.2108e+06
    0.90805 0.35641 0 4.2108e+06
    View Code

    代码:

    #include <iostream>
    #include <pcl/io/pcd_io.h>
    #include <pcl/point_types.h>
    
    int main(int argc, char **argv)
    {
        
        pcl::PointCloud<pcl::PointXYZ> cloud;
    
        // Fill in the cloud data
        cloud.width = 5;
        cloud.height = 1;
        cloud.is_dense = false;
        cloud.points.resize(cloud.width*cloud.height);
    
        for (auto &point : cloud) 
        {
            point.x = 1024 * rand() / (RAND_MAX + 1.0f);
            point.y = 1024 * rand() / (RAND_MAX + 1.0f);
            point.z = 1024 * rand() / (RAND_MAX + 1.0f);
        }
    
        pcl::io::savePCDFileASCII("test_pcd.pcd", cloud);
        std::cerr << "Saved " << cloud.size() << " data points to test_pcd.pcd." << std::endl;
    
    
        for (const auto &point : cloud) 
        {
            std::cerr << "   " << point.x << "    " << point.y << "    " << point.z << std::endl;
        }
    
    
        system("pause");
    
        return (0);
    }
    View Code

     

     

     

    参考:https://www.yuque.com/huangzhongqing/pcl/hl1582

  • 相关阅读:
    apply call bind方法的区别和含义
    html头部meta标签
    语义化标签
    “文件名和url路径名”命名要点以及大小写问题
    BMP GIF PNG JPG等图片格式的区别和适用情况
    前端页面的性能优化
    js阻止默认事件,如a标签跳转和事件冒泡
    散列碰撞问题的解决——开链法(拉链法)
    substring()方法
    对学生成绩进行散列
  • 原文地址:https://www.cnblogs.com/zhaopengpeng/p/15566847.html
Copyright © 2011-2022 走看看