Simple VR180 image converter
Project description
VR180 image converter
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 |
---|---|---|
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for vr180_convert-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9286b23f255fad52c1f2c785ba92d87e9e97391ae983ab2496a68f9335a8a84c |
|
MD5 | ad4074fce5d0681aa5457aa5fd9be9bf |
|
BLAKE2b-256 | d485bb8e8f09bcdab344d7be457b9c9d5fa50ad31ba2a7072a5f02caf1a16689 |