Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import os
from PIL import Image
import numpy as np
files = [f for f in os.listdir("handwriting/numbers/")]
files = ["handwriting/numbers/" + f for f in files]
STANDARD_SIZE = (50, 50)
def get_image_data(filename):
img =
img = img.getdata()
img = img.resize(STANDARD_SIZE)
img = map(list, img)
img = np.array(img)
s = img.shape[0] * img.shape[1]
img_wide = img.reshape(1, s)
return img_wide[0]
data = []
labels = []
print "extracting features..."
for f in files:
print "done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.