A lightweight PCD file processing library
Project description
PCDKit
A lightweight and efficient Python library for working with PCD (Point Cloud Data) files.
Supports both in-memory and memory-mapped processing, and provides modular tools for I/O, transformation, merge and metadata management.
📦 Features
- ✅ Read/write PCD files (ASCII, binary, and compressed)
- ✅ Structured NumPy or memory-mapped point cloud representation
- ✅ Add/drop/set custom fields
- ✅ Apply geometric transformations (e.g., rotation, translation)
- ✅ Metadata-aware, type-safe interface
🚀 Installation
pip install pcdkit
🧪 Usgae
from pathlib import Path
import numpy as np
import pcloud
# Create a structured NumPy array with 5 3D points
array = np.array([
(1.0, 2.0, 3.0),
(4.0, 5.0, 6.0),
(7.0, 8.0, 9.0),
(10.0, 11.0, 12.0),
(13.0, 14.0, 15.0),
], dtype=[("x", "f4"), ("y", "f4"), ("z", "f4")])
# Temporary paths for saving memory-mapped file and PCD
memmap_path = Path("test.memmap")
pcd_path = Path("test.pcd")
# ----------------------------
# 1. Construct PointCloud from NumPy array
# ----------------------------
cloud = pcloud.from_array(array, memmap_file_path=memmap_path)
# Add a new field called 'intensity' with default value 1.0
cloud.add_field("intensity", "f4", default=1.0)
# Set the intensity field to a constant value
cloud.set_field("intensity", 5.0)
# Overwrite the intensity field with a per-point array
cloud.set_field("intensity", np.array([10, 20, 30, 40, 50]))
# Apply an affine transformation (scale coordinates by 2)
transform = np.eye(4)
transform[:3, :3] *= 2
cloud.transform(transform)
# Drop the intensity field
cloud.drop_field("intensity")
# Save the point cloud to a binary PCD file
cloud.save(pcd_path, format="binary")
print(f"Saved PointCloud from array to: {pcd_path}")
# ----------------------------
# 2. Load the saved PCD back and verify structure
# ----------------------------
cloud_loaded = pcloud.load_pcd_from_path(
file_path=pcd_path,
memmap_file_path=memmap_path.with_suffix(".reloaded.memmap"),
replace_nan_with_zero=True,
)
print("Reloaded PointCloud:")
print(cloud_loaded)
# ----------------------------
# 3. Merge the original and reloaded clouds
# ----------------------------
merged_cloud = pcloud.merge(
[cloud, cloud_loaded],
memmap_file_path=Path("merged.memmap")
)
print("Merged PointCloud:")
print(merged_cloud)
merged_cloud.save("merged.pcd", format="binary")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pcdkit-0.2.14.tar.gz.
File metadata
- Download URL: pcdkit-0.2.14.tar.gz
- Upload date:
- Size: 12.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e912a930e99c30d7965751e9420cba6c5ba2980712b365ebe71a6d0d3589d928
|
|
| MD5 |
4850e9c0ace7ce3c22b207a8d0bab095
|
|
| BLAKE2b-256 |
1e8b7d4904866d924f34b4d77aa060606545602c53f51dadd350c7b78a42fef6
|
Provenance
The following attestation bundles were made for pcdkit-0.2.14.tar.gz:
Publisher:
release.yml on FledgeXu/PCDKit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pcdkit-0.2.14.tar.gz -
Subject digest:
e912a930e99c30d7965751e9420cba6c5ba2980712b365ebe71a6d0d3589d928 - Sigstore transparency entry: 600822761
- Sigstore integration time:
-
Permalink:
FledgeXu/PCDKit@2ed8535457903aeffb2efc48ca4728efc879f055 -
Branch / Tag:
refs/tags/v0.2.14 - Owner: https://github.com/FledgeXu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2ed8535457903aeffb2efc48ca4728efc879f055 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pcdkit-0.2.14-py3-none-any.whl.
File metadata
- Download URL: pcdkit-0.2.14-py3-none-any.whl
- Upload date:
- Size: 14.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a90cbfdac518bb7250d649e9b0b51db78051a679fcb0fe2f020f6f98b8863d8a
|
|
| MD5 |
bcd40ffd8375222ba644a03be7d0d162
|
|
| BLAKE2b-256 |
febec7c34dc8861a094e9ff6f3ef8867e8c5d92f1e7641d9aabf61b68a284e95
|
Provenance
The following attestation bundles were made for pcdkit-0.2.14-py3-none-any.whl:
Publisher:
release.yml on FledgeXu/PCDKit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pcdkit-0.2.14-py3-none-any.whl -
Subject digest:
a90cbfdac518bb7250d649e9b0b51db78051a679fcb0fe2f020f6f98b8863d8a - Sigstore transparency entry: 600822762
- Sigstore integration time:
-
Permalink:
FledgeXu/PCDKit@2ed8535457903aeffb2efc48ca4728efc879f055 -
Branch / Tag:
refs/tags/v0.2.14 - Owner: https://github.com/FledgeXu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2ed8535457903aeffb2efc48ca4728efc879f055 -
Trigger Event:
push
-
Statement type: