Anda di halaman 1dari 77

DISSERTATION

On

RECOGNITION OF HANDWRITTEN BENGALI CHARACTER BASED ON CHARACTER


FEATURES

Thesis Submitted in the partial fulfillment of the requirements for the degree of
M.TECH IT (Courseware Engineering)

Submitted By
SWATI MUKHERJEE
Examination Roll number:-M48CWE10-03

Under the Guidance of


Mr. Arunasish Acharya

School of Education Technology


Faculty Council for UG and PG studies in
Engineering and Technology
JADAVPUR UNIVERSITY
KOLKATA- 700032
2010

Faculty Council for UG and PG studies in Engineering and Technology


JADAVPUR UNIVERSITY, KOLKATA- 700032

Certificate of Recommendation

This is to certify that Swati Mukherjee has completed her dissertation entitled Recognition of
Handwritten Bengali Character Based on Character Features, under the supervision and
guidance of Arunasish Acharya, School of Education Technology, Faculty Council for UG and
PG studies in Engineering and Technology, JADAVPUR UNIVERSITY, Kolkata. We are
satisfied with her work, which is being presented for the partial fulfillment of the degree of
Master of Technology in IT (Courseware Engineering), Jadavpur University, Kolkata700032.

Mr. Arunasish Acharya


Teacher in Charge of Thesis,
School of Education Technology
Jadavpur University, Kolkata 700 032

Prof. Samar Bhattacharya


Director, School of Education Technology
Jadavpur University,Kolkata 700 032

Prof. Niladri Chakraborty


Dean, Faculty Council for UG and PG
studies in Engineering and Technology
Jadavpur University, Kolkata 700 032

Faculty Council for UG and PG studies in Engineering and Technology


JADAVPUR UNIVERSITY, KOLKATA- 700032

Certificate of Approval*
The foregoing thesis is hereby approved as a creditable study of M.Tech IT (Courseware
Engineering) and presented in a manner satisfactory to warrant its acceptance as a prerequisite to
the degree for which it has been submitted. It is understood that by this approval the undersigned
do not necessarily endorse or approve any statement made, opinion expressed or conclusion
therein but approve this thesis only for the purpose for which it is submitted.

Final Examination for


Evaluation of the Thesis

_____________________________

_____________________________

_____________________________
Signature of Examiners
*Only in case the thesis is approved.

Declaration of Originality and Compliance of Academic Ethics

I hereby declare that this thesis contains literature survey and original research work by the
undersigned candidate, as part of Master of Technology in IT (Courseware Engineering
studies).
All information in this document have been obtained and presented in accordance with academic
rules and ethical conduct.
I also declare that, as required by these rules and conduct, I have fully cited and referenced all
material and results that are not original to this work.

Name (Block Letters)

: SWATI MUKHERJEE

Exam Roll Number

: M48CWE10-03

Thesis Title

: RECOGNITION OF HANDWRITTEN BENGALI


CHARACTER BASED ON CHARACTER FEATURES.

Signature With Date

ACKNOWLEDGEMENTS
I feel extremely glad in presenting my final year project at School Of Education Technology,
Jadavpur University, Kolkata, in the partial fulfillment of the requirements for the M.Tech
IT(Courseware Engineering).
I would specially like to thank my guide, Mr. Arunashis Acharya, for his vigilant supervision and
his constant encouragement. He spent his precious time in reviewing the project work and
provided many insightful comments and constructive criticism. Without his enthusiasm and
intelligence this work would not have been possible.
I would also like to express my grateful thanks to Prof. Samar Bhattacharya, Director of School
of Education Technology, for his support, encouragement and timely advices. I am really
indebted to Prof. Pramatha Nath Basu, Dr. Ranjan Parekh, Dr.Matangini Chattopadhyay,
Mrs. Saswati Mukherjee for their continuous support during the entire course of the project.
Their advice and support was inspirational and motivational.
There are a lot of people who contributed towards the completion of the project and I am really
thankful to all of them.I do wish to Thank to all of my classmates of M. Tech. IT (Courseware
Engineering) and MMD department, who inspired and motivated me to complete my project
work successfully, departmental support staff and all of these who were associated with this
project contributed in some form or the other.
Lastly, most important I would like to thank my parents. Without love, patience, support, and joy
that they have provided, I would be unable to complete this project.

Date:
Place: Jadavpur, Kolkata

________________________________
Swati Mukherjee
Roll No-000811902003
M.Tech IT (Courseware Engineering)
School of Education Technology
Jadavpur University
Kolkata - 700032

CONTENTS
Executive Summery.3
Chapter 1: Introduction..4
1.1 Problem Statement ...7
1.2 Brief of Problem to be Solved...7
1.3 Objectives..7
1.4 Assumptions..7
1.5 Organization of the Thesis.. .8

Chapter 2: Literature Survey ....9


Chapter 3: Concept & Problem Analysis....17
3.1Digital Image Processing...17
3.2 Bengali Script Overview...17
3.2.1 Properties of Bengali Script19
3.3Character Recognition...22
3.3.1 Online Character Recognition.22
3.3.2 Offline Character Recognition23
3.4Optical Character Recognition (OCR)......23
3.4.1Data Acquisition..23
3.4.2Binarization..25
3.4.3 Noise Removal26
3.4.4 Skeletonization....26
3.4.5 Skew detection & Correction......26
3.4.6 Segmentation...27
3.4.7 Feature Extraction...28
3.4.8 Classification...29
3.5 Problem Analysis..29

School Of Education Technology, Jadavpur University

Chapter 4: Design & Implementation.31


4.1Block Diagrams..............................................................................................................................32
4.1.1 Block diagram of Handwritten Bengali character recognition system.................................32
4.1.2 Block diagram of proposed handwritten Bengali character recognition system..................33
4.2Algorithms.....................................................................................................................................35
4.2.1Algorithm1. Shadow based feature extraction technique......................................................35
4.2.2Algorithm2.Diagonal-distance feature extraction technique36
4.2.3Algorithm3. Shadow feature extraction technique37
4.2.4Algorithm4. Centroid feature extraction technique...38
4.2.5Algorithm5. Longest-run feature extraction technique.39

Chapter 5: Results and Interpretations.....44


Chapter 6: Conclusion and Future Scope...48
6.1 Conclusion.48
6.2 Future scope..48

Chapter 7: References...49
Appendix I Codes of the Project.......53
Appendix II Output of the Project.......70

School Of Education Technology, Jadavpur University

Executive Summary

This thesis proposes two new approaches for extracting features in context of Handwritten Bengali
character recognition. First approach is to compute shadow based features where each character image
is enclosed within a minimal square, divided into four quadrants. Each quadrant is further divided into
eight octants. Then lengths of projections of character images on three sides of each octant are then
computed. Lengths of all such projections on each of the 3x8=24x4 sides of all octants are summed up
to produce 24x4=96 shadow based features of the character image are obtained. The second approach
is to compute the Diagonal Distance features from four corners of the minimal square containing the
character image. Here a set of 4 features of each character image are obtained. Thus a summation of
all features of each character image, 100 features are obtained to feed to the Neural Network to
classify properly.

School Of Education Technology, Jadavpur University

CHAPTER 1

INTRODUCTION

Handwritten Character recognition has attracted voluminous research in recent times and received
extensive attention in academic and production fields. It is important area in image processing and
pattern recognition. India is a multi-lingual and multi-script country, where eighteen official scripts are
accepted and have over hundred regional languages.
Today, many researchers have been done to recognize Bengali characters. But the problem of
interchanging data between human beings and computing machines is a challenging one. Even today,
many algorithms have been proposed by many researchers so-that these Bengali characters can be
easily recognize. But the efficiency of these algorithms is not satisfactory.
Mainly, users do Handwritten Character Recognition for interpretation of data, which describes
handwritten drawing. Handwritten character recognition can be differentiated into two categories i.e.
Online Handwritten character recognition and Offline Handwritten character recognition. On-line
handwritten character recognition deals with automatic conversion of characters, which are written on
a special digitizer, tablet PC or PDA where a sensor picks up the pen-tip movements as well as penup/pen-down switching. Off-line handwritten character recognition deals with a data set, which is
obtained from a scanned handwritten document. The main objective of handwritten Bengali character
recognition (HBCR) is to recognize the Bengali characters in desirable format from image format so
that they can be easily edited.
Many researchers have been done to solve handwritten character recognition problem in related areas
such as Image Processing, Pattern Recognition, Artificial Intelligence, and cognitive science etc.
Further researches are being done to improve accuracy and efficiency. Recognition of Offline
Handwritten Bengali characters is a goal of many research efforts in the pattern recognition field.
Many techniques have been applied for recognition of handwritten Bengali characters but still it is the
case of less efficiency and accuracy of recognition.
Artificial Intelligence concepts like neural networks are used to perform the work as human mind can
do. This explores the idea of how humans recognize text in general and are used to develop machines
that simulated this process. Developing these intelligent machines for recognizing characters is not an
easy task; this is because a character can be written in different ways. Also there are so many
imperfections and variation of handwriting such as alignment, noise and angles, which make
handwritten character recognition difficult to implement with a machine. All these imperfections of

School Of Education Technology, Jadavpur University

handwritten characters cannot be removed easily, so this problem is separated in sub- problems. This
means that a single process or single machine is not capable of performing the entire process. It can be
done by a series of processes that return some desirable result. Then a final process will combine the
results from all the sub-process to produce a final result. For recognition of handwritten characters,
some sub-processes are followed i.e. scanning a document, pre-processing, feature extraction,
Classification etc. The output of previous process is used as input in next process.
For example, the first sub-process i.e. scanning of document scans the information and produces some
output that is taken by next sub-process i.e. preprocessing which eliminates all the noise such as ink
spots that have no meaning, binarization, skew correction ,slant removal can be done to the document.
Then next sub-process extracts all the features of characters and produces the pixels according to
feature of character. Then output of this process is used to train the neural network and produces the
final result. Thus, recognition of handwritten characters is not a single process; it is the combination of
many processes such as scanning of characters called as digitization, pre-processing, segmentation,
feature extraction, classification and post-processing. By the combination of these processes, the
desired output is obtained.
For recognition of handwritten characters, HBCR machine depends on learning process in which back
propagation algorithm takes input from user. In this learning process, training and testing of characters
is done. A library is made in which the information of text segments is stored which are used for future
comparisons. This library helps in acceptance and rejection of characters. For example: Character is
written 50 times in library in which 40 fonts are used for training of neural network and rest are used
for testing the network. The importance of neural networks has grown dramatically during the last
fifteen years. A large number of universities and companies are using neural networks and products
based on neural network are available in market.
Neural network works as human brain, thus the architecture of neural network machine is same as the
architecture of human brain. There are hundreds or even thousands of neurons in custom integrated
circuits. In conjunction, the growing interest in learning machines, non-linear dynamics and parallel
computation spurred renewed attention in artificial neural networks. There are so many real world
applications such as pattern recognition, system identification, noise removal etc. in which neural
network is extensively applied. There are also positive results when it is used in character recognition.

School Of Education Technology, Jadavpur University

Many non-Indian and Indian scripts are recognized accurately and efficiently with the help of neural
networks.
There are too many applications, which can be solved easily using neural networks that are difficult to
solve using traditional methods. A neural network is consisted of three layers i.e. input layer, hidden
layer and the output layer. Each layer consists of small-interconnected processing units. These units
are interconnected with each other via a weighted link. Every unit has individual function but the
combination of these units display complex behaviors. A neural network is a massively paralleldistributed processor that has a natural propensity for storing experimental knowledge and making it
available for use. Neural network behaves like human brain. Neural network acquires knowledge as
human brain acquires knowledge from learning process. Neural network has many advantages over
traditional systems. For example: - It is insensible to noise and easier to handle, because it involves
less human work than other traditional statistical analysis. Neural network can solve problems that do
not have an algorithmic solution or problems whose algorithmic solutions are too complex to find. It
has fewer errors because it can respond to anything and small changes in the input normally do not
cause a change in the output. This behavior of neural network shows its importance.
In the literature survey includes about Indian language scripts as well as
Bengali script and also discussed the previous work on handwritten Bengali character recognition.
Different types of approaches and algorithm related to OCR and classification based on MLP related
to this topic are also discussed.

School Of Education Technology, Jadavpur University

1.1Problem Statement
Design of an enhanced technique for recognition of handwritten bengali character based on character
features.

1.2 Brief of Problem to be solved


Recognition of handwritten Bengali character is a process which loads a handwritten Bengali character
image, preprocesses the image, extracts proper image features, classify the characters based on the
extracted image features and the known features are stored in the image model library, and recognizes
the image according to the degree of similarity between the loaded image and the image models. Here
MLP based classifier is used to recognize handwritten Bengali character properly.

1.3 Objectives
The present work has the following objectives
i.

Design an OCR system for recognizing Handwritten Bengali character based on character
feature.

ii.

Different types of features are extracted from a character image.

iii.

Proper recognition of Handwritten Bengali character.

1.4 Assumptions
Image preprocessing involves the following steps are assumed.
(i) The input image should contain only segmented handwritten Bengali character .Character
Extraction from a scanned document.
(ii) Skew detection & correction
(iii) Background noise removal
(iv) Skeletonization
This thesis is assumed that the input image is available after undergoing all the process. These can be
incorporated into thesis.

School Of Education Technology, Jadavpur University

1.5Organization of Thesis
The first Chapter introduces the project work and it covers Problem statement, objective,
assumptions & scope of the project.
The second Chapter includes the Literature Survey of the project.
The third Chapter describes the concepts involved and problem analysis of the work.
The fourth Chapter includes the detail description of implementation with block diagrams of the
project.
Result & Interpretation are discussed in Chapter five.
Conclusion and future scope of the work has been included in the Chapter six.
Chapter seven contains references/ bibliography of the project.
The Appendix I contains the codes.
The Appendix II contains the sample output of the project.

School Of Education Technology, Jadavpur University

CHAPTER 2

LITERATURE SURVEY

Indian language scripts are fundamentally non-cursive in nature, where the aksharas (characters) are
written independently, separated by space or pen-lifts. However, these scripts often contain a large
number of characters that have complex spatial layout of strokes. Indian scripts have compound
characters, which are combinations of multiple consonants and vowels. The handwriting synthesis
process should hence model all the possible variations of characters and their combinations to be able
to generate any given text. This makes the problem of synthesis; extremely complex in the case of
Indian language scripts. There are many other properties of the Indian scripts that are not seen in
Roman[40].
Bangali, the second most popular language in India and the fifth most popular language in the world,
is an ancient Indo-Aryans language. Bangali is one of the most widely spoken languages in the
world.More than 200 million people in the eastern part of Indian subcontinent speak in this language.
Bangali script alphabet is used in texts of Bangali, Assamese and Manipuri languages. Bangali is a
very rich and old language; the matter of regret is its computerization has not yet gone much far. In
fact, dedicated research and development for Bangali computerization has just been started from the
last decade.Bangali scripts are moderately complex patterns. Unlike simple juxtaposition in Roman
scripts, each word in Bangali scripts is composed of several characters joined by a horizontal line
(called Maatra or head-line) at the top [26]. Often there may be different composite characters and
vowel and consonant signs (Kaar and Falaa symbols)[27-28]. Among the characters, the vowels
often take modified shapes in a word. Such characters are called modifiers or allographs (in Bangla
Kaar).Consonant modifiers are possible (calledFalaa). In a single syllable of a word, several
consonant characters may combine to form a compound character that partly retains the shape of the
constituent characters (e.g. + Da, Ka + Ta, Va + Ra-falaa, Na +Daa + Ra-falaa) [27-29]. Each syllable
in a Bengali word can be divided into three horizontal layers [41]. All the basic alphabets, compound
characters and numerals have almost same width whereas the modifiers and punctuations vary in their
width and height. Most of the characters of Bengali alphabet set have the property of intersection of
two lines in different positions. Many characters have one or more corner or sharp angle property.
Some characters carry isolated dot along with them [30].

School Of Education Technology, Jadavpur University

Character recognition is a process, which associates a symbolic meaning with object (letters, symbols
and numbers) drawn on an image. It may be classified as offline and online. In case of online character
recognition, there is real time recognition of characters. Offline character recognition, the
typewritten/handwritten character is typically scanned in form of a paper document and made
available in the form of a binary or gray scale image to the recognition algorithm. The major
difference between Online and Offline Character Recognition is that Online Character Recognition has
real time contextual information but offline data does not [31-33].
Optical Character Recognition (OCR) is still an active area of research, especially

for handwritten

text. Success of the commercially available OCR system is yet to be extended to handwritten text. It is
mainly due to the fact that numerous variations in writing styles of individuals make recognition of
handwritten characters difficult. Past work on OCR of handwritten alphabet and numerals has been
mostly found to concentrate on Roman script [24], related to English and some European languages,
and scripts related to Asian languages like Chinese[25], Korean, and Japanese. Among Indian scripts,
Devnagri, Tamil, Oriya and Bengali have started to receive attention for OCR related research in the
recent years. Out of these, Bengali is the second most popular script and language in the Indian
subcontinent and the fifth most popular language in the world. As a script, it is used for Bengali,
Ahamia and Manipuri languages. Bengali, which is also the national language of Bangladesh, is the
fifth most popular language in the world. So is the importance of Bengali both as a script and as a
language. But evidences of research on OCR of handwritten Bengali characters, as observed in the
literature, are a few in numbers. Not only because of numerous variation of writing styles of different
individuals but also for the complex nature of Bengali alphabet, automatic recognition of handwritten
Bengali characters still poses some potential problems to the researchers. Compared to Roman
alphabet, basic Bengali alphabet consists of a much larger number of characters. The number of
characters in basic Bengali alphabet is 50. And some characters therein resemble pair wise so closely
that the only sign of small difference left between them is a period or a small line.
OCR is one of the oldest ideas in the history of pattern recognition using computers. In recent time,
Bengali character recognition becomes the field of practical usage. In character recognition, the
process starts with reading of a scanned image of a series of characters, determines their meaning, and
finally translates the image to a computer written text document.

School Of Education Technology, Jadavpur University

10

Many researches have been done on character recognition in last 56 years. Some books [1-3] and
many surveys [4, 5] have been published on the character recognition. Most of the work on character
recognition has been done on Japanese, Latin, Chinese characters in the middle of 1960s.
Preprocessing operations include binarization, contour smoothing, noise reduction, skew detection of a
digital image so that subsequent algorithms along the road to final classification can be made simple
and more accurate. Reference [6] presents a good work on preprocessing and segmentation .Here preprocessing stage consists of 4 steps - compression, skew correction, binarization, noise removal. In
this paper the nearest neighbor interpolation method is used for scaling down the original image for
fast processing and accurate results.
During pre-processing the input RGB image in converted to gray scale image.[7] consider the OTHUs
algorithm for gray scale conversion with good flexibility. In this paper the OTSU methods is used for
gray scale to binary image conversion. The principal idea is to convert images of text documents such
as those obtained from scanning a document into editable texts. This report does not address the preprocessing steps such as skew correction and noise reduction, so the documents are assumed to preprocess by another tool in the pipeline. For training and recognition, the input is then first converted to
a binary image, and then into to a 25x25 pixel2 image; the only feature extracted from the images is a
625-bit long vector, which is then trained or classified using a Kohonen neural network. The OCR
shows excellent performance for documents with single typeface. The work in progress is extending it
to handle multiple typefaces. 98% character recognition accuracy is reported.
The work of J.U. Mahmud, Md. F. Raihan and C. M Rahman [8] is concerned with a complete optical
character recognition (OCR) system for Bengali character. Recognition is done for both isolated and
continuous printed multi font Bengali characters. Pre-processing steps includes segmentation in
various levels, noise removal and scaling. Free man chain code has been calculated from scaled
character which is further processed to obtain a discriminating set of feature vectors for the recognizer.
The unknown samples are classified using feed forward neural network based recognition scheme. It
has been found from experimental results that success rate is approximately 98% for isolated
characters and 96% for continuous character.
Segmentation is an operation that seeks to decompose an image of sequence of characters into sub
images of individual symbols. Character segmentation is a key requirement that determines the utility

School Of Education Technology, Jadavpur University

11

of conventional Character Recognition systems. It includes line, word and character segmentation.
Character segmentation is a necessary preprocessing step for character recognition in many
handwritten word recognition systems. Dipankar Das and Rubaiyat yashmin shows [9] the projection
based heuristic technique for segmenting the Bengali handwritten numerals. The results, based on this
approach are quite satisfactory for the next classifier stage. In this approach the character matrices
from each numerals are extracted, normalized then passed through an ANN classifier for classification.
It is observed that the accuracy level of this approach is 100%.
A fuzzy technique for segmentation of handwritten Bengali word images is presented in [10]. It works
in two steps. In first step, the black pixels constituting the Matra (i.e., the longest horizontal line
joining the tops of individual characters of a Bengali word) in the target word image is identified by
using a fuzzy feature. In second step, some of the black pixels on the Matra are identified as segment
points (i.e., the points through which the word is to be segmented) by using three fuzzy features. On
experimentation with a set of 210 samples of handwritten Bengali words, collected from different
sources, the average success rate of the technique is shown to be
95.32%.
Segmentation work [11] based on certain characteristics of Bengali handwriting methods; different
zones across the height of the word are detected. These zones provide certain structural information
about the constituent characters of the respective word. In Bengali handwritten texts often there is
overlap between rectangular hulls of successive characters, as such the characters are seldom vertically
separable. This method of recursive contour following in one of the zones across the height of the
word is used to find out the extents within which the main portion of the character lies. If the
successive characters are not touching in the zone of contour following, the algorithm gives fairly
good results. Another good work on segmentation for Bengali handwritten characters using
superimposed matrices[12].In this system, the Bengali text, accepted as an image file, is first
segmented into lines and words and then each word is segmented into characters. Then the boundary
of each character is determined. The characters are scaled to a standard size using an image scaling
algorithm and are stored in a 32X32 matrix. This matrix is then compared with a knowledge base
where all recognized characters given by various persons are stored in superimposed form. Finally,
depending on the similarity of the character with the stored one, the system recognizes the character to

School Of Education Technology, Jadavpur University

12

use in the output. This system is suitable to convert handwritten texts into printed documents and the
system achieves 100% accuracy.
After pre-processing and segmentation of Bengali handwritten document, features of the characters are
extracted. This step is heart of the system. This step helps in classifying the characters based on their
features. In fact, the variation depends on font styles, document noise, photometric effect, document
skew and poor image quality. The large variation in shapes makes it difficult to determine the number
of features that are convenient prior to model building. Though many kinds of features have been
developed and their test performances on standard database have been reported to classify and
recognize the character. Bengali is the second most popular script and language in the Indian
subcontinent and the fifth most popular language in the world. The work presented by S. Basu et al.
[13] involves the design of a Multi Layer Perceptron (MLP) based classifier for recognition of
handwritten Bengali alphabet using a 76 element feature set. The feature set developed for
representing handwritten characters of Bengali alphabet includes 24 shadow features, 16 centroid
features and 36 longest-run features. Recognition performances of the MLP designed to work with this
feature set are experimentally observed as 86.46% and 75.05% on the samples of the training and the
test sets respectively. The work has useful application in the development of a complete OCR system
for handwritten Bengali text. Some pixel-based and shape-based features are chosen for the purpose of
recognition of both printed and handwritten Bengali numerals [14]. Such mixed numerals may appear
in documents like application forms, postal mail, bank checks etc. The pixel-based features are
normalized pixel density over 4 X 4 blocks in which the numeral bounding-box is partitioned. The
shape-based features are normalized position of holes, end-points, intersections and radius of curvature
of strokes found in each block. Multi-layer neural network architecture was chosen as classifier of the
mixed class of handwritten and printed numerals. For the mixture of twenty three different fonts of
printed numerals of various sizes and 10,500 handwritten numerals, an overall recognition accuracy of
97.2% has been achieved.
In [15] Zone centroid and Image centroid based Distance metric feature extraction is proposed. The
character centroid is computed and is further divided in to n equal zones. Average distance from the
character centroid to the each pixel present in the zone is computed. Similarly zone centroid is
computed and average distance from the zone centroid to each pixel present in the zone is computed.

School Of Education Technology, Jadavpur University

13

This procedure is repeated for all the zones/grids/boxes present in the numeral image. There could be
some zones that are empty, and then the value of that particular zone image value in the feature vector
is zero. Finally 2*n such features are extracted. Nearest neighbor and Feed forward back propagation
neural network classifiers are used for subsequent classification and recognition purpose. Oriented
features in the word are extracted with the Gabor filters. In [16] it is estimated that the Gabor filter
parameters form the grayscale images. After filtering the images and comparing with Bengali text
images (sample file contains the fonts) the output text is created. The system achieves an average
conversion rate of 65%for the writing being correctly classified within the top five positions. [17]
deals with a recognition system for unconstrained off-line Bengali handwritten numerals. To take care
of variability involved in the writing style of different individuals, a robust scheme is presented here.
The scheme is mainly based on new features obtained from the concept of water overflow from the
reservoir as well as topological and structural features of the numerals. The scheme is tested obtained
an overall recognition accuracy of about 92.8% from 12000 data.
A work on multi-stage character recognition system for an Indian script, namely, Bengali (also called
Bengali) using fuzzy features and multilayer perceptron (MLP)is represented by Samik Surul[18].The
fuzzy features are extracted from Hough transform of a character pattern pixels. First define a number
of fuzzy sets on the Hough transform accumulator cells. The fuzzy sets are then combined by t-norms
to generate feature vectors from each character. A set of fuzzy linguistic vectors is next generated from
these feature vectors. The MLPs used for classification have the fuzzy features as inputs. The MLP
outputs also represent the belongingness of an input pattern to different fuzzy character pattern classes.
To improve the recognition accuracy of Bengali characters, divide all the patterns into three distinct
sets. Each set of characters is once again divided into a number of mutually exclusive character pattern
classes. During recognition, the class of each pattern is first determined, followed by recognition of the
actual character within that class. Recognition accuracy of the system is more than 98%. Ray &
Chatterjee [22] presented a recognition system based on a nearest neighbor classifier-employing
feature extracted by using a string connectivity criterion. A complete OCR for printed Bengali is
reported in the work by Chaudhuri & U Pal [23], in which a combination of template and featurematching approach is used. A histogram-based thresholding approach is used to convert the image into
binary images. For a clear document the histogram shows two prominent peaks corresponding to white
and black regions. The threshold value is chosen as the midpoint of the two-histogram peaks. Skew

School Of Education Technology, Jadavpur University

14

angle is determined from the skew of the headline. Text lines are partitioned into three zones and the
horizontal and vertical projection profiles are used to segment the text into lines, words, and
characters. Primary grouping of characters into the basic, modified and compound characters is made
before the actual classification. A few stroke features are used for this purpose along with a tree
classifier where the decision at each node of the tree is taken on the basis of presence/absence of a
particular feature. The compound character recognition is done in - two stages: In the first stage the
characters are grouped into small sub-sets by the above tree classifier. At the second stage, characters
in each group are recognized by a run-based template matching approach. Some character level
statistics like individual character occurrence frequency, bigram and trigram statistics etc. are utilized
to aid the recognition process. For single font, clear documents 99.10% character level recognition
accuracy is reported. In[19]features are obtained by computing local chain code histograms of input
character shape. Comparative recognition results are obtained between computation of the above
feature based on the contour and one-pixel skeletal representations of the input character image. Also,
the classification results are obtained after down sampling the histogram feature by applying Gaussian
filter in both these cases. Multilayer perceptron (MLP) trained by back propagation (BP) algorithm are
used as classifiers in the present study. Near exhaustive studies are done for selection of its hidden
layer size. An analysis of the misclassified samples shows an interesting error pattern and this has been
used for further improvement in the recognition results. Final recognition accuracies on the training
and the test sets are respectively 94.65% and 92.14%.
An Artificial Neural Network (ANN) is an information-processing paradigm that is inspired by the
way biological nervous systems[39], such as the brain, process information. The key element of this
paradigm is the novel structure of the information processing system. It is composed of a large number
of highly interconnected processing elements (neurons) working in unison to solve specific problems.
ANNs, like people, learn by example.
An ANN is configured for a specific application, such as pattern recognition or data classification
through a learning process. Learning in biological systems involves adjustments to the synaptic
connections that exist between the neurons. This is true of ANNs as well. An Artificial Neural
Network is a network of many very simple processors units, each possibly having a small amount of
local memory. The units are connected by unidirectional communication channels connections,

School Of Education Technology, Jadavpur University

15

which carry numeric as opposed to symbolic data. The units operate only on their local data and on the
inputs they receive via the connections.
The work presented by Alessandro L. Koerich [20] tackles the problem of unconstrained handwritten
character recognition using different classification strategies. For such an aim, He built four multilayer
perceptron classifiers (MLP) and used into three different classification strategies: combination of two
26class classifiers; a 26metaclass classifier and a 52class classifier. The Experimental results
showed that better recognition performance is achieved by the metaclass classifier in which the
uppercase and the lowercase representations of the characters are merged into single classes. The
recognition rate for 52-class classifier ranges in between 62.98% and 96.66% where as for the
metaclass classifier ranges in between 84.97 %and 98.96%.
The work presented by Mirosaw Kordos et al. [21] describes a new algorithm named as variable step
search algorithm which is based on a simple search procedure that changes one network parameter at a
time. Visualization of learning trajectories and MLP error surfaces is used for the algorithm design and
optimization. The algorithm is compared to three other MLP training algorithms: LevenbergMarquardt (LM), scaled conjugate gradient (SCG), and training based on numerical gradient. It has
been shown that the proposed variable step search algorithm is fast, can find very good solutions, does
not require multistart and has low memory requirements. It is also very simple to program since it does
not require calculation of derivatives and matrices, therefore it is quite surprising that in empirical tests
it usually outperforms both LM and SCG.

School Of Education Technology, Jadavpur University

16

CHAPTER 3

CONCEPTS AND PROBLEM ANALYSIS

3.1Digital Image Processing


Images are the most common and convenient means of conveying or transmitting information. An
Image is worth a thousand words it concisely conveys information about positions, sizes and interrelationships between objects. They portray spatial information that we can recognize as objects.
Human beings are good at deriving information from such images, because of our innate visual and
mental abilities. About 75% of the information received by human is in pictorial form. Digital Image
Processing encompasses processes whose inputs and outputs are images, and in addition, encompasses
processes that extract attributes from images, up to and including the recognition of individual images.
A simple illustration is the automated analysis of text. The processes of acquiring an image of the area
containing the text, preprocessing the text, extracting (segmenting) the individual characters,
describing the characters in a form suitable for computer processing, and recognizing the individual
characters are in the scope of Digital Image Processing.
Pattern Recognition in image processing encompasses several areas of research, viz., face recognition,
signature recognition, text recognition, and fingerprint recognition. High accuracy text recognition or
optical character recognition (OCR) is a challenging task for scripts of languages.

3.2 Bengali Script Overview


India is a multi-lingual and multi-script country comprising of eighteen official languages, namely
Assamese, Bangla, English, Gujarati, Hindi,Kankanai, Kannada, Kashmiri, Malayalam,Marathi,
Nepali, Oriya, Punjabi, Rajasthani,Sanskrit, Tamil, Telugu and Urdu are accepted and have over
hundred regional languages.
Bengali, the second most popular language in India and the fifth most popular language in the world,
is an ancient Indo-Aryans language. Bengali is one of the most widely spoken languages in the world.
More than 200 million people in the eastern part of Indian subcontinent speak in this language.
Bengali script alphabet is used in texts of Bengali, Assamese and Manipuri languages. The Bengali is
derived from the ancient Brahmi script through various transformations. Other Indian scripts also have
the same origin, making many of them similar in shape.

School Of Education Technology, Jadavpur University

17

The primary alphabet of Bengali script is quite large compared to the alphabet sets of English and
other western languages. The alphabet of the modern Bengali script consists of 11 vowels and 39
consonants. These characters are called basic characters. The basic characters of Bengali script are
shown in Fig.3.1. There are 10 numerals in Bengali script. These are shown in Fig.3.2.

Fig. 3.1 Basic character in Bangla script. (The first 11 characters are vowels while
Others are consonants.)

Fig.3.2 Numerals in Bengali script.

School Of Education Technology, Jadavpur University

18

3.2.1 Properties of Bengali Script

Writing style of Bengali is from left to right.

The concept of upper and lower case (as in English) is absent here.
each word in Bangali scripts is composed of several characters joined by a horizontal line
(called Maatra or head-line) at the top.

Except very few characters and symbols (e.g. Ae, Oy, O, Ow, Kha, Ga, Ungo, Nio etc), almost
all Bengali alphabets and symbols have a horizontal line at the upper part called maatra Some
are shown in Fig.3.3.The characters with maatra remain connected together through their
maatra and other characters and symbols (e.g. Khondota, Bishorgo, Ungo, Ae, Oy etc) remain
isolated in the word Some are shown in Fig.3.4.

Figure3.3.Some alphabets with maatra

The vowel A (
A(

Figure3.4: Some alphabets without maatra

) following a consonant character is never printed in a word. Thus,

) can occur only at the beginning of the word.

School Of Education Technology, Jadavpur University

19

Fig 3.5(a)Modified vowel.Fig 3.5(b) vowels may take different modified shapes
Fig. 3.5(c)consonant modifier
In Fig. 3.5(a) modified vowel shapes and their attachment with a consonant character is shown. If the
first character of the word is a vowel then it retains its basic shape. For two consecutive vowels in a
word, the second one also retains its basic shape. Some vowels may take different modified shapes
when attached to some consonant characters. They also change the shape of some consonant
characters to which they are attached (see Fig. 3.5(b)).

School Of Education Technology, Jadavpur University

20

In some cases a consonant following (proceeding) a consonant is represented by a modifier called


consonant modifier (eg-raphala, japhala). It is shown in Fig. 3.5(c)

Fig. 3.6. A set of 90 compound characters


Sometimes a consonant or vowel following a consonant forms a different shape character. This
character is called compound character. Compound characters can be combinations of two consonants
as well as a consonant and a vowel. Combination of three or four characters also exists in the Bengali
script. To get an idea about Bengali compound characters some examples of compound characters
formed by two and three characters are shown in Fig-3.6. Because of modified and compound
characters in total there are about 300 characters in Bengali.
As compared to Roman, the font and style variations in Bengali script are few. Popular font for mass
printing media is inotype. Recently, some fonts are proposed for desk top publication (DTP) using PC,
but none of them popular. The size of characters in most Bengali documents ranges between 8 and 16
points of which 12 point is most popular. Among style variations, occasionally bold, expanded and
rarely italicized style are used.

School Of Education Technology, Jadavpur University

21

3.3 Character Recognition


Character recognition is a process, which associates a symbolic meaning with object (letters, symbols
and numbers) drawn on an image, i.e., character recognition techniques associate a symbolic identity
with the image of a character. Mainly, character recognition machine takes the raw data that further
implements the process of preprocessing of any recognition system. On the basis of that data
acquisition process, character recognition system can be classified into following categories shown in
Fig3.7.
Character
Recognition

Online Character
Recognition

Offline Character
Recognition

Optical Character
Recognition

Handwritten
Character
Recognition

Printed
Character
Recognition

Optical Character
Recognition

Magnetic Character
Recognition

Handwritten
Character
Recognition

Printed
Character
Recognition

Fig3.7. Classification of Character Recognition


3.3.1 Online Character Recognition
In case of online character recognition, there is real time recognition of characters. Online systems
obtain the position of the pen as a function of time directly from the interface. Online handwritten
character recognition, the handwriting is captured and stored in digital form via different means.
Usually, a special pen is used in conjunction with an electronic surface. As the pen moves across the
surface, the two- dimensional coordinates of successive points are represented as a function of time

School Of Education Technology, Jadavpur University

22

and are stored in order [24]. It is generally accepted that the on-line method of recognizing
handwritten text has achieved better results than its off-line counterpart.
3.3.2 Offline Character Recognition
In case of Offline character recognition, the typewritten/handwritten character is typically scanned in
form of a paper document and made available in the form of a binary or gray scale image to the
recognition algorithm. Offline character recognition is a more challenging and difficult task as there is
no control over the medium and instrument used. The artifacts of the complex interaction between the
instrument medium and subsequent operations such as scanning and binarization present additional
challenges to the algorithm for the offline character recognition.

3.4 Optical Character Recognition (OCR)


The Optical Character Recognition is a process of automatic recognition of different characters from a
document image and also provides a full alphanumeric recognition of printed or handwritten
characters, text, numerals, letters and symbols into a computer process able format such as ASCII. At
electronic speed by simply scanning the form. The process involves clear and unambiguous
recognition, analysis and understanding of the document content.OCR is an area of pattern recognition
and processing of handwritten character is motivated largely by desire to improve man and machine
communication.OCR of Indian scripts is in preliminary stage. Much of the research work has been
done for developing OCR systems in Roman scripts. Compared to this; extensive research and
development activities are required for developing OCR systems for Indian scripts. OCR involves
photo scanning of the text, which converts the paper document into an image, and then translation of
the text image into character codes such as ASCII.Cheque reading, postcode recognition, form
processing, signature verification are the application of OCR.
3.4.1 Data Acquisition
The input images are acquired from documents containing Bengali text by using scanner as an input
device. Scanned images are then stored in some picture file such as BMP, JPG etc.
After data acquisition, the major steps involved in OCR are Preprocessing Segmentation and
Recognition. The block diagram of OCR system is shown in Fig.3.8.

School Of Education Technology, Jadavpur University

23

Scanned Document

Data Acquisition

Binarization
Noise Removal

Pre-Processing

Skeletonization
Skew Detection & Correction

Line Segmentation
Word Segmentation

Segmentation

Character Segmentation

Feature Extraction
Classification

Recognition

Fig.3.8.The block diagram of OCR system

School Of Education Technology, Jadavpur University

24

Preprocessing involves the following stages:


Binarization,
Noise removing,
Skeletonization
Skew detection and correction.
Segmentation involves the following stages:
Line Segmentation,
Word Segmentation,
Character Segmentation
Recognition involves the following stages:
Feature extraction,
Classification.
3.4.2 Binarization
In the pre-processing 1st stage is to convert the input RGB image into gray scale image. Binarization
is the process of converting a gray scale image (0 to 255 pixel values) into binary image (0 and 1 pixel
values) by selecting a global threshold that separates the foreground from background. Each pixel is
compared with the threshold and if it is greater than the threshold it is made 1 or else 0.Binarization is
usually reported to be performed either globally or locally. Global methods apply one intensity value
to the entire image The histogram of gray scale values of a document image typically consists of two
peaks: a high peak corresponding to the white background and a smaller peak corresponding to the
foreground. So the task of determining the threshold gray-scale value is one of determining as optimal
value in the valley between the two peaks. Local or adaptive thresholding methods apply different
intensity values to different regions of the image. These threshold values are determined by the
neighborhood of the pixel to which the thresholding is being applied. There are several binarization
techniques exist [42]. Among them Otsu, Savala are popularly used.

School Of Education Technology, Jadavpur University

25

3.4.3 Noise removal:


The noise introduced during scanning or due to page quality has to be cleared before further
processing. It is necessary to filter this noise before process the image. The commonly used approach
is to low-pass filter the image and to use it for later processing. The objective in the design of a filter
to reduce noise is that it should remove as much of the noise as possible while retaining the entire
signal.

3.4.4 Skeletonization
Skeletonization is also called thinning. Skeletonization refers to the process of reducing the width of a
line like object from many pixels wide to just single pixel. This process can remove irregularities in
letters and in turn, makes the recognition algorithm simpler because they only have to operate on a
character stroke, which is only one pixel wide. It also reduces the memory space required for storing
the information about the input characters and no doubt, this process reduces the processing time too.

3.4.5 Skew Detection & Correction


Skew Detection refers to the tilt in the bitmapped image of the scanned paper for OCR. It is usually
caused if the paper is not fed straight into the scanner. A few degrees of skew (tilt) unavoidable. Skew
angle is the angle that the lines of the text in the digital image make with the horizontal direction.
There exist many techniques for skew estimation. One skew estimation technique is based on the
projection profile of the document; another class of approach is based on nearest neighbour clustering
of connected components [44][45]. Techniques based on the Hough transform and Fourier transform
are also employed for skew estimation. The image before skew correction is shown in Fig. 3.8.and
image after skew correction is shown in Fig. 3.9.

School Of Education Technology, Jadavpur University

26

The image before skew correction is shown in Fig. 3.8.The image after skew correction is
shown in Fig. 3.9.
3.4.6 Segmentation
It is an operation that seeks to decompose an image of sequence of characters into sub images of
individual symbols. Character segmentation is a key requirement that determines the utility of
conventional Character Recognition systems. It includes line, word and character segmentation.
Different methods used can be classified based on the type of text and strategy being followed
like recognition-based segmentation and cut classification method[41].
Line segmentation
In a Bangla printed script, the text lines are almost of same height, provided that the script is
written in a specific font size. If the script is composed by a type-machine, surely the font size
will be uniform everywhere. Between two text lines, there is a narrow horizontal band with
either no pixel or very few pixels. Hence, applying horizontal projection profile (HPP) and
detecting the valleys in it, text line bands can be retrieved [34-37].

School Of Education Technology, Jadavpur University

27

Word segmentation
From the extracted text lines, words get separated. Usually, applying vertical projection profile
(VPP) and detecting some specific threshold exceeding horizontal gaps, words are separated
from a text line [34-36]. Computer composed scripts may contain different font sizes and
different styles (i.e. bold, italic etc) and adversely affect the threshold value for identifying
isolated words. Hence, identifying an effective threshold value is very difficult. It may change
twice or more even a single text line. On the other hard, since the style of type-machine
composed scripts is very specific, it is much easier to calculate the threshold value of the gap
between two consecutive words in a line.
Character segmentation
Segmentation of characters from the isolated words is the most challenging part of the script
segmentation phase [34-36]. Since, in computer composed scripts some characters in a container
word may partially overlap with one another, it becomes very difficult to isolate those characters
properly. Especially the modifiers (both vowels and consonants) most of the time coincide with
the modifying characters. These kinds of non-trivial combinations of characters make the whole
process of character segmentation extremely challenging. Besides, some symbols, like ChandraBindu, often come between two consecutive characters in a word; then isolating those becomes a
tough job. This problem can be overcome by applying contour tracing mechanism [38] or by
implementing greedy search technique [34] for letter segmentation.
3.4.6 Feature Extraction
The segmented Bangla characters are converted into a real valued vector called feature form of
0s and 1s that characterizes the essential information content of the pattern. Each character has
some features, which play an important role in pattern recognition. Handwritten Bengali
characters have many particular features. Feature extraction describes the relevant shape
information contained in a pattern so that the task of classifying the pattern is made easy by a
formal procedure. Feature extraction stage in OCR system analyses these character segment and
selects a set of features that can be used to uniquely identify that character segment. Mainly, this
stage is heart of OCR system because output depends on these features. Feature extraction is the
name given to a family of procedures for measuring the relevant shape information contained in

School Of Education Technology, Jadavpur University

28

a pattern so that the task of classifying the pattern is made easy by a formal procedure. Among
the different design issues involved in building a recognizing system, perhaps the most
significant one is the selection of set of features.

3.4.8 Classification
Classification stage is the main decision making stage of the system and uses the features
extracted in the previous stage to identify the text segment according to preset rules.
Classification is concerned with making decisions concerning the class membership of a pattern
in question. The task in any given situation is to design a decision rule that is easy to compute
and will minimize the probability of misclassification relative to the power of feature extraction
scheme employed. Patterns are thus transformed by feature extraction process into points in d
dimensional feature space. A pattern class can then be represented by a region or sub-space of
the feature space. Classification then becomes a problem of determining the region of feature
space in which an unknown pattern falls.

3.5 Problem Analysis


This thesis deals with recognition of handwritten Bengali character based on character features.
That means recognition of a given input character has been done by extracting some different
features from that input character. To recognize handwritten Bengali character, the input images
are acquired from documents containing Bengali text by using scanner as an input device.
Scanned images are then stored in some picture file such as BMP, JPG etc.This image
subsequently passes through preprocessing, segmentation, feature extraction and classification
steps.
This thesis proposes two new approaches for extracting features in context of Handwritten
Bengali character recognition. First approach is to compute shadow based feature extraction
algorithm where each character image is enclosed within a minimal square, divided into four
quadrants. Each quadrant is further divided into eight octants. Then lengths of projections of
character images on three sides of each octant are then computed. Lengths of all such projections
on each of the 3x8=24x4 sides of all octants are summed up to produce 24x4=96 shadow based
School Of Education Technology, Jadavpur University

29

features of the character image are obtained. The second approach is to compute the Diagonal
Distance features from four corners of the minimal square containing the character image. Here a
set of 4 features of each character image are obtained. The features are computed from 64x64
pixel size binary images of alphabetic characters. This feature set is the input of MLP based
classifier to classify the given input character.
Classification consists of two phases training phase and testing phase. Here MLP based
classifier is used to recognize handwritten Bengali character. An MLP consists of one input
layer, one output layer and a number of hidden or intermediate layers. Here 35 different training
sets, each of which consists of 15 alphabetic character samples are used for training and other 5
different alphabetic character samples of each character are used for testing phase.

School Of Education Technology, Jadavpur University

30

CHAPTER 4

DESIGN & IMPLEMENTATION

Handwritten Bengali Character recognition is a system which loads a handwritten Bengali


character image, preprocesses the image, extracts proper image features, classify the characters
based on the extracted image features and the known features are stored in the image model
library, and recognizes the image according to the degree of similarity between the loaded image
and the image models. To recognize handwritten Bengali character firstly, the input images are
acquired from documents containing Bengali text by using scanner as an input device. Scanned
images are then stored in some picture file such as BMP, JPG etc. This image subsequently
passes through preprocessing, segmentation, feature extraction and classification steps.
Preprocessing operations include image processing, binarization, contour smoothing, noise
reduction, skew detection & correction, and skeletonization of a digital image so that subsequent
algorithms along the road to final classification can be made simple and more accurate.
Segmentation includes line segmentation-extract lines from a paragraph, word segmentationextract word from a line, and character segmentation-extract character from a word. After
completing preprocessing and segmentation some features are extracted from the character
image. Various feature extraction algorithms are there according to the behavior of the character.
This thesis proposes two new approaches for extracting features in context of Handwritten
Bengali character recognition. First new approach is to compute features, namely Shadow based
features, each character image is enclosed within a minimal square, divided into four quadrants.
Each quadrant is further divided into eight octants. Then lengths of projections of character
images on three sides of each octant are then computed. Lengths of all such projections on each
of the 3x8=24x4 sides of all octants are summed up to produce 24x4=96 shadow based features
of the character image are obtained. The second new approach is to compute the Diagonal
Distance features from four corners of the minimal square containing the character image. Here a
set of 4 features of each character image are obtained. The feature set selected for the present
work consists of 100 features, which include 96 shadow based features, and 4 diagonal distance
features. The features are computed from 64x64 pixel size binary images of alphabetic
characters. This feature set is the input of MLP based classifier.
The Shadow feature extraction algorithm S. Basu et.al is implemented here on each character
image to obtained 24 shadow feature set. Then compare the results of existing Shadow feature

School Of Education Technology, Jadavpur University

31

extractionn algorithm
m and proposed Shadow
w based featture extractiion algorithhm and Diaggonal
distance feature extraaction algoriithm.

Pre-proocessing

Feature Extraction
E

Classificaation using
MLP
M Based Classifieer

Original
character
existing inn the
Library

F 4.1.1. Bllock diagram


Fig
m of Handw
written Benggali charactter recognition system
Classification consissts of two phases- trainiing phase annd testing phase.
p
Training is perfoormed
with labeeled data off known inpuut-output ressponses. Tessting is perfformed by giiving some input
characterr image to th
he classifierr and then with
w the helpp of training data the claassifier is abble to
recognizee that inputt character. Fig4.1.1.shoown is the block diagrram of handdwritten Beengali
characterr recognition
n system.

Scchool Of Ed
ducation Techhnology, Jaddavpur Univversity

3
32

Scanned Image

Convert to Gray Scale


Binarization

Feature Extraction
Shadow based Feature (96)
(Proposed)

Diagonal Distance (4)


(Proposed)

Classification
Training Class
Testing

Recognition of Input Character


Fig 4.1.2 Block diagram of proposed handwritten Bengali character recognition system

School Of Education Technology, Jadavpur University

33

Data Acquisition
The input images are acquired from documents containing Bengali text by using scanner as an
input device. Scanned images are then stored in some picture file such as BMP, JPG etc.
RGB to gray conversion
In the pre-processing 1st stage is to convert the input RGB image into gray scale image.
Binarization
Binarization is the process of converting a gray scale image (0 to 255 pixel values) into binary
image (0 and 1 pixel values) by selecting a threshold value in between 0 to 255(here threshold
value is 128).

Feature extraction
Each character has some features, which play an important role in pattern recognition. Each
character have many particular features. Feature extraction describes the relevant shape
information contained in a pattern so that the task of classifying the pattern is made easy by a
formal procedure. Feature extraction stage in HBCR system analyses these Bengali character
segment and selects a set of features that can be used to uniquely identify that character segment.
Mainly, this stage is heart of HBCR system because output depends on these features. Feature
extraction is the name given to a family of procedures for measuring the relevant shape
information contained in a pattern so that the task of classifying the pattern is made easy by a
formal procedure.
Here some feature extractions techniques are implemented along with two new feature extraction
approaches are also implemented. All theses implemented feature extraction techniques are
discussed below with diagram.

School Of Education Technology, Jadavpur University

34

Firstly we have to know how to calculate length of projection of each octant of the character
image-

Fig4.3(a)
Fig4.3(b)
Fig4.3(c)
1. The projection length of the hypotenuse is calculated by combining the light projection from
two directions -i.e. base and perpendicular shown in the fig4.3 (a).
2. The projection length of the base is calculated by the light projection from hypotenuse is
shown in the fig4.3 (b).
3. The projection length of the perpendicular is calculated by the light projection from
hypotenuse is shown in the fig4.3 (c).

The proposed feature extraction algorithm


4.2.1Algorithm1. Shadow based feature extraction technique:-

Fig 4.3. An illustration for shadow based features. Each character image is enclosed within
a minimal square & divided into 4 quadrants. Each quadrant is further divided into eight
octants.

School Of Education Technology, Jadavpur University

35

Step1. The handwritten data is converted into digital form by scanning.


Step2. The image of that data is fed to the pre-processing phase.
Step3. The digital image converted into the gray scale image. Each character image is enclosed
within a minimal square.
Step4. Convert a gray scale image (0 to 255 pixel values) into binary image (0 and 1 pixel
values) by selecting a threshold value in between 0 to 255(here threshold value is 128).
Step5. Each binary character image is now divided into 4 quadrants. Each quadrant is further
divided into eight octants is shown in the fig4.3.
Step6. Then lengths of projections of character images on three sides of each octant are then
computed.
Step7. Lengths of all such projections on each of the 3x8=24x4 sides of all octants are obtained.
Step8. Summed up all features, 96 features are obtained to feed into the MLP based classifier as
input to classify properly.
4.2.2.Algorithm2.Diagonal-distance feature extraction technique:-

Fig 4.4. An illustration for diagonal distance features.

School Of Education Technology, Jadavpur University

36

Step1. The handwritten data is converted into digital form by scanning.


Step2. The image of that data is fed to the pre-processing phase.
Step3. The digital image converted into the gray scale image. Each character image is enclosed
within a minimal square.
Step4. Convert a gray scale image (0 to 255 pixel values) into binary image (0 and 1 pixel
values) by selecting a threshold value in between 0 to 255(here threshold value is 128).
Step5.Measure the distance diagonally from each character image is enclosed within a minimal
square by calculating the no. of black pixel found is shown in fig4.4.
Step6.4 diagonal distance features are obtained from each character image is enclosed within a
minimal square
Step7.Diagonal distance features are obtained to feed into the MLP based classifier as input to
classify properly.
Now total 96+4=100 features are obtained from each Bengali handwritten character image.
This proposed algorithm is inspired the work of S.Basu et.al [13].The concept of the algorithm
(shadow,centroid,longest-run) of feature extraction are implemented and compare the %of
recognition accuracy with the proposed algorithm.
4.2.3Algorithm3. Shadow feature extraction technique:-

Fig 4.5. An illustration for shadow features.

School Of Education Technology, Jadavpur University

37

Step1. The handwritten data is converted into digital form by scanning.


Step2. The image of that data is fed to the pre-processing phase.
Step3. The digital image converted into the gray scale image. Each character image is enclosed
within a minimal square.
Step4. Convert a gray scale image (0 to 255 pixel values) into binary image (0 and 1 pixel
values) by selecting a threshold value in between 0 to 255(here threshold value is 128).
Step5. Each binary character image is now divided into eight octants is shown in the fig 4.5.
Step6. Then lengths of projections of character images on three sides of each octant are then
computed.
Step7. Lengths of all such projections on each of the 3x8=24 sides of all octants are obtained.
Step8.24 features are obtained to feed into the MLP based classifier as input to classify properly.

4.2.4Algorithm4. Centroid feature extraction technique:-

Centroid of the
pixels containing

Fig 4.6 (a). An illustration for centroid features.

Fig 4.6 (b). An illustration for centroid features.

School Of Education Technology, Jadavpur University

38

Step1. The handwritten data is converted into digital form by scanning.


Step2. The image of that data is fed to the pre-processing phase.
Step3. The digital image converted into the gray scale image. Each character image is enclosed
within a minimal square.
Step4. Convert a gray scale image (0 to 255 pixel values) into binary image (0 and 1 pixel
values) by selecting a threshold value in between 0 to 255(here threshold value is 128).
Step5. Each binary character image is now divided into eight octants is shown in the fig 4.6(b).
Step6.For each octant locate the coordinates of black pixels
Step7.Then coordinates of centroids of black pixels in all the 8 octants of a character image are
obtained is shown in the fig 4.6(a).
Step8.Now 8x2(each centroid consists of 2 values of coordinate, (x, y)) =16 features are
obtained.
Step9.16 features are obtained to feed into the MLP based classifier as input to classify properly.
4.2.5.Algorithm5. Longest-run feature extraction technique:-

Fig 4.7(a) character image enclosed within a minimal square is now divided into nine
overlapping square regions.

School Of Education Technology, Jadavpur University

39

1
1
1
1
0
0

0
0
0
0
1
0

4
0
0
0
0
2

4
2
2
0
0
2

4 4
2 0
2 0
1 0
1 0
0 0
Sum =

Length of the
Longest Bar
4
2
2
1
1
2
12

Fig4.7(b) An illustration for computation of the row wise longestrun feature.(Every pixel
position in each row of the image is marked with the length of the longest bar that fits
consecutive black pixels along the same row)
Step1. The handwritten data is converted into digital form by scanning.
Step2. The image of that data is fed to the pre-processing phase.
Step3. The digital image converted into the gray scale image. Each character image is enclosed
within a minimal square.
Step4. Convert a gray scale image (0 to 255 pixel values) into binary image (0 and 1 pixel
values) by selecting a threshold value in between 0 to 255(here threshold value is 128).
Step5. Each binary character image enclosed within a minimal square is now divided into nine
overlapping square regions is shown in the fig 4.7(a)..
Step6. Coordinates(x,y) of top left corners of all nine overlapping square regions are {(x,y) | x=0,
h/4, 2h/4 and y=0, w/4, 2w/4}, where h and w denote the height and the width of the minimal
square.
Step7. Row-wise longest-run feature is computed by considering the sum of the lengths of the
longest bars that fit consecutive black pixels along each of all the rows of a square region is
illustrated in fig4.7(b).

School Of Education Technology, Jadavpur University

40

Step8.The three other longest-run features are computed in the same way but along the column
wise and two major diagonal wise directions within the rectangle separately.
Step9.Each square region, 4 longest-run features are computed row wise, column wise and along
two of its major diagonals.
Step10. 9x4=36 longest-run features are computed from each character image.
Step11.36 features are obtained to feed into the MLP based classifier as input to classify
properly.
Classification
Classification consists of two phases training phase and testing phase. Here MLP based
classifier is used to recognize handwritten Bengali character. An MLP consists of one input
layer, one output layer and a number of hidden or intermediate layers. The output from every
neuron in a layer of the MLP is connected to all inputs of each neuron in the immediate next
layer of the same. Neurons in the input layer of the MLP are all basically dummy neurons as they
are used simply to pass on the input to the next layer just by computing an identity function each.
The numbers of neurons in the input and the output layers of an MLP are chosen depending on
the problem to be solved. The number of neurons in other layers and the number of layers in the
MLP are all determined by a trial and error method at the time of its training. An ANN requires
training to learn an unknown input-output relationship to solve a problem. A single layer MLP,
i.e., an MLP with one hidden layer is chosen here. This is mainly to keep the computational
requirement of the same low without affecting its function approximation capability. According
to Universal Approximation theorem [43], a single hidden layer is sufficient to compute a
uniform approximation to a given training set.

School Of Education Technology, Jadavpur University

41

Training phase
The program trains the network to recognize the characters. This network takes input-output
vector pairs during training. The network trains its weight array to minimize the selected
performance measure, i.e., error using back propagation algorithm. Here a database consists of
35 different training sets, each of which has 15 alphabetic character samples and is formed by
collecting optically scanned handwritten Bengali characters.
The following are taken as inputs from the user:
a) The input pattern file
b) No. of neurons in each hidden layer
c) Error value for convergence
The output of training program is a file which contains modified weights of different connection
of the network. This file is used as the input to testing program. This file also contains the values
of numbers of neurons in input layer, Hidden layers, output layer, value of learning rate and
momentum factor so that used is no require to enter the values during testing.
Following parameters are used for training of Neural Networks:
No. of neurons in input Layer: 100
No of neurons in Hidden Layer: 50
No of epochs: 5000
No. of neurons in output Layer: 35
Transfer Function Used for Layer 1: Logsig
Transfer Function Used for Layer 2: Logsig
Adaption Learning Function: Traingdx
Performance Function: MSE
Network Type = Feedforword Back propagation
Goal=0.001

Testing phase
Each set of character images contain 5 characters for testing purpose. Beside these character
images, other character images can be used for testing.
School Of Education Technology, Jadavpur University

42

After training is complete, a test pattern is given to the neural network and the results are
compared with the desired result. Difference between the two values gives the error. Percentage
accuracy is found as follows:
% Accuracy = No of characters found correctly *100
Total no of patterns

School Of Education Technology, Jadavpur University

43

CHAPTER 5

RESULTS & INTERPETATION

Handwritten Bengali Character sets are taken. These steps are followed to obtain best accuracy
of input handwritten Bengali character image. First of all, training of system is done by using
different data set or sample. And then system is tested for few of the given sample, and accuracy
is measured. The data set was partitioned into two parts. The first part is used for training the
system and the second was for testing purpose. For each character, the proposed feature were
computed and stored for training the network to classify. The results obtained from the proposed
algorithms are displayed in the table.5.1.and table 5.2 contains the comparision of the
recognition accuracy of proposed algorithm with the algorithm of S.Basu et.al[13]. In fig 5.is
showing the Curves variation of the Recognition performance of the proposed algorithm with the
algorithm of S. Basu et.al[13]. This variance is very small but it is there.
MLP based classifier consists of three network layer one input layer, one hidden layer and one output
layer are taken. If number of neurons in the hidden layer is increased, then a problem of allocation of
required memory is occurred. Also, if the value of error tolerance is high, desired results are not
obtained, so changing the value of error tolerance i.e. say, high accuracy rate is obtained. Also the
network takes more number of cycles to learn when the error tolerance value is less rather than in the
case of high value of error tolerance in which network learns in less number of cycles and so the
learning is not very fine.

School Of Education Technology, Jadavpur University

44

Table 5.1: Recognition Accuracy of Handwritten Bengali Characters using proposed


shadow based feature set
Training
Testing
Correctly
% of Recognition
Letters
Samples
Samples
Recognized
Accuracy
15
4
3
75
A (A)
15
5
4
80
B (AA)
15
5
5
100
I (AI)
15
5
5
100
K (AU)
15
3
3
100
h (BA)
15
5
3
60
I (BHA)
15
4
3
75
Q (CA)
15
4
4
100
R (CHA)
15
5
4
80
c (DA)
15
3
3
100
X (DDA)
15
4
4
100
Y (DDHA)
15
5
5
100
d (DHA)
15
4
3
75
t (DRHA)
15
4
3
75
H (E)
15
4
3
75
N (GA)
15
5
4
80
O (GHA)
15
5
4
80
L (KA)
15
5
4
80
M (KHA)
15
5
4
80
m (LA)
15
5
4
80
j (MA)
15
5
4
80
f (PA)
15
5
4
80
g (PHA)
15
4
4
100
l (RA)
15
5
4
80
p (SA)
15
4
2
50
n (SHA)
15
5
4
80
a (TA)
15
5
4
80
b (THA)
15
5
4
80
V (TTA)
15
5
5
100
W (TTHA)
15
5
4
80
E (U)
15
5
3
60
F (UU)
15
5
4
80
q (HA)
15
5
4
80
C (I)
15
5
4
80
D (II)

S (JA)

15

School Of Education Technology, Jadavpur University

80

45

Table 5.2: Comparison of Recognition Accuracies of shadow feature of S.Basu et.al[13] &
proposed algorithms
% of Recognition Accuracy of
% of Recognition Accuracy in
Letters
shadow feature of S.Basu
Proposed Algorithm
et.al[13]
A (A)
75
75
B (AA)
80
80
I (AI)
40
100
K (AU)
60
100
h (BA)
66
100
I (BHA)
60
60
Q (CA)
75
75
R (CHA)
75
100
c (DA)
60
80
X (DDA)
66
100
Y (DDHA)
75
100
d (DHA)
80
100
t (DRHA)
75
75
H (E)
75
75
N (GA)
75
75
O (GHA)
60
80
L (KA)
60
80
M (KHA)
60
80
m (LA)
60
80
j (MA)
60
80
f (PA)
60
80
g (PHA)
60
80
l (RA)
50
100
p (SA)
60
80
n (SHA)
50
50
a (TA)
60
80
b (THA)
60
80
V (TTA)
60
80
W (TTHA)
60
100
E (U)
80
80
F (UU)
60
60
q (HA)
60
80
C (I)
60
80
D (II)
60
80
S (JA)
75
80

School Of Education Technology, Jadavpur University

46

Comparison Graph of the Proposed Algorithm


& the Algorithm of S.Basu et.al[13]
120
100
80
60
40
20
0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
% of Recognition Accuracy in Existing Algorithm
% of Recognition Accuracy in Proposed Algorithm

fig5. Showing the Curves variation of the Recognition performance of the proposed
algorithm with the algorithm of S. Basu et.al[13]

CHAPTER 6

CONCLUSION & FUTURE SCOPE

School Of Education Technology, Jadavpur University

47

Conclusion
Handwritten Bengali character recognition based on character feature is discussed here. Shadow
based feature algorithm and diagonal distance feature algorithm are implemented and the
recognition accuracy compared with the state-of-the-art. An MLP based classifier is used. There are

lots of ways to implement this project but recognition is done based on character feature.
Recognition approaches heavily depend on the nature of the data to be recognized. Since handwritten
Bengali characters could be of various shapes and size, the recognition process needs to be much
efficient and accurate to recognize the characters written by different users.

Future Scope
Recognition accuracy can be increased by taking more training character sets. This recognition
system can be extended for the recognition of Bengali compound characters, words, sentence and
documents, neumerals and other multingual script.

CHAPTER 7
School Of Education Technology, Jadavpur University

REFERENCES
48

[1] H. Bunke and P. S. P. Wang, Handbook of Character Recognition and Document Image
Analysis,
World Scientific Publishing Company, 1997.
[2]Stephen V. Rice, George Nagy and Thomas A. Nartker, Optical Character Recognition: An
Illustrated Guide to the Frontier, Kluwer Academic Publications, 1999.
[3]S. Mori, H. Nishida and H. Yamada, Optical Character Recognition, John Wiley & Sons,
1999.
[4]S. Mori, C. Y. Suen and K. Yamamoto, Historical review of OCR research and
development. Proceedings of the IEEE, Vol. 80(7), pp. 1029-1058, 1992.
[5]U. Pal and B. B. Chaudhuri, Indian script character recognition, Pattern Recognition, Vol.
37(9), pp. 1887-1899, 2004.
[6] K.H.Aparna and V.S. Chavravarthy,A complete OCR system development of Tamil
Magazin documents Tamil Internet 2003, Chennai, August, 22-24, 2003.
[7]Adnan Md. Shoeb Shatil , Research Report on Bangla Optical Character Recognition Using
Kohonen network Center for Research on Bangla, 29 Jul 2009
[8]J.U. Mahmud, Md. F. Raihan and C. M Rahman, A Complete OCR System for Continuous
Bengali Characters Proc. of the Conf. on. Convergent Technologies,2003.
[9]Dipankar Das and Rubaiyat yashmin, Segmentation and Recongnition of Unconstrained
Bengla Handwritten Numeral, Asian journal of Information Technology 5(2)-155-159, 2006
[10]Subhadip Basu , Ram Sarkar , Nibaran Das, Mahantapas Kundu , Mita Nasipuri,Dipak
Kumar Basu , A Fuzzy Technique for Segmentation of Handwritten Bangla Word Images,
Proceedings of the International Conference on Computing: Theory and Applications
(ICCTA'07).
[11]A. Bishnu and B. B. Chaudhuri, Segmentation of Bangla handwritten text into characters by
recursive contour following, Proc. 5th ICDAR, pp.402-405,1999.
[12]Ahmed Shah Mashiyat,Ahmed Shah Mehadi and Kamrul Hasan Talukder,Bangla off-line
Handwritten Character Recognition Using Superimposed
Matrices 7th International
Conference on Computer and Information Technology (ICCIT 2004),26-28 December, 2004

School Of Education Technology, Jadavpur University

49

[13]S.Basu et al. Handwritten BANGLA Alphabet Recognition Using An MLP Based


Classifier, Proc. 2nd NCCPB, Dhaka, February, 2005.
[14]A. Majumdar and B.B. Chaudhuri, A MLP Classifier for Both Printed and Handwritten
Bangla Numeral Recognition, ICVGIP 2006, LNCS 4338, pp. 796 804, 2006.
[15]S.V. Rajashekararadhya, Dr P. Vanaja Ranjan, EFFICIENT ZONE BASED FEATURE
EXTRATION ALGORITHM FOR HANDWRITTEN NUMERAL RECOGNITION OF FOUR
POPULAR SOUTH INDIAN SCRIPTS, Journal of Theoretical and Applied Information
Technology 2005 - 2008 JATIT. All rights reserved.
[16]Gahangir Hissain and Md. Abdus Salam, Bangla Handwriting to Text Conversion, 5th
ICCIT-2002, pp. 207-212.
[17]U. Pal A. Belaid B. B. Chaudhuri, A System for Bangla Handwritten Numeral
Recognition, IETE journal of research. January-February, 2006
[18]Shamik Surul, Recognition of an Indian Script using Multilayer Perceptron and Fuzzy
Features, Proc. of 6th Int. Conf. on Document,2003.
[19]U. Bhattacharya, M. Shridhar, and S.K. Parui, On Recognition of Handwritten Bangla
Characters, P.Kalra and S.Peleg(Eds):ICVGIP 2006,LNCS 4338,pp.817-828 2006 @ SpringerVerlag Berlin Heidelberg 2006.
[20]Alessandro L. Koerich, Unconstrained Handwritten Character Recognition Using Different
Classification Strategies, IAPR-TC3 International Workshop on Artificial Neural Networks in
Pattern Recognition, Florence, Italy, September 12-13, 2003.
[21]Mirosaw Kordos, Wodzisaw Duch, Variable Step Search Algorithm for MLP Training,
Proceeding (451) Artificial Intelligence and Soft Computing 2004.
[22]Ray K, and Chatterjee, Design of a nearest neighbor classifier system for Bengali character
recognition. Journal of Inst. Electronics. Telecom. Eng. 30.pgs226229,1984.
[23]Chaudhuri, B.B. and Pal, U. A complete printed Bangla OCR system. Pattern Recognition,
Vol. 31, 1998, pp 531-549.
[24] R. Plamondom, S. N. Srihari, On-line and Off-line Handwriting Recognition: a
Comprehensive Survey, IEEE Trans. PAMI. Vol. 22, p.p. 63-84, 2000.

School Of Education Technology, Jadavpur University

50

[25] P. K. Wong et al. Off-line Handwritten Chinese Character Recognition as a Compound


Bays Decision Problem, IEEE Trans. PAMI, vol. 20. , p.p. 1016-1023,1998.
[26] P. Doke, R. Gupta and V. Nabar, A Survey of Indian Script OCR System, www.cfar.umd.
edu/~kanungo/workshop/abstracts/nabar.html
[27] A. B. M. Abdullah and A. Rahman, A Different Approach in Spell Checking for South
Asian Languages, Proc. of 2nd ICITA, 2004.
[28] A. B. M. Abdullah and A. Rahman, Spell Checking for Bangla Languages: An
Implementation Perspective, Proc. of 6th ICCIT, 2003, pp. 856-860.
[29] U. Garain and B. B. Chaudhuri, Segmentation of Touching Characters in Printed
Devnagari and Bangla Scripts using Fuzzy Multifactorial Analysis, IEEE Transactions on
Systems, Man and Cybernetics, vol. 32, pp. 449-459, Nov. 2002.
[30] R. Kapoor, D. Bagai and T. S. Kamal,Representation and Extraction of Nodal Features of
DevNagri Letters, Proc. of ICVGIP, 2002.
[31] Plamondon, R. and S. N. Srihari (2000), On-Line and Off- Line Handwriting Recognition:
A Comprensive Survey, IEEE trans. Pattern Analysis and Machine Intelligence, vol. 22 (1), pp.
63-84.
[32] R. Plamondon and S. N. Srihari, On-line and off-line handwritten recognition: a
comprehensive survey, IEEE Transactions on PAMI, Vol. 22(1), pp. 6384, 2000.
[33] Negi, C. Bhagvati and B. Krishna, An OCR system for Telugu, in the Proceedings of the
Sixth International Conference on Document Processing, pp.1110-1114, 2001.
[34] J. U. Mahmud, M. F. Rahman and C. M. Rahman, A Complete OCR System for
Continuous Bengali Characters, Proc. IEEE TE3CO3, 2003, pp. 1372-1376.
[35] U. Pal and B. B. Chaudhuri, OCR in Bangla: an Indo-Bangladeshi Language, Proc. of
ICPR,1994, pp. 269-274.
[36] B. B. Chaudhuri, U. Pal and M. Mitra,Automatic Recognition of Printed Oriya
Script,Proc. of ICDAR, 2001, pp. 795-799.

School Of Education Technology, Jadavpur University

51

[37] U. Pal, S. Sinha and B. B. Chaudhuri, Multi-Script Line Identification from Indian
Documents,Proc. 7th ICDAR, 2003.
[38] A. Bishnu and B. B. Chaudhuri, Segmentation of Bangla Handwritten Text into Characters
by Recursive Contour Following, Proc. of ICDAR,1999, pp. 402-405.
[39] Anil k. Jain, Jianchang Mao, K.M. Mohiuddin, Artificial Neural Network: A Tutorial,
IEEE 0018-9162/96, March 1996.
[40] C. V. Jawahar, A. Balasubramanian, " Synthesis of Online Handwriting in Indian
Languages in Proc.of the Tenth International Workshop on Frontiers in Handwriting
Recognition, 2006.
[41] Arif Billah Al-Mahmud Abdullah and Mumit Khan, A Survey on Script Segmentation for
Bangla OCR
[42]Anuradha B, Koteswarrao B 2006 An efficient Binarization technique for old documents.
Proc. Of International conference on Systemics,Cybernetics, and Inforrmatics(ICSCI2006),
Hyderabad, pp771-775.
[43] N. Das, R. Sarkar, S. Basu, M. Kundu, M. Nasipuri, D.K. Basu, A Soft Computing
Paradigm for Handwritten Digit Recognition with application to Bangla Digits, Proc. of
International Conference on Modelling and Simulation ( MS07 India), vol. 2, pp. 771-774,
Kolkata, Dec. 3-5, 2007.
[44] A. Hushizume et al., A method of detecting the orientation of aligned components, PRL,
4(2): 125-132, 1986
[45] L. OGorman, The document spectrum for page layout analysis, IEEE Trans. on PAMI,
15(11): 11621173, 1993.

APPENDIX I: CODES USED IN THIS PROJECT


1. Code for Image Acquisition

School Of Education Technology, Jadavpur University

52

I=imread('C:\Documents and
Settings\swati_m\Desktop\Mats\Matlab\Final\Classify\SA\310.bmp');

2. Code for Binarization:


function [I]=binarise(I)
%M=imresize(K,[64,64]);
I=rgb2gray(I);
for row=1:64
for col=1:64
if I(row,col)<128
I(row,col)=1;
else
I(row,col)=0;
end;
end
end

3. Code for Cropping Image


function [J1,J2,J3,J4]=crop(I)
J1=imcrop(I,[1 1 31 31]);
J2=imcrop(I,[1 33 31 31]);
J3=imcrop(I,[33 1 31 31]);
J4=imcrop(I,[33 33 31 31]);

4. Code for Feature Extraction (Compact):


[J1,J2,J3,J4]=crop(I);
for i=1:8
L(i)=0;
s(i)=0;
s1(i)=0;
Cx(i)=0;
Cy(i)=0;
end
for i=1:9
r(i)=0;
c(i)=0;
d1(i)=0;
d2(2)=0;
end
for i=1:4
d(i)=0;
end
%Obtaining distance from corners features(4)
[d(1),d(2),d(3),d(4)]=distance_corner(I);

School Of Education Technology, Jadavpur University

53

%Obtaining centroid features(16)


[Cx(1),Cy(1)]=centroid1(I);
[Cx(2),Cy(2)]=centroid2(I);
[Cx(3),Cy(3)]=centroid3(I);
[Cx(4),Cy(4)]=centroid4(I);
[Cx(5),Cy(5)]=centroid5(I);
[Cx(6),Cy(6)]=centroid6(I);
[Cx(7),Cy(7)]=centroid7(I);
[Cx(8),Cy(8)]=centroid8(I);
%Obtaining shadow based features(96)
[a1(1),b1(1),e1(1)]=extended_shadow1(J1);
[a1(2),b1(2),e1(2)]=extended_shadow2(J1);
[a1(3),b1(3),e1(3)]=extended_shadow3(J1);
[a1(4),b1(4),e1(4)]=extended_shadow4(J1);
[a1(5),b1(5),e1(5)]=extended_shadow5(J1);
[a1(6),b1(6),e1(6)]=extended_shadow6(J1);
[a1(7),b1(7),e1(7)]=extended_shadow7(J1);
[a1(8),b1(8),e1(8)]=extended_shadow8(J1);
[a2(1),b2(1),e2(1)]=extended_shadow1(J2);
[a2(2),b2(2),e2(2)]=extended_shadow2(J2);
[a2(3),b2(3),e2(3)]=extended_shadow3(J2);
[a2(4),b2(4),e2(4)]=extended_shadow4(J2);
[a2(5),b2(5),e2(5)]=extended_shadow5(J2);
[a2(6),b2(6),e2(6)]=extended_shadow6(J2);
[a2(7),b2(7),e2(7)]=extended_shadow7(J2);
[a2(8),b2(8),e2(8)]=extended_shadow8(J2);
[a3(1),b3(1),e3(1)]=extended_shadow1(J3);
[a3(2),b3(2),e3(2)]=extended_shadow2(J3);
[a3(3),b3(3),e3(3)]=extended_shadow3(J3);
[a3(4),b3(4),e3(4)]=extended_shadow4(J3);
[a3(5),b3(5),e3(5)]=extended_shadow5(J3);
[a3(6),b3(6),e3(6)]=extended_shadow6(J3);
[a3(7),b3(7),e3(7)]=extended_shadow7(J3);
[a3(8),b3(8),e3(8)]=extended_shadow8(J3);
[a4(1),b4(1),e4(1)]=extended_shadow1(J4);
[a4(2),b4(2),e4(2)]=extended_shadow2(J4);
[a4(3),b4(3),e4(3)]=extended_shadow3(J4);
[a4(4),b4(4),e4(4)]=extended_shadow4(J4);
[a4(5),b4(5),e4(5)]=extended_shadow5(J4);
[a4(6),b4(6),e4(6)]=extended_shadow6(J4);
[a4(7),b4(7),e4(7)]=extended_shadow7(J4);
[a4(8),b4(8),e4(8)]=extended_shadow8(J4);
%fprintf(fid,'Shadow based feature\n')
%displaying Shadow based features
for i=1:8
fprintf(fid,'%f\t',a1(i));
fprintf(fid,'%f\t',b1(i));
fprintf(fid,'%f\t',e1(i));

School Of Education Technology, Jadavpur University

54

fprintf(fid,'%f\t',a2(i));
fprintf(fid,'%f\t',b2(i));
fprintf(fid,'%f\t',e2(i));

fprintf(fid,'%f\t',a3(i));
fprintf(fid,'%f\t',b3(i));
fprintf(fid,'%f\t',e3(i));

fprintf(fid,'%f\t',a4(i));
fprintf(fid,'%f\t',b4(i));
fprintf(fid,'%f\t',e4(i));
end
%fclose(fid);
for i=1:9
fprintf(fid,'%f\t',r(i));
fprintf(fid,'%f\t',c(i));
fprintf(fid,'%f\t',d1(i));
fprintf(fid,'%f\t',d2(i));
end
%fid=fopen('outputs\27_3.txt','w');
for i=1:4
fprintf(fid,'%f\t',d(i));
end
for i=1:8
fprintf(fid,'%f\t',L(i));
fprintf(fid,'%f\t',s(i));
fprintf(fid,'%f\t',s1(i));
end
for i=1:8
fprintf(fid,'%f\t',Cx(i));
fprintf(fid,'%f\t',Cy(i));
end

4A. Sample Code for Shadow Feature Extraction of one Octant (of the total Image) :
function [L,s,s1]=shadow_feature1(I)
K=I;

School Of Education Technology, Jadavpur University

55

% for the 1st OCTANT


for row=1:32
L1(row)=0;
end
L=0;
s=0;
s1=0;
for row=1:32
for col=1:row
if K(row,col)==1
L1(row) = 1;
break;
end;
end
end
for col=1:32
for row=32:-1:col
if K(row,col)==1
L1(col)= 1;
break;
end;
end
end
r=0;
c=0;
for i=1:32
r=r+1;
c=c+1;
for col=c:-1:1
if K(r,col)==1
s=s+1;
break;
end;
end
for row=r:32
if K(row,c)==1;
s1=s1+1;
break;
end;
end
end
L=sum(L1)/32;
s=s(1)/32;
s1=s1(1)/32;

4B. Code for measuring distances from corners:


function [d1,d2,d3,d4]=distance_corner(I)
K=I;
%from top-left corner

School Of Education Technology, Jadavpur University

56

d1=0;
for row=1:32
col=row;
if K(row,col)==0
d1=d1+1;
continue;
else
break;
end;
end;
d1=d1/32;
%disp(d1);
%from top-right corner
d2=0;
for row=1:32
col=65-row;
if K(row,col)==0
d2=d2+1;
continue;
else
break;
end;
end;
d2=d2/32;
%from bottom-left corner
d3=0;
for row=64:-1:33
col=65-row;
if K(row,col)==0
d3=d3+1;
continue;
else
break;
end;
end;
d3=d3/32;
%from bottom-right corner
d4=0;
for row=64:-1:33
col=row;
if K(row,col)==0
d4=d4+1;
continue;
else
break;
end;
end;
d4=d4/32;

School Of Education Technology, Jadavpur University

57

4C. Sample Code for obtaining centroids of each octant:


function [Cx,Cy]=centroid1(I)
K=I;
%for 1st Octant
xrow=0;
ycol=0;
count=0;
for row=1:32
for col=1:row
if K(row,col)==1
xrow=xrow+row;
ycol=ycol+col;
count=count+1;
end;
end
end
if count==0
Cx=0;
Cy=0;
else
Cx=(xrow/(count*64));
Cy=(ycol/(count*64));
end

4D. Sample Code for obtaining longest run features:


function [r,c,d1,d2]=longest_run(I,rt,cl)
rb=rt+31;
cr=cl+31;
r=0;
c=0;
d1=0;
d2=0;
for row=rt:rb
for i=1:64
lrl1(i)=0;
end
for col=cl:cr
crl=0;
if I(row,col)==0
continue;
end
%if i==48
%
break;
%end
if col==64
continue;
else
if I(row,col)==I(row,col+1)
lrl1(col)=lrl1(col)+2;
x=col+2;
for j=x:cr
if I(row,col)==I(row,j)

School Of Education Technology, Jadavpur University

58

%crl=crl+1;
lrl1(col)=lrl1(col)+1;
else
break;
end

end
else
continue;
end

end
end
r=r+max(lrl1);
end

for col=cl:cr
for i=1:64
lrl2(i)=0;
end
for row=rt:rb
crl=0;
if I(row,col)==0
continue;
end
%if i==48
%
break;
%end
if I(row,col)==I(row+1,col)
lrl2(row)=lrl2(row)+2;
x=row+2;
for j=x:rb
if I(row,col)==I(j,col)
%crl=crl+1;
lrl2(row)=lrl2(row)+1;
else
break;
end
end
else
continue;
end
end
c=c+max(lrl2);
end
for col=cl:cr
for i=1:64
lrl3(i)=0;
end
row=rt;
if I(row,col)==0
continue;
end
%if i==48
%
break;
%end
if I(row,col)==I(row+1,col+1)

School Of Education Technology, Jadavpur University

59

lrl3(row)=lrl3(row)+2;
x=row+2;
for j=x:rb
y=col+1;
if I(row,col)==I(j,y)
%crl=crl+1;
lrl3(row)=lrl3(row)+1;
else
break;
end
end
else
continue;
end
d1=d1+max(lrl3);
row=row+1;
end
for col=cr:-1:cl
for i=1:64
lrl4(i)=0;
end
row=rb;
if I(row,col)==0
continue;
end
%if i==48
%
break;
%end
if I(row,col)==I(row+1,col+1)
lrl4(row)=lrl4(row)+2;
x=row-2;
for j=x:-1:rt
y=col-1;
if I(row,col)==I(j,y)
%crl=crl+1;
lrl4(row)=lrl4(row)+1;
else
break;
end
end
else
continue;
end
d2=d2+max(lrl4);
row=row-1;
end
r=r/(32*32);
c=c/(32*32);
d1=d1/(32*32);
d2=d2/(32*32);

4E. Sample Code for obtaining shadow based features of each octant (of th of the total
Image):
function [L,s,s1]=extended_shadow1(I)
K=I;

School Of Education Technology, Jadavpur University

60

% for the 1st OCTANT


for row=1:16
L1(row)=0;
end
L=0;
s=0;
s1=0;
for row=1:16
for col=1:row
if K(row,col)==1
L1(row) = 1;
break;
end;
end
end
for col=1:16
for row=16:-1:col
if K(row,col)==1
L1(col)= 1;
break;
end;
end
end
r=0;
c=0;
for i=1:16
r=r+1;
c=c+1;
for col=c:-1:1
if K(r,col)==1
s=s+1;
break;
end;
end
for row=r:16
if K(row,c)==1;
s1=s1+1;
break;
end;
end
end
L=sum(L1)/16;
s=s(1)/16;
s1=s1(1)/16;

5. Creating Neural Network:


function net=trainnet(M,T)
[R,Q] = size(M);
[S2,Q] = size(T);
S1 = 176;

School Of Education Technology, Jadavpur University

61

net = newff(minmax(M),[S1 S2],{'logsig' 'logsig'},'traingdx');


net.LW{2,1} = net.LW{2,1}*0.01;
net.b{2} = net.b{2}*0.01;
net.performFcn = 'mse';
net.trainParam.goal = 0.001;
net.trainParam.show = 20;
net.trainParam.epochs = 5000;
net.trainParam.mc = 0.1;
[net,tr] = train(net,M,T);

6. Sample Code of constructing array for training & testing the Neural Network:
function [M_BA]=array_construct_BA();
fid=fopen('C:\Documents and
Settings\swati_m\Desktop\Mats\Matlab\Final\Classify\Ba\17.txt','r');
M1=fscanf(fid,'%e',[176,176]);
fclose(fid);
fid=fopen('C:\Documents and
Settings\swati_m\Desktop\Mats\Matlab\Final\Classify\Ba\18.txt','r');
M2=fscanf(fid,'%e',[176,176]);
fclose(fid);
fid=fopen('C:\Documents and
Settings\swati_m\Desktop\Mats\Matlab\Final\Classify\Ba\22.txt','r');
M3=fscanf(fid,'%e',[176,176]);
fclose(fid);
fid=fopen('C:\Documents and
Settings\swati_m\Desktop\Mats\Matlab\Final\Classify\Ba\59.txt','r');
M4=fscanf(fid,'%e',[176,176]);
fclose(fid);
fid=fopen('C:\Documents and
Settings\swati_m\Desktop\Mats\Matlab\Final\Classify\Ba\199.txt','r');
M5=fscanf(fid,'%e',[176,176]);
fclose(fid);
fid=fopen('C:\Documents and
Settings\swati_m\Desktop\Mats\Matlab\Final\Classify\Ba\200.txt','r');
M6=fscanf(fid,'%e',[176,176]);
fclose(fid);
fid=fopen('C:\Documents and
Settings\swati_m\Desktop\Mats\Matlab\Final\Classify\Ba\202.txt','r');
M7=fscanf(fid,'%e',[176,176]);
fclose(fid);
fid=fopen('C:\Documents and
Settings\swati_m\Desktop\Mats\Matlab\Final\Classify\Ba\203.txt','r');
M8=fscanf(fid,'%e',[176,176]);
fclose(fid);

School Of Education Technology, Jadavpur University

62

fid=fopen('C:\Documents and
Settings\swati_m\Desktop\Mats\Matlab\Final\Classify\Ba\595.txt','r');
M9=fscanf(fid,'%e',[176,176]);
fclose(fid);
fid=fopen('C:\Documents and
Settings\swati_m\Desktop\Mats\Matlab\Final\Classify\Ba\596.txt','r');
M10=fscanf(fid,'%e',[176,176]);
fclose(fid);
fid=fopen('C:\Documents and
Settings\swati_m\Desktop\Mats\Matlab\Final\Classify\Ba\598.txt','r');
M11=fscanf(fid,'%e',[176,176]);
fclose(fid);
fid=fopen('C:\Documents and
Settings\swati_m\Desktop\Mats\Matlab\Final\Classify\Ba\599.txt','r');
M12=fscanf(fid,'%e',[176,176]);
fclose(fid);
fid=fopen('C:\Documents and
Settings\swati_m\Desktop\Mats\Matlab\Final\Classify\Ba\1218.txt','r');
M13=fscanf(fid,'%e',[176,176]);
fclose(fid);
fid=fopen('C:\Documents and
Settings\swati_m\Desktop\Mats\Matlab\Final\Classify\Ba\1221.txt','r');
M14=fscanf(fid,'%e',[176,176]);
fclose(fid);
fid=fopen('C:\Documents and
Settings\swati_m\Desktop\Mats\Matlab\Final\Classify\Ba\1231.txt','r');
M15=fscanf(fid,'%e',[176,176]);
fclose(fid);
M_BA=[M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 M12 M13 M14 M15];

7. Code for training & testing the Neural Network:


M_A=array_construct_A();
M_AA=array_construct_AA();
M_AI=array_construct_AI();
M_AU=array_construct_AU();
M_BA=array_construct_BA();
M_BHA=array_construct_BHA();

School Of Education Technology, Jadavpur University

63

M_CA=array_construct_CA();
M_CHA=array_construct_CHA();
M_DA=array_construct_DA();
M_DDA=array_construct_DDA();
M_DDHA=array_construct_DDHA();
M_DHA=array_construct_DHA();
M_DRHA=array_construct_DRHA();
M_E=array_construct_E();
M_GA=array_construct_GA();
M_GHA=array_construct_GHA();
M_KA=array_construct_KA();
M_KHA=array_construct_KHA();
M_LA=array_construct_LA();
M_MA=array_construct_MA();
M_PA=array_construct_PA();
M_PHA=array_construct_PHA();
M_RA=array_construct_RA();
M_SA=array_construct_SA();
M_SHA=array_construct_SHA();
M_TA=array_construct_TA();
M_THA=array_construct_THA();
M_TTA=array_construct_TTA();
M_TTHA=array_construct_TTHA();
M_U=array_construct_U();
M_UU=array_construct_UU();
M_HA=array_construct_HA();

School Of Education Technology, Jadavpur University

64

M_I=array_construct_I();
M_II=array_construct_II();
M_new=[M_A M_AA M_AI M_AU M_BA M_BHA M_CA M_CHA M_DA M_DDA M_DDHA M_DHA
M_DRHA M_E M_GA M_GHA M_HA M_I M_II M_KA M_KHA M_LA M_MA M_PA M_PHA
M_RA M_SA M_SHA M_TA M_THA M_TTA M_TTHA M_U M_UU];
T=[ones(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15);
zeros(1,15) ones(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15);
zeros(1,15) zeros(1,15) ones(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15);
zeros(1,15) zeros(1,15) zeros(1,15) ones(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15);
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) ones(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15);
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
ones(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15);
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) ones(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15);
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) ones(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15);

School Of Education Technology, Jadavpur University

65

zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)


zeros(1,15) zeros(1,15) zeros(1,15) ones(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15);
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) ones(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15);
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) ones(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15);
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
ones(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15);
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) ones(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15);
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) ones(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15);
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) ones(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15);
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) ones(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15);
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) ones(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15);
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)

School Of Education Technology, Jadavpur University

66

ones(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)


zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15);
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) ones(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15);
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) ones(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15);
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) ones(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15);
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) ones(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15);
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) ones(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15);
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
ones(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15);
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) ones(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15);
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) ones(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15);
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) ones(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15);

School Of Education Technology, Jadavpur University

67

zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)


zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) ones(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15);
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) ones(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15);
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
ones(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15);
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) ones(1,15) zeros(1,15) zeros(1,15) zeros(1,15);
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) ones(1,15) zeros(1,15) zeros(1,15);
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) ones(1,15) zeros(1,15);
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15)
zeros(1,15) zeros(1,15) zeros(1,15) zeros(1,15) ones(1,15);
];
display(size(T));
fid=fopen('C:\Documents and
Settings\swati_m\Desktop\Mats\Matlab\Final\Classify\CA\469.txt','r');
M_test1=fscanf(fid,'%e',[176,176]);
fclose(fid);
%display(size(M_test1));
net=trainnet(M_new,T);
b=sim(net,M_test1);
siz=size(b);
i=1;
fid=fopen('C:\Documents and
Settings\swati_m\Desktop\Mats\Matlab\Final\Classify\aa.m','a+');
fprintf(fid,'\n');

School Of Education Technology, Jadavpur University

68

fprintf(fid,'\nClassCon=[');
while i<=siz(1)
for j=1:siz(2)
fprintf(fid,'%1.6f\t',b(i,j));
end
i=i+1;
if i<=siz(1)
fprintf(fid,'\n\t\t');
end
end
fprintf(fid,']');
fclose(fid);
display(b);
plot(b);

APPENDIX II: SAMPLE OUTPUT OF THE PROJECT


1. Screenshot of Neural Network Training

School Of Education Technology, Jadavpur University

69

2. Output Curve (Performance)

School Of Education Technology, Jadavpur University

70

3. Output Curve (Classification)

4. Output from the file fin.m

School Of Education Technology, Jadavpur University

71

ClassCon=[0.000004
0.000002
0.001739
0.000000
0.000048
0.007578
0.971304
0.000729
0.010591
0.000079
0.047503
0.002410
0.000944
0.000007
0.000011
0.000266
0.000011
0.000013
0.000008
0.000734
0.000001
0.000054
0.000001
0.000001
0.000000
0.000048
0.000007
0.000012
0.000009
0.000498
0.000060
0.021542
0.000574
0.000377

School Of Education Technology, Jadavpur University

72