kornia.geometry.pointcloud#
- kornia.geometry.pointcloud.save_pointcloud_ply(filename, pointcloud)[source]#
Save to disk a pointcloud in ASCII PLY format.
- Convention:
The file holds one
vertexper row ofpointcloud.reshape(-1, 3), in order and with none dropped, and declares the propertiesx,yandzin that order asdouble. Each value is printed as the shortest text that parses back to the same float64, a non-finite one asnan/inf.pointcloudis channels-last. Applypermute(0, 2, 3, 1)to adepth_to_3d()result or usedepth_to_3d_v2(): a channels-first tensor whose width is 3 passes the shape check and is written scrambled.The PLY writers and loaders take
filenameas astroros.PathLike[str]ending in.ply(any case); another suffix raisesTypeError.
- kornia.geometry.pointcloud.load_pointcloud_ply(filename, header_size=None)[source]#
Load from disk a pointcloud in ASCII PLY format.
The header is parsed up to
end_header; the number of points comes from theelement vertex Ndeclaration and the coordinates from thex,yandzproperties, whatever other properties (normals, colours) or elements (faces) the file carries. Alistproperty among the vertex properties is rejected, since it spans a variable number of tokens and would shift every column after it. See the Convention block onsave_pointcloud_ply().- Parameters:
- Return type:
- Returns:
tensor containing the loaded points with shape \((N, 3)\) in
float32, where \(N\) is the declared vertex count.
- kornia.geometry.pointcloud.save_pointcloud_ply_binary(filename, pointcloud)[source]#
Save to disk a pointcloud in binary PLY format.
See the Convention block on
save_pointcloud_ply(); the payload is little-endian float64.
- kornia.geometry.pointcloud.load_pointcloud_ply_binary(filename, header_size=None)[source]#
Load from disk a pointcloud in binary PLY format.
The header is parsed up to
end_header; the number of points comes from theelement vertex Ndeclaration and the coordinates from thex,yandzproperties, whatever their scalar type. Extra vertex properties (normals, colours) are skipped, and so are elements that follow the vertices (faces). Both little- and big-endian payloads are read. Alistproperty is only supported in elements that follow the vertices. Among the vertex properties, or in an element that precedes them, its byte length is unknown without parsing it, so such a file is rejected. See the Convention block onsave_pointcloud_ply().- Parameters:
- Return type:
- Returns:
tensor containing the loaded points with shape \((N, 3)\) in
float32, where \(N\) is the declared vertex count.