Untitled

mail@pastecode.io avatar
unknown
python
7 months ago
696 B
1
Indexable
Never
from scipy.stats import qmc
import numpy as np
import matplotlib.pyplot as plt
import cv2
from math import floor

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)

colors = []
x_pts= []
y_pts = []

for i in range(500):
    elem = sample[i]
    x = floor(elem[0])
    y = floor(elem[1])

    x_pts.append(x)
    y_pts.append(y)

    b,g,r = img[y][x]

    colors.append((r / 255.0,  g/255.0, b / 255.0))

fig, ax = plt.subplots()
ax.scatter(x_pts, y_pts, cmap='gray', vmin=0, vmax=255, c=colors)
ax.imshow(plt_img)
plt.show()