cars_mesh.tools.handlers

Define classes for handling common objects

Module Contents

Classes

PointCloud

Point cloud data

Mesh

Mesh data

Functions

read_input_path(→ Mesh)

Read input path as either a PointCloud or a Mesh object

Attributes

COLORS

NORMALS

UVS

cars_mesh.tools.handlers.COLORS = ['red', 'green', 'blue', 'nir'][source]
cars_mesh.tools.handlers.NORMALS = ['n_x', 'n_y', 'n_z'][source]
cars_mesh.tools.handlers.UVS = ['uv1_row', 'uv1_col', 'uv2_row', 'uv2_col', 'uv3_row', 'uv3_col'][source]
class cars_mesh.tools.handlers.PointCloud(df: None | pandas.DataFrame = None, o3d_pcd: None | open3d.geometry.PointCloud = None)[source]

Point cloud data

property has_colors: bool[source]

Whether colors are specified

property has_normals: bool[source]

Whether point normals are specified

property are_normals_unitary: bool[source]

Whether normals are unitary (i.e. of norm equal to 1)

property has_classes: bool[source]

Whether point cloud has classes specified by point

set_df_from_o3d_pcd()[source]

Set pandas.DataFrame from open3D PointCloud

set_df_from_vertices(vertices: numpy.ndarray) None[source]

Set point coordinates in the pandas DataFrame

set_df_colors(colors: numpy.ndarray, color_names: list) None[source]

Set color attributes per point in the pandas DataFrame

set_df_normals(normals: numpy.ndarray) None[source]

Set normal attributes per point in the pandas DataFrame

set_o3d_pcd_from_df()[source]

Set open3d PointCloud from pandas.DataFrame

set_o3d_colors() None[source]

Set color attribute of open3D PointCloud

set_o3d_normals() None[source]

Set normal attribute of open3D PointCloud

get_vertices() pandas.DataFrame[source]

Get vertex data

get_colors() pandas.DataFrame[source]

Get color data

get_normals() pandas.DataFrame[source]

Get normals

set_unitary_normals()[source]

Make normals unitary (i.e. with a norm equal to 1.)

serialize(filepath: str, **kwargs) None[source]

Serialize point cloud

deserialize(filepath: str) None[source]

Deserialize point cloud

class cars_mesh.tools.handlers.Mesh(pcd: None | pandas.DataFrame = None, mesh: None | pandas.DataFrame = None, o3d_pcd: None | open3d.geometry.PointCloud = None, o3d_mesh: None | open3d.geometry.TriangleMesh = None)[source]

Mesh data

property has_triangles: bool[source]

Whether mesh has triangles specified

property has_texture: bool[source]

Whether mesh has a texture specified

property has_triangle_uvs: bool[source]

Whether mesh has triangle uvs

property has_normals: bool[source]

Whether mesh has face normals

property has_classes: bool[source]

Whether mesh has a classification by face

set_df_from_o3d_mesh() None[source]

Set pd.DataFrame from open3d TriangleMesh data

set_df_from_vertices(vertices) None[source]

Set pd.DataFrame from an array of vertices

set_image_texture_path(image_texture_path) None[source]

Set image texture path

set_df_uvs(uvs) None[source]

UVs

Parameters:

uvs ((N, 6) np.ndarray or list) – Image texture (row, col) normalized coordinates per triangle vertex

set_o3d_mesh_from_df() None[source]

Set open3d TriangleMesh from a pd.DataFrame

set_o3d_vertex_colors() None[source]

Set color attribute of open3D TriangleMesh

set_o3d_vertex_normals() None[source]

Set normal attribute of open3D TriangleMesh

set_o3d_image_texture_and_uvs() None[source]

Set image texture path and uvs of open3D TriangleMesh

get_triangles() pandas.DataFrame[source]

Get point triangle indexes

get_triangle_uvs() pandas.DataFrame[source]

Get triangle uvs

get_image_texture_path() str[source]

Get image texture path

serialize(filepath: str, **kwargs) None[source]

Serialize mesh

deserialize(filepath: str) None[source]

Deserialize mesh

cars_mesh.tools.handlers.read_input_path(input_path: str) Mesh[source]

Read input path as either a PointCloud or a Mesh object and returns in generic Mesh() object (containing pcd dict if point cloud)

Parameters:

input_path (str) – Input path to read (best with absolute path)

Returns:

mesh – Mesh object

Return type:

Mesh