semvec/pypi-packages huggingface dataset:
poisson-d 0.5.0
poisson disk implementation in python
License: MIT license

=========
poisson-d
=========


.. image:: https://img.shields.io/pypi/v/poisson-d.svg
        :target: https://pypi.python.org/pypi/poisson-d

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 

.. code:: python

    # 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 

.. code:: python

    # 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

.. code:: bash

    python3 -m pip install poisson-d --upgrade

now generate an image

.. code:: bash

    python3 -m poisson_d.cli image --image input/sample.png

* Generate points of poisson disk in text format, from an image

.. code:: bash

    python3 -m poisson_d.cli points --image input/sample.png

Credits
-------

This package was initialized with Cookiecutter_.

.. _Cookiecutter: https://github.com/audreyr/cookiecutter