Reputation: 776
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);
Icon = imadjust(Ig);
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?
Upvotes: 0
Views: 70
Reputation: 948
To sharpen the image, you can use the imfilter
method. This takes in an image and a kernel (in this case, a sharpening kernel) and applies the kernel to the image. For example:
kernel = [0 -1 0;
-1 5 -1;
0 -1 0]
sharpened_image = imfilter(image, kernel)
Upvotes: 1