A class to project 360x180 images onto a cube
Project description
Three60Cube
A Package to project a 360 x 180 image onto a cube.
Installation
pip install three60cube
Usage
Creation of projection template
from three30cube import Three60Cube
proj = Three60Cube('source.JPG')
This will write a npy
file to your working directory. To get the projection on a certain cube pane:
new_img = proj.get_projected_pane(pane=1, dim=500)
new_img
Panes 0 through 3 are taken from the left to right side of the 360 image. Pane 4 is the top of the cube and pane 5 is the bottom part. The dim
parameter refers to dimension of the output image; a dim
of 500 will produce a 500 x 500px image.
After you have generated the npy-template you can process images with the same dimensions of the initial 360 image:
# use the generated template if you have one and haven't
# initialized a Three60Cube object already
proj = Three60Cube(template='three60cube_template.npy')
# open an image
proj.open_image('trees.JPG')
# project
new_img = proj.get_projected_pane(pane=0, dim=500)
Fast vs Slow
The get_projected_pane
function takes a parameter fast
(default value is True) that will project single RGB on the cube. If fast
is set to False it will collect all RGB values of all pixels that are projected on a single pixel of the cube and sets its RGB value to the average of the collected values. Thanks to qubixes this won't take a lot of time.
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
Built Distribution
Hashes for three60cube-0.0.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ebe60238dedad969bd845f367c3c7c823a29f55a089c129f3409101cda00cc6 |
|
MD5 | b252cdd2ee78e7d5c572aaef014c243d |
|
BLAKE2b-256 | eb4b4c14123007b0fdfc6a58f49c69fb4df2148d69caff33ac000fdda4130c83 |