def generate_image(width, height):
image = np.zeros([height, width], dtype=np.float32)
count = np.random.randint(min_count, max_count+1)
half_size = dot_size/2
for i in range(count):
x = np.random.randint(half_size, width - half_size)
y = np.random.randint(half_size, height - half_size)
rr, cc = circle(x, y, half_size)
image[rr, cc] = 1.0
return image, count
评论列表
文章目录