Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/davidcaron/pye57
Read and write e57 point clouds from Python
https://github.com/davidcaron/pye57
e57 point-cloud python
Last synced: 1 day ago
JSON representation
Read and write e57 point clouds from Python
- Host: GitHub
- URL: https://github.com/davidcaron/pye57
- Owner: davidcaron
- License: mit
- Created: 2018-05-18T03:33:25.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-05-05T18:17:41.000Z (8 months ago)
- Last Synced: 2024-06-11T17:31:17.563Z (7 months ago)
- Topics: e57, point-cloud, python
- Language: Python
- Homepage:
- Size: 7.33 MB
- Stars: 65
- Watchers: 6
- Forks: 39
- Open Issues: 27
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pye57
[![PyPI](https://img.shields.io/pypi/v/pye57.svg)](https://pypi.org/project/pye57)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pye57.svg)](https://pypi.org/project/pye57)
![GitHub](https://img.shields.io/github/actions/workflow/status/davidcaron/pye57/build.yml?branch=master)Python wrapper of [LibE57Format](https://github.com/asmaloney/libE57Format) to read and write .e57 point cloud files
## Example usage
```python
import numpy as np
import pye57e57 = pye57.E57("e57_file.e57")
# read scan at index 0
data = e57.read_scan(0)# 'data' is a dictionary with the point types as keys
assert isinstance(data["cartesianX"], np.ndarray)
assert isinstance(data["cartesianY"], np.ndarray)
assert isinstance(data["cartesianZ"], np.ndarray)# other attributes can be read using:
data = e57.read_scan(0, intensity=True, colors=True, row_column=True)
assert isinstance(data["cartesianX"], np.ndarray)
assert isinstance(data["cartesianY"], np.ndarray)
assert isinstance(data["cartesianZ"], np.ndarray)
assert isinstance(data["intensity"], np.ndarray)
assert isinstance(data["colorRed"], np.ndarray)
assert isinstance(data["colorGreen"], np.ndarray)
assert isinstance(data["colorBlue"], np.ndarray)
assert isinstance(data["rowIndex"], np.ndarray)
assert isinstance(data["columnIndex"], np.ndarray)# the 'read_scan' method filters points using the 'cartesianInvalidState' field
# if you want to get everything as raw, untransformed data, use:
data_raw = e57.read_scan_raw(0)# writing is also possible, but only using raw data for now
e57_write = pye57.E57("e57_file_write.e57", mode='w')
e57_write.write_scan_raw(data_raw)
# you can specify a header to copy information from
e57_write.write_scan_raw(data_raw, scan_header=e57.get_header(0))# the ScanHeader object wraps most of the scan information:
header = e57.get_header(0)
print(header.point_count)
print(header.rotation_matrix)
print(header.translation)# all the header information can be printed using:
for line in header.pretty_print():
print(line)# the scan position can be accessed with:
position_scan_0 = e57.scan_position(0)# the binding is very close to the E57Foundation API
# you can modify the nodes easily from python
imf = e57.image_file
root = imf.root()
data3d = root["data3D"]
scan_0 = data3d[0]
translation_x = scan_0["pose"]["translation"]["x"]
```## Installation
On linux, Windows or Apple Silicon:
`python -m pip install pye57`
On macOS with Intel CPU you can try to build from source (advanced users):
## Building from source (for developers)
### Cloning the repository with required submodule
Clone a new repository along with the libe57Format submodule
`git clone https://github.com/davidcaron/pye57.git --recursive`
If the repository has already been previously cloned, but without the --recursive flag
```Bash
cd pye57 # go to the cloned repository
git submodule init # this will initialise the submodules in the repository
git submodule update # this will update the submodules in the repository
```### Dependencies on Linux
Install libxerces-c-dev first.
`sudo apt install libxerces-c-dev`
### Dependencies on Windows
To get xerces-c, you can either build from source or if you're using conda:
`conda install -y xerces-c`
### Dependencies on MacOS
To get xerces-c, run:
`bash ./scripts/install_xerces_c.sh`
### Run `pip install` from the repo source
```Bash
cd pye57
python -m pip install .
```### Uninstalling
Use pip again
```Bash
python -m pip uninstall pye57
```