def create_blurred_palette(enc_palette, stdev): pal = genome.palette_decode(enc_palette) y, uvr, uvt, a = Palette.rgbtoyuvpolar(pal) uvt = gaussian_filter1d(uvt, stdev) y, uvr, a = [gaussian_filter1d(ch, stdev * 0.5) for ch in y, uvr, uvt] return genome.palette_encode(Palette.yuvpolartorgb(y, uvr, uvt, a))
def palflip(gnm): for v in gnm["xforms"].values(): c = v["color"] v["color"] = SplEval([0, c(0), 1, 1 - c(1)], c(0, 1), -c(1, 1)) pal = genome.palette_decode(gnm["palettes"][1]) gnm["palettes"][1] = genome.palette_encode(np.flipud(pal))
def palflip(gnm): for v in gnm['xforms'].values(): c = v['color'] v['color'] = SplEval([0, c(0), 1, 1 - c(1)], c(0, 1), -c(1, 1)) pal = genome.palette_decode(gnm['palettes'][1]) gnm['palettes'][1] = genome.palette_encode(np.flipud(pal))