Skip to main content

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
  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)

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-1.0.2.tar.gz (9.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

virtual_camera-1.0.2-py3-none-any.whl (198.9 kB view details)

Uploaded Python 3

File details

Details for the file virtual_camera-1.0.2.tar.gz.

File metadata

  • Download URL: virtual_camera-1.0.2.tar.gz
  • Upload date:
  • Size: 9.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.9

File hashes

Hashes for virtual_camera-1.0.2.tar.gz
Algorithm Hash digest
SHA256 025c513a70108268fb98af78fc32174c80a7162ac4399e1e9640eb610ff36b2d
MD5 39763d11acb0f0fc5867fcc602aa24a9
BLAKE2b-256 cd6f0d9b746b05166d3048d74579b0b231ef760cce2ca19e2c22bcd8ddb04070

See more details on using hashes here.

File details

Details for the file virtual_camera-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: virtual_camera-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 198.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.9

File hashes

Hashes for virtual_camera-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 501bfc0b9b341cc630ae9d85ccffdd65b844d35c8c64aaaddfadbc0b86f5bcca
MD5 ffddf7de1a522bbbb4541f2005055b0f
BLAKE2b-256 f5cc039d34e20be158001ff26e1cdb7683d3484412045cc04b6067b551492d3b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page