Untitled

 avatar
unknown
python
2 years ago
523 B
4
Indexable
from scipy.stats import qmc
import numpy as np
import matplotlib.pyplot as plt
import cv2
from math import floor

"""
Generates voronoi diagram for points sampled with halton sequence
"""

img = cv2.imread('poo.png')
plt_img = plt.imread('poo.png')

l_bounds = [0,0]
u_bounds = [512,512]

sampler = qmc.Halton(d=2, scramble=False)
sample = sampler.random(n=500)

sample = qmc.scale(sample, l_bounds, u_bounds)

from scipy.spatial import Voronoi, voronoi_plot_2d
vor = Voronoi(sample)

fig = voronoi_plot_2d(vor)

plt.show()
Editor is loading...