Skip to main content

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
  1. 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)
  1. Read the real image.
src_image = plt.imread('data/src_image.jpg')
  1. Convert the image to a virtual image. Alongside with mask.
dst_image, mask = vc.render_image(src_image, camera_real, vc.VCAMERA_PERSPECTIVE_FRONT)

Metadata

Release files for virtual-camera 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for virtual-camera 1.1.0
File Size Uploaded
virtual_camera-1.1.0.tar.gz 9.2 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for virtual-camera 1.1.0
File Interpreter ABI Platform
virtual_camera-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.4 MB

Release files / virtual_camera-1.1.0.tar.gz

Download URL virtual_camera-1.1.0.tar.gz
Size 9.2 MB
Tags Source
SHA-256 checksum
How to use checksums
ef7e3d84a0f589e19d9fffc7f2497efd2a20d75f9b02fa1835817290b3292708
BLAKE2b-256 checksum
How to use checksums
009d139d855ae70f903dec7a1846d263637b39eac916bcf6117c370310c19dbb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.9

Release files / virtual_camera-1.1.0-py3-none-any.whl

Download URL virtual_camera-1.1.0-py3-none-any.whl
Size 205.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
05abfb95f922bb7d4df2e2eb7f193f24a4f3b1c7a6ea9664a0eaec2015d179ce
BLAKE2b-256 checksum
How to use checksums
5dff5e851c7e0315494b0746e6a2e8f57db54292c86239024df86ae9db2d5945
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.9

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

0.0.4

2 release files

0.0.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page