0

Windows で Visual Studio 2019 を使用して、pcl ライブラリを使用しています。残念ながら、ファイルへのフル パスを指定しても、ダウンロードしたデモ ファイルを読み込むことができません。

例外は、reader.read("table_scene_lms400.pcd", *cloud); で発生します。// 最初にファイルをダウンロードすることを忘れないでください!

ここに私のコードがあります:

#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/filters/voxel_grid.h>

int
main(int argc, char** argv)
{
    pcl::PCLPointCloud2::Ptr cloud(new pcl::PCLPointCloud2());
    pcl::PCLPointCloud2::Ptr cloud_filtered(new pcl::PCLPointCloud2());

    // Fill in the cloud data
    pcl::PCDReader reader;
    // Replace the path below with the path where you saved your file
    reader.read("table_scene_lms400.pcd", *cloud); // Remember to download the file first!

    std::cerr << "PointCloud before filtering: " << cloud->width * cloud->height
        << " data points (" << pcl::getFieldsList(*cloud) << ")." << std::endl;

    // Create the filtering object
    pcl::VoxelGrid<pcl::PCLPointCloud2> sor;
    sor.setInputCloud(cloud);
    sor.setLeafSize(0.01f, 0.01f, 0.01f);
    sor.filter(*cloud_filtered);

    std::cerr << "PointCloud after filtering: " << cloud_filtered->width * cloud_filtered->height
        << " data points (" << pcl::getFieldsList(*cloud_filtered) << ")." << std::endl;

    pcl::PCDWriter writer;
    writer.write("table_scene_lms400_downsampled.pcd", *cloud_filtered,
        Eigen::Vector4f::Zero(), Eigen::Quaternionf::Identity(), false);

    return (0);
}

例外は: PCL_Down_Sample_Point_Clouds.exe の 0x00007FFB65A94F69 で未処理の例外: Microsoft C++ 例外: std::bad_alloc メモリ位置 0x000000377BBFE9A0 です。

4

1 に答える 1