dreifus
OpenCV, OpenGL, Pytorch3D, ... you never know which camera coordinate convention you are currently using?
You always have to try invert() on your "pose" matrices because you never know whether they are cam2world or
world2cam?
The dreifus library is what you need!
dreifus (German for tripod) assists you in dealing with 3D cameras in Python.
1. Installation
pip install dreifus
2. Usage
2.1. Extrinsic (Pose) matrices
Translating between coordinate conventions made easy:
from dreifus.matrix import Pose, CameraCoordinateConvention, PoseType
# wrap some 4x4 extrinsic matrix
# Default assumed coordinate convention: OPEN_CV
# Default assumed pose type: WORLD_2_CAM
pose = Pose(some_extrinsic_matrix, pose_type=..., camera_coordinate_convention=...)
# Translate between coordinate conventions
pose.change_camera_coordinate_convention(CameraCoordinateConvention.OPEN_GL)
# Ensure your pose transforms into the direction you expect
pose.change_pose_type(PoseType.CAM_2_WORLD)
2.2. Intrinsics
from dreifus.matrix import Intrinsics
intrinsics = Intrinsics(fx, fy, cx, cy)
# Adapt your intrinsics to images downscaled by a factor of 2x
intrinsics.rescale(0.5)
# Adapt your intrinsics to an image cropped at (50, 50) left-top
intrinsics.crop(50, 50)
3. Visualization
The visualization tools will automatically interpret your camera poses correctly, as long as you specified camera_coordinate_convention and pose_type correctly.
import pyvista as pv
from dreifus.pyvista import add_coordinate_axes, add_camera_frustum
pose = Pose(...) # Some extrinsics
intrinsics = Intrinsics(...) # Some intrinsics
image = ... # Some images taken from that view
p = pv.Plotter()
add_coordinate_axes(p)
add_camera_frustum(p, pose, intrinsics, image=image)
p.show()
Render a pyvista scene from a specific camera:
import pyvista as pv
from dreifus.pyvista import render_from_camera
p = pv.Plotter(window_size=[IMG_W, IMG_H], off_screen=True)
p.background_color = (0, 0, 0, 0)
image = render_from_camera(p, pose, intrinsics)
Metadata
Release files for dreifus 0.1.28
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 |
|---|---|---|---|---|
| dreifus-0.1.28.tar.gz | 37.9 kB | Without provenance | Details for dreifus-0.1.28.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dreifus-0.1.28-py3-none-any.whl | Python 3 | none | any | Details for dreifus-0.1.28-py3-none-any.whl |
Total release size: 77.4 kB
Release files / dreifus-0.1.28.tar.gz
| Download URL | dreifus-0.1.28.tar.gz |
|---|---|
| Size | 37.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1cfd45161b360362ea69d62f3f6f1db75728d528a0b921fdc50d2073c54daa55
|
|
BLAKE2b-256 checksum How to use checksums |
565b40d3e983d84186a618e0c03255e4175b0673d91fdd963f9878388693a5de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.6
|
Release files / dreifus-0.1.28-py3-none-any.whl
| Download URL | dreifus-0.1.28-py3-none-any.whl |
|---|---|
| Size | 39.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7b30c65e34047de0c1c8492441c149040e60f2ca724c601e303c115fd1724434
|
|
BLAKE2b-256 checksum How to use checksums |
d209b25e9ba01035e0436f79c4f28aaf62b4d8ad4bd02f7a2354fefc8e6a363c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.6
|
Security for dreifus 0.1.28
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.