CHAPTER ONE
INTRODUCTION 1.1 Project Overview : This project will will demonstrate a kind of editing editing of both image, text , and voice technologies. The user will be able to output the text that is contained in an image or written in the the editor and read this text text by using the speech recognition. Also the ability of having an edited text in a le format of editing and save this le in a specic place under the name of recent documents that you got from this editor. This project will will explore explore these ideas by developing Optical Optical haracter !ecognition !ecognition "O!# "O!# software, software, and then demonstrating demonstrating that software through a basic implementation of a text to $peech conversion system . The system will load an image of any type of format, format, extract the text text founded in this image , and then read this text text and sore this edited edited text in a le. Also the the user can write or copy and paste a text on the editor directly.
1.2
Problem : %ecause of the high speed of information technology in the world ,
there is a strong connection between technology and the other elds in our life. Technology , software and hardware , are used in many places by di&erent age slides of the community, adults and children, but the main problem is that there is a specic slide of people gets a di'culty in dealing with technology. technology. This slide is blind people. $o our project project came to help this slide of community by making making a conversion of edited text into into speech to be listened by the blind people.
1
Also the another aim of making our project is that there is many images contained text which sometimes the user need it to his di&erent purpose. (n this case , our project helps the user to get this text , contained in an image , by using the techni)ue of Optical haracter !ecognition !ecognition "O!#.
1.3
Objectives : A full reali*ation reali*ation of this concept would involve a few distinct steps +
•
To To develop a text from from an image by O! system. system. To To develop text recognition recognition software software that can be gotten from an image image
•
or even directory written into text editor system. To To develop a read the text text contained in the text text editor by using $peech
•
!ecognition !ecognition $ystem. To To develop the above system to exist on a programmable programmable O! such
•
that it operates independently of an external computing computing source, and interacts with its software inputs and outputs independently. $uch a system would be integrated in the users sources, s ources, use speakers speakers in the computer as output sources, and would issue control les to software already installed in the computer. There are di&erent signicant factors to be considered while designing both Optical haracter !ecognition and Text to speech systems that will produce clear text and speech outputs.
1.
I!tro"#ctio! I!tro"#c tio! To OCR : The goal of Optical haracter !ecognition !ecognition "O!# is to classify classify optical
patterns "often contained in a digital image# corresponding to alphanumeric or other characters. The process of O! involves several steps including segmentation, feature extraction, extraction, and classication. -ach of these steps is a eld unto itself, and is described briey here in the context of a /atlab implementation of O!.
2
Also the another aim of making our project is that there is many images contained text which sometimes the user need it to his di&erent purpose. (n this case , our project helps the user to get this text , contained in an image , by using the techni)ue of Optical haracter !ecognition !ecognition "O!#.
1.3
Objectives : A full reali*ation reali*ation of this concept would involve a few distinct steps +
•
To To develop a text from from an image by O! system. system. To To develop text recognition recognition software software that can be gotten from an image image
•
or even directory written into text editor system. To To develop a read the text text contained in the text text editor by using $peech
•
!ecognition !ecognition $ystem. To To develop the above system to exist on a programmable programmable O! such
•
that it operates independently of an external computing computing source, and interacts with its software inputs and outputs independently. $uch a system would be integrated in the users sources, s ources, use speakers speakers in the computer as output sources, and would issue control les to software already installed in the computer. There are di&erent signicant factors to be considered while designing both Optical haracter !ecognition and Text to speech systems that will produce clear text and speech outputs.
1.
I!tro"#ctio! I!tro"#c tio! To OCR : The goal of Optical haracter !ecognition !ecognition "O!# is to classify classify optical
patterns "often contained in a digital image# corresponding to alphanumeric or other characters. The process of O! involves several steps including segmentation, feature extraction, extraction, and classication. -ach of these steps is a eld unto itself, and is described briey here in the context of a /atlab implementation of O!.
2
1.$
Te%t&to&'(eec) e%t&to&' (eec) 'o*tw+re : A Text0To0$peech "TT$# recognition is computer based system that
should be able to read any text aloud, whether it was straight bring in the computer by an operator or scanned and submitted to an Optical haracter !ecognition !ecognition system. (n the context of TT$ synthesis, it is very complicated to record record and accumulate all the words of the language. $o it is in e&ect more appropriate to dene TT$ as the automatic production of speech by using the concept of grapheme and phonemes text of the sentences to complete.
1.,
Project -et)o"oloies :
1.,.1
OCR -et)o"olo/ :
O! software has software has been around as long as computers have to connect the printed world with the electronic one. Traditional Traditional document imaging methods use templates and algorithms in a two0dimensional environment to recogni*e objects and patterns. O! methods today recogni*e a spectrum of colors, and they can distinguish between the background and the forefront in documents. They de0skew, de0speckle and use 102 image correction in order to work with lower resolution images taken from mediums such as faxes, the internet and cell phone cameras. O! software uses two di&erent kinds of optical character recognition+ feature extraction and matrix matching. 3eature extraction recogni*es shapes using statistical and mathematical techni)ues to detect edges, corners and ridges in a text font to identify the letters in a word, sentence and paragraph. O! software achieves the best results when the image has the following conditions+ •
(s a clean, straight image.
•
4ses a very distinguishable font such as Arial or 5elvetica.
•
4ses black letters on a clear background ba ckground for better results.
•
5as at least 166 dpi resolution.
3
5owever, these conditions are not always possible. The best O! techni)ues can still read words accurately in less ideal circumstances using matrix matching. One example of O! is shown below. A portion of a scanned image of text, borrowed borrowed from the web, is shown along a long with the corresponding corresponding "human recogni*ed# characters from that text.
0i#re 1.1 : 'c+!!e" im+e o* te%t +!" its corres(o!"i! reco!ie" re(rese!t+tio!.
1.,.2
Te%t to '(eec) -et)o"olo/ -et)o"ol o/ :
A Text0To0$peech "TT$# recognition is computer based system that should be able to read any text aloud, whether it was straight bring in the computer by an operator or scanned and submitted to an Optical haracter !ecognition !ecognition system. (n the context of TT$ synthesis, it is very complicated to record record and accumulate all the words of the language. $o it is in e&ect more appropriate to dene TT$ as the automatic production of speech by using the concept of grapheme and phonemes text of the sentences to complete.
4
0i#re 1.2 : TT' '/stem.
1.
'(eec) '/!t)esis : $ynthesi*ed speech can be created by concatenating part of recorded recorded
speech which is stored in a database. The power of a speech synthesi*er is moderator by its similarity to the human being voice, and by its ability a bility to be understood. The mainly signicant )ualities of a speech synthesis system are naturalness and (ntelligibility. 7aturalness expresses expresses how intimately the output sounds like human speech, whereas intelligibility intelligibility is the easiness with which the output is understood. The perfect speech synthesi*er is providing both natural and intelligible speech hence speech synthesis systems usually us ually try to maximi*e both characteristics. There are di&erent signicant factors to be considered while designing a Text to speech system that will produce clear speech.
5
0i#re 1.3 : 0lowc)+rt o* Te%t to '(eec) Reco!itio!.
1..1
Te%t To '(eec) '/stem :
TT$ $ynthesi*er is a computer based system that should be understand any text clearly whether it was establish in the computer by an operator or scanned and submitted to an Optical haracter !ecognition "O!# system. The intention of a text to speech system is to convert an random given wording into a speak waveform. /ost important workings of text to speech system are Text processing and $peech production. The two primary methods for producing synthetic speech waveforms are concatenative synthesis and formant synthesis. 8e are used oncatenative synthesis for our TT$. oncatenative synthesis is stand on the concatenation 6
of piece of recorded words. 4sually concatenative synthesis constructs the most normal sounding synthesi*ed words.
1..2
'(eec) e!er+tio! Com(o!e!t :
9iven order of phonemes, the idea of the speech generation component is to synthesi*e the acoustic waveform $peech generation has been attempted by concatenating the recorded words . !ecent state of art language synthesis produces natural sounding speech by using huge amount of speech pieces. $torage of huge number of pieces and their retrieval in real time is feasible due to availability of cheap memory and computation power. The problem related to the unit selection speech synthesis system are consider in three things that are choice of unit si*e, generation of speech database and criteria for selection of a unit.
1..3
'(eec) '/!t)esis Process :
This TT$ system is able to read any written text. This procedure is called text normali*ation, preprocessing and tokeni*ation. (n this system, we have developed a phonetic based text to speech synthesis system. 8e can improve the speech )uality using matlab language . The following gure shows the block diagram for TTs system .
0i#re 1. : 4loc5 Di+r+m *or Te%t to s(eec) '/!t)esis.
7
0i#re 1.$ : 0low c)+rt *or TT' wit) e%+m(le.
1.6
'(eec) '/!t)esis Tec)!olo/ : !esearch in the area of speech synthesis has been going on for
decades. As we found out with our research, numerous models and theories exist for the best way implementing a speech synthesis system. Although the models seemed intuitive from a high level perspective they )uickly grew in complexity as we got closer to implementation.
1.7 -AT8A4 Overview : /atlab is widely used in all areas of applied mathematics, in education and research at universities, and in the industry. /atlab stands for /ATrix :A%oratory and the software is built up around vectors and matrices. This makes the software particularly useful for linear algebra but matlab is also a great tool for solving algebraic and di&erential e)uations and for numerical integration. /atlab has powerful graphic tools and can produce nice pictures
8
in both ;2 and 12. (t is also a programming language, and is one of the easiest programming languages for writing mathematical programs. /atlab also has some tool boxes useful for signal processing, image processing, optimi*ation, etc. /atlab is a high0performance language for technical computing. (t integrates computation, visuali*ation, and programming in an easy0to0use environment where problems and solutions are expressed in familiar mathematical notation. Typical uses include+ • • • • • •
/ath and computation Algorithm development /odeling, simulation, and prototyping 2ata analysis, exploration, and visuali*ation $cientic and engineering graphics Application development, including 9raphical 4ser (nterface building.
/atlabis an interactive system whose basic data element is an array that does not re)uire dimensioning. This allows you to solve many technical computing problems, especially those with matrix and vector formulations, in a fraction of the time it would take to write a program in a scalar noninteractive language such as or 3ortran. /atlab was originally written to provide easy access to matrix software developed by the LINPACK and EISPACK projects, which together represent the state0of0the0art in software for matrix computation. /atlab has evolved over a period of years with input from many users. (n university environments, it is the standard instructional tool for introductory and advanced courses in mathematics, engineering, and science. (n industry, /atlab is the tool of choice for high0productivity research, development, and analysis.
9
/atlab features a family of application0specic solutions called toolboxes.
1.19
Histor/ o* -+tl+b :
leve /oler, the chairman of the computer science department at the 4niversity of 7ew /exico, started developing matlab in the late =>?6s. 5e designed it to give his students access to LINPACK and EISPACK without them having to learn 3ortran. (t soon spread to other universities and found a strong audience within the applied mathematics community. @ack :ittle, an engineer, was exposed to it during a visit /oler made to $tanford 4niversity in =>1. !ecogni*ing its commercial potential, he joined with /oler and $teve %angert. They rewrote matlab in and founded /ath8orks in =>B to continue its development. These rewritten libraries were known as JACKPAC. (n ;666, matlab was rewritten to use a newer set of libraries for matrix manipulation, LAPACK . /atlab was rst adopted by researchers and practitioners in control engineering, :ittleCs specialty, but )uickly spread to many other domains. (t is now also used in education, in particular the teaching of linear algebra and numerical analysis, and is popular amongst scientists involved in image processing.
1.11
'8 'erver Overview :
9enerically, any database management system "2%/$# that can respond to )ueries from client machines formatted in the $D: language. 8hen capitali*ed, the term generally refers to either of two database 10
management products from $ybase and /icrosoft. %oth companies o&er client0server 2%/$ products called $D: $erver.
1.12 T)e Histor/ o* '8 'erver : (%/ invented a computer language back in the =>?6s designed specically for database )ueries called $-D4-:, which stood for $tructured -nglish Duery :anguage. Over time the language has been added to, so that it is not just a language for )ueries but can also be used to build databases and manage security of the database engine. (%/ released $-D4-: into the public domain, where it became known as $D:.
%ecause of this heritage you can pronounce it as Ese)uelE or spell it out as E$0D0:E when talking about it.
$erver I.K, which also ran on top of 8indows 7T. $D: $erver ?.6 now runs on 8indows 7T as well as on 8indows >K and 8indows >. Although you can run $D: $erver ?.6 on a 8indows >x system, you do not get all the functionality of $D: $erver. 8hen running it on the 8indows >x platform, you lose the capability to use multiple processors, 8indows 7T security, 7T3$ "7ew Technology 3ile $ystem# volumes, and much more. 8e strongly urge you to use $D: $erver ?.6 on 8indows 7T rather than on 8indows >x. 8indows 7T has other advantages as well. The 7T platform is designed to support multiple users. 8indows >x is not designed this way, and your $D: $erver performance degrades rapidly as you add more users. $D: $erver ?.6 is implemented as a service on either 7T 8orkstation or 7T $erver "which makes it run on the server side of 8indows 7T# and as an application on 8indows >KH>. The included utilities, such as the $D: $erver -nterprise /anager, operate from the client side of 8indows 7T $erver or 7T 8orkstation. Of course, just like all other applications on 8indows >x, the tools run as applications. A service is an application 7T can start when booting up that adds functionality to the server side of 7T. $ervices also have a generic application programming interface "AF(# that can be controlled programmatically. Threads originating from a service are automatically given a higher priority than threads originating from an application.
1.13 '8 'erver 2996 R2 : /icrosoft $D: $erver ;66 !; is the most advanced, trusted, and scalable data platform released to date. %uilding on the success of the original $D: $erver ;66
12
release, $D: $erver ;66 !; has made an impact on organi*ations worldwide with its groundbreaking capabilities, empowering end users through self0 service business intelligence "%(#, bolstering e'ciency and collaboration between database administrators "2%As# and application developers, and scaling to accommodate the most demanding data workloads. This chapter introduced the new $D: $erver ;66 !; features, capabilities, and editions from a 2%As perspective. (t also discusses why 8indows $erver ;66 !; is recommended as the underlying operating system for deploying $D: $erver ;66 !;. :ast, $D: $erver ;66.
CHAPTER T;O
PRO
2.1 T)e Cl+ssi>c+tio! Process :
13
There are two steps in building a classier, training and testing. These steps can be broken down further into sub0steps + 1.
Tr+i!i! :
a. Fre0processing L Frocesses the data so it is in a suitable form for use. b. 3eature extraction L !educe the amount of data by extracting relevant informationJ4sually results in a vector of scalar values. c. /odel -stimation L from the nite set of feature vectors, need to estimate a model "usually statistical# for each class of the training data. 2. Testi! : a. Fre0processing. b. 3eature extraction L "both same as above#. c. lassication L ompare feature vectors to the various models and nd the closest match. One can use a distance measure.
0i#re 2.1 : T)e (+tter! cl+ssi>c+tio! (rocess .
2.2
OCR ? Pre&(rocessi! :
These are the pre-processing steps often performed in OC ! •
•
Binarization " #s$a%%& presented 'ith a gra&sca%e image( )inari*ation is then simp%& a matter of choosing a thresho%d +a%$e. Morphological Operators " emo+e iso%ated spec,s and ho%es in characters( can $se the
majority operator. 14
•
Segmentation " Chec, connecti+it& of shapes( %a)e%( and iso%ate. Can $se at%a) 6.1s
bwlabel and regionprops f$nctions. /iffic$%ties 'ith characters that arent connected( e.g. the %etter i( a semico%on( or a co%on or !. egmentation is )& far the most important aspect of the pre-processing stage. t a%%o's the recogni*er to etract feat$res from each indi+id$a% character. n the more comp%icated case of hand'ritten tet( the segmentation pro)%em )ecomes m$ch more diffic$%t as %etters tend to )e connected to each other.
2.3
OCR ? 0e+t#re e%tr+ctio! :
i+en a segmented iso%ated character( the $sef$% feat$res for recognition are !
1. Moment based features :
Thin, of each character as a otepad. The 2-/ moments of the character are!
From the moments we can compute features like:
1. Tota% mass n$m)er of pie%s in a )inari*ed character 2. Centroid - Center of mass 3. %%iptica% parameters i. ccentricit& ratio of maor to minor ais ii. Orientation ang%e of maor ais 4. ,e'ness 15
5. :$rtosis 6. ;igher order moments 2. ;o$gh and Chain code transform 3.
2.
OCR & -o"el Estim+tio! :
i+en %a)e%ed sets of feat$res for man& characters( 'here the %a)e%s correspond to the partic$%ar c%asses that the characters )e%ong to( 'e 'ish to estimate a statistica% mode% for each character c%ass.
0i#re 2.2 : C)+r+cter cl+sses (lotte" +s + *#!ctio! o* two *e+t#res.
16
0i#re 2.3 : 0lowc)+rt o* reco!ii! wor"s
The Optica% Character ecognition dea%s 'ith recognition of optica%%& processed characters. e%ia)%& interpreting tet from rea%-'or%d photos is a cha%%enging pro)%em d$e to +ariations in en+ironmenta% factors e+en it )ecomes easier $sing the )est open so$rce OC engine.
17
CHAPTER THREE
PRO
T)e (roject Desi! wit) t)e UI @r+()ic+l User I!ter*+ce :
0i#re 3.1 : T)e m+i! UI o* t)e (roject .
8o+" Im+e :
18
0i#re 3.2 : 8o+"i! +! im+e *rom com(#ter i!to t)e +((lic+tio! .
T)e m+tl+b co"e : [filename, pathname] = uigetfile({'*.jpg';'*.bmp';'*.gif';'*.tif'}, 'Pick an Image File'; if (filename==! "a#n$lg('%&u $i$ n&t electe$ an file ' ; ) fille i n&t electe$ en$ img=im#ea$([pathname,filename]; h = "aitba#(!,'Pleae "ait...'; tep = !!; f tep = +tep ) c&mputati&n take place he#e "aitba#(tep tep en$ cl&e(h et(han$le.btn-&ne#t,'/nable','&n'; et(han$le.path,'/nable','&n'; et(han$le.imageInf&,'/nable','&n'; et(han$le.img0$ipla,'1iible','&n'; et(han$le.te2t,'3t#ing',[filename]; et(han$le.te2t,'F&nt3i4e',5; et(han$le.path,'3t#ing',[pathname]; a2e(han$le.img0$ipla; imagec(img; a$$#e = cat(6,pathname,filename; imagen=im#ea$(a$$#e; ) 3h&" image imh&"(imagen;
19
Reco!ie Te%t : "I! 0ol"er B letters!#mbers
0i#re 3.3 : Reco!ie te%t (+tter!.
Cre+te Tem(l+tes : )-7/89/ 9/:P89/3 )ette# clc; cl&e all; 8=im#ea$('lette#0numbe#<8.bmp';=im#ea$('lette#0num be#<.bmp'; -=im#ea$('lette#0numbe#<-.bmp';>=im#ea$('lette#0num be#<>.bmp'; /=im#ea$('lette#0numbe#
20
:=im#ea$('lette#0numbe#<:.bmp';C=im#ea$('lette#0num be#
=im#ea$('lette#0numbe#<.png';4=im#ea$('lette#0num be#<4.png'; )Cumbe# &ne=im#ea$('lette#0numbe#<.bmp'; t"&=im#ea$('lette#0numbe#<6.bmp'; th#ee=im#ea$('lette#0numbe#
)*Q*Q*Q*Q*Q*Q*Q*Q*Q*Q*Q lette#=[8 - > / F ? @ I A B :... C D P E 7 3 9 1 G H % ]; numbe#=[&ne t"& th#ee f&u# fie... i2 een eight nine 4e#&]; l&"e#cae = [a b c $ e f g h i j k ... l m n & p J # t u " 2 4]; cha#acte#=[lette# numbe# l&"e#cae]; template=mat6cell(cha#acte#,56,[65 65 65 65 65 65 65 ... 65 65 65 65 65 65 65 ... 65 65 65 65 65 65 65 ... 65 65 65 65 65 65 65 ... 65 65 65 65 65 65 65 65 ... 65 65 65 65 65 65 65 65 ... 65 65 65 65 65 65 65 65 ... 65 65 65 65 65 65 65 65 ... 65 65]; ae ('template','template' clea# all
22
Re+" 8etter : )functi&n #ea$0lette# functi&n lette#=#ea$0lette#(imagn,num0let#a ) -&mpute the c#elati&n bet"een template an$ input image ) an$ it &utput i a t#ing c&ntaining the lette#. ) 3i4e &f 'imagn' mut be 56 2 65 pi2el ) /2ample+ ) imagn=im#ea$('>.bmp'; ) lette#=#ea$0lette#(imagn )l&a$ template gl&bal template c&mp=[ ]; f n=+num0let#a em=c#6(template{,n},imagn; c&mp=[c&mp em]; )paue( en$ $=fin$(c&mp==ma2(c∓ )*Q*Q*Q*Q*Q*Q*Q*Q*Q*Q*Q*Q*Q if $== lette#='8'; eleif $==6 lette#=''; eleif $==K lette#='-'; eleif $==5 lette#='>'; eleif $==L lette#='/'; eleif $==M lette#='F'; eleif $==N 23
lette#='?'; eleif $==O lette#='@'; eleif $== lette#='I'; eleif $==! lette#='A'; eleif $== lette#='B'; eleif $==6 lette#=''; eleif $==K lette#=':'; eleif $==5 lette#='C'; eleif $==L lette#='D'; eleif $==M lette#='P'; eleif $==N lette#='E'; eleif $==O lette#='7'; eleif $== lette#='3'; eleif $==6! lette#='9'; eleif $==6 lette#=''; eleif $==66 lette#='1'; eleif $==6K lette#='G'; eleif $==65 lette#='H'; eleif $==6L lette#='%'; eleif $==6M lette#=''; )*Q*Q*Q*Q* 24
eleif $==6N lette#=''; eleif $==6O lette#='6'; eleif $==6 lette#='K'; eleif $==K! lette#='5'; eleif $==K lette#='L'; eleif $==K6 lette#='M'; eleif $==KK lette#='N'; eleif $==K5 lette#='O'; eleif $==KL lette#=''; eleif $==KM lette#='!'; )******** eleif $==KN lette#='a'; eleif $==KO lette#='b'; eleif $==K lette#='c'; eleif $==5! lette#='$'; eleif $==5 lette#='e'; eleif $==56 lette#='f'; eleif $==5K lette#='g'; eleif $==55 lette#='h'; eleif $==5L lette#='i'; eleif $==5M 25
lette#='j'; eleif $==5N lette#='k'; eleif $==5O lette#='l'; eleif $==5 lette#='m'; eleif $==L! lette#='n'; eleif $==L lette#='&'; eleif $==L6 lette#='p'; eleif $==LK lette#='J'; eleif $==L5 lette#='#'; eleif $==LL lette#=''; eleif $==LM lette#='t'; eleif $==LN lette#='u'; eleif $==LO lette#=''; eleif $==L lette#='"'; eleif $==M! lette#='2'; eleif $==M lette#=''; eleif $==M6 lette#='4'; ele lette#='l'; )*Q*Q*Q*Q* /n$
26
8ettere cro(e : )functi&n lette#0in0a0line functi&n [fl #e pace]=lette#0c#&p(im0te2t& ) >ii$e lette# in line im0te2t&=clip(im0te2t&; num0fila=i4e(im0te2t&,6; )figu#e,imh&"(im0te2t&; )title('line ent in the functi&n lette#'; f =+num0fila ; um0c&l = um(im0te2t&(+,; if um0c&l==! k = 't#ue'; nm=im0te2t&(+,+Q; ) Fi#t lette# mat#i2 )figu#e,imh&"(nm; )title('fi#t lette# in the functi&n lette#0in0a0line'; )paue(; #m=im0te2t&(+,+en$;) 7emaining line mat#i2 )figu#e,imh&"(#m; )title('#emaining lette# in the functi&n lette#0in0a0line'; )paue(; fl = clip(nm; )paue(; #e=clip(#m; pace = i4e(#m,6Qi4e(#e,6; )*Q*Q*nc&mment line bel&" t& ee the #eult*Q )ubpl&t(6,,;imh&"(fl; )ubpl&t(6,,6;imh&"(#e; b#eak ele fl=im0te2t&;)Dnl &ne line. #e=[ ]; pace = !; en$ en$ functi&n img0&ut=clip(img0in 27
[f c]=fin$(img0in; img0&ut=img0in(min(f+ma2(f,min(c+ma2(c;
8i!es Cro( : functi&n [fl #e]=line(im0te2t& ) >ii$e te2t in line ) im0te2t&QRinput image; flQRfi#t line; #eQR#emain line ) /2ample+ ) im0te2t&=im#ea$('9/390K.jpg'; ) [fl #e]=line(im0te2t&; ) ubpl&t(K,,;imh&"(im0te2t&;title('ICP9 I:8?/' ) ubpl&t(K,,6;imh&"(fl;title('FI739 IC/' ) ubpl&t(K,,K;imh&"(#e;title('7/:8IC IC/3' im0te2t&=clip(im0te2t&; num0fila=i4e(im0te2t&,; f =+num0fila if um(im0te2t&(,+==! nm=im0te2t&(+Q, +; ) Fi#t line mat#i2 #m=im0te2t&(+en$, +;) 7emain line mat#i2 fl = clip(nm; #e=clip(#m; )*Q*Q*nc&mment line bel&" t& ee the #eult*Q *Q*Q*Q ) ubpl&t(6,,;imh&"(fl; ) ubpl&t(6,,6;imh&"(#e; b#eak ele fl=im0te2t&;)Dnl &ne line. #e=[ ]; en$ en$ functi&n img0&ut=clip(img0in [f c]=fin$(img0in; img0&ut=img0in(min(f+ma2(f,min(c+ma2(c;)-#&p image
28
0i#re 3. : Reco!ie te%t i! t)e (roject .
) QQQ /2ecute &n butt&n p#e in btn-&ne#t. functi&n btn-&ne#t0-allback(hDbject, eent$ata, han$le ) hDbject han$le t& btn-&ne#t (ee ?-D ) eent$ata #ee#e$ Q t& be $efine$ in a futu#e e#i&n &f :898 ) han$le t#uctu#e "ith han$le an$ ue# $ata (ee ?I>898 ) -&ne#t t& g#a cale pathname=get(han$le.path,'3t#ing'; filename=get(han$le.te2t,'3t#ing'; a$$#e = cat(6,pathname,filename; imagen=im#ea$(a$$#e; if i4e(imagen,K==K )7? image imagen=#gb6g#a(imagen; en$ ) -&ne#t t& G th#eh&l$ = g#ath#eh(imagen; imagen =Sim6b"(imagen,th#eh&l$; ) 7em&e all &bject c&ntaining fe"e# than K! pi2el imagen = b"a#ea&pen(imagen,K!; )3tage mat#i2 "$ f#&m image
29
)3tage mat#i2 "$ f#&m image "$=[ ]; te2t=[ ]; #e=imagen; te2t=''; ) &a$ template l&a$ template gl&bal template ) -&mpute the numbe# &f lette# in template file num0let#a=i4e(template,6; "hile )Fcn 'line' epa#ate line in te2t [fl #e]=line(#e; imgn=fl; n=!; )nc&mment line bel&" t& ee line &ne b &ne )figu#e,imh&"(fl;paue(6 )QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ paceect = []; pace bet"eeen
) t& c&mpute the t&tal ) a$jacent lette#
#c = fl; "hile )Fcn 'lette#0c#&p' epa#ate lette# in a line [fc #c pace]=lette#0c#&p(#c; )fc = fi#t lette# in the line )#c = #emaining c#&ppe$ line )pace = pace bet"een the lette# ) c#&ppe$ an$ the ne2t lette# )unc&mment bel&" line t& ee lette# &ne b &ne )figu#e,imh&"(fc;paue(!.L img0# = im#ei4e(fc,[56 65]; )#ei4e lette# & that c#elati&n )can be pe#fme$ 30
n = n T ; paceect(n=pace;
)Fcn '#ea$0lette#' c#elate the c#&ppe$ lette# "ith the image )gien in the f&l$e# 'lette#0numbe#' lette# = #ea$0lette#(img0#,num0let#a; )lette# c&ncatenati&n "$ = ["$ lette#]; if iempt(#c me cha#acte# b#eak; en$ en$
)b#eak l&&p "hen the#e a#e n&
)QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ) ma20pace = ma2(paceect; n&0pace = !; f 2= +n )l&&p t& int#&$uce pace at #eJuiite l&cati&n if paceect(2Tn&0paceR (!.NL * ma20pace n&0pace = n&0pace T ; f m = 2+n "$(nT2QmTn&0pace="$(nT2Q mTn&0paceQ; en$ "$(2Tn&0pace = ' '; paceect = [! paceect]; en$ en$ )fp#intf(fi$,')
31
) -lea# '"$' a#iable "$=[ ]; )*Ghen the entence finih, b#eak the l&&p if iempt(#e )3ee a#iable '#e' in Fcn 'line' b#eak en$ en$ h = "aitba#(!,'Pleae "ait...'; tep = !!; f tep = +tep ) c&mputati&n take place he#e "aitba#(tep tep en$ cl&e(h et(han$le.te2t6,'3t#ing',te2t; et(han$le.te2t6,'F&nt3i4e',65; et(han$le.3peak,'/nable','&n'; gui$ata(hDbject, han$le;
'+ve to NoteP+" :
0i#re 3.$ : '+ve to Note(+" >le *orm+t .
32
) QQQ /2ecute &n butt&n p#e in btnDpen. functi&n btnDpen0-allback(hDbject, eent$ata, han$le ) hDbject han$le t& btnDpen (ee ?-D ) eent$ata #ee#e$ Q t& be $efine$ in a futu#e e#i&n &f :898 ) han$le t#uctu#e "ith han$le an$ ue# $ata (ee ?I>898 alue=get(han$le.te2t6,'3t#ing'; etapp$ata(!,'t2t',alue file0fig(;
0i#re 3., : '+vi! + te%t >le.
) QQQ /2ecute &n butt&n p#e in btnDk. functi&n btnDk0-allback(hDbject, eent$ata, han$le ) hDbject han$le t& btnDk (ee ?-D ) eent$ata #ee#e$ Q t& be $efine$ in a futu#e e#i&n &f :898 ) han$le t#uctu#e "ith han$le an$ ue# $ata (ee ?I>898 )Dpen te2t.t2t a file f "#ite fname=get(han$le.e$it0name,'3t#ing'; filename=t#cat(fname,'.t2t'; pathname=get(han$le.e$it0l&cati&n,'3t#ing'; filepath=fullfile(pathname,filename; if ieJual(e2it(filepath,'file',6 butt&n = Juet$lg('file name al#ea$ e2it ', ... 'Ga#ning','De##i$e','-ancle','-ancle'; "itch butt&n 33
cae 'De##i$e' fi$ = f&pen(filepath, '"t'; cae '-ancle' #etu#n; en$ ele fi$ = f&pen(filepath, '"t'; en$ h = "aitba#(!,'Pleae "ait...'; tep = !!; f tep = +tep ) c&mputati&n take place he#e "aitba#(tep tep en$ cl&e(h )fp#intf(fi$,')
34
)$ata = cell(,M; c&lumn={'i$','name0file','te2t','path0file','time','n& te'}; $ata={han$le.lati$ fname t2t pathname $ate $ec#}; c&nn = $atabae('$bFile','a','6K'; ine#t(c&nn,'File0>ata',c&lumn,$ata; cl&e(c&nn ) p$ate han$le t#uctu#e gui$ata(hDbject, han$le; )Dpen 'te2t.t2t' file "in&pen(filepath cl&e
0i#re 3. : E"ite" te%t i! + Note(+" >le *orm+t .
8o+" Te%t 0ile :
0i#re 3.6 : 8o+"i! + te%t >le @Note(+" >le *orm+t .
) QQQ /2ecute &n butt&n p#e in l&a$. functi&n l&a$0-allback(hDbject, eent$ata, han$le 35
) hDbject han$le t& l&a$ (ee ?-D ) eent$ata #ee#e$ Q t& be $efine$ in a futu#e e#i&n &f :898 ) han$le t#uctu#e "ith han$le an$ ue# $ata (ee ?I>898 [filename,pathname] = uigetfile('*.t2t;','elect t2t file'; filepath=fullfile(pathname,filename; h = "aitba#(!,'Pleae "ait...'; tep = !!; f tep = +tep ) c&mputati&n take place he#e "aitba#(tep tep en$ cl&e(h; )U p#eaign t& &me la#ge cell a##a t2t=cell(!!!!,; i43 = !!!!; line-t = ; fi$ = f&pen(filepath,'#'; tline = fgetl(fi$; "hile icha#(tline t2t{line-t} = tline; line-t = line-t T ; )U g#&" if necea# if line-t R i43 t2t = [t2t;cell(!!!!,]; i43 = i43 T !!!!; en$ tline = fgetl(fi$; en$ )U #em&e empt ent#ie in t2t(line-t+en$ = []; et(han$le.te2t6,'3t#ing',t2t et(han$le.3peak,'/nable','&n' fcl&e(fi$
oading file in edit tool :
36
0i#re 3.7 : 8o+"i! + te%t o* !ote(+" >le *orm+t i! t)e e"it tool.
•
Te%t To '(eec) +
) QQQ /2ecute &n butt&n p#e in 3peak. functi&n 3peak0-allback(hDbject, eent$ata, han$le ) hDbject han$le t& 3peak (ee ?-D ) eent$ata #ee#e$ Q t& be $efine$ in a futu#e e#i&n &f :898 ) han$le t#uctu#e "ith han$le an$ ue# $ata (ee ?I>898 te2t=get(han$le.te2t6,'3t#ing'; n7&" = i4e(te2t, ; if iempt(te2t te2t = 'G#ite &mething t& peak'; en$ t# C/9.a$$8embl('3tem.3peech'; 3peake# = 3tem.3peech.3nthei.3peech3nthei4e#; f n=+n7&" #"t2t=te2t(n,+; if Sia(#"t2t,'cell' #"t2t = {#"t2t}; 37
en$ f k=+length(#"t2t 3peake#.3peak (#"t2t{k}; en$ en$ catch "a#ning(['C&t "king VV']; en$
Desi! D+t+4+se @#si! '8 'rver 2996 R :
Ta)%e ame ! File!ata !
0i#re 3.19 : 0ile "+t+.
ome /ata in a Ta)%e !
0i#re 3.11 : 'ome "+t+ i! + "+t+b+se t+ble .
-icroso*t '8 'erver OD4C i! -+tl+b *or ;i!"ows : 38
0i#re 3.12 : D+t+b+se e%(lorer i! m+tl+b .
8ist o* Te%t i! D+t+b+se :
0i#re 3.13 : 8ist o* te%t i! t)e "+t+b+se .
O! O(e!i! 0orm : 39
) QQQ /2ecute jut befe lit0file i ma$e iible. functi&n lit0file0DpeningFcn(hDbject, eent$ata, han$le, a#a#gin ) 9hi functi&n ha n& &utput a#g, ee DutputFcn. ) hDbject han$le t& figu#e ) eent$ata #ee#e$ Q t& be $efine$ in a futu#e e#i&n &f :898 ) han$le t#uctu#e "ith han$le an$ ue# $ata (ee ?I>898 ) a#a#gin c&mman$ line a#gument t& lit0file (ee 18787?IC han$le.e$it=!; c&nn = $atabae('$bFile','a','6K'; cu# = e2ec(c&nn,['elect * f#&m File0>ata']; et$bp#ef('>ata7etu#nFmat','cella##a' cu#=fetch(cu#; a=cu#.>ata; if SieJual('C& >ata',a et(han$le.litb&2,'3t#ing',a(+,6 et(han$le.litb&2,'1alue', et(han$le.e$it0i$,'3t#ing',a(, et(han$le.e$it0name,'3t#ing',a(,6 et(han$le.e$it0$ate,'3t#ing',a(,L et(han$le.e$it0l&cati&n,'3t#ing',a(,5 et(han$le.e$it0te2t,'3t#ing',a(,K if iempt(a(,M et(han$le.e$it0n&te,'3t#ing','9he#e i n& n&te'; ele et(han$le.e$it0n&te,'3t#ing',a(,M; en$ en$ ) -h&&e $efault c&mman$ line &utput f lit0file han$le.&utput = hDbject; ) p$ate han$le t#uctu#e gui$ata(hDbject, han$le;
O(e! 0ile : 40
0i#re 3.1 : O(e! >le b/ #si! !ote(+" >le *orm+t .
) QQQ /2ecute &n butt&n p#e in btn0&pen. functi&n btn0&pen0-allback(hDbject, eent$ata, han$le ) hDbject han$le t& btn0&pen (ee ?-D ) eent$ata #ee#e$ Q t& be $efine$ in a futu#e e#i&n &f :898 ) han$le t#uctu#e "ith han$le an$ ue# $ata (ee ?I>898 i$=get(han$le.e$it0i$,'3t#ing'; if Siempt(i$ fname=get(han$le.e$it0name,'3t#ing'; fname=t#cat(fname,'.t2t'; pathname=get(han$le.e$it0l&cati&n,'3t#ing'; filepath=fullfile(pathname,fname; t2t=get(han$le.e$it0te2t,'3t#ing'; ee=e2it(filepath{},'file'; if ieJual(ee,6 "in&pen(filepath{} ele butt&n = Juet$lg(['file ha been $amge$ change it l&cati&n. ',cha#(!,'Ghat &u "ant t& $&W'], ... 'Ga#ning','-#eate','>elete','-ancle','-ancle'; "itch butt&n cae '-#eate' fi$ = f&pen(filepath{}, '"t' n7&" = i4e(t2t, ; 41
f k=+n7&" fp#intf(fi$,')elete' butt&n = Juet$lg(['8#e &u u#e &u "ant t& $eleteW'], ... 'Ga#ning','DB','-ancle','-ancle'; "itch butt&n cae 'DB' btn0$el0-allback(hDbject, eent$ata, han$le; cae '-ancle' #etu#n; en$ cae '-ancle' #etu#n; en$ en$ en$
E"it :
0i#re 3.1$ : E"ite" te%t i! !ote(+" >le .
) QQQ /2ecute &n butt&n p#e in puhbutt&nL. functi&n btn0e$it0-allback(hDbject, eent$ata, han$le ) hDbject han$le t& puhbutt&nL (ee ?-D ) eent$ata #ee#e$ Q t& be $efine$ in a futu#e e#i&n &f :898 ) han$le ?I>898
t#uctu#e "ith han$le an$ ue# $ata (ee
42
i$=get(han$le.e$it0i$,'3t#ing'; if Siempt(i$ han$le.e$it=han$le.e$itT; if han$le.e$it== et(han$le.e$it0n&te,'/nable','&n' et(han$le.e$it0n&te,'ackg#&un$-&l',[.! .! .!]; ele han$le.e$it=!; c&nn = $atabae('$bFile','a','6K'; e$it0t2t=get(han$le.e$it0n&te,'3t#ing'; if SieJual(e$it0t2t,'9he#e i n& n&te' "he#eclaue=t#cat('"he#e i$=',i$; up$ate(c&nn,'File0>ata',{'n&te'}, {e$it0t2t},"he#eclaue et(han$le.e$it0n&te,'/nable','inactie' et(han$le.e$it0n&te,'ackg#&un$-&l',[!.M !.NM !.6]; help$lg('%&u a#e >&ne up$ate','p$ate' ele et(han$le.e$it0n&te,'/nable','inactie' et(han$le.e$it0n&te,'ackg#&un$-&l',[!.M !.NM !.6]; en$ en$ ) p$ate han$le t#uctu#e gui$ata(hDbject, han$le; en$
Delete 0rom D+t+b+se : ) QQQ /2ecute &n butt&n p#e in btn0$el. functi&n btn0$el0-allback(hDbject, eent$ata, han$le ) hDbject han$le t& btn0$el (ee ?-D ) eent$ata #ee#e$ Q t& be $efine$ in a futu#e e#i&n &f :898 ) han$le t#uctu#e "ith han$le an$ ue# $ata (ee ?I>898 i$=get(han$le.e$it0i$,'3t#ing'; if Siempt(i$ 43
butt&n = Juet$lg(['8#e &u u#e &u "ant t& $eleteW'], ... 'Ga#ning','DB','-ancle','-ancle'; "itch butt&n cae 'DB' i$=get(han$le.e$it0i$,'3t#ing'; Jue#=t#cat('$elete f#&m File0>ata "he#e i$=',i$; c&nn = $atabae('$bFile','a','6K'; cu# = e2ec(c&nn,Jue#{}; cu# = e2ec(c&nn,['elect * f#&m File0>ata']; et$bp#ef('>ata7etu#nFmat','cella##a' cu#=fetch(cu#; a=cu#.>ata; if SieJual('C& >ata',a{} et(han$le.litb&2,'3t#ing',a(+,6 et(han$le.litb&2,'1alue', et(han$le.litb&2,'3t#ing',a(+,6 et(han$le.litb&2,'1alue', et(han$le.e$it0i$,'3t#ing',a(, et(han$le.e$it0name,'3t#ing',a(,6 et(han$le.e$it0$ate,'3t#ing',a(,L et(han$le.e$it0l&cati&n,'3t#ing',a(,5 et(han$le.e$it0te2t,'3t#ing',a(,K if iempt(a(,M et(han$le.e$it0n&te,'3t#ing','9he#e i n& n&te'; ele et(han$le.e$it0n&te,'3t#ing',a(,M; en$ ele 44
et(han$le.litb&2,'3t#ing','' et(han$le.e$it0i$,'3t#ing','' et(han$le.e$it0name,'3t#ing','' et(han$le.e$it0$ate,'3t#ing','' et(han$le.e$it0l&cati&n,'3t#ing','' et(han$le.e$it0te2t,'3t#ing','' et(han$le.e$it0n&te,'3t#ing','' en$ cl&e(cu# cl&e(c&nn help$lg('>elete if >&ne','>elete' cae '-ancle' #etu#n; en$ en$
8ist o* >les :
0i#re 3.1, : 8ist o* >les.
) QQQ /2ecute &n butt&n p#e in btn0peak. functi&n btn0peak0-allback(hDbject, eent$ata, han$le ) hDbject han$le t& btn0peak (ee ?-D
45
) eent$ata #ee#e$ Q t& be $efine$ in a futu#e e#i&n &f :898 ) han$le t#uctu#e "ith han$le an$ ue# $ata (ee ?I>898 te2t=get(han$le.e$it0te2t,'3t#ing'; if Siempt(te2t alue=get(han$le.e$it0te2t,'3t#ing'; etapp$ata(!,'te2t',alue cl&e( &c#0gui( en$
Ret#r! to t)e m+i! 0orm wit) t)e te%t :
0i#re 3.1 : Ret#r!i! to t)e m+i! *orm wit) t)e te%t .
46
functi&n &c#0gui0DpeningFcn(hDbject, eent$ata, han$le, a#a#gin ) 9hi functi&n ha n& &utput a#g, ee DutputFcn. ) hDbject han$le t& figu#e ) eent$ata #ee#e$ Q t& be $efine$ in a futu#e e#i&n &f :898 ) han$le t#uctu#e "ith han$le an$ ue# $ata (ee ?I>898 ) a#a#gin c&mman$ line a#gument t& &c#0gui (ee 18787?IC ) -h&&e $efault c&mman$ line &utput f &c#0gui han$le.&utput = hDbject; te2t=getapp$ata(!,'te2t'; if Siempt(te2t et(han$le.te2t6,'3t#ing',te2t et(han$le.3peak,'/nable','&n' #mapp$ata(!,'te2t'; en$ ) p$ate han$le t#uctu#e gui$ata(hDbject, han$le;
47
CHAPTER 0OUR
I-P8E-ENTATION .1 Project Im(leme!t+tio! : =. :oading any image format "bmp, jpg, png Metc #
0i#re .1 : 8o+"i! +! im+e i!to t)e (ror+m . ;. The image will load .
0i#re .2 : iewi! t)e im+e i! t)e (ror+m . 1.
48
0i#re .3 : iewi! t)e im+e i!*orm+tio! . B. onvert the image to grayscale and binari*e it using the threshold value "Otsu algorithm#. K. Fage layout analysis. (n this step we tried to identify the text *ones present in the image. $o that only that portion is used for recognition and rest of the region is left out. I. :ines detection and removing. ?. 2etection of text lines and words. 5ere we also need to take care of di&erent font si*es and small spaces between words. . !ecognition of characters. This is the main algorithm of O!N an image of every character must be converted to appropriate character code. $ometimes this algorithm produces several character codes for uncertain images. 3or instance, recognition of the image of E(E character can produce E(E, EE E=E, ElE codes and the nal character code will be selected later.
49
>. lick !ecogni*e Text to get the text
0i#re . : Reco!ii! te%t.
Saving results to selected output format, for instance, searchable TXT file format.
.10
And . store (name, Text, Location, path and note of txt file in database directl! ."li#ing on Save to $otepad %ill open form to insert name and location of the file (&ro'se
50
.11
0i#re .$ : '+vi! te%t i! + !ote(+" >le . =;.
lick OP to open and save in a le.
(f the le name is already in the location you select a message will show .ask you if you want to override or cancel to rename the le
0i#re ., : ;+r!i! mess+e o* +! e%it >le !+me .
51
0i#re . : O(e!i! + >le i! !ote(+" . (mport text to be edited and read in the editor and to be converted into .voice
" text0to0speech # conversion
0i#re .6 : T)e (+tter! cl+ssi>c+tio! (rocess . 52
.1
) %hen !ou select the file ,the contents text 'ell loaded in the edit text
•
0i#re .7 : 8o+"i! t)e co!te!ts o* t)e >le i!to t)e e"it te%t . 4sing database to view the recent documents that have been saved by .this program
53
.1*
0i#re .19 : iewi! t)e rece!t "oc#me!t #si! t)e "+t+b+se .
Open the text you have been saved in database in 7otepad
.=K
0i#re .11 : O(e!i! t)e te%t o* !ote(+" >le #si! "+t+b+se .
54
Gou . can -dit the note
.=I
0i#re .12 : E"iti! i! t)e !ote(+" >le.
55
0i#re .13 : U("+ti! t)e e"iti!. =?.
Gou can click on speak to load the text in main form.
=.
Absolutely you can delete from the list.
0i#re .1 : ;+r!i! mess+e o* "eleti! >le *rom list.
56
0i#re .1$ : Delete "o!e mess+e.
#onclusion : n this proect( 'e disc$ssed the topics re%e+ant to the de+e%opment of TT s&stems. >e cond$cted O tests to e+a%$ate the performance of speech s&nthesi*er. This paper descri)es the s$ccessf$% comp%etion of a simp%e tet to speech trans%ation )& simp%e matri operations. Th$s this s&stem is +er& eas& and efficient to imp%ement $n%i,e other methods 'hich in+o%+e man& comp%e a%gorithms and methods. The net step in impro+ing this s&stem 'o$%d )e imp%ementing some machine %earning a%gorithms in order to s$pport genera%i*ation.
•
Suggestions for Future $ork :
•
? n$m)er of open pro)%ems m$st )e so%+ed to a%%o' the de+e%opment of a tr$%& mage ( tet to speech con+ersion and recognition s&stem. These pro)%ems s$ggest a +ariet& of research directions that need to )e p$rs$ed to ma,e s$ch a s&stem feasi)%e. ?@( =3( @OA( ?>(...etc( 'ith the he%p of data)ase programs. Third( opening an a$dio fi%e and getting the speech to tet con+ersion of this fi%e.
57