Skip to main content

Simple VR180 image converter

Project description

VR180 image converter

CI Status Documentation Status Test coverage percentage

Poetry black pre-commit

PyPI Version Supported Python versions License


Documentation: https://vr180-convert.readthedocs.io

Source Code: https://github.com/34j/vr180-convert


Simple VR180 image converter on top of OpenCV and NumPy.

Installation

Install this via pip (or your favourite package manager):

pipx install vr180-convert
Left Right Output
left right output

Usage

Simply run the following command to convert 2 fisheye images to a SBS equirectangular VR180 image:

v1c lr left.jpg right.jpg

You can also specify the conversion model by adding Python code directly to the --transformer option:

v1c lr left.jpg right.jpg ---transformer "EquirectangularEncoder() * Euclidean3DRotator(from_rotation_vector([0, np.pi / 4, 0])) * FisheyeDecoder("equidistant")"

Please refer to the API documentation for the available transformers and their parameters. For from_rotation_vector, please refer to the numpy-quaternion documentation.

The radius of the non-black area of the input image is assumed by counting black pixels by default, but it would be better to specify it manually to get stable results:

v1c lr left.jpg right.jpg --radius 1000
v1c lr left.jpg right.jpg --radius max # min(width, height) / 2

To convert a single image, use v1c s instead.

For more information, please refer to the help or API documentation:

v1c --help

Usage as a library

For more complex transformations, it is recommended to create your own Transformer.

Note that the transformation is applied in inverse order (new[(x, y)] = old[transform(x, y)], e.g. to decode orthographic fisheye images, transform_polar should be arcsin(theta), not sin(theta).)

from vr180_convert import PolarRollTransformer, apply_lr

class MyTransformer(PolarRollTransformer):
    def transform_polar(
        self, theta: NDArray, roll: NDArray, **kwargs: Any
    ) -> tuple[NDArray, NDArray]:
        return theta**0.98 + theta**1.01, roll

transformer = EquirectangularEncoder() * MyTransformer() * FisheyeDecoder("equidistant")
apply_lr(transformer, left_path="left.jpg", right_path="right.jpg", out_path="output.jpg")

Contributors ✨

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!

Credits

This package was created with Copier and the browniebroke/pypackage-template project template.

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

vr180_convert-0.1.0.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

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

vr180_convert-0.1.0-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file vr180_convert-0.1.0.tar.gz.

File metadata

  • Download URL: vr180_convert-0.1.0.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for vr180_convert-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ffb113a90d78ed5260fd41164866eb255da2b0f62b73150b4bf560a84918516b
MD5 200f70063550a9e10deb9447a271a199
BLAKE2b-256 3a949e01e13a2d132b86ac61b2f5b646ad193fb4b02261724a54ca742839cdc8

See more details on using hashes here.

File details

Details for the file vr180_convert-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: vr180_convert-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for vr180_convert-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9286b23f255fad52c1f2c785ba92d87e9e97391ae983ab2496a68f9335a8a84c
MD5 ad4074fce5d0681aa5457aa5fd9be9bf
BLAKE2b-256 d485bb8e8f09bcdab344d7be457b9c9d5fa50ad31ba2a7072a5f02caf1a16689

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