# MATLAB: Prepare an RGB image for digit and letter recognition

I need a Matlab function that prepares an image for digit and letter recognition.

What I need now is to convert the original RGB image to a binary image that every pixel in it is white except the pixels corresponding to letters and digits, as well as all digit and letter must appear chromatic/saturated, i.e. appear full of color.

Here is the code I have been tested. As you can see some pixels of a letter or digit are white.

I = imread('img6.png');   % read the image into the matrix
Ig = rgb2gray(I);

subplot(2,2,1)
imshow(Ig)
subplot(2,2,2)
imshow(Icon)
subplot(2,2,3)
imhist(I)
subplot(2,2,4)
imhist(Icon)


1- How we can convert the original image to a high contrast image?

2- How the shadows around letters and digits can be removed?