virtual-camera


Namevirtual-camera JSON
Version 0.0.4.3 PyPI version JSON
download
home_pagehttps://github.com/AlphaLFC/virtual_camera
SummaryVirtual Camera
upload_time2024-08-14 06:43:49
maintainerNone
docs_urlNone
authorAlphaLFC
requires_pythonNone
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Virtual Camera

## Install
```bash
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.
```python
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
```python
import yaml
import virtual_camera as vc
```
1. Initialize the a camera from a real image and its calibration file.
```python
yaml_file = 'data/calibration.yml'
cfg = yaml.safe_load(open(yaml_file, 'r'))
camera_real = vc.FisheyeCamera.init_from_motovis_cfg(cfg)
```
2. Read the real image.
```python
src_image = plt.imread('data/src_image.jpg')
```
3. Convert the image to a virtual image. Alongside with mask.
```python
dst_image, mask = vc.render_image(src_image, camera_real, vc.VCAMERA_PERSPECTIVE_FRONT)
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/AlphaLFC/virtual_camera",
    "name": "virtual-camera",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "AlphaLFC",
    "author_email": "alphali@motovis.com",
    "download_url": "https://files.pythonhosted.org/packages/a4/9a/abe61ac68d6ffd8ca68551c4f0a503518d37825e3a27112cf65a6d5efa8d/virtual_camera-0.0.4.3.tar.gz",
    "platform": null,
    "description": "# Virtual Camera\n\n## Install\n```bash\npip install virtual_camera\n```\n\n## Instructions\n### Coordinate systems\n| STYLE     | X-Y-Z              |\n| :-------: | :-----------------:|\n| MOTOVIS   | right-forward-up   |\n| openGL    | right-up-backward  |\n| camera    | right-down-forward |\n| pytorch3d | left-up-forward    |\n\n### Create virtual cameras\nFollowing are default virtual camera setups.\n```python\nVCAMERA_PERSPECTIVE_FRONT = create_virtual_perspective_camera((1280, 960), (-90, 0, 0), (0, 1.5, 1.5))\nVCAMERA_PERSPECTIVE_FRONT_LEFT = create_virtual_perspective_camera((1280, 960), (-90, 0, 45), (-1, 2, 1))\nVCAMERA_PERSPECTIVE_FRONT_RIGHT = create_virtual_perspective_camera((1280, 960), (-90, 0, -45), (1, 2, 1))\nVCAMERA_PERSPECTIVE_BACK = create_virtual_perspective_camera((1280, 960), (-90, 0, 180), (0, -1, 1))\nVCAMERA_PERSPECTIVE_BACK_LEFT = create_virtual_perspective_camera((1280, 960), (-90, 0, 135), (-1, 2, 1))\nVCAMERA_PERSPECTIVE_BACK_RIGHT = create_virtual_perspective_camera((1280, 960), (-90, 0, -135), (1, 2, 1))\n\nVCAMERA_FISHEYE_FRONT = create_virtual_fisheye_camera((1024, 640), (-120, 0, 0), (0, 3.5, 0.5))\nVCAMERA_FISHEYE_LEFT = create_virtual_fisheye_camera((1024, 640), (-135, 0, 90), (-1, 2, 1))\nVCAMERA_FISHEYE_RIGHT = create_virtual_fisheye_camera((1024, 640), (-135, 0, -90), (1, 2, 1))\nVCAMERA_FISHEYE_BACK = create_virtual_fisheye_camera((1024, 640), (-120, 0, 180), (0, -1, 0.5))\n```\n\n### Convert from a real image\n```python\nimport yaml\nimport virtual_camera as vc\n```\n1. Initialize the a camera from a real image and its calibration file.\n```python\nyaml_file = 'data/calibration.yml'\ncfg = yaml.safe_load(open(yaml_file, 'r'))\ncamera_real = vc.FisheyeCamera.init_from_motovis_cfg(cfg)\n```\n2. Read the real image.\n```python\nsrc_image = plt.imread('data/src_image.jpg')\n```\n3. Convert the image to a virtual image. Alongside with mask.\n```python\ndst_image, mask = vc.render_image(src_image, camera_real, vc.VCAMERA_PERSPECTIVE_FRONT)\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Virtual Camera",
    "version": "0.0.4.3",
    "project_urls": {
        "Homepage": "https://github.com/AlphaLFC/virtual_camera"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9a0432244bdfbeb1fe02883de3d91cd2e5811e8e2aef33afab919ccec9ae7c43",
                "md5": "0aa2d6bcc454e2843786455090717b6d",
                "sha256": "3d4d76951ec627ed93b721dd0371ca5e4d852a005773662cae7e97818a8b8d50"
            },
            "downloads": -1,
            "filename": "virtual_camera-0.0.4.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0aa2d6bcc454e2843786455090717b6d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 198557,
            "upload_time": "2024-08-14T06:43:47",
            "upload_time_iso_8601": "2024-08-14T06:43:47.853798Z",
            "url": "https://files.pythonhosted.org/packages/9a/04/32244bdfbeb1fe02883de3d91cd2e5811e8e2aef33afab919ccec9ae7c43/virtual_camera-0.0.4.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a49aabe61ac68d6ffd8ca68551c4f0a503518d37825e3a27112cf65a6d5efa8d",
                "md5": "de20c54c071cfa6a78c9d442ccc25aed",
                "sha256": "00571ea51066a2ef7c8a99fd914cf4520395b343f7b122e8f6d9c36531b67383"
            },
            "downloads": -1,
            "filename": "virtual_camera-0.0.4.3.tar.gz",
            "has_sig": false,
            "md5_digest": "de20c54c071cfa6a78c9d442ccc25aed",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 199693,
            "upload_time": "2024-08-14T06:43:49",
            "upload_time_iso_8601": "2024-08-14T06:43:49.717915Z",
            "url": "https://files.pythonhosted.org/packages/a4/9a/abe61ac68d6ffd8ca68551c4f0a503518d37825e3a27112cf65a6d5efa8d/virtual_camera-0.0.4.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-14 06:43:49",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "AlphaLFC",
    "github_project": "virtual_camera",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "virtual-camera"
}
        
Elapsed time: 0.64338s