def process(image):
# apply gaussian filter to image to make text wider
image = gaussian_filter(image, sigma=BLUR_AMOUNT)
# invert black and white because most of the image is white
image = 255 - image
# resize image to make it smaller
image = scipy.misc.imresize(arr=image, size=(FINAL_SIZE, FINAL_SIZE))
# scale down the value of each pixel
image = image / 255.0
# flatten the image array to a list
return [item for sublist in image for item in sublist]
评论列表
文章目录