Ejemplo n.º 1
0
    def generate_full_image(color_string, seed):
        r.init_def_generator(seed)

        rkey = r.bind_generator()
        lp = len(PS)
        guard_size = 450
        image = np.zeros((HEIGHT + guard_size * 2, WIDTH + guard_size * 2))

        # num_circles = r.choice_from(rkey,[5,10,15,20,25])
        # num_circles = r.choice_from(rkey,[30,40,50,60,70,80,90,100])
        # num_circles = r.choice_from(rkey,[80,120,140])
        # num_circles = r.choice_from(rkey,[200,220,240])
        num_circles = 10
        ps = r.choice_from(rkey, PS, lp)
        for i in range(num_circles):

            loopkey = r.bind_generator_from(rkey)
            band_size = r.choice_from(loopkey, [10] + [15])
            circle = gradient_circle(band_size, PS[::-1] + PS[::2] + PS[1::2],
                                     r.bind_generator_from(loopkey))

            cheight, cwidth = circle.shape

            xstart = r.choice_from(loopkey, np.arange(WIDTH + 250))
            ystart = r.choice_from(loopkey, np.arange(HEIGHT + 250))

            image[ystart:ystart + cheight, xstart:xstart + cwidth] += circle

        image = image[guard_size:HEIGHT + guard_size,
                      guard_size:WIDTH + guard_size]
        image /= np.max(image)

        return data.upscale_nearest(data.prepare_image_for_export(image * 255),
                                    ny=UPSCALE_FACTOR_Y,
                                    nx=UPSCALE_FACTOR_X)
Ejemplo n.º 2
0
    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)
Ejemplo n.º 3
0
    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)
Ejemplo n.º 4
0
    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
        )
Ejemplo n.º 5
0
    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)
Ejemplo n.º 6
0
    def generate_full_image(color_string, seed):
        r.init_def_generator(seed)

        rkey = r.bind_generator()

        template_height = NUM_BANDS * BAND_LEN
        image = np.zeros((template_height, template_height))

        for i, p in enumerate(range(NUM_BANDS)):
            cheight = (NUM_BANDS - i) * BAND_LEN
            c = gen.circle((template_height, template_height), cheight // 2)
            p = r.poisson_from(rkey,
                               i + 1.1,
                               size=(template_height, template_height))
            mask = c == 1
            image[mask] = p[mask]

        image = image / np.max(image)

        return data.upscale_nearest(data.prepare_image_for_export(image * 255),
                                    ny=UPSCALE_FACTOR_Y,
                                    nx=UPSCALE_FACTOR_X)
Ejemplo n.º 7
0
    def generate_full_image(color_string,seed):
        r.init_def_generator(seed)

        rkey = r.bind_generator()
        guard_size = 200
        image = np.zeros((HEIGHT+guard_size*2,WIDTH+guard_size*2))

        num_circles = r.choice_from(rkey,[5,10,15,20,25])
        # num_circles = r.choice_from(rkey,[30,40,50,60,70,80,90,100])
        # num_circles = r.choice_from(rkey,[400,500,600,700,800])
        for i in range(num_circles):

            loopkey = r.bind_generator_from(rkey)
            band_size = r.choice_from(loopkey,np.arange(5,10))
            circle = gradient_circle(
                band_size,
                r.bind_generator_from(loopkey)
            )

            cheight,cwidth = circle.shape

            xstart = r.choice_from(loopkey,np.arange(WIDTH+100))
            ystart = r.choice_from(loopkey,np.arange(HEIGHT+100))
            image[ystart:ystart+cheight,xstart:xstart+cwidth] += circle

        image /= np.max(image)
        image = image[
                guard_size:HEIGHT+guard_size,
                guard_size:WIDTH+guard_size]


        return  data.upscale_nearest(
            data.prepare_image_for_export(image*255),
            ny=UPSCALE_FACTOR_Y,
            nx=UPSCALE_FACTOR_X
        )