Character Recognition Example (I): Image Pre-processing

This example illustrates simple way of character recognition. It just serves as a kick start for beginers by introducing them simple coding in MATLAB for character recognition.

Some useful example for image pre-processing before the recognition stage is shown as follow:

1. Manual Cropping
This cell of codes allow the user to crop the image manually, which is important proccess especially the programmer would like to manipulate the data more in details.

img = imread('sample.bmp');
imshow(img)
imgGray = rgb2gray(img);
imgCrop = imcrop(imgGray);
imshow(imgCrop)


2. Resizing
This cell of codes magnify the image for 5 times. Resize function is important when the size of the character are not standard, especially in the handwritting recognition program.

imgLGE = imresize(imgCrop, 5, 'bicubic');
imshow(imgLGE)



3. Rotation
This cell of codes rotate the image for 35 degree. Some of the printed documents might not in the right degree as expected. This operation coulf make the character to our desired angle.

imgRTE = imrotate(imgLGE, 35);
imshow(imgRTE)



4. Binary Image
This cell of codes convert the image to binary image. Definitely, the speed and also the accuracy will increse if this operation is perform properly.

imgBW = im2bw(imgLGE, 0.90455);
imshow(imgBW)