点云数据批量,连续3帧或5帧叠加/拼接

环境:Ubuntu
如果是windows系统,读取文件的代码可参考:https://blog.csdn.net/qq_19332527/article/details/78404583

前提
1)在Linux系统编译环境下,C++头文件。在查询到findfirst的百度百科的时候有如下的解释:

Linux下的FindFirst
在linux操作系统下,编译器用findfirst(),而不是_findfirst().
linux操作系统下的查找文件的操作,需要包含dirent.h头文件.

但是尝试之后仍旧不行就放弃了。。。。(怎么总是放弃啊。。。。。但是真的查好久了,如果有新的解答,欢迎评论私信!!谢谢!!)
2)另尝试用python-pcl来完成,但是这个安装实在有点坑,放弃了。最后还是用C++完成。

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
using namespace std;

void scanFile(char *szDir){
    DIR *pDir = NULL;
    struct dirent *pFile = NULL;

    pDir = opendir(szDir);
    if (pDir == NULL) return;
    vector result;

    while ((pFile = readdir(pDir)) != NULL){
        if (pFile->d_type & DT_DIR){
            if (strcmp(pFile->d_name, ".") ==0
                || strcmp(pFile->d_name, "..") == 0) continue;
            char Path[256];
            int len = strlen(szDir);
            strncpy(Path, szDir, len + 1);
            if (szDir[len-1] !='/') strncat(Path, "/", 2);
            strncat(Path, pFile->d_name, strlen(pFile->d_name) + 1);
            scanFile(Path);
        }
        else {
            result.push_back(pFile->d_name);

        }
    }
    string path(szDir);
    sort(result.begin(), result.end());
    for (int i=4; i cloud_1;
        pcl::PointCloud cloud_2;
        pcl::PointCloud cloud_3;
        pcl::PointCloud cloud_4;       //如果是三帧,则将cloud_4,cloud_5这几句相关的去掉即可
        pcl::PointCloud cloud_5;
        pcl::console::TicToc tt;
        cout< cloud;
        cloud = cloud_1 + cloud_2;
        cloud = cloud + cloud_3;
        cloud = cloud + cloud_4;
        cloud = cloud + cloud_5;
        std::cerr<<"The point cloud_1 has:  "<

参考文献:
https://blog.csdn.net/xiexingshishu/article/details/42886885
https://blog.csdn.net/qq_42318305/article/details/81988138

你可能感兴趣的:(pcl点云)