File Exchange

image thumbnail

Character Recognition Example (III):Training a Simple NN for classification

version 1.0 (122 KB) by

This demo shows some examples for image pre-processing before the recognition stage.

4.33333
36 Ratings

50 Downloads

Updated

View License

This demo shows the recognition stage for the character recognition. This example come with a GUI with a trained network for handwritting recognition. The step-by-step explanation can be found at:

http://basic-eng.blogspot.com/

Comments and Ratings (60)

Duc Hoang

annmaria

i am working on ext recognition using matlab, i got the sample code from the file exchange of mathworks, but it is only for numbers but how about alphabets, i am not able know whether i have change in data.mat to get required output, i understood the concept but not getting where to change the database, to know how can i train the neural network for alphabets.

ayushi singh

??? Error using ==> fopen
Invalid filename.

Error in ==> imread at 353
fid = fopen(filename, 'r');

Error in ==> charGUI>pbLoad_Callback at 83
S = imread([pathname,filename]);

Error in ==> gui_mainfcn at 96
feval(varargin{:});

Error in ==> charGUI at 42
gui_mainfcn(gui_State, varargin{:});

??? Error while evaluating uicontrol Callback

??? Reference to non-existent field 'S'.

Error in ==> charGUI>pbSelect_Callback at 96
S = handles.S;

Error in ==> gui_mainfcn at 96
feval(varargin{:});

Error in ==> charGUI at 42
gui_mainfcn(gui_State, varargin{:});

??? Error while evaluating uicontrol Callback

??? Error using ==> fopen
Invalid filename.

Error in ==> imread at 353
fid = fopen(filename, 'r');

Error in ==> charGUI>pbLoad_Callback at 83
S = imread([pathname,filename]);

Error in ==> gui_mainfcn at 96
feval(varargin{:});

Error in ==> charGUI at 42
gui_mainfcn(gui_State, varargin{:});

??? Error while evaluating uicontrol Callback

??? Reference to non-existent field 'img_crop'.

Error in ==> charGUI>pbPreprocess_Callback at 113
img_crop = handles.img_crop;

Error in ==> gui_mainfcn at 96
feval(varargin{:});

Error in ==> charGUI at 42
gui_mainfcn(gui_State, varargin{:});

??? Error using ==> waitfor
Error while evaluating uicontrol Callback

??? Reference to non-existent field 'img_crop'.

Error in ==> charGUI>pbPreprocess_Callback at 113
img_crop = handles.img_crop;

Error in ==> gui_mainfcn at 96
feval(varargin{:});

Error in ==> charGUI at 42
gui_mainfcn(gui_State, varargin{:});

??? Error using ==> waitfor
Error while evaluating uicontrol Callback

??? Reference to non-existent field 'img_crop'.

Error in ==> charGUI>pbPreprocess_Callback at 113
img_crop = handles.img_crop;

Error in ==> gui_mainfcn at 96
feval(varargin{:});

Error in ==> charGUI at 42
gui_mainfcn(gui_State, varargin{:});

??? Error using ==> waitfor
Error while evaluating uicontrol Callback

??? Reference to non-existent field 'img_crop'.

Error in ==> charGUI>pbPreprocess_Callback at 113
img_crop = handles.img_crop;

Error in ==> gui_mainfcn at 96
feval(varargin{:});

Error in ==> charGUI at 42
gui_mainfcn(gui_State, varargin{:});

??? Error using ==> waitfor
Error while evaluating uicontrol Callback

??? Reference to non-existent field 'img_crop'.

Error in ==> charGUI>pbPreprocess_Callback at 113
img_crop = handles.img_crop;

Error in ==> gui_mainfcn at 96
feval(varargin{:});

Error in ==> charGUI at 42
gui_mainfcn(gui_State, varargin{:});

??? Error using ==> waitfor
Error while evaluating uicontrol Callback

??? Reference to non-existent field 'bw2'.

Error in ==> charGUI>pbExtract_Callback at 130
bw2 = handles.bw2;

Error in ==> gui_mainfcn at 96
feval(varargin{:});

Error in ==> charGUI at 42
gui_mainfcn(gui_State, varargin{:});

??? Error using ==> waitfor
Error while evaluating uicontrol Callback

??? Reference to non-existent field 'bw2'.

Error in ==> charGUI>pbExtract_Callback at 130
bw2 = handles.bw2;

Error in ==> gui_mainfcn at 96
feval(varargin{:});

Error in ==> charGUI at 42
gui_mainfcn(gui_State, varargin{:});

??? Error using ==> waitfor
Error while evaluating uicontrol Callback

??? Reference to non-existent field 'charvec'.

Error in ==> charGUI>pbRecognize_Callback at 142
charvec = handles.charvec;

Error in ==> gui_mainfcn at 96
feval(varargin{:});

Error in ==> charGUI at 42
gui_mainfcn(gui_State, varargin{:});

??? Error using ==> waitfor
Error while evaluating uicontrol Callback

infcn(gui_State, varargin{:});

??? Error using ==> waitfor
Error while evaluating uicontrol Callback

??? Reference to non-existent field 'bw2'.

Error in ==> charGUI>pbExtract_Callback at 130
bw2 = handles.\

why i am getting this error can anyone help?
and reply on sayushi47@gmail.com pleaseeee

please help me. how change vector to 8 x 5..

code at edu_imgresize (bw2)

function lett = edu_imgresize(bw2)
% This function will take the cropped binary image and change it to 5 x 7
% character representation in single vector.

bw_7050=imresize(bw2,[70,50]);
for cnt=1:7 row
for cnt2=1:5 col
Atemp=sum(bw_7050((cnt*10-9:cnt*10),(cnt2*10-9:cnt2*10)));
lett((cnt-1)*5+cnt2)=sum(Atemp);
end
end

lett=((100-lett)/100);

fid = fopen('imageresize.txt','w');
lett=lett';
fprintf(fid,'%6.2f \n',lett);
fclose(fid);

anh hoang

help me ! how to train letter

Dabira

Dabira (view profile)

How can I open GUI

Amit Kumar

thanks for matlab code...........:)

Amit Kumar

??? Error using ==> charGUI2>pbRecognize_Callback at
189
'model' parameter must be a string.

Error in ==> gui_mainfcn at 96
feval(varargin{:});

Error in ==> charGUI2 at 42
gui_mainfcn(gui_State, varargin{:});

??? Error while evaluating uicontrol Callback

??? Error using ==> charGUI2>pbRecognize_Callback at
189
'model' parameter must be a string.

Error in ==> gui_mainfcn at 96
feval(varargin{:});

Error in ==> charGUI2 at 42
gui_mainfcn(gui_State, varargin{:});

??? Error while evaluating uicontrol Callback

??? Error using ==> charGUI2>pbRecognize_Callback at
189
'model' parameter must be a string.

Error in ==> gui_mainfcn at 96
feval(varargin{:});

Error in ==> charGUI2 at 42
gui_mainfcn(gui_State, varargin{:});

??? Error while evaluating uicontrol Callback

??? Error using ==> charGUI2>pbRecognize_Callback at
189
'model' parameter must be a string.

Error in ==> gui_mainfcn at 96
feval(varargin{:});

Error in ==> charGUI2 at 42
gui_mainfcn(gui_State, varargin{:});

??? Error while evaluating uicontrol Callback

??? Error using ==> charGUI2>pbRecognize_Callback at
189
'model' parameter must be a string.

Error in ==> gui_mainfcn at 96
feval(varargin{:});

Error in ==> charGUI2 at 42
gui_mainfcn(gui_State, varargin{:});

??? Error while evaluating uicontrol Callback

??? Error using ==> charGUI2>pbRecognize_Callback at
189
'model' parameter must be a string.

Error in ==> gui_mainfcn at 96
feval(varargin{:});

Error in ==> charGUI2 at 42
gui_mainfcn(gui_State, varargin{:});

??? Error while evaluating uicontrol Callback

??? Invalid or deleted object.

Error in ==> charGUI2>pbSelect_Callback at 101
handles.api.delete();

Error in ==> gui_mainfcn at 96
feval(varargin{:});

Error in ==> charGUI2 at 42
gui_mainfcn(gui_State, varargin{:});

??? Error while evaluating uicontrol Callback
..

hey guy's plz help me out i am geting following when i try to run this code.......it urgent.....thank you

Mohan K

Omar

Omar (view profile)

Tks a lot, fully helped me.

Sandeep

What is the use og data.mat file in this program, why that file is required from where are you getting the recognized value on the axis, how can i do it for english alphabet please help me as i am doing my final year project, send me the example code to my id sandeepec035@gmail.com

<a href=http://soundfrost.org/ >convert to mp3</a>

Thanks a lot for this example. It truly helps.

sarika sen

For English and number recognition [(A to E) and (1 to 5)]

charvec = handles.charvec;
selected_net = get(handles.editNN,'string');
selected_net = evalin('base',selected_net);
result = sim(selected_net,charvec);
[val, num] = max(result);

if num>5
num = num -5;
charvec = ['A','B','C','D','E'];
% In this case, output is character, defined as a number from num
else
charvec = [1, 2, 3, 4, 5];
% Else, output is number, defined from num
end

oknum = charvec(1,num);
set(handles.editResult, 'string',oknum);

copywrite to me...

sarika sen

this application works for numeric figures only, what about english or japanese alphabets?

Hi could you please tell me the logic behind how the image cropping takes place....

varsha

varsha (view profile)

please explain the coding & calculations given in edu_imgpreprocess and edu_imgresize...

shubhi

shubhi (view profile)

Error in ==> gui_mainfcn at 75
feval(varargin{:});

Error in ==> charGUI at 42
gui_mainfcn(gui_State, varargin{:});

??? Error while evaluating uicontrol Callback.

??? Error using ==> fopen
Invalid filename.

Error in ==> imread at 226
fid = fopen(filename, 'r');

Error in ==> charGUI>pbLoad_Callback at 83
S = imread([pathname,filename]);

Error in ==> gui_mainfcn at 75
feval(varargin{:});

Error in ==> charGUI at 42
gui_mainfcn(gui_State, varargin{:});

??? Error while evaluating uicontrol Callback.

??? Attempt to reference field of non-structure array.

Error in ==> charGUI>pbSelect_Callback at 96
S = handles.S;

Error in ==> gui_mainfcn at 75
feval(varargin{:});

Error in ==> charGUI at 42
gui_mainfcn(gui_State, varargin{:});

??? Error while evaluating uicontrol Callback.

??? Input argument "bw2" is undefined.

Error in ==> edu_imgresize at 5
bw_7050=imresize(bw2,[70,50]);

??? Error using ==> fopen
Invalid filename.

Error in ==> imread at 226
fid = fopen(filename, 'r');

Mert

Mert (view profile)

Mr Smart

Waqas Soomro

hi. when i m loading image in chargui its ginen following errors. plz guide me in this problem.

Error in ==> gui_mainfcn at 96
feval(varargin{:});

Error in ==> charGUI at 42
gui_mainfcn(gui_State, varargin{:});

??? Error while evaluating uicontrol Callback

prathiba

great

Yawar Rehman

gr8

ALOK JHA

was of great help for my project...
pls tell me how do i include alphabets and special character in recognition.
aloknandujha@gmail.com

Haider Raza

How to run CHARGUI....its a figure file..!!

Thabit

Thabit (view profile)

Hi, I think this the best guide to OCR I have seen so far, but I wonder if you would be able to give me a simple explanation on what to change if I needed to expand this to include A-Z?

t.1.hassan@herts.ac.uk

Thanks

humza

humza (view profile)

i ran chargui.m, loaded image, did select, pre process, feature extract & recognize, nothing happen in feature extract and recognize,
and this was written,
"
??? Reference to non-existent field 'charvec'.

Error in ==> charGUI>pbRecognize_Callback at 142
charvec = handles.charvec;

Error in ==> gui_mainfcn at 75
feval(varargin{:});

Error in ==> charGUI at 42
gui_mainfcn(gui_State, varargin{:});

??? Error while evaluating uicontrol Callback."

what should i do,

salam fadi

please i don't know how i get these files and dowload it please tell me my email is zoufa1@hotmail.com

Eugene

Eugene (view profile)

Hi
When I ran chargui, I could load the image and select region. But nothing happens when I press crop. Also when I press preprocess the following error occur
??? There is no 'Colormap' property in the 'uipanel' class.

Error in ==> <a href="error:C:\MATLAB7\toolbox\images\images\imshow.m,115,1">imshow at 115</a>
set(figHandle, 'Colormap', map);

Error in ==> <a href="error:C:\MATLAB7\work\charGUI.m,117,1">charGUI>pbPreprocess_Callback at 117</a>
imshow(bw);

Error in ==> <a href="error:C:\MATLAB7\toolbox\matlab\uitools\gui_mainfcn.m,75,1">gui_mainfcn at 75</a>
feval(varargin{:});

Error in ==> <a href="error:C:\MATLAB7\work\charGUI.m,42,1">charGUI at 42</a>
gui_mainfcn(gui_State, varargin{:});

??? Error while evaluating uicontrol Callback.

When I did feature extraction the following error occur
??? Reference to non-existent field 'bw2'.

Error in ==> <a href="error:C:\MATLAB7\work\charGUI.m,130,1">charGUI>pbExtract_Callback at 130</a>
bw2 = handles.bw2;

Error in ==> <a href="error:C:\MATLAB7\toolbox\matlab\uitools\gui_mainfcn.m,75,1">gui_mainfcn at 75</a>
feval(varargin{:});

Error in ==> <a href="error:C:\MATLAB7\work\charGUI.m,42,1">charGUI at 42</a>
gui_mainfcn(gui_State, varargin{:});

??? Error while evaluating uicontrol Callback.

When I press recognize the following error occur
??? Reference to non-existent field 'charvec'.

Error in ==> <a href="error:C:\MATLAB7\work\charGUI.m,142,1">charGUI>pbRecognize_Callback at 142</a>
charvec = handles.charvec;

Error in ==> <a href="error:C:\MATLAB7\toolbox\matlab\uitools\gui_mainfcn.m,75,1">gui_mainfcn at 75</a>
feval(varargin{:});

Error in ==> <a href="error:C:\MATLAB7\work\charGUI.m,42,1">charGUI at 42</a>
gui_mainfcn(gui_State, varargin{:});

??? Error while evaluating uicontrol Callback.

What should I do??

my email is angelflames84@hotmail.com

erruva erruva

Greate work! Works fine for 1-9. But why is 0 recognized as 10? I can not understand the training data.

art

art (view profile)

I have the same question as kobe above. How can i change the training data?

Kaso

Kaso (view profile)

i'd like to know where can i get the image processing toolbox which required for this program.my email address :yesterday322130@163.com
3ks a lot

kobe

kobe (view profile)

how can I access the training data so I can change it for my own data?
cyber_kobe@hotmail.com if you know, cheers

z h

my email is zhaohuihuang278@sohu.com

z h

i ran chargui.m, loaded image, did select, pre_process, nothing happen in feature extract and recognize, and this was written,

??? There is no 'Colormap' property in the 'uipanel' class.
Error in ==> imshow at 115
set(figHandle, 'Colormap', map);
Error in ==> charGUI>pbPreprocess_Callback at 117
imshow(bw);
Error in ==> gui_mainfcn at 75
feval(varargin{:});
Error in ==> charGUI at 42
gui_mainfcn(gui_State, varargin{:});
??? Error while evaluating uicontrol Callback.

when i did feature extract & recognize,the wrong is following:

??? Reference to non-existent field 'bw2'.
Error in ==> charGUI>pbExtract_Callback at 130
bw2 = handles.bw2;
Error in ==> gui_mainfcn at 75
feval(varargin{:});
Error in ==> charGUI at 42
gui_mainfcn(gui_State, varargin{:});
??? Error while evaluating uicontrol Callback.


what should i do

aradya tp

Hope information given here will help much to know the concept of CR,,,,, thanks......

salman syed

i ran chargui.m, loaded image, did select, pre process, feature extract & recognize, nothing happen in feature extract and recognize,
and this was written,
"
??? Reference to non-existent field 'charvec'.

Error in ==> charGUI>pbRecognize_Callback at 142
charvec = handles.charvec;

Error in ==> gui_mainfcn at 75
feval(varargin{:});

Error in ==> charGUI at 42
gui_mainfcn(gui_State, varargin{:});

??? Error while evaluating uicontrol Callback."

what should i do, i dont know much about matlab.

anju akalanka

fa ho

ok

Nors Harman

Very good example!

vaishali shinde

nalan soylu

Please type the characters you see in the picture above

ihsan ihsan

Thanks for sharing. Have you any code about hyperspectral image analysis?
Regards

nafisa gady

vaishali shinde

it is realy excellent & very usefull to all

Vikas Rajput

Dear Sir I have following problem when running charGUI in my matlab6.5
Unable to read MAT file C:\numeral recognition\charGUI.fig
plz help me what can i do
vikas

jineen mohammed

thanx alot, i have gained alot of useful things from this code
but a want to ask how can we aligment the image in order to know the (x,y)=(0,0)of it
thaaanx again

Amninder Kaur

anirudh r

desture restret

naresh v

i really acknowledge this effort
keep it up

anand dwivedi

Miguel de Juana

Hello, i have a problem, i want to know, which parameters take the program from the image to recognition of the number, is urgent, thanks.

ari kabisat

great. help my research to detect pipe. thanks very much..muah

Satyajit Malugu

is the GUI executable on all machines or it needs any modifications?

Salim Alkathiri

this is the example that will make me understand the concept of handwirtten character recognition. Using nuralnetwor as methode for recognition training. I thank you all for your efforts.

Chibila Ulaya

Great help in my research. Built a marking machine using a webcam instead of a scanner for image acquisition.....works fantastically due to the guidance in this code...

kailup Tan

It works in MATLAB 7 but some of the readers facing the same problem with you: try to change line 26 --> Ic(:,4) = 1:50; to Ic(:,4) = [1:50]'; in edu_imgpreprocess.m (think ML 7 smart enough to change 1:50 to a column vector but ML 6 still not able to perform it automatically)

MATLAB Release
MATLAB 7.5 (R2007b)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video