FisheyeWarping


NameFisheyeWarping JSON
Version 1.0.1 PyPI version JSON
download
home_pagehttps://github.com/NatLee/fisheye-warping
SummaryDewarp top-down fisheye image to panorama and rewarp panorama to fisheye image.
upload_time2023-05-07 13:59:37
maintainer
docs_urlNone
authorNat Lee
requires_python>=3.6
license
keywords dewarp rewarp panorama fisheye mesh cli
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center" style="text-align: center">

# **Fisheye Warping**

<p style="text-align: center">
  <img align="center" src="https://github.com/NatLee/fisheye-warping/raw/main/doc/101-panorama.jpg" alt="Panorama" width="70%" height="100%">
  <div></div>
  <img align="center" src="https://github.com/NatLee/fisheye-warping/raw/main/doc/101-fisheye.jpg" alt="Fisheye" width="40%" height="40%">
</p>

[![PyPI pyversions](https://img.shields.io/pypi/pyversions/FisheyeWarping.svg)](https://pypi.python.org/pypi/FisheyeWarping/) [![PyPI implementation](https://img.shields.io/pypi/implementation/FisheyeWarping.svg)](https://pypi.python.org/pypi/FisheyeWarping/)

[![Test](https://github.com/NatLee/fisheye-warping/actions/workflows/test.yml/badge.svg)](https://github.com/NatLee/Eagle-Wrappger/actions/workflows/test.yml) [![Release](https://github.com/NatLee/fisheye-warping/actions/workflows/release.yml/badge.svg)](https://github.com/NatLee/fisheye-warping/actions/workflows/release.yml)

[![PyPI status](https://img.shields.io/pypi/status/FisheyeWarping.svg)](https://pypi.python.org/pypi/FisheyeWarping/) [![PyPI license](https://img.shields.io/pypi/l/FisheyeWarping.svg)](https://pypi.python.org/pypi/FisheyeWarping/)

[![PyPI version fury.io](https://badge.fury.io/py/FisheyeWarping.svg)](https://pypi.python.org/pypi/FisheyeWarping/)

[![PyPI download month](https://img.shields.io/pypi/dm/FisheyeWarping.svg)](https://pypi.python.org/pypi/FisheyeWarping/) [![PyPI download week](https://img.shields.io/pypi/dw/FisheyeWarping.svg)](https://pypi.python.org/pypi/FisheyeWarping/) [![PyPI download day](https://img.shields.io/pypi/dd/FisheyeWarping.svg)](https://pypi.python.org/pypi/FisheyeWarping/)

[![forthebadge made-with-python](http://ForTheBadge.com/images/badges/made-with-python.svg)](https://www.python.org/)

</div>

A tool for dewarping and rewarping on a top-down fisheye image by using OpenCV on Python.

## Installation

```bash
pip install FisheyeWarping
```

Check it in [Pypi](https://pypi.org/project/FisheyeWarping/)

## Usage

```bash
fisheyewarping --help
```

```
usage: fisheyewarping [-h] [--panorama_output PANORAMA_OUTPUT] [--fisheye_output FISHEYE_OUTPUT] [--save_dewarp_mesh_path SAVE_DEWARP_MESH_PATH] [--save_rewarp_mesh_path SAVE_REWARP_MESH_PATH] [--load_dewarp_mesh_path LOAD_DEWARP_MESH_PATH]
                      [--load_rewarp_mesh_path LOAD_REWARP_MESH_PATH] [--fisheye_img_path FISHEYE_IMG_PATH] [--panorama_img_path PANORAMA_IMG_PATH] [--use_multiprocessing USE_MULTIPROCESSING]

optional arguments:
  -h, --help            show this help message and exit
  --panorama_output PANORAMA_OUTPUT
                        Specific path for `output`. Default is `./dewarp-output.png`.
  --fisheye_output FISHEYE_OUTPUT
                        Specific path for `output`. Default is `./rewarp-output.png`.
  --save_dewarp_mesh_path SAVE_DEWARP_MESH_PATH
                        Specific path for saving mesh data for `dewarping`. Default is `None`.
  --save_rewarp_mesh_path SAVE_REWARP_MESH_PATH
                        Specific path for saving mesh data for `rewarping`. Default is `None`.
  --load_dewarp_mesh_path LOAD_DEWARP_MESH_PATH
                        Specific path for loading mesh data for `dewarping`. Default is `None`.
  --load_rewarp_mesh_path LOAD_REWARP_MESH_PATH
                        Specific path for loading mesh data for `rewarping`. Default is `None`.
  --fisheye_img_path FISHEYE_IMG_PATH
                        Specific path of your fisheye image for dewarping to a panorama.
  --panorama_img_path PANORAMA_IMG_PATH
                        Specific path of your panorama image for rewarping to a fisheye image.
  --use_multiprocessing USE_MULTIPROCESSING
                        Use multiprocessing to get mesh. Default is `True`.
```

## Example

### Dewarp a fisheye image to panorama

- In the first time, you will need to build a mesh file for dewarping.

    ```bash
    fisheyewarping \
    --save_dewarp_mesh_path ./dewarp-mesh.pkl \
    --fisheye_img_path ./test-fisheye.jpg
    ```

    ```python
    import cv2
    from fisheyewarping import FisheyeWarping
    fisheye_img = cv2.imread('./test-fisheye.jpg')
    frd = FisheyeWarping(fisheye_img, use_multiprocessing=True)
    frd.build_dewarp_mesh(save_path='./dewarp-mesh.pkl')
    frd.run_dewarp(save_path='./dewarp-output.png')
    ```

- In the next time, you just load the mesh and feel free to go.

    ```bash
    fisheyewarping \
    --load_dewarp_mesh_path ./dewarp-mesh.pkl \
    --fisheye_img_path ./test-fisheye.jpg
    ```

    ```python
    import cv2
    from fisheyewarping import FisheyeWarping
    fisheye_img = cv2.imread('./test-fisheye.jpg'.)
    frd = FisheyeWarping(fisheye_img, use_multiprocessing=True)
    frd.load_dewarp_mesh(save_path='./dewarp-mesh.pkl')
    frd.run_dewarp(save_path='./dewarp-output.png')
    ```

### Rewarp any panorama image to fisheye

- In the first time, you will need to build 2 mesh files for dewarping and rewarping by using one fisheye image.

    ```bash
    fisheyewarping \
    --save_dewarp_mesh_path ./dewarp-mesh.pkl \
    --save_rewarp_mesh_path ./rewarp-mesh.pkl \
    --fisheye_img_path ./test-fisheye.jpg
    ```

    ```python
    import cv2
    from fisheyewarping import FisheyeWarping
    fisheye_img = cv2.imread('./test-fisheye.jpg'.)
    frd = FisheyeWarping(fisheye_img, use_multiprocessing=True)
    frd.build_dewarp_mesh(save_path='./dewarp-mesh.pkl')
    frd.build_rewarp_mesh(save_path='./rewarp-mesh.pkl')
    panorama_img = cv2.imread('./test-panorama.jpg'.)
    frd.run_rewarp_with_mesh(panorama_img, save_path='./rewarp-output.png')
    ```

- In the next time, you just load the meshes and feel free to go.

    ```bash
    fisheyewarping \
    --load_dewarp_mesh_path ./dewarp-mesh.pkl \
    --load_rewarp_mesh_path ./rewarp-mesh.pkl \
    --panorame_img_path ./test-panorama.jpg
    ```

    ```python
    import cv2
    from fisheyewarping import FisheyeWarping
    frd = FisheyeWarping(None, use_multiprocessing=True)
    frd.load_dewarp_mesh(save_path='./dewarp-mesh.pkl')
    frd.load_rewarp_mesh(save_path='./rewarp-mesh.pkl')
    panorama_img = cv2.imread('./test-panorama.jpg'.)
    frd.run_rewarp_with_mesh(panorama_img, save_path='./rewarp-output.png')
    ```


## Mesh

> The source of mesh image is from (http://paulbourke.net/dome/fish2/).

Here is the mesh image for this tool, it shows the transformation from the original fisheye image to the panorama image.

- Before - **Fisheye**

<div align="center" style="text-align: center">
<img align="center" src="https://github.com/NatLee/fisheye-warping/raw/main/doc/mesh-fisheye.jpg" alt="Fisheye" width="40%" height="40%">
</div>

- After - **Panorama**

<div align="center" style="text-align: center">
<img align="center" src="https://github.com/NatLee/fisheye-warping/raw/main/doc/mesh-panorama.jpg" alt="Panorama" width="70%" height="100%">
</div>


## Contributor

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
  <tbody>
    <tr>
      <td align="center"><a href="https://github.com/NatLee"><img src="https://avatars.githubusercontent.com/u/10178964?v=3?s=100" width="100px;" alt="Nat Lee"/><br /><sub><b>Nat Lee</b></sub></a></td>
    </tr>
  </tbody>
</table>

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->

## LICENSE

[MIT](LICENSE)



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/NatLee/fisheye-warping",
    "name": "FisheyeWarping",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "dewarp,rewarp,panorama,fisheye,mesh,cli",
    "author": "Nat Lee",
    "author_email": "natlee.work@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/6b/65/a532ad690df35789fdcf87add15b5365b9cae63fc86bd8043c10d9ec8e6a/FisheyeWarping-1.0.1.tar.gz",
    "platform": null,
    "description": "<div align=\"center\" style=\"text-align: center\">\n\n# **Fisheye Warping**\n\n<p style=\"text-align: center\">\n  <img align=\"center\" src=\"https://github.com/NatLee/fisheye-warping/raw/main/doc/101-panorama.jpg\" alt=\"Panorama\" width=\"70%\" height=\"100%\">\n  <div></div>\n  <img align=\"center\" src=\"https://github.com/NatLee/fisheye-warping/raw/main/doc/101-fisheye.jpg\" alt=\"Fisheye\" width=\"40%\" height=\"40%\">\n</p>\n\n[![PyPI pyversions](https://img.shields.io/pypi/pyversions/FisheyeWarping.svg)](https://pypi.python.org/pypi/FisheyeWarping/) [![PyPI implementation](https://img.shields.io/pypi/implementation/FisheyeWarping.svg)](https://pypi.python.org/pypi/FisheyeWarping/)\n\n[![Test](https://github.com/NatLee/fisheye-warping/actions/workflows/test.yml/badge.svg)](https://github.com/NatLee/Eagle-Wrappger/actions/workflows/test.yml) [![Release](https://github.com/NatLee/fisheye-warping/actions/workflows/release.yml/badge.svg)](https://github.com/NatLee/fisheye-warping/actions/workflows/release.yml)\n\n[![PyPI status](https://img.shields.io/pypi/status/FisheyeWarping.svg)](https://pypi.python.org/pypi/FisheyeWarping/) [![PyPI license](https://img.shields.io/pypi/l/FisheyeWarping.svg)](https://pypi.python.org/pypi/FisheyeWarping/)\n\n[![PyPI version fury.io](https://badge.fury.io/py/FisheyeWarping.svg)](https://pypi.python.org/pypi/FisheyeWarping/)\n\n[![PyPI download month](https://img.shields.io/pypi/dm/FisheyeWarping.svg)](https://pypi.python.org/pypi/FisheyeWarping/) [![PyPI download week](https://img.shields.io/pypi/dw/FisheyeWarping.svg)](https://pypi.python.org/pypi/FisheyeWarping/) [![PyPI download day](https://img.shields.io/pypi/dd/FisheyeWarping.svg)](https://pypi.python.org/pypi/FisheyeWarping/)\n\n[![forthebadge made-with-python](http://ForTheBadge.com/images/badges/made-with-python.svg)](https://www.python.org/)\n\n</div>\n\nA tool for dewarping and rewarping on a top-down fisheye image by using OpenCV on Python.\n\n## Installation\n\n```bash\npip install FisheyeWarping\n```\n\nCheck it in [Pypi](https://pypi.org/project/FisheyeWarping/)\n\n## Usage\n\n```bash\nfisheyewarping --help\n```\n\n```\nusage: fisheyewarping [-h] [--panorama_output PANORAMA_OUTPUT] [--fisheye_output FISHEYE_OUTPUT] [--save_dewarp_mesh_path SAVE_DEWARP_MESH_PATH] [--save_rewarp_mesh_path SAVE_REWARP_MESH_PATH] [--load_dewarp_mesh_path LOAD_DEWARP_MESH_PATH]\n                      [--load_rewarp_mesh_path LOAD_REWARP_MESH_PATH] [--fisheye_img_path FISHEYE_IMG_PATH] [--panorama_img_path PANORAMA_IMG_PATH] [--use_multiprocessing USE_MULTIPROCESSING]\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --panorama_output PANORAMA_OUTPUT\n                        Specific path for `output`. Default is `./dewarp-output.png`.\n  --fisheye_output FISHEYE_OUTPUT\n                        Specific path for `output`. Default is `./rewarp-output.png`.\n  --save_dewarp_mesh_path SAVE_DEWARP_MESH_PATH\n                        Specific path for saving mesh data for `dewarping`. Default is `None`.\n  --save_rewarp_mesh_path SAVE_REWARP_MESH_PATH\n                        Specific path for saving mesh data for `rewarping`. Default is `None`.\n  --load_dewarp_mesh_path LOAD_DEWARP_MESH_PATH\n                        Specific path for loading mesh data for `dewarping`. Default is `None`.\n  --load_rewarp_mesh_path LOAD_REWARP_MESH_PATH\n                        Specific path for loading mesh data for `rewarping`. Default is `None`.\n  --fisheye_img_path FISHEYE_IMG_PATH\n                        Specific path of your fisheye image for dewarping to a panorama.\n  --panorama_img_path PANORAMA_IMG_PATH\n                        Specific path of your panorama image for rewarping to a fisheye image.\n  --use_multiprocessing USE_MULTIPROCESSING\n                        Use multiprocessing to get mesh. Default is `True`.\n```\n\n## Example\n\n### Dewarp a fisheye image to panorama\n\n- In the first time, you will need to build a mesh file for dewarping.\n\n    ```bash\n    fisheyewarping \\\n    --save_dewarp_mesh_path ./dewarp-mesh.pkl \\\n    --fisheye_img_path ./test-fisheye.jpg\n    ```\n\n    ```python\n    import cv2\n    from fisheyewarping import FisheyeWarping\n    fisheye_img = cv2.imread('./test-fisheye.jpg')\n    frd = FisheyeWarping(fisheye_img, use_multiprocessing=True)\n    frd.build_dewarp_mesh(save_path='./dewarp-mesh.pkl')\n    frd.run_dewarp(save_path='./dewarp-output.png')\n    ```\n\n- In the next time, you just load the mesh and feel free to go.\n\n    ```bash\n    fisheyewarping \\\n    --load_dewarp_mesh_path ./dewarp-mesh.pkl \\\n    --fisheye_img_path ./test-fisheye.jpg\n    ```\n\n    ```python\n    import cv2\n    from fisheyewarping import FisheyeWarping\n    fisheye_img = cv2.imread('./test-fisheye.jpg'.)\n    frd = FisheyeWarping(fisheye_img, use_multiprocessing=True)\n    frd.load_dewarp_mesh(save_path='./dewarp-mesh.pkl')\n    frd.run_dewarp(save_path='./dewarp-output.png')\n    ```\n\n### Rewarp any panorama image to fisheye\n\n- In the first time, you will need to build 2 mesh files for dewarping and rewarping by using one fisheye image.\n\n    ```bash\n    fisheyewarping \\\n    --save_dewarp_mesh_path ./dewarp-mesh.pkl \\\n    --save_rewarp_mesh_path ./rewarp-mesh.pkl \\\n    --fisheye_img_path ./test-fisheye.jpg\n    ```\n\n    ```python\n    import cv2\n    from fisheyewarping import FisheyeWarping\n    fisheye_img = cv2.imread('./test-fisheye.jpg'.)\n    frd = FisheyeWarping(fisheye_img, use_multiprocessing=True)\n    frd.build_dewarp_mesh(save_path='./dewarp-mesh.pkl')\n    frd.build_rewarp_mesh(save_path='./rewarp-mesh.pkl')\n    panorama_img = cv2.imread('./test-panorama.jpg'.)\n    frd.run_rewarp_with_mesh(panorama_img, save_path='./rewarp-output.png')\n    ```\n\n- In the next time, you just load the meshes and feel free to go.\n\n    ```bash\n    fisheyewarping \\\n    --load_dewarp_mesh_path ./dewarp-mesh.pkl \\\n    --load_rewarp_mesh_path ./rewarp-mesh.pkl \\\n    --panorame_img_path ./test-panorama.jpg\n    ```\n\n    ```python\n    import cv2\n    from fisheyewarping import FisheyeWarping\n    frd = FisheyeWarping(None, use_multiprocessing=True)\n    frd.load_dewarp_mesh(save_path='./dewarp-mesh.pkl')\n    frd.load_rewarp_mesh(save_path='./rewarp-mesh.pkl')\n    panorama_img = cv2.imread('./test-panorama.jpg'.)\n    frd.run_rewarp_with_mesh(panorama_img, save_path='./rewarp-output.png')\n    ```\n\n\n## Mesh\n\n> The source of mesh image is from (http://paulbourke.net/dome/fish2/).\n\nHere is the mesh image for this tool, it shows the transformation from the original fisheye image to the panorama image.\n\n- Before - **Fisheye**\n\n<div align=\"center\" style=\"text-align: center\">\n<img align=\"center\" src=\"https://github.com/NatLee/fisheye-warping/raw/main/doc/mesh-fisheye.jpg\" alt=\"Fisheye\" width=\"40%\" height=\"40%\">\n</div>\n\n- After - **Panorama**\n\n<div align=\"center\" style=\"text-align: center\">\n<img align=\"center\" src=\"https://github.com/NatLee/fisheye-warping/raw/main/doc/mesh-panorama.jpg\" alt=\"Panorama\" width=\"70%\" height=\"100%\">\n</div>\n\n\n## Contributor\n\n<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->\n<!-- prettier-ignore-start -->\n<!-- markdownlint-disable -->\n<table>\n  <tbody>\n    <tr>\n      <td align=\"center\"><a href=\"https://github.com/NatLee\"><img src=\"https://avatars.githubusercontent.com/u/10178964?v=3?s=100\" width=\"100px;\" alt=\"Nat Lee\"/><br /><sub><b>Nat Lee</b></sub></a></td>\n    </tr>\n  </tbody>\n</table>\n\n<!-- markdownlint-restore -->\n<!-- prettier-ignore-end -->\n\n<!-- ALL-CONTRIBUTORS-LIST:END -->\n\n## LICENSE\n\n[MIT](LICENSE)\n\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Dewarp top-down fisheye image to panorama and rewarp panorama to fisheye image.",
    "version": "1.0.1",
    "project_urls": {
        "Bug Reports": "https://github.com/NatLee/fisheye-warping/issues",
        "Documentation": "https://github.com/NatLee/fisheye-warping",
        "Homepage": "https://github.com/NatLee/fisheye-warping",
        "Source Code": "https://github.com/NatLee/fisheye-warping"
    },
    "split_keywords": [
        "dewarp",
        "rewarp",
        "panorama",
        "fisheye",
        "mesh",
        "cli"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e7b8f55cb46d5176f9c78314562d66156a6da514bd5922838cf15da6f9f555eb",
                "md5": "3d22b64c126d95196a5fe5c53a660709",
                "sha256": "a15c9f51c4a88995ebe55bedeb1f27eb812d93c94b670694c8e9423e257fb8da"
            },
            "downloads": -1,
            "filename": "FisheyeWarping-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3d22b64c126d95196a5fe5c53a660709",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 9061,
            "upload_time": "2023-05-07T13:59:35",
            "upload_time_iso_8601": "2023-05-07T13:59:35.777718Z",
            "url": "https://files.pythonhosted.org/packages/e7/b8/f55cb46d5176f9c78314562d66156a6da514bd5922838cf15da6f9f555eb/FisheyeWarping-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6b65a532ad690df35789fdcf87add15b5365b9cae63fc86bd8043c10d9ec8e6a",
                "md5": "e6c0e597897c8b255d7f7925913abaa5",
                "sha256": "895f2a53a98bfc1ab25f604c44baa66ef800d1df96b8242888d65fe13b296b07"
            },
            "downloads": -1,
            "filename": "FisheyeWarping-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "e6c0e597897c8b255d7f7925913abaa5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 2388490,
            "upload_time": "2023-05-07T13:59:37",
            "upload_time_iso_8601": "2023-05-07T13:59:37.672772Z",
            "url": "https://files.pythonhosted.org/packages/6b/65/a532ad690df35789fdcf87add15b5365b9cae63fc86bd8043c10d9ec8e6a/FisheyeWarping-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-07 13:59:37",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "NatLee",
    "github_project": "fisheye-warping",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "fisheyewarping"
}
        
Elapsed time: 0.84006s