Virtual Camera
Project description
Virtual Camera
Install
pip install virtual_camera
Instructions
Coordinate systems
STYLE | X-Y-Z |
---|---|
MOTOVIS | right-forward-up |
openGL | right-up-backward |
camera | right-down-forward |
pytorch3d | left-up-forward |
Create virtual cameras
Following are default virtual camera setups.
VCAMERA_PERSPECTIVE_FRONT = create_virtual_perspective_camera((1280, 960), (-90, 0, 0), (0, 1.5, 1.5))
VCAMERA_PERSPECTIVE_FRONT_LEFT = create_virtual_perspective_camera((1280, 960), (-90, 0, 45), (-1, 2, 1))
VCAMERA_PERSPECTIVE_FRONT_RIGHT = create_virtual_perspective_camera((1280, 960), (-90, 0, -45), (1, 2, 1))
VCAMERA_PERSPECTIVE_BACK = create_virtual_perspective_camera((1280, 960), (-90, 0, 180), (0, -1, 1))
VCAMERA_PERSPECTIVE_BACK_LEFT = create_virtual_perspective_camera((1280, 960), (-90, 0, 135), (-1, 2, 1))
VCAMERA_PERSPECTIVE_BACK_RIGHT = create_virtual_perspective_camera((1280, 960), (-90, 0, -135), (1, 2, 1))
VCAMERA_FISHEYE_FRONT = create_virtual_fisheye_camera((1024, 640), (-120, 0, 0), (0, 3.5, 0.5))
VCAMERA_FISHEYE_LEFT = create_virtual_fisheye_camera((1024, 640), (-135, 0, 90), (-1, 2, 1))
VCAMERA_FISHEYE_RIGHT = create_virtual_fisheye_camera((1024, 640), (-135, 0, -90), (1, 2, 1))
VCAMERA_FISHEYE_BACK = create_virtual_fisheye_camera((1024, 640), (-120, 0, 180), (0, -1, 0.5))
Convert from a real image
import yaml
import virtual_camera as vc
- Initialize the a camera from a real image and its calibration file.
yaml_file = 'data/calibration.yml'
cfg = yaml.safe_load(open(yaml_file, 'r'))
camera_real = vc.FisheyeCamera.init_from_motovis_cfg(cfg)
- Read the real image.
src_image = plt.imread('data/src_image.jpg')
- Convert the image to a virtual image. Alongside with mask.
dst_image, mask = vc.render_image(src_image, camera_real, vc.VCAMERA_PERSPECTIVE_FRONT)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
virtual_camera-0.0.4.1.tar.gz
(199.7 kB
view details)
Built Distribution
File details
Details for the file virtual_camera-0.0.4.1.tar.gz
.
File metadata
- Download URL: virtual_camera-0.0.4.1.tar.gz
- Upload date:
- Size: 199.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2db298e4579848b0c52c0e22e3195684f958ad4f1c92684d5271cffb75597d19 |
|
MD5 | e65256c1b50aedc1491d6b107474b3e2 |
|
BLAKE2b-256 | 9565a4cea39eab5b00e920a3202e05fb031e1f72069b34f88e2cb0a529288e76 |
File details
Details for the file virtual_camera-0.0.4.1-py3-none-any.whl
.
File metadata
- Download URL: virtual_camera-0.0.4.1-py3-none-any.whl
- Upload date:
- Size: 198.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 748593d90d4e8027647c8887fe13c71f839589194e515f2deeacbf754c88749b |
|
MD5 | 3e7d2e741862105fc4b38a4cb4481ed2 |
|
BLAKE2b-256 | 7b8232d22fb8292bfa16d3d60904beafecee4f7b08854fa0f300b99b6b19a63f |