def generate_full_image(color_string,seed): r.init_def_generator(seed) rkey = r.bind_generator() image = np.zeros((HEIGHT,WIDTH)) p1,p2 = PS[current_iteration] image[:,:WIDTH//2] = r.binomial_from(rkey,1,p1,size=(HEIGHT,WIDTH//2)) image[:,WIDTH//2:] = r.binomial_from(rkey,1,p2,size=(HEIGHT,WIDTH//2)) return data.upscale_nearest( data.prepare_image_for_export(image*255), ny=UPSCALE_FACTOR_Y, nx=UPSCALE_FACTOR_X )
def generate_full_image(color_string, seed): r.init_def_generator(seed) rkey = r.bind_generator() p = PS[current_iteration] image = r.binomial_from(rkey, 1, p, size=(HEIGHT, WIDTH)) * 255 return data.upscale_nearest(data.prepare_image_for_export(image), ny=UPSCALE_FACTOR_Y, nx=UPSCALE_FACTOR_X)
def gradient_circle(band_len, ps, rkey): lp = len(ps) template_height = lp * band_len gradient_circle = np.zeros((template_height, template_height)) for i, p in enumerate(ps): cheight = (lp - i) * band_len c = gen.circle((template_height, template_height), cheight // 2) p = r.binomial_from(rkey, 1, p, size=(template_height, template_height)) mask = c == 1 gradient_circle[mask] = p[mask] return gradient_circle
def generate_full_image(color_string, seed): r.init_def_generator(seed) rkey = r.bind_generator() image = np.zeros((HEIGHT, WIDTH)) for i in range(NUM_SEGMENTS): start = i * SEGMENT_LENGTH end = (i + 1) * SEGMENT_LENGTH image[:, start:end] = r.binomial_from(rkey, 1, PS[i], size=(HEIGHT, SEGMENT_LENGTH)) return data.upscale_nearest(data.prepare_image_for_export(image * 255), ny=UPSCALE_FACTOR_Y, nx=UPSCALE_FACTOR_X)
def generate_full_image(color_string, seed): r.init_def_generator(seed) rkey = r.bind_generator() lp = len(PS) template_height = lp * BAND_LEN image = np.zeros((template_height, template_height)) for i, p in enumerate(PS): cheight = (lp - i) * BAND_LEN c = gen.circle((template_height, template_height), cheight // 2) p = r.binomial_from(rkey, 1, p, size=(template_height, template_height)) mask = c == 1 image[mask] = p[mask] return data.upscale_nearest(data.prepare_image_for_export(image * 255), ny=UPSCALE_FACTOR_Y, nx=UPSCALE_FACTOR_X)