braille recognition using image processing

i have a braille character recognition research and i'm not very good in matlab .. i want to know how to compute the centroids of dots and do alignment for it and make cells of braille characters ..
this is my code
RGB = imread('braille.jpg');
I = rgb2gray(RGB);
I2 = imcrop(I,[14.5100 3.5100 189.9800 134.9800]);
h = ones(5,5) / 25;
I3=imfilter(I2,h);
I4 = imadjust(I3);
I5 = imcomplement(I4);
se = strel('disk',1);
I6 = imdilate(I5,se);
I7 = im2bw(I6, 0.4);
subplot(4,4,1)
imshow(RGB)
title('rgb')
subplot(4,4,2)
imshow(I)
title('gray Image')
subplot(4,4,3)
imshow(I2)
title('Cropped Image')
subplot(4,4,4)
imshow(I3)
title('filtered Image')
subplot(4,4,5)
imshow(I4)
title('contrast Image')
subplot(4,4,6)
imshow(I5)
title('complement Image')
subplot(4,4,7)
imshow(I6)
title('dilate Image')

3 Comments

Your Question would be easier to Answer if you attach your 'braille.jpg' file.
And, is the image a profilometer image (so it's the height/topography) or is it an RGB image like you're casting brightness on the sides of the dots and shadows beside them?
Star Strider about 8 hours ago Your Question would be easier to Answer if you attach your 'braille.jpg' file.
ok i attached the image ..
. .
Image Analyst about 7 hours ago And, is the image a profilometer image (so it's the height/topography) or is it an RGB image like you're casting brightness on the sides of the dots and shadows beside them?
no, the image is from an online text to braille converter .. i attached the photo put the code in matlab editor and run the program u will see where i stuck
i need to make a matching with braille characters so it can be recognized and the converting from braille to english text produced

Sign in to comment.

Answers (1)

This looks easy. First you need to decide the rows and columns that divide the image up into individual tiles for each character. Then you simply need to have a 3-by-2 template where you check each place in for the intensity. If it's dark it's a spot, if it's light it's paper
for k = 1 : 6
output(k) = subImage(row(k), col(k)) > 128
end
Then you can convert all the 6 output locations into an integer that is used in a look up table to give you the letter
index = 0;
for k = 1 : 6
index = index + 2^(k-1) * output(k);
end
theCharacter = yourLookUpTable(index);

16 Comments

thanks for this, but shouldn't i upload the character templates to match with the image and translate the braille code to english??
If you have the template location data and you want us to run it because you need more help, then sure, you can upload it.
I would think translation into English text is what is needed. Then you can have it read it with code like this:
% Program to do text to speech.
% Get user's sentence
userPrompt = 'What do you want the computer to say?';
titleBar = 'Text to Speech';
defaultString = 'Hello World! MATLAB is an awesome program!';
caUserInput = inputdlg(userPrompt, titleBar, 1, {defaultString});
if isempty(caUserInput)
return;
end; % Bail out if they clicked Cancel.
caUserInput = char(caUserInput); % Convert from cell to string.
NET.addAssembly('System.Speech');
obj = System.Speech.Synthesis.SpeechSynthesizer;
obj.Volume = 100;
Speak(obj, caUserInput);
you are awesome.. but this for speech
what i want from the code to do is the following
i input the photo of braille characters and perform some filtering and contrast and binarization, then convert it from braille character to english text.. by matching it with character template i have for braille font
Follow my algorithm. Don't do the text to speech part if you don't want to - that's completely optional. Note that I did not say to do filtering or contrast adjustment. It's not necessary. Filtering is not needed unless it's noisy - so much so that there are pixels in the dots that are the same intensity as the background. I did not see anything like that so filtering is not needed.
I did do binarization in a way when I compared the value to 128, but I did it on just 6 pixels, not the whole image so this way it will be faster. The value you should compare it to is half way between the dark dot intensity and the bright background intensity.
Again, the fastest way is to measure just 6 locations, then use those to build an index, and then look up the translated character from the lookup table. Don't do a template matching like with normxcorr2() or anything - that will be slower than a lookup table.
Really, it's fast and super easy so don't make it more complicated and time consuming than it needs to be.
i don't know what to do .. is this code right ?
RGB = imread('braille.jpg');
I = rgb2gray(RGB);
I2 = imcrop(I,[14.5100 3.5100 189.9800 134.9800]);
h = ones(5,5) / 25;
I3=imfilter(I2,h);
I4 = imadjust(I3);
I5 = imcomplement(I4);
se = strel('disk',1);
I6 = imdilate(I5,se);
I7 = im2bw(I6, 0.4);
for k = 1 : 6
output(k) = subimage(rows(k), cols(k)) > 128;
end
index = 0;
for k = 1 : 6
index = index + 2^(k-1) * output(k);
end
theCharacter = yourLookUpTable(index);
may i tell you what i want exactly and you provide me with the final code ? so when i press on run it all procceded and get the text from the braille photo ?
No - you did anyway what I specifically told you not to do. Again, no contrast adjustment is needed. No filtering is needed. No complementing is needed. No dilation is needed And you didn't define the lookup table. All you need to do is to check intensities and use those to determine the look up table index and then read off the letter. I'll see if I can spend some time on it to get you a little farther along.
Ismail, try the attached .m file.
excus me sir,, i've try your code, but this can't run because "Undefined function 'histogram' for input arguments of type 'uint8'. Error in matriks (line 66) histogram(grayImage); " what's wrong sir ? i use matlab R2012.
use hist() instead of histogram()
thank's sir, i use histeq () ,,
i have this image, what must i do for this image so that this image can running on your code ?
histeq() and histogram() are completely different purposes; you cannot substitute histeq() for histogram(). hist() is the older routine that most closely matches histogram()
histogram() both computes the histogram and plots it. For an older version of MATLAB, you can use imhist() and bar():
[counts, grayLevels] = imhist(grayImage);
bar(grayLevels, counts];
grid on;
thank you sir, i want to ask again, what should i do for my image above so that my image can run use your code (m.file).
You need to change the line that says:
baseFileName = 'braille.jpg';
so that it refers to your image. Other than that, I don't know - just work through the code line by line and see what happens.
i know that, but that not what i ask, ok, thanks sir, i'll see

Sign in to comment.

Categories

Find more on Images in Help Center and File Exchange

Asked:

on 6 May 2016

Commented:

on 13 Mar 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!