test data generation for nural network handwriting recognition

601 views Asked by At

Can someone share some octave/matlab code/algo to preprocess a photo taken from mobile camera of a handwritten digit. After preprocessing data should have similar characteristic like MNIST data set digits images. I have a neural network trained using MNIST date set. Now I want to test my implementation by taking handwritten digit using phone camere and saving it on my computer. I want to give this image as input to test my neural net implementation. Thanks in advance !!

1

There are 1 answers

0
Falimond On

As it is already saved on your computer, drag and drop the image file into whatever directory your NN files are located/sources images from.

myImage = imread('myImageName.jpg');  %load the image file

grayImage = rgb2gray(myImage);

% maybe there is some processing you should do here so that the mean pixel white value for 
% your image is the same as that of the MNIST data, and also centered in the window
% or maybe just test it as is and see how your NN implementation handles it

formatMNIST = imresize(greyImage,[28,28]);  % change size to 28x28

% now formatMNIST should be useable in your NN