vprdb.providers.point_cloud_provider

 1#  Copyright (c) 2023, Ivan Moskalenko, Anastasiia Kornilova
 2#
 3#  Licensed under the Apache License, Version 2.0 (the "License");
 4#  you may not use this file except in compliance with the License.
 5#  You may obtain a copy of the License at
 6#
 7#      http://www.apache.org/licenses/LICENSE-2.0
 8#
 9#  Unless required by applicable law or agreed to in writing, software
10#  distributed under the License is distributed on an "AS IS" BASIS,
11#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12#  See the License for the specific language governing permissions and
13#  limitations under the License.
14import open3d as o3d
15
16from dataclasses import dataclass
17from pathlib import Path
18
19
20@dataclass(frozen=True)
21class PointCloudProvider:
22    """PointCloudProvider provider is a wrapper for point clouds"""
23
24    path: Path
25    """Path to the file on the hard drive"""
26
27    @property
28    def point_cloud(self) -> o3d.geometry.PointCloud:
29        """Returns Open3D point cloud"""
30        return o3d.io.read_point_cloud(str(self.path))
@dataclass(frozen=True)
class PointCloudProvider:
21@dataclass(frozen=True)
22class PointCloudProvider:
23    """PointCloudProvider provider is a wrapper for point clouds"""
24
25    path: Path
26    """Path to the file on the hard drive"""
27
28    @property
29    def point_cloud(self) -> o3d.geometry.PointCloud:
30        """Returns Open3D point cloud"""
31        return o3d.io.read_point_cloud(str(self.path))

PointCloudProvider provider is a wrapper for point clouds

PointCloudProvider(path: pathlib.Path)
path: pathlib.Path

Path to the file on the hard drive

point_cloud: open3d.cpu.pybind.geometry.PointCloud

Returns Open3D point cloud