I'm developing a handwritten digit recognizer with a Devanagari Character Dataset from Kaggle. I managed to scan all the images and train my model in Tensorflow. Now i'm not able to convert my own handwritten digits drawn in Tkinter canvas to MNIST format 28x28 image. This is the info about the png image that is loaded from canvas.

Shape : (264, 264) 
[[255 255 255 ... 255 255 255]
 [255 255 255 ... 255 255 255]
 [255 255 255 ... 255 255 255]
 ...
 [255 255 255 ... 255 255 255]
 [255 255 255 ... 255 255 255]
 [255 255 255 ... 255 255 255]]

Now i want to be able to convert the 264x264 image matrix to 28x28 by applying "bounding-box normalization and centering" algorithm. I referred Normalization and centering of images in MNIST which i didn't quite understand how it works. And also i referred convert-images-to-mnist-format.py file which is focused on a lot of images. So it would be a great help if there is an explanation on how the algorithm works and how it can be used to normalize and reduce one pixel array of size 264x264 or around. I'm using Python 3.x.

0 Answers