About
Python library for reading, modifying and writing Agisoft Photoscan/Metashape PSX projects. Unofficial.
Pretty rough at the moment.
Questions? Contributions? Bug reports? Open an issue on the gitlab page for the project.
I am very interested in hearing your use cases for pypsxlib to help drive the roadmap.
Contributors
- Luke Miller
Thanks
pypsxlib made for 'Project 39', a creative art project supported by Creative Victoria.
Roadmap
- Test suite to find where the psx specification is unsupported
- Create transformation objects for manipulation instead of strings
- Add texture support
- Add mask support
- Add dense cloud support
- Add depth maps support
- Copy images+masks across chunks
Quickstart
Installing
pip install pypsxlib
How do I...
Load a .PSX project
from pypsxlib import Project
project = Project().load_psx("myProject.psx") # not all features supported
Save a .PSX project
project = Project("myProject")
project.path = "/path/for/project"
project.save() # project.name and project.path must be set
Add a Chunk
p = Project("myProject")
p.defaults() # create a new app and document
p.add_chunk() # add an empty chunk
Access a chunk
chunk = p.apps[0].documents[0].chunks[0]
Access thumbnails
chunk.frames[0].thumbnails
Copy a chunk's bounding box to all other chunks
doc = project.apps[0].documents[0] # or project.document shortcut
boundingbox = copy.copy(doc.chunks[0].region)
for chunk in doc.chunks[1:]:
chunk.region = boundingbox
Duplicate a Chunk
from pypsxlib import utils
p = Project().load("projects/sample.psx")
assert len(p.document.chunks) == 1
utils.duplicate_chunk(p, 0)
assert len(p.document.chunks) == 2
Access the point data of a mesh
doc = project.apps[0].documents[0]
mesh = doc.chunks[0].frames[0].model.mesh
print(mesh.faceCount)
# uses plyfile module to load data
print([x for x in doc.plydata]) # all the vertices
Source
git clone https://gitlab.com/dodgyville/pypsxlib.git
Reference
.psx project layout
myProject.psx
myProject.files/
myProject.files/project.zip
myProject.files/<chunkid>/
myProject.files/<chunkid>/chunk.zip
myProject.files/<chunkid>/<frameid>/
myProject.files/<chunkid>/<frameid>/frame.zip
myProject.files/<chunkid>/<frameid>/thumbnails/
myProject.files/<chunkid>/<frameid>/thumbnails/thumbnails.zip
Changelog
v0.2.0
- add lens distortion support
- add
enabledfield to chunk cameras - add
chunk.load_xmlto load direct from xml string - change
chunk.regionandchunk.transformto load direct into numpy arrays - fix load bug when no active chunk
- fix bug where sensor property would not load
- lots of small fixes and new tests
v0.1.8
- improved handling for single images
- add
num_of_repeatsarg toutils.duplicate_chunk
v0.1.7
- fix bugs
- add better path support
- add utils
- add
utils.duplicate_chunk - add
Project.deleteandProject.document
v0.1.5
- fix packaging issue
v0.1.4
- add calibration support to Sensor
- add params support to Sensor
- add loading and saving for model and mesh data
- fix minor bugs
v0.1.3
- add loading and saving for point cloud data
- add covariance support to Sensor
- fix minor bugs
v0.1.2
- improve support for loading and saving thumbnails
- add loading and saving for camera transformations
- add loading and saving of bounding boxes
- add chunk transform, region and meta saving
- fix bugs
v0.1.1
- improve support for loading project with multiple chunks and cameras
- improve support for loading models
- improve support for loading frames
- improve support for loading aligned photos
v0.1.0
- initial release
Metadata
Release files for pypsxlib 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pypsxlib-0.2.0.tar.gz | 24.3 kB | Without provenance | Details for pypsxlib-0.2.0.tar.gz |
Release files / pypsxlib-0.2.0.tar.gz
| Download URL | pypsxlib-0.2.0.tar.gz |
|---|---|
| Size | 24.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f3201fdfff6d363c7933469844348006b9998444abbb4afc5fa4dfaf53c9de88
|
|
BLAKE2b-256 checksum How to use checksums |
5280981394a27694f9d6219ea9f1f0a2f15b68bf48a7bdbaa860c6ca4e7a74f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.11.3 pkginfo/1.4.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.7
|
Security for pypsxlib 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.