{ "info": { "author": "Cheng Sun", "author_email": "chengsun@gapp.nthu.edu.tw", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Artistic Software", "Topic :: Software Development :: Libraries" ], "description": "# py360convert\n\nFeatures of this project:\n- Convertion between cubemap and equirectangular \n ![](assert/teaser_convertion.png)\n- Equirectangular to planar \n ![](assert/teaser_2planar.png)\n- Pure python implementation and depend only on [numpy](http://www.numpy.org/) and [scipy](https://www.scipy.org/)\n- Vectorization implementation (in most of the place)\n - `c2e` takes 300ms and `e2c` takes 160ms on 1.6 GHz Intel Core i5 CPU\n\n## Requirements\n- numpy\n- scipy\n- pillow (for example code to load/save image)\n\n## Run with command line\nYou can run command line to use the functionality. Please See `python convert360.py -h` for detailed. The python script is also an example code to see how to use this as a package in your code.\n\n```\npython convert360.py --convert e2c --i assert/example_input.png --o assert/example_e2c.png --w 200\n```\n| Input Equirectangular | Output Cubemap |\n| :---: | :----: |\n| ![](assert/example_input.png) | ![](assert/example_e2c.png) |\n\n-----\n\n```\npython convert360.py --convert c2e --i assert/example_e2c.png --o assert/example_c2e.png --w 800 --h 400\n```\n| Input Cubemap | Output Equirectangular |\n| :---: | :----: |\n| ![](assert/example_e2c.png) | ![](assert/example_c2e.png) |\n\nYou can see the blurring artifacts in the polar region because the equirectangular in above figure are resampled twice (`e2c` then `c2e`).\n\n----\n\n```\npython convert360.py --convert e2p --i assert/example_input.png --o assert/example_e2p.png --w 300 --h 300 --u_deg 120 --v_deg 23\n```\n| Input Equirectangular | Output Perspective |\n| :---: | :----: |\n| ![](assert/example_input.png) | ![](assert/example_e2p.png) |\n\n\n## Doc\n\n#### `e2c(e_img, face_w=256, mode='bilinear', cube_format='dice')`\nConvert the given equirectangular to cubemap. \n**Parameters**:\n- `e_img`: Numpy array with shape [H, W, C].\n- `face_w`: The width of each cube face.\n- `mode`: `bilinear` or `nearest`.\n- `cube_format`: See `c2e` explaination.\n\n\n#### `e2p(e_img, fov_deg, u_deg, v_deg, out_hw, in_rot_deg=0, mode='bilinear')`\nTake perspective image from given equirectangular.\n**Parameters**:\n- `e_img`: Numpy array with shape [H, W, C].\n- `fov_deg`: Field of view given in int or tuple `(h_fov_deg, v_fov_deg)`.\n- `u_deg`: Horizontal viewing angle in range [-pi, pi]. (- Left / + Right).\n- `v_deg`: Vertical viewing angle in range [-pi/2, pi/2]. (- Down/ + Up).\n- `out_hw`: Output image `(height, width)` in tuple.\n- `in_rot_deg`: Inplane rotation.\n- `mode`: `bilinear` or `nearest`.\n\n\n#### `c2e(cubemap, h, w, cube_format='dice')`\nConvert the given cubemap to equirectangular. \n**Parameters**:\n- `cubemap`: Numpy array or list/dict of numpy array (depend on `cube_format`).\n- `h`: Output equirectangular height.\n- `w`: Output equirectangular width.\n- `cube_format`: 'dice' (default) or 'horizon' or 'dict' or 'list'. Telling the format of the given `cubemap`.\n\n**Example**:\n```\nimport numpy as np\nfrom PIL import Image\nimport py360convert\n\ncube_dice = np.array(Image.open('assert/demo_cube.png'))\n\n# You can make convertion between supported cubemap format\ncube_h = py360convert.cube_dice2h(cube_dice) # the inverse is cube_h2dice\ncube_dict = py360convert.cube_h2dict(cube_h) # the inverse is cube_dict2h\ncube_list = py360convert.cube_h2list(cube_h) # the inverse is cube_list2h\nprint('cube_dice.shape:', cube_dice.shape)\nprint('cube_h.shape:', cube_h.shape)\nprint('cube_dict.keys():', cube_dict.keys())\nprint('cube_dict[\"F\"].shape:', cube_dict[\"F\"].shape)\nprint('len(cube_list):', len(cube_list))\nprint('cube_list[0].shape:', cube_list[0].shape)\n```\nOutput:\n```\ncube_dice.shape: (768, 1024, 3)\ncube_h.shape: (256, 1536, 3)\ncube_dict.keys(): dict_keys(['F', 'R', 'B', 'L', 'U', 'D'])\ncube_dict[\"F\"].shape: (256, 256, 3)\nlen(cube_list): 6\ncube_list[0].shape: (256, 256, 3)\n```\n", "description_content_type": "", "docs_url": null, "download_url": "https://github.com/sunset1995/py360convert/archive/v_0.1.0.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/sunset1995", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "py360convert", "package_url": "https://pypi.org/project/py360convert/", "platform": "", "project_url": "https://pypi.org/project/py360convert/", "project_urls": { "Download": "https://github.com/sunset1995/py360convert/archive/v_0.1.0.tar.gz", "Homepage": "https://github.com/sunset1995" }, "release_url": "https://pypi.org/project/py360convert/0.1.0/", "requires_dist": null, "requires_python": "", "summary": "Convertion between cubemap and equirectangular and also to perspective planar.", "version": "0.1.0" }, "last_serial": 4729577, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "3576acfe36762c68d523a6e6d23725f3", "sha256": "ffde46646db828119ca7e23da68c0e25ccf3c9c7295c619aef8a29ba86af7e55" }, "downloads": -1, "filename": "py360convert-0.1.0.tar.gz", "has_sig": false, "md5_digest": "3576acfe36762c68d523a6e6d23725f3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6513, "upload_time": "2019-01-23T07:49:47", "url": "https://files.pythonhosted.org/packages/45/bc/92dfa33e0ecdcda7f17fd93034ac833fc5566e113403fcc27bbd7c0d0086/py360convert-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3576acfe36762c68d523a6e6d23725f3", "sha256": "ffde46646db828119ca7e23da68c0e25ccf3c9c7295c619aef8a29ba86af7e55" }, "downloads": -1, "filename": "py360convert-0.1.0.tar.gz", "has_sig": false, "md5_digest": "3576acfe36762c68d523a6e6d23725f3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6513, "upload_time": "2019-01-23T07:49:47", "url": "https://files.pythonhosted.org/packages/45/bc/92dfa33e0ecdcda7f17fd93034ac833fc5566e113403fcc27bbd7c0d0086/py360convert-0.1.0.tar.gz" } ] }