Untitled
unknown
python
2 years ago
767 B
4
Indexable
from scipy.stats import qmc import matplotlib.pyplot as plt import cv2 from math import floor import numpy as np img = cv2.imread('poo.png') plt_img = plt.imread('poo.png') l_bounds = [0] u_bounds = [512] sampler = qmc.Halton(d=1, scramble=False) sample = sampler.random(n=500) sample = qmc.scale(sample, l_bounds, u_bounds).flatten() thing = [] for i in range(1, 501): thing.append((i / 500) * 511) combined = np.vstack((sample, np.array(thing))).T print(combined) colors = [] for i in range(500): elem = combined[i] x = floor(elem[0]) y = floor(elem[1]) b,g,r = img[y][x] colors.append((r / 255.0, g/255.0, b / 255.0)) fig, ax = plt.subplots() ax.scatter(combined[:,0], combined[:,1], c=colors) ax.imshow(plt_img) plt.show()
Editor is loading...