This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// BorderZoom.cpp : Defines the entry point for the console application. | |
// | |
#include "stdafx.h" | |
#include <vector> | |
#include <windows.h> | |
#include <fstream> | |
#include <string> | |
#include <sstream> | |
#include <map> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import prepare_img2 | |
import skimage.io as io | |
import PIL | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from skimage.color import rgb2gray | |
from skimage import data | |
from skimage.filters import gaussian | |
from skimage.segmentation import active_contour |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import PIL | |
import numpy as np | |
def quantizetopalette(silf, palette, dither=False): | |
"""Convert an RGB or L mode image to use a given P image's palette.""" | |
silf.load() | |
# use palette from reference image | |
palette.load() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import PIL | |
import numpy as np | |
img = PIL.Image.open('in.bmp') | |
palette = img.getpalette() | |
alpha = palette[0:3] | |
palette[0:3] = (0,0,0) | |
img.putpalette(palette) | |
img.save('out.bmp') | |
palette[3:(256*3)] = (255,255,255)*255 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from skimage.color import rgb2gray | |
from skimage.filters import gaussian | |
import scipy.ndimage as ndi | |
import random | |
import scipy | |
import PIL | |
def img_prepare(img): | |
r = random.random() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" _ _ | |
_ __ ___ _ _ _ __ __ _| | ___ _ __ | |__ __ _ _ __ ___ ___ | |
| '_ \ / _ \ | | | '__/ _` | | / _ \ '_ \| '_ \ / _` | '_ \ / __/ _ \ | |
| | | | __/ |_| | | | (_| | | | __/ | | | | | | (_| | | | | (_| __/ | |
|_| |_|\___|\__,_|_| \__,_|_| \___|_| |_|_| |_|\__,_|_| |_|\___\___| | |
""" | |
# | |
# Copyright (c) 2016, Alex J. Champandard. |