def gen_portion(parent, height, width, tile_height=None, tile_width=None):
    img = m.paint_linearly_markov_hierarchy(markov_tree=parent,
                                            width=width,
                                            height=height,
                                            tile_width=tile_width,
                                            tile_height=tile_height)
    return img.reshape(img.shape[0], img.shape[1])
def gen_channel(seed):
    img = markov.paint_linearly_markov_hierarchy(markov_tree=parent,
                                                 width=WIDTH,
                                                 height=HEIGHT,
                                                 seed=seed)
    img = data.upscale_nearest(img, UPSCALE_FACTOR)
    return img.reshape(HEIGHT * UPSCALE_FACTOR, WIDTH * UPSCALE_FACTOR, 1)
Exemplo n.º 3
0
def gen_coherent_noise(height,width):

    vs = np.linspace(-0.2, 0.2, num=width)
    px_1 = markov.FuzzyProgression(
        values=vs,
        positive_shifts=3, negative_shifts=3,
        repeat_factor=4)

    np.random.seed(120)
    values = []
    for i in range(3):
        mask = np.random.binomial(1, p=0.5, size=width // 10)
        vs = ['0', '1','2' ]
        pattern = ''.join([vs[i] for i in mask])
        print(pattern)
        values += [
            markov.SimplePattern(pattern=pattern, candidates=[-0.5,0,0.5])]

    black_white = markov.RandomMarkovModel(
        values=values,
        child_lengths=[width * i for i in range(1, 2)])
    varied = markov.SimpleProgression(
        values=[px_1],
        child_lengths=[width * i for i in range(10, 15)])
    parent = markov.RandomMarkovModel(
        values=[varied, black_white],
        child_lengths=[1, 2])

    img = markov.paint_linearly_markov_hierarchy(
        markov_tree=parent, width=width, height=height, seed=20)

    return img
Exemplo n.º 4
0
def gen_channel(parent):
    img = m.paint_linearly_markov_hierarchy(markov_tree=parent,
                                            width=WIDTH,
                                            height=HEIGHT,
                                            tile_height=TILE_HEIGHT,
                                            tile_width=TILE_WIDTH)
    img = data.upscale_nearest(img, UPSCALE_FACTOR)
    # img = data.upscale_with_circle(img,UPSCALE_FACTOR,bg=0)
    # img = data.upscale_with_shape(img,line,bg=0)
    return img.reshape(img.shape[0], img.shape[1], 1)
    ]
    color_patterns += [
        m.SPat(pattern=p, self_length=len(p), candidates=skips,lenghts=r.choice([5,10,14,15]))
        for p in color_patterns_2
        for i in range(2)
    ]


    color_column_left = m.Proc(
        m.SProg(values=color_patterns, self_length=WIDTH // 3), length_limit=WIDTH)

    color_column_right = m.Proc(
        m.SProg(values=color_patterns, self_length=WIDTH // 3), length_limit=WIDTH)
    color_parent = m.SProg(values=[color_column_left, color_column_right],start_probs=0)

    colors_deriv = m.paint_linearly_markov_hierarchy(
        markov_tree=color_parent, width=WIDTH, height=2)
    colors_acum = np.cumsum(colors_deriv, axis=1)


    # generating the row transitions
    patterns = [
        m.SPat(pattern=p,candidates=skips,start_probs=[0,1],lenghts=r.choice([1,2,3,4,5]),self_length=len(p))
        for p in patterns_1
        for _ in range(3)
    ]
    patterns += [
        m.SPat(pattern=p,candidates=skips,start_probs=[0,1],lenghts=r.choice([5,10,15]*2+[30,40,50,60]),self_length=len(p))
        for p in patterns_2
        for _ in range(3)
    ]