pyosa


Namepyosa JSON
Version 0.0.1 PyPI version JSON
download
home_page
SummarySimple estimator of the irregular open surface area in 3-D
upload_time2023-04-26 12:19:14
maintainer
docs_urlNone
author
requires_python>=3.7
licenseMIT License Copyright (c) 2023 Ante Kapetanovic Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords point cloud triangle mesh surface reconstruction surface area
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PyOpenSurfaceArea

Estimates the area of an open surface represented as a point cloud in 3-D space.

## Installation

Install it simply by
```shell
pip install pyosa
```

## Usage

A simple example of estimating the surface area composed of all points within some radius around a targeted point on the surface of the Stanford bunny is shown below. Run `example.py` to reproduce this example.

```python
from matplotlib.patches import Circle
import numpy as np
from scipy import spatial

import pyosa


# laod the data
xyz = np.genfromtxt('bunny100k.xyz', delimiter=' ')
    
# downsampling the point cloud just a bit for visualization purposes
N = xyz.shape[0]
num = 0.05 * N
mask = np.arange(0, N, int(N/num))
xyz_ds = xyz[mask]
    
# extract an arbitrary, open surface for which we want to extract the area
point = xyz_ds[np.argmax(xyz_ds[:, 2]), :]
tree = spatial.KDTree(xyz_ds)
r = 0.5
ind = tree.query_ball_point(point, r)

# extraction of the surface area is as simple as
surf = xyz_ds[ind]
area = pyosa.estimate(surf)

# show the resulting figure
circle = patches.Circle(point, r, fc='none', ec='k')
fig, ax  = show_pcd(xyz_ds, point, circle)  # impementation in example.py
ax.set_title(f'surface area: {area:.2f}')
```

<p align="center"><img src="https://github.com/akapet00/pyosa/raw/main/bunny.png" width="60%"></p>

## Shortcomings

The current implementation is limited to open surfaces in 3-D space. The surface is assumed to have the least amount of variance in its "height" direction, that is, the surface is observed from the point of view on the normal at the center of the surface.

## License
[MIT](https://github.com/akapet00/pyosa/blob/main/LICENSE)

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "pyosa",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "point cloud,triangle mesh,surface reconstruction,surface area",
    "author": "",
    "author_email": "Ante Kapetanovi\u0107 <akape00@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/bc/46/341d8456f559fb5add1795086cc0cf69bf904caf1c27104b9eabdf797308/pyosa-0.0.1.tar.gz",
    "platform": null,
    "description": "# PyOpenSurfaceArea\n\nEstimates the area of an open surface represented as a point cloud in 3-D space.\n\n## Installation\n\nInstall it simply by\n```shell\npip install pyosa\n```\n\n## Usage\n\nA simple example of estimating the surface area composed of all points within some radius around a targeted point on the surface of the Stanford bunny is shown below. Run `example.py` to reproduce this example.\n\n```python\nfrom matplotlib.patches import Circle\nimport numpy as np\nfrom scipy import spatial\n\nimport pyosa\n\n\n# laod the data\nxyz = np.genfromtxt('bunny100k.xyz', delimiter=' ')\n    \n# downsampling the point cloud just a bit for visualization purposes\nN = xyz.shape[0]\nnum = 0.05 * N\nmask = np.arange(0, N, int(N/num))\nxyz_ds = xyz[mask]\n    \n# extract an arbitrary, open surface for which we want to extract the area\npoint = xyz_ds[np.argmax(xyz_ds[:, 2]), :]\ntree = spatial.KDTree(xyz_ds)\nr = 0.5\nind = tree.query_ball_point(point, r)\n\n# extraction of the surface area is as simple as\nsurf = xyz_ds[ind]\narea = pyosa.estimate(surf)\n\n# show the resulting figure\ncircle = patches.Circle(point, r, fc='none', ec='k')\nfig, ax  = show_pcd(xyz_ds, point, circle)  # impementation in example.py\nax.set_title(f'surface area: {area:.2f}')\n```\n\n<p align=\"center\"><img src=\"https://github.com/akapet00/pyosa/raw/main/bunny.png\" width=\"60%\"></p>\n\n## Shortcomings\n\nThe current implementation is limited to open surfaces in 3-D space. The surface is assumed to have the least amount of variance in its \"height\" direction, that is, the surface is observed from the point of view on the normal at the center of the surface.\n\n## License\n[MIT](https://github.com/akapet00/pyosa/blob/main/LICENSE)\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2023 Ante Kapetanovic  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Simple estimator of the irregular open surface area in 3-D",
    "version": "0.0.1",
    "split_keywords": [
        "point cloud",
        "triangle mesh",
        "surface reconstruction",
        "surface area"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "286ccfa57fc0325b895e738e3b4c4b5924694fd2b1a6c08852cc14d9b0139c4b",
                "md5": "ef6374fa8f84968f8e56c9f84b15706c",
                "sha256": "b5edb33108ca01d7f25edec91b03af1e1e14b3de4c92e2ad60f8da0bc7221cf8"
            },
            "downloads": -1,
            "filename": "pyosa-0.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ef6374fa8f84968f8e56c9f84b15706c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 5844,
            "upload_time": "2023-04-26T12:19:10",
            "upload_time_iso_8601": "2023-04-26T12:19:10.840293Z",
            "url": "https://files.pythonhosted.org/packages/28/6c/cfa57fc0325b895e738e3b4c4b5924694fd2b1a6c08852cc14d9b0139c4b/pyosa-0.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bc46341d8456f559fb5add1795086cc0cf69bf904caf1c27104b9eabdf797308",
                "md5": "6d1990697cf92b6499d796f95efa8f7a",
                "sha256": "e246cc578e15d486056f4bf4184bcb53c400470aa4dc4f4ab4e33c4de7a0219b"
            },
            "downloads": -1,
            "filename": "pyosa-0.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "6d1990697cf92b6499d796f95efa8f7a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 1753351,
            "upload_time": "2023-04-26T12:19:14",
            "upload_time_iso_8601": "2023-04-26T12:19:14.954101Z",
            "url": "https://files.pythonhosted.org/packages/bc/46/341d8456f559fb5add1795086cc0cf69bf904caf1c27104b9eabdf797308/pyosa-0.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-26 12:19:14",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "pyosa"
}
        
Elapsed time: 1.47370s