英文:
Open3D WARNING Read PLY failed: unable to read file
问题
我在读取.ply
文件方面遇到了问题。我已经确认文件路径是正确的。代码会引发警告并继续运行。然而,在cloud
变量上进行的处理结果为空。
import open3d as o3d
cloud = o3d.io.read_point_cloud("aaa.ply")
[Open3D WARNING] 读取PLY文件失败:无法读取文件:aaa.ply
RPly:用户中止
我正在使用Open3D的版本0.17.0
。
更新:
英文:
I'm facing an issue regarding reading .ply
files. I double-checked that the file's path is correct. The code raises a warning and continues running. However, the results of the processing made on the cloud
variable empty.
import open3d as o3d
cloud = o3d.io.read_point_cloud("aaa.ply")
> [Open3D WARNING] Read PLY failed: unable to read file: aaa.ply
RPly: Aborted by user
I'm using the version 0.17.0
of Open3D.
Update:
答案1
得分: 2
这是您要翻译的部分:
- "It might be a problem with your
.ply
file, try with one from here or share youraaa.ply
file with us." - "Also, you can have a look at this issue."
- "EDIT After you provided the .ply file, indeed it seems to be throwing that warning, but I can access the points in the point cloud:"
- "import open3d as o3d"
- "import numpy as np"
- "cloud = o3d.io.read_point_cloud('aaa.ply')"
- "o3d.visualization.draw_geometries([cloud])"
- "cloudPoints = np.asarray(cloud.points)"
请注意,其中的HTML标签已经被移除,以保持文本的清晰度。
英文:
It might be a problem with your .ply
file, try with one from here or share your aaa.ply
file with us.
Also, you can have a look at this issue.
EDIT
After you provided the .ply file, indeed it seems to be throwing that warning, but I can access the points in the point cloud:
import open3d as o3d
import numpy as np
cloud = o3d.io.read_point_cloud('aaa.ply')
o3d.visualization.draw_geometries([cloud])
cloudPoints = np.asarray(cloud.points)
答案2
得分: 0
我遇到一个类似但略有不同的错误:“open3d .ply Read PLY failed: no vertex attribute”,所以这可能对你有帮助。我使用的.ply文件是DALES激光雷达数据集的一部分。Open3d期望文件中的元素名称为“vertex”和“face”。我发现我的.ply文件的元素名称在头部中是“testing”。
如何检查元素类型
打开文件编辑器,或者使用命令行查看前10行左右
在文件内:
ply
format binary_little_endian 1.0
element testing 11331760 # 这应该是“vertex”或“face”,而不是“testing”
property float x
property float y
property float z
property int intensity
property int sem_class
property int ins_class
end_header
你可以手动输入并保存。我有几个文件要更改,所以使用了以下代码将所有元素转换为“vertex”。如果你的文件同时包含顶点和面,这可能不适用。我的数据是点云,所以一切都是顶点。
更改元素类型
要使用Python将单个文件转换为“vertex”类型:
from plyfile import PlyData, PlyProperty, PlyElement
from pathlib import Path
# 读取文件
data = PlyData.read("orig_file.ply")
# 使用我们现有的数据创建一个新的PlyElement,类型为“vertex”
renamed_element = PlyElement.describe(data.elements[0].data, 'vertex',
comments=[f'Renamed from: {data.elements[0].name}'])
# 创建一个新的二进制格式的PlyData对象
fixed_data = PlyData([renamed_element], text=to_ascii)
# 将其写出
fixed_data.write("Fixed_file.ply")
英文:
I had a similar but slightly different error: "open3d .ply Read PLY failed: no vertex attribute", so this may help you. The .ply file I was using was part of the DALES lidar dataset. Open3d expects the files have elements named "vertex" and "face" apparently. I found that my .ply files had elements named "testing" in the header.
How to check element types
Open the file in a text editor, or just use command line to see the top 10 or so lines
Inside :
<!-- language: text-->
ply
format binary_little_endian 1.0
element testing 11331760 # This needs to be "vertex" or "face" not "testing"
property float x
property float y
property float z
property int intensity
property int sem_class
property int ins_class
end_header
You may be able to manually type and save it. I had several files to change, so used this code to convert all elements to "vertex". This would be bad if you had a mix of vertexes and faces. My data are pointclouds, so everything is a vertex.
Change element types
To convert a single file to type "vertex" with python:
<!-- language: python -->
from plyfile import PlyData, PlyProperty, PlyElement
from pathlib import Path
# read in file
data = PlyData.read("orig_file.ply")
# make a new PlyElement with type "vertex" with our existing data
renamed_element = PlyElement.describe(data.elements[0].data, 'vertex',
comments=[f'Renamed from: {data.elements[0].name}'])
# Make a new PlyData object of binary format
fixed_data = PlyData([renamed_element], text=to_ascii)
# Write it out
fixed_data.write("Fixed_file.ply")
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论