A Python implementation of SN-Graph algorithm.
Project description
SN-Graph: a graph skeletonisation algorithm.
A Python implementation of an SN-Graph skeletonisation algorithm. Based on the article SN-Graph: a Minimalist 3D Object Representation for Classification arXiv:2105.14784.
Description
SN-Graph works by:
- Creating vertices as centres of spheres inscribed in the image, where one balances the size of the spheres with their coverage of the shape, and pariwise distances from one another.
- Adding edges between the neighbouring spheres, subject to a few common-sense criteria.
The resulting graph serves as a lightweight 1-dimensional representation of the original image, potentially useful for further analysis.
Basic Usage
import numpy as np
import sn_graph as sn
# Create a simple square image
img = np.zeros((100, 100))
img[40:60, 40:60] = 1 # Create a square region
# Generate the SN graph
centers, edges = sn.create_sn_graph(
img,
max_num_vertices=10,
edge_threshold=1.0
)
Key Parameters
max_num_vertices: Maximum number of vertices in the graphmax_edge_length: Maximum allowed edge lengthedge_threshold: Threshold for determining what portion of an edge must be contained within the shapeminimal_sphere_radius: Minimum radius allowed for spheresedge_sphere_threshold: Threshold value for deciding how close can an edge be to a non-enpdpoint spheres
Authors
- Tomasz Prytuła (tomasz.prytula@alexandra.dk)
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sn_graph-0.1.0.tar.gz.
File metadata
- Download URL: sn_graph-0.1.0.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.7 Darwin/24.2.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
edb0c47ebad777c29b3e49787c42c0be51054d65a42a608ed8aaf0a4d551f50c
|
|
| MD5 |
ee37b4bfa56d3c71f10fb08a6a4b571d
|
|
| BLAKE2b-256 |
ccdea0204135921b9ac910fd88a444e2e45b760a4d5a1b770150a435441cae2a
|
File details
Details for the file sn_graph-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sn_graph-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.7 Darwin/24.2.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51517855da5ecf9e6b799847a40dc0ea20078e99da39f2d345b43f27a190d520
|
|
| MD5 |
87ae3003198f9f53c76dcafc33b117fc
|
|
| BLAKE2b-256 |
65d0efa0d7782b59963be963ab841be4f55ded0a19170a1f1717b30d4f0972ee
|