Open3d C++ Create File from point cloud failing due to unknown file extension

537 Views Asked by At

I'm attempting to read in a pointcloud .ply file using the open3d library in C++. When using either the open3d::io::CreatePointCloudFromFile or open3d::io::ReadPointCloud(pcv_load_path, *pcv, open3d::io::ReadPointCloudOption(".ply", false, false, true))

I'm using the newest version of the library, cxx 20, and cmake for linking the libraries. Thank you.

I've tried running the same code in python and using the same path, that worked fine so I'm aware that the file isn't corrupt and the file format is correct. Here is the python code that I used:

pc_load = o3d.io.read_point_cloud(pcv_load_path)
o3d.visualization.draw_geometries([pc_load])

I also have tried reading in the file in different way using the different IO function open3d offers. Here is the C++ code:

if (! open3d::io::ReadPointCloud (pcv_load_path, *pcv, open3d::io::ReadPointCloudOption ("auto", false, false, true))) {
    if (!open3d::io::ReadPointCloud(pcv_load_path, *pcv, open3d::io::ReadPointCloudOption(".ply", false, false, true))) {
            cout << "Error: cannot load point cloud" << endl;
            return;
        }
    }
pcv = open3d::io::CreatePointCloudFromFile(pcv_load_path, ".ply", false);

*Note that pcv_load_path is the exact same in both. It is an explicit path and I'm using the forward slashes.

Also, in the pcv_load_path. I include ".ply" format to the end of the path string.

Edit: Here is the output:

[Open3D WARNING] Read geometry::PointCloud failed: unknown file extension for  (format: ).

Edit: I attempted to use the following code to output the file extension:

open3d::utility::filesystem::GetFileExtensionInLowerCase(pcv_load_path) << endl;

This results in a memory access violation and crashes the code.

0

There are 0 best solutions below