pointcloud¶
Functions
|
Get HTML link to the labeling tool with the specified URL and name. |
|
Get the URL for the labeling tool with the specified dataset ID and point cloud ID. |
|
Checks if file from given path with given extention is supported |
|
Checks if given extention is supported. |
|
Checks if Pointcloud file from given path has supported extension. |
|
Loads a pointcloud from the specified file and returns it in XYZ format. |
|
Raise error if given extention is not supported |
|
Raise error if file from given path with given extention is not supported |
|
Saves a pointcloud to the specified file. |
Description
Functions for processing pointclouds
- exception PointcloudExtensionError[source]¶
Bases:
ExceptionRaised when a point cloud file extension is invalid or unsupported.
- exception PointcloudReadException[source]¶
Bases:
ExceptionRaised when a point cloud file cannot be read or decoded.
- exception UnsupportedPointcloudFormat[source]¶
Bases:
ExceptionRaised when a point cloud file format/extension is not supported by the SDK.
-
get_labeling_tool_link(url, name=
'open in labeling tool')[source]¶ Get HTML link to the labeling tool with the specified URL and name.
- Parameters:
- Returns:
HTML link to the labeling tool with the specified URL and name.
- Return type:
- Usage Example:
import os from dotenv import load_dotenv import supervisely as sly # Load secrets and create API object from .env file (recommended) # Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication if sly.is_development(): load_dotenv(os.path.expanduser("~/supervisely.env")) api = sly.Api.from_env() pointcloud_id = 19373403 pcd_info = api.pointcloud.get_info_by_id(pointcloud_id) url = sly.pointcloud.get_labeling_tool_url(pcd_info.dataset_id, pcd_info.id) name = "my link" link = sly.pointcloud.get_labeling_tool_link(url, name) print(link) # Output: # <a # href="https://app.supervisely.com/app/point-clouds/?datasetId=55875&pointCloudId=19373403" # rel="noopener noreferrer" # target="_blank" # > # my link<i class="zmdi zmdi-open-in-new" style="margin-left: 5px"></i> # </a>
- get_labeling_tool_url(dataset_id, pointcloud_id)[source]¶
Get the URL for the labeling tool with the specified dataset ID and point cloud ID.
- Parameters:
- Returns:
URL for the labeling tool with the specified dataset ID and point cloud ID
- Return type:
- Usage Example:
import os from dotenv import load_dotenv import supervisely as sly # Load secrets and create API object from .env file (recommended) # Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication if sly.is_development(): load_dotenv(os.path.expanduser("~/supervisely.env")) api = sly.Api.from_env() pointcloud_id = 19373403 pcd_info = api.pointcloud.get_info_by_id(pointcloud_id) url = sly.pointcloud.get_labeling_tool_url(pcd_info.dataset_id, pcd_info.id) print(url) # Output: # https://app.supervisely.com/app/point-clouds/?datasetId=55875&pointCloudId=19373403
-
read(path, coords_dims=
None)[source]¶ Loads a pointcloud from the specified file and returns it in XYZ format.
- validate_format(path)[source]¶
Raise error if file from given path with given extention is not supported
- Parameters:
- Returns:
None
- Return type:
None
- Usage Example:
import supervisely as sly path = "/Downloads/videos/111.mp4" sly.pointcloud.validate_format(path) # UnsupportedPointcloudFormat: Unsupported pointcloud extension: .mp4. # Only the following extensions are supported: ['.pcd'].
-
write(path, pointcloud_np, coords_dims=
None)[source]¶ Saves a pointcloud to the specified file. It creates directory from path if the directory for this path does not exist.
- Parameters:
- Returns:
Success or not.
- Return type:
- Usage Example:
import numpy as np import supervisely as sly pointcloud = np.random.randn(100, 3) ptc = sly.pointcloud.write('/home/admin/work/pointclouds/ptc0.pcd', pointcloud)