Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

templates file matlab

rigasrigas Posts: 1Member
good morning people

i am trying to create a new ocr program at matlab that it will take a jpg picture and only recognize zero and one numbers and then print them to a txt file. doing some googling i found out some interesting algorithms. the faster is one that takes the picture and compares it with some templates to decide which letter or number is. the problem is that trying to create my own templates file that it will help me complete the work. below i post the code using all 36 templates. if you have any idea how i could make it work for 2 numbers only please help


[code]%CREATE TEMPLATES
%Letter
A=imread('letters_numbersA.bmp');B=imread('letters_numbersB.bmp');
C=imread('letters_numbersC.bmp');D=imread('letters_numbersD.bmp');
E=imread('letters_numbersE.bmp');F=imread('letters_numbersF.bmp');
G=imread('letters_numbersG.bmp');H=imread('letters_numbersH.bmp');
I=imread('letters_numbersI.bmp');J=imread('letters_numbersJ.bmp');
K=imread('letters_numbersK.bmp');L=imread('letters_numbersL.bmp');
M=imread('letters_numbersM.bmp');N=imread('letters_numbersN.bmp');
O=imread('letters_numbersO.bmp');P=imread('letters_numbersP.bmp');
Q=imread('letters_numbersQ.bmp');R=imread('letters_numbersR.bmp');
S=imread('letters_numbersS.bmp');T=imread('letters_numbersT.bmp');
U=imread('letters_numbersU.bmp');V=imread('letters_numbersV.bmp');
W=imread('letters_numbersW.bmp');X=imread('letters_numbersX.bmp');
Y=imread('letters_numbersY.bmp');Z=imread('letters_numbers.bmp');
%Number
one=imread('letters_numbers1.bmp'); two=imread('letters_numbers2.bmp');
three=imread('letters_numbers3.bmp');four=imread('letters_numbers4.bmp');
five=imread('letters_numbers5.bmp'); six=imread('letters_numbers6.bmp');
seven=imread('letters_numbers7.bmp');eight=imread('letters_numbers8.bmp');
nine=imread('letters_numbers9.bmp'); zero=imread('letters_numbers.bmp');
%*-*-*-*-*-*-*-*-*-*-*-
letter=[A B C D E F G H I J K L M...
N O P Q R S T U V W X Y Z];
number=[one two three four five...
six seven eight nine zero];
character=[letter number];
templates=mat2cell(character,42,[24 24 24 24 24 24 24 ...
24 24 24 24 24 24 24 ...
24 24 24 24 24 24 24 ...
24 24 24 24 24 24 24 ...
24 24 24 24 24 24 24 24]);
save ('templates','templates')
clear all
[/code]
Sign In or Register to comment.