Created
November 29, 2017 23:41
-
-
Save Schizo/3e70265767afcc66155b238e7155b76c to your computer and use it in GitHub Desktop.
This file contains 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 scipy.interpolate import interp1d | |
from scipy.misc import imresize | |
import cv2 | |
def mapCharacters(a): | |
m = interp1d([0,255],[0,22]) | |
stamps = " .,:;irsXA253hMHGS#9B&@" | |
return stamps[int(m(a))] | |
img = cv2.imread("spidyHead.png", 0) | |
resizedIMG = imresize(img, (img.shape[0]/2, img.shape[1]/2)) | |
afunc = np.vectorize(mapCharacters) | |
out = afunc(resizedIMG) | |
np.savetxt("test.txt", out, delimiter=',', fmt='%s') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment