jeudi 30 septembre 2021

I would like to generate random points in an image with delauney triangulation with mean distance between neighbours of 4.1 pixels

I am using this function to generate uniformly distributed points on a an image.

def generate_uniform_random_points(image, n_points=100):
    """
    Generates a set of uniformly distributed points over the area of image
    :param image: image as an array
    :param n_points: int number of points to generate
    :return: array of points
    """
    ymax, xmax = image.shape[:2]
    points = np.random.uniform(size=(n_points, 2))
    points *= np.array([xmax, ymax])
    points = np.concatenate([points, edge_points(image)])
    return points 

However, I would like to get randomly distributed points with with mean distance between neighbours of 4.1 pixels.

Any help will help.




Aucun commentaire:

Enregistrer un commentaire