poisson disk implementation in python
Project description
Poisson disk implementation in python
Free software: MIT license
Features
Generate poisson disk coordinates on a grid
Generate points with charactoristics of poisson disk from an image
Generate points with charactoristics of poisson disk from CMYK channels of an image
Usage examples
Use poisson-d module, from Grasshoper Python Script Component, to generate points of poisson disk
# requirements: poisson-d==latest
import rhinoscriptsyntax as rs
import imageio.v3 as iio
from poisson_d import poisson_d as p
# remove the follow two lines if you want take these two parameters as input variables
max_points = 30000
white_threshold = 0.8
# input variables: img_path, radius_min, radius_max
# output variables: coordinates (list of Point3D), greys (list of floats)
image = iio.imread(img_path)
result = p.poisson_d_variant(
img=image,
radius_min_max=(radius_min, radius_max),
max_points=max_points,
)
print(f"generated {len(result)} points")
result = p.filter_out_white(result, white_threshold)
coordinates = [rs.CreatePoint(pn.x, -pn.y, 0) for pn in result]
greys = [x.grey for x in result]
Use poisson-d module, from Grasshoper Python Script Component, to generate points of poisson disk on C, M, Y, K channels
# requirements: poisson-d==latest
import rhinoscriptsyntax as rs
import imageio.v3 as iio
from poisson_d import poisson_d as p
# remove the follow two lines if you want take these two parameters as input variables
max_points = 30000
white_threshold = 0.9
# input variables: img_path, radius_min, radius_max
# output variables: c_points, m_points, y_points, k_points for coordinates; c, m, y, k for greyscales
image = iio.imread(img_path)
((c_points, m_points, y_points, k_points), (c, m, y, k)) = poisson_d_cmyk(
img=image,
r=(radius_min, radius_max),
cnt=max_points,
th=white_threshold,
)
Generate points of poisson disk from an image
install the poisson-d module
python3 -m pip install poisson-d --upgrade
now generate an image
python3 -m poisson_d.cli image --image input/sample.png
Generate points of poisson disk in text format, from an image
python3 -m poisson_d.cli points --image input/sample.png
Credits
This package was initialized with Cookiecutter.
Project details
Release history Release notifications | RSS feed
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 poisson_d-0.5.0.tar.gz.
File metadata
- Download URL: poisson_d-0.5.0.tar.gz
- Upload date:
- Size: 18.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c778e7016b0147b065aefd8d7da91a4697472a12dd7df1d11359322f47ca554
|
|
| MD5 |
7b2405ed286d8b0ed606ed0278793950
|
|
| BLAKE2b-256 |
f83fa0c9a34cc46215a44939e8abcbe1a4e84888ac35b1518a86fdbc9c13c479
|
File details
Details for the file poisson_d-0.5.0-py3-none-any.whl.
File metadata
- Download URL: poisson_d-0.5.0-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dfe8f5233b5da5eff3f1db8c5fe2db9fd9397b74a30d32c122cb5914f2d3a96b
|
|
| MD5 |
8ca6a0e3f21a3e05987866f538741a01
|
|
| BLAKE2b-256 |
b935d33b47b76af43440c1e3d9fb376575895be3b489eb57da5419c9a41e5c0e
|