Git Product home page Git Product logo

py360convert's People

Contributors

sunset1995 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

py360convert's Issues

error in py360convert/utils.py line no: 193

In py360convert/utils.py line no: 193, you have an unknown variable reference "k" commenting that line works though.

def cube_dict2h(cube_dict, face_k=['F', 'R', 'B', 'L', 'U', 'D']):
    # assert len(k) == 6
    return cube_list2h([cube_dict[k] for k in face_k])

Support for p2e conversion

I am trying to create a photosphere using a combination of a few normal camera images.
I know the fov, u, v and also the height and width of the input image.

My initial image (equirectangular)
grey

My input image (planer or perspective view [fov=75, u=0, v=0, img_w=640, img_h=480])
1

I was able to get the (x,y) position using your e2p function and fit those images in the sample equirectangular image near the equator(mid of the image). But as I go near the edges, the images start to overlap since I am missing the pixel manipulation to form curves.
out

Can you please provide some reading material, since your code has no documentation or, if you got time, can you please help me out.

Document is missing

TODO:

  • introduction to the coordinate system this repo use
  • functionality documentation & example with image

error in py360convert/utils.py line no: 217

Hey,
Using your example code :


import numpy as np
from PIL import Image
import py360convert

cube_dice = np.array(Image.open('MyImage.jpg'))

cube_h = py360convert.cube_dice2h(cube_dice)  # the inverse is cube_h2dice
cube_dict = py360convert.cube_h2dict(cube_h)  # the inverse is cube_dict2h
cube_list = py360convert.cube_h2list(cube_h)  # the inverse is cube_list2h
print('cube_dice.shape:', cube_dice.shape)
print('cube_h.shape:', cube_h.shape)
print('cube_dict.keys():', cube_dict.keys())
print('cube_dict["F"].shape:', cube_dict["F"].shape)
print('len(cube_list):', len(cube_list))
print('cube_list[0].shape:', cube_list[0].shape)

I've got this error message :

Traceback (most recent call last):
  File "PhotoToCubeMap.py", line 8, in <module>
    cube_h = py360convert.cube_dice2h(cube_dice)  # the inverse is cube_h2dice
  File "C:\Program Files\Python37\lib\site-packages\py360convert\utils.py", line 217, in cube_dice2h
    assert cube_dice.shape[0] == w * 3 and cube_dice.shape[1] == w * 4
AssertionError

New PyPi Release

Thanks for your library @sunset1995 ! I was wondering if you could tag a new release for pypi; seems like some bugs have been fixed since the initial release. Thanks!

recommended reading materials

Thank you for this great contribution!
Yet, I am wondering where we could find are some reading materials that might help us understand the theory foundation behind the implementations.
Any recommendation would be appreciated!

Bug in c2e

I am using p360convert with python 3.7.8. I tried e2c and it worked as expected but I am having issue in c2e. I used the example, but same issue appeared. Am I doing it wrong or is this a bug?

cube_dice = np.array(Image.open('assert/example_e2c.png'))
Image.fromarray(py360convert.c2e(cube_dice,400,800), 'RGB').show()

image

a big bug in c2e

The list of equirectangulars generated by c2e is not right, look the picture:
Lark20201112-170458

the right, back and up picture is reversed, use an another tool, we got a right list pictures.

Lark20201112-170653

python.exe: No module named convert360

Thanks for this great tool :)
Unfortunately I cannot execute it, any idea what I'm doing wrong?
I tried both python 2.7 and python3, both fail:

> python -m convert360 --convert e2c --i equirectangular-0.jpg -o e2c.png --w 512
D:\Program Files\Python27\python.exe: No module named convert360

> python -m py360convert --convert e2c --i equirectangular-0.jpg -o e2c.png --w 512
Traceback (most recent call last):
  File "D:\Program Files\Python27\lib\runpy.py", line 151, in _run_module_as_mai
n
    mod_name, loader, code, fname = _get_module_details(mod_name)
  File "D:\Program Files\Python27\lib\runpy.py", line 109, in _get_module_detail
s
    return _get_module_details(pkg_main_name)
  File "D:\Program Files\Python27\lib\runpy.py", line 101, in _get_module_detail
s
    loader = get_loader(mod_name)
  File "D:\Program Files\Python27\lib\pkgutil.py", line 464, in get_loader
    return find_loader(fullname)
  File "D:\Program Files\Python27\lib\pkgutil.py", line 474, in find_loader
    for importer in iter_importers(fullname):
  File "D:\Program Files\Python27\lib\pkgutil.py", line 430, in iter_importers
    __import__(pkg)
  File "D:\Program Files\Python27\lib\site-packages\py360convert\__init__.py", l
ine 1, in <module>
    from .e2c import e2c
  File "D:\Program Files\Python27\lib\site-packages\py360convert\e2c.py", line 3
, in <module>
    from . import utils
  File "D:\Program Files\Python27\lib\site-packages\py360convert\utils.py", line
 68
    out = np.ones((*out_hw, 3), np.float32)
                   ^
SyntaxError: invalid syntax

> python3 -m py360convert --convert e2c --i equirectangular-0.jpg -o e2c.png --w 512
C:\Users\me\scoop\apps\python\current\python.exe: No module named py360convert

> python3 -m py360convert --convert e2c --i equirectangular-0.jpg -o e2c.png --w 512
C:\Users\me\scoop\apps\python\current\python.exe: No module named py360convert._
_main__; 'py360convert' is a package and cannot be directly executed

> python3 -m convert360 --convert e2c --i equirectangular-0.jpg -o e2c.png --w 512
C:\Users\me\scoop\apps\python\current\python.exe: No module named convert360

Btw, with this tool, how can I generate 6 different image files for the cubemap faces?

Problem with Py360Convert and Pillow

When I play the code on Python it gives me this error and I think it is a problem with PIL

/bin/python3 "/home/jubei/Documentos/Python/Images 360/equiretangular.py"
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/PIL/Image.py", line 2813, in fromarray
    mode, rawmode = _fromarray_typemap[typekey]
KeyError: ((1, 1, 3), '<f8')

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/jubei/Documentos/Python/Images 360/equiretangular.py", line 9, in <module>
    image = Image.fromarray(equiretangular)
  File "/usr/lib/python3/dist-packages/PIL/Image.py", line 2815, in fromarray
    raise TypeError("Cannot handle this data type: %s, %s" % typekey) from e
TypeError: Cannot handle this data type: (1, 1, 3), <f8

What does each cubemap format means

In the README.md, c2e categorize the input cubemap's format, 'dice' (default), 'horizon', 'dict' and 'list'. But, there's no further explain about that format because i guess there's no formal sentence for cubemap format.

I searched about cubemap formap and there's some shape of cubemap.
cubemap_format

So, if anyone have time to add the more precise explain about format. Please add it :)
Thank you for reading.

Numba Support

With some rewriting to support Numba, this library could be even faster. It would require a bit of refactoring, but it might make the code even faster and unlocks the ability to use fastmath, autoparallelilzation and other features.

The jit_module function from numba gets you part of the way there, but there were several parts of the functions like c2e that needs to be rewritten into smaller functions or slightly modified to use the supported functions in numpy.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.