CHAPTER 1

INTRODUCTION AND MOTIVATION

MOTIVATION OF THE PROJECT

Our dietary habits affect our health in many ways. Research has confirmed that di­ etary 
habits are important factors for healthy living and have profound impacts on many chronic 
illnesses. The vast majority of the population has chronic illnesses  such as heart disease, 
diabetes, hypertension, dyslipidemia, and obesity. A recent Surgeon General Report 
indicated that approximately 300,000 U.S. deaths are associated with obesity and 
overweight each year. The total cost attributed to overweight and obesity amounts to 117 
billion in 2000. Proper dietary intake and related interventions are effective in ameliorating 
symptoms and improving health. 
Nutritious dietary is one of the most accessible means for people to prevent illness and to 
promote well­being]. Unlike traditional healthcare in which professionals assess and weigh 
one’s dietary intake and then develop a plan for behavioral changes, ubiquitous healthcare 
technologies provide an opportunity for individuals effortlessly to quantify and 
acknowledge their dietary intake . For example, at home patients face the bersome need to 
record everything they eat, a task which can take a minimum of 15­20 minutes per day. 
Ubiquitous computing technologies provide a means for individuals to proactively monitor 
their intake and act upon it, leading to better food selection and more sensible eating. 

Problem and Solution 
This thesis proposes a diet­aware Smart Airtificial Intelligent Platform for Finding 
Adaptive Diet Chat for Different individual that automatically Update what and how much 
each individual need to eat over the course of a meal. 
Considering the Real Time Fact , Poor nutrition can impair our daily health and

wellbeing and reduce our ability to lead an enjoyable and active life.
In the short term, poor nutrition can contribute to stress, tiredness and our
capacity to work, and over time, it can contribute to the risk of developing
some illnesses and other health problems such as:

being overweight or obese
tooth decay
1







high blood pressure
high cholesterol
heart disease and stroke
type-2 diabetes
osteoporosis
some cancers
depression
As an Online application , we will  try to create personalize profile for different individual 
and Prescribe Diet Plan after considering the important and crucial factor of Body Mass Index
(BMI) and Basal Metabolic Rate (BMR) . 
With Calculated Value We will try to evaluate following  Application using personalized Artificial Intelligent
system to provide detailed Diet Plan and Suggestion for Individuals 
The proposed architectural framework and module development as presented above encompasses four (4)
modules namely:
(1) Food calorie Intake Calculator
(2) Mealtime Planner
(3) BMI Calculator and
(4) Disease Risk Determinator.

2

The user will Update and Maintain Personal profile , give it as an input to the Diet360
engine which will pre- process the User Input according to the requirements
The System involves a number of demanding Evaluation Process steps and other
complicated algorithms which has to be implemented on Diet 360 Services for
considering its limitations and Personalized User

1.1

OUTLINE OF THE REPORT

The project is divided into 8 chapters.

Chapter 1: This chapter gives a brief overview of the entire project and its scope.

Chapter 2: This Chapter describes the review of literature done for the entire project and
the comparison of the proposed system with respect to existing system.
Chapter 3: This Chapter gives the different requirements and analyses them.

Chapter 4: This Chapter describes the different processes used in the system and the
implementation diagrams.

Chapter 5: This Chapter describes the different algorithms used in the image and the
snapshots of the current system.
Chapter 6: This Chapter gives the different test cases regarding the project and their
analysis.

The trade-off required to perform well and at the same time not to exploit the resources is also being described in detail in the following sections. REQUIREMENT ANALYSIS 3. Economic and Operational feasibilities. The different strengths and weaknesses regarding the system are discussed and the various factors such as cost and performance are considered. Chapter 8: This Chapter concludes the topic and gives the future scope.Chapter 7: This Chapter contains the Timeline chart and Gnatt chart. The document provide the feasibility of the project that is being designed and lists various areas that were considered very carefully during the feasibility study of this project such as Technical. The following are its features: .1 FEASIBILITY ANALYSIS Feasibility study is an evaluation and analysis of the potential of the proposed project.

programs and procedures. The system is built for recognizing the characters from the images captured from an Android based camera phone. As a result the various factors considered are the limited memory that is available on a mobile phone. The color to grayscale conversion is done using a simple formula. In order to make the system feasible. etc.3. the pre-processing operation is done based by converting the color image to grayscale and then further to binary. the amount of resolution available for a android based phone. output. Similarly the grayscale to binary conversion is done by calculating an adaptive threshold and then comparing the pixel values of the . the different algorithms used in the project are based on a consideration of the platform being used.1 Technical Feasibility The system must be evaluated from the technical point of view first. In order to have minimal processing done.1. no floating point of the phone. The assessment of this feasibility is based on an outline design of the system requirement in the terms of input.

uses the phone memory instead of the memory card. So there are minimal constraints involved with this project. Thus. Lastly in the character recognition phase. we haven’t stored the feature vectors of the characters in the database instead we have stored all the pixel values in an array because when we perform the dissimilarity measure based on the feature vector the processing time required was increased.2 Resources Feasibility The system is built for an android based mobile phone. the applications stored. This is done using the Sobel edge detection filter. Also the built system does need any dedicated hardware or does not depend on the network. otherwise they are. The next operation performed is Edge detection in order to detect the edges and remove noise if present in the image. As a result of which the application built should be such that it uses minimal resources of the system.1. image with the characters having different skew angles are not digitized correctly. In order to keep processing minimal we have sacrificed on skew correcting the image. . In the android phones. then the characters are not similar. Image segmentation is performed followed by edge detection wherein we use horizontal and vertical projections of the image and calculate their histograms so as to detect the individual lines and words present in each line. If the difference calculated is more than the threshold. since it computes the edges based on a 3 x 3 mask. 3. The dissimilarity based on the pixel values is computed by simply subtracting the pixel values of the cropped character from the character stored in the database.image. Considering all these factors the system is built. Thus. in order to keep a trade-off between performance and processing required to meet the limited resource utilization necessity we use adaptive thresholding technique. Also using Sobel filter the noise removal is done so that in the later stage the characters are recognized properly. In case we use the global thresholding method the processing required would be minimal but the performance degrades. Also mobile phones have minimal memory available and no floating point unit.

The application need not require any additional hardware or software requirement and must be feasible on all the phones with the same platform.3 SYSTEM ANALYSIS System analysis is the study of sets of interacting entities. These different sub modules work independently and do not interrupt the working of other.2 REQUIREMENT ANALYSIS Requirement analysis encompasses the task that go into determining the different requirements of different stakeholders. The application works in isolation and thus does not interrupt in the working of the other applications. the application is built. words of each line and then crops the characters present in each word. Considering the requirements of the user. The first sub module includes the activity of capturing image. After edge detection. The character recognition module follows the image segmentation module where the actual characters are recognized by it comparing the . Also the user need not worry about the resource allocation and stuff.3. The user-interface is easy to understand and also since the user is not able to see any operation that is being done at the back end the user is not worried about anything. It returns a preprocessed image which it would now be suitable to process further. 3. Also the application must be userfriendly for the user and the user need not require somebody’s help in learning the system. The users of the system are common people and the only requirement the users demand from the system is that the application should occupy minimal space in the phone and run independent of the other applications. this module takes in the input from the previous module and processes it. The performance offered by the application should also be acceptable for the user. The user need not know the internal operation of the system. The entire system is based on different sub modules. The next module being the pre-processing module. comes the image segmentation module which segments the image to detect the individual lines. Then the next module that is edge detection module detects the edges present in the image and removes the noise from the already pre-processed image.

individual cropped character images with the ones present in the database. 3. Thus. Java 2. Android SDK manager 2. JDK 4. Hard disk: 16 GB or more Software 1. Android libraries Backend 1. none of the modules work independently without affecting the operation of the other modules.4 HARDWARE AND SOFTWARE REQUIREMENTS Hardware 1. SQLite Browser . Eclipse 3. RAM: 512 MB or more 3. Processor: Pentium 4 2. SQLite Browser Frontend 1.

.

This is obtained by merging classes as soon as a new . Jain [4] Binarization of scanned gray scale images is the first step in most document image analysis systems. This is done by forming a weighted sum of R. each color appears in its primary spectral components of red. one needs to investigate how well the subsequent image analysis steps will perform on the binarized image. Selection of an appropriate binarization method for an input image domain is a difficult problem. and blue. Oiving Due Trier. This color image is converted to grayscale image with 256 levels of brightness using the conversion formula. G. Prasad S. Anil K. so the performance of the character recognition module is the objective measure. Arun Verma [6] In RGB color model. and B components. unlike the classical approach.CHAPTER 2 REVIEW OF LITERATURE The different papers we referred in context with the project are given below s follows: “A Theory Based on Conversion of RGB image to Gray image”. “Connected Component Analysis and Change Detection for Images”. Tarun kumar. and blue (RGB). Halgaonkar [7] A two-scan labelling algorithm whereby. Evaluation of binarization methods is in the context of digit recognition. green. green. “Goal-Directed Evaluation of Binarization Methods”. red. described by three corresponding intensities. The color of a pixel is made up of three components. However to conduct an objective evaluation. equivalences are processed during the first pass in order to determine the correct state of equivalence classes at each time of the scan. Typically. a human expert evaluates the binarized image according to his/her visual criteria.

This approach allows the check for a conflict to be carried out on class identifiers . the data structure used to support the merging being a simple 1D array.equivalence is found.

Chang [3] A shape Recognition with the help of three methods is discussed. “A Shape Recognition Scheme Based on Real-Valued Boundary Points”. image segmentation is performed by calculating horizontal and vertical projections of the image. Then. In case of vertical projection. It has been show that this significantly improves the efficiency of the labelling process. First method for estimating the real-valued boundary points from the integer-valued coordinates and the gray-level values of binary images. maximum and the minimum value of horizontal projection is taken as threshold. A horizontal profile is defined as vector of the sum of the pixel intensities over each column and a vertical profile is defined as vector of the sum of the pixel intensities over each row. D.Lu.K.J. .S. V. C. There are two types of projection profile. One is horizontal profile and another one is vertical profile. The projection profile is used to separate text blocks into single line text. as instead it is mandatory with the classical algorithm. The horizontal and vertical projections of the binary edge map are found.Buehrer. The effectiveness of the shape recognition depends on the good recognition rates. Second method determines all the feature points with this representation by using an angle calculation formula and then separating them. Neha Gupta. Third method is the matching process where we use the split-merge technique to assist in shape matching. “Image segmentation for Text Extraction”. Banga [8] In this paper. C. where each pair contains the coordinate of a feature point and its distance from the centroid. The average value of maximum and minimum of the vertical projection is taken as threshold and in the same way.rather than on labels.C. each shape is represented by an array of pairs. the rows whose sum of pixel intensities above the threshold are taken and in case of horizontal projection only the columns whose sum of pixel intensities above the threshold is taken.

In Response Delivery the text is sent back to the client’s mobile via SMS. . the image is received from the client’s mobile phone. and server does the character recognition.e. In Language Translation the extracted string which is in a different language is converted into English language. The system is divided into four modules:  Request Acceptance  Character Recognition  Language Translation  Response Delivery In Request Acceptance module the request from the customer is acknowledged i. language translation and sends the customer the translated text via SMS. In Character Recognition module the characters are extracted from the given image. Language Emulator In this system a photo taken from the mobile phone needs to be sent to the server.COMPARISON WITH EXISTING IMPLEMENTATIONS The different existing systems available are: 1.

simple cursor capture. and rectangular selection.1: Diagrammatic Representation of Language Emulator 2. Desktop Based OCR System This system lets select a text region on the desktop screen. Also. . performs the character recognition and returns me the characters. The available selection modes include whole window selection. It is useful in situations where the text can only be viewed (not copied or printed). 2. The Existing System needs specialized hardware or depends on the network for optical character recognition but the current system is capable of performing the required task without these requirements.Fig. the limitation of the mobile phones is also considered and processing done is not too exhaustive since mobile phones do not have a floating point unit and have very limited memory. scrolling capture.

no floating point of the phone. the pre-processing operation is done based by converting the color image to grayscale and then further to binary. As a result the various factors considered are the limited memory that is available on a mobile phone.1 Technical Feasibility The system must be evaluated from the technical point of view first. The assessment of this feasibility is based on an outline design of the system requirement in the terms of input. The different strengths and weaknesses regarding the system are discussed and the various factors such as cost and performance are considered.5 FEASIBILITY ANALYSIS Feasibility study is an evaluation and analysis of the potential of the proposed project. etc. The color to grayscale . The following are its features: 3. the different algorithms used in the project are based on a consideration of the platform being used. the amount of resolution available for a android based phone. In order to have minimal processing done. Economic and Operational feasibilities. The document provide the feasibility of the project that is being designed and lists various areas that were considered very carefully during the feasibility study of this project such as Technical.CHAPTER 3 REQUIREMENT ANALYSIS 3.5. The system is built for recognizing the characters from the images captured from an Android based camera phone. The trade-off required to perform well and at the same time not to exploit the resources is also being described in detail in the following sections. In order to make the system feasible. output. programs and procedures.

Similarly the grayscale to binary conversion is done by calculating an adaptive threshold and then comparing the pixel values of the .conversion is done using a simple formula.

2 Resources Feasibility The system is built for an android based mobile phone. then the characters are not similar. In the android phones. In order to keep processing minimal we have sacrificed on skew correcting the image. Image segmentation is performed followed by edge detection wherein we use horizontal and vertical projections of the image and calculate their histograms so as to detect the individual lines and words present in each line. uses the phone memory instead of the memory card. .5. So there are minimal constraints involved with this project. Lastly in the character recognition phase. Thus. In case we use the global thresholding method the processing required would be minimal but the performance degrades. Considering all these factors the system is built. image with the characters having different skew angles are not digitized correctly.image. the applications stored. 3. As a result of which the application built should be such that it uses minimal resources of the system. Thus. If the difference calculated is more than the threshold. The dissimilarity based on the pixel values is computed by simply subtracting the pixel values of the cropped character from the character stored in the database. The next operation performed is Edge detection in order to detect the edges and remove noise if present in the image. Also mobile phones have minimal memory available and no floating point unit. we haven’t stored the feature vectors of the characters in the database instead we have stored all the pixel values in an array because when we perform the dissimilarity measure based on the feature vector the processing time required was increased. in order to keep a trade-off between performance and processing required to meet the limited resource utilization necessity we use adaptive thresholding technique. otherwise they are. Also using Sobel filter the noise removal is done so that in the later stage the characters are recognized properly. Also the built system does need any dedicated hardware or does not depend on the network. This is done using the Sobel edge detection filter. since it computes the edges based on a 3 x 3 mask.

Considering the requirements of the user. this module takes in the input from the previous module and processes it. The application need not require any additional hardware or software requirement and must be feasible on all the phones with the same platform. The user-interface is easy to understand and also since the user is not able to see any operation that is being done at the back end the user is not worried about anything. The next module being the pre-processing module.3. words of each line and then crops the characters present in each word. The first sub module includes the activity of capturing image. The users of the system are common people and the only requirement the users demand from the system is that the application should occupy minimal space in the phone and run independent of the other applications. The character recognition module follows the image segmentation module where the actual characters are recognized by it comparing the . Also the user need not worry about the resource allocation and stuff. It returns a preprocessed image which it would now be suitable to process further.7 SYSTEM ANALYSIS System analysis is the study of sets of interacting entities. 3. These different sub modules work independently and do not interrupt the working of other. The entire system is based on different sub modules.6 REQUIREMENT ANALYSIS Requirement analysis encompasses the task that go into determining the different requirements of different stakeholders. The application works in isolation and thus does not interrupt in the working of the other applications. The user need not know the internal operation of the system. the application is built. After edge detection. Then the next module that is edge detection module detects the edges present in the image and removes the noise from the already pre-processed image. Also the application must be userfriendly for the user and the user need not require somebody’s help in learning the system. comes the image segmentation module which segments the image to detect the individual lines. The performance offered by the application should also be acceptable for the user.

none of the modules work independently without affecting the operation of the other modules. JDK 8. Android SDK manager 6. Thus. Android libraries Backend 1. Hard disk: 16 GB or more Software 5. RAM: 512 MB or more 6. Processor: Pentium 4 5. 3.8 HARDWARE AND SOFTWARE REQUIREMENTS Hardware 4.individual cropped character images with the ones present in the database. SQLite Browser Frontend 3. Java 4. Eclipse 7. SQLite Browser .

The proposed system has the following subsystems listed in chronological order: 1. Character Recognition All this sub-modules can be diagrammatically represented as follows: Fig 4.CHAPTER 4 PROJECT DESIGN A Standalone Optical Character System for mobile camera phones can be viewed as a combination of several subsystems each specialized to solving one of the several sub problems. Preprocessing 3. Feature Extraction 5.1: Diagrammatic representation of design of OCR system [5] . Image Capturing 2. Segmentation 4. After the system has received an input image from a camera. there are several preparative stages the data has to undergo before the actual recognition of characters can take place.

Segmentation When dealing with the segmentation of machine printed text. this will mark the end of our line. 2. These projections are helpful in telling us how the image is composed along the different axes. We continue to run through this binary vector until we find a value equal to 0. it is time to extract the words and then. Image Capturing and Preprocessing Modern day hand-held devices are capable of capturing color images. A color image consists of color pixels represented by a combination of three basic color components viz. Horizontal or vertical image projections work by summing up either the rows or columns of the image into a 1-dimensional vector. In order to find out where each line starts. Extracting the words Now that we have each horizontal line extracted. In a similar manner to using the horizontal projection. we can go back to the original image and extract it.1. Each line is clearly separated in the binary threshold of the sum. So. Since we have the vertical start and end points of our line. all we do is sum up each row into a vector. the output of this step is a centered block of text with black capitalized letters against a white background. we can use histogram projections for segmentation. b. the characters. . This blur will allow words to be segmented together. we also need to blur the image in the horizontal direction to remove the small spaces between characters. This RGB image is now converted to grayscale. we just run through this binary vector until we find our first value equal to 1. This process can be applied to either binary or normal images. For a horizontal projection. Red. we will take the vertical projection of the image. a. Green and Blue. Extracting the lines This type of projection is used to segment the different lines from an image. but before doing so.

we take a ratio of the black to the white pixels of this newly generated image. Data Flow Diagrams Context Level 0 DFD Fig 4. Extracting the characters For each word that is extracted. the individual character image is converted into pixels and compared with the pixilated images in the database. After this. now vertical projection is once again performed for a single word to extract the individual characters. Character Recognition Now when the individual characters are extracted.c. . The comparison is done by subtracting the corresponding pixels of both the images and creating a new pixilated image of the difference pixels. d. The OCR system performs the OCR task and returns the user recognized text from the image.2: Level 0 DFD The user gives the captured color image as an input to the OCR system. If the difference is within the acceptable range then it is recognized as that particular character.

features are extracted and the characters are recognized by mapping with the database. .3: Level 1 DFD The image that is input at the OCR system is now pre-processed. segmented.Level 1 DFD Fig 4.

0 Fig 4. followed by binarization operation.4: Level 2 DFD of Process 1. .0 In the pre-processing operation.Level 2 DFD of Process 1. the image is initially converted from color to gray scale.

0 In the segmentation operation. .Level 2 DFD of Process 2.5: Level 2 DFD of process 2.e.0 Fig 4. two operations are performed i. edge detection and horizontal and vertical projection.

5870 * G + 0.1 PRE-PROCESSING OF IMAGE Convert RGB image to Grayscale The images captured on are initially 24bpp color (RGB) images.1 METHODOLOGY 5.2989 * R + 0. but are converted to grayscale with 256 levels of brightness.CHAPTER 5 IMPLEMENTATION DETAILS 5. G. and B components. 0.1: Conversion of RGB to Grayscale .1140 * B Fig 5. This is done by forming a weighted sum of R.1.

e. The threshold is decided based on the characteristics of the image. White and the pixels with values lesser than the threshold as 0 i. Black.e.2: Snapshot of RGB to Grayscale conversion Convert Grayscale image to Binary Now the grayscale image obtained in the previous step has to be converted to a binary image so that we get a centered block of text printed in black against a white background. This is done by replacing all the pixels with values greater than the threshold as 1 i.Fig 5. .

3: Conversion of Grayscale to Binary .Fig 5.

These discontinuities can be due to various reasons such as type of material. .1. lines and edges. An edge can be defined as a set of connected pixels that form a boundary between two disjoint regions.4: Snapshot of Grayscale to Binary conversion 5.Fig 5.2 IMAGE SEGMENTATION Edge Detection Images consist of many types of discontinuities like points.

surface texture etc. Sobel operator identifies them and also provides smoothening effects thus eliminating noise completely. .

5: Snapshot of Edge detection Horizontal and Vertical Projection When dealing with the segmentation of machine printed text. we can use histogram projections for segmentation. These projections are helpful in telling us how the image is composed along the different axes. . This process can be applied to either binary image. Horizontal or vertical image projections work by summing up either the rows or columns of the image into a 1-dimensional vector.Fig 5.

After this.6: Snapshot of the database . we take a ratio of the black to the white pixels of this newly generated image. If the difference is within the acceptable range then it is recognized as that particular character.3 CHARACTER RECOGNITION Now when the individual characters are extracted. The comparison is done by subtracting the corresponding pixels of both the images and creating a new pixilated image of the difference pixels.5. the individual character image is converted into pixels and compared with the pixilated images in the database.1. Fig 5.

Fig 5.7: Snapshot of correct Character Recognition .

Fig 5.8: Snapshot of incorrect Character Recognition .

1.1: Test case table Yes Yes Yes . No.CHAPTER 6 TESTING Sr. Different font sizes 5. Module Image Capture 2. Lighting throughout image 4. Noise Action Expected Result Actual result Pass Capture blur image Capture skewed image Capture image with handwritten text Incorrect Result Incorrect Result Incorrect Result Incorrect Result Incorrect Result Incorrect Result Yes Capture color image Capture Binary image Special Characters in the image Image captured with too much RGB components Different lighting in the same image Correct Result Correct Result Yes Correct Result Correct Result Yes Incorrect Result Incorrect Result Yes Recognize properly Properly recognized Yes Process correctly and return right result Correctly recognize Correctly recognized Yes The cropped characters are resized and correctly recognized The noise removal is done and the characters are correctly recognized Yes Capture image with nonuniform font size throughout the image Too much noise present in the image Characters should be correctly recognized Table 6. Too much RGB components 3.

Coding 7. 3. 1. 5. Testing 8.No. 4. AUG SEP OCT NOV FEB MARCH APRIL Project planning and scheduling Conclusion and Future Work Fig 7.1: Timeline Chart . 9. ACTIVITIES Introduction & Motivation Review of Literature Requirement Analysis Project Design Implementation Details 6. 2.CHAPTER 7 PROJECT PLANNING AND SCHEDULING TIMELINE CHART Sr.

2: Gnatt Chart .GNATT CHART Fig 7.

it will be easy to electronically search or store it compactly after digitizing the text. The application has been designed to work specifically on the android OS platform. some words that do not completely appear in the image also be corrected after recognition. The project has been successful in catering to all the basic requirements which were mentioned in the requirement specification. However we have not considered every type of possible form and/or representation of the English characters. We would like to extend this ability and make it platform independent and highly generic. These inherent limitations are something we would like to work on and try to broaden our potential scope as much as possible. we look forward to provide text-to-speech facility integrated with the OCR application so that it would be a boon for the visually challenged people. Our project is a unique and a genuine starting point for all those who want to work in this particular domain. . Also. Our project has culminated in the development of an application capable of recognizing the symbolic characters appearing in the image. We aim to provide a baseline for developers who want to develop similar applications. As was mentioned earlier. We would like to extend our applications capabilities so that it includes the entire spectrum of characters and numbers. numbers or words that are handwritten.CHAPTER 8 CONCLUSION AND FUTURE WORK We have successfully implemented our project as per the specifications. We hope to impart a grammar comprehensive ability so that the in case. This mainly involves the omission of words having special characters.

Hirobumi Nishida. Hiromitsu Yamada “Optical Character Recognition. [8] Neha Gupta. Karun Verma “A Theory Based on Conversion of RGB image to Gray image” 2010. Hwang. C. [6] Tarun Kumar. Halgaonkar “Connected Component Analysis and Change Detection for Images” 2011. M. S. Jain “Goal-Directed Evaluation of Binarization Methods” 1995.References Bibliography [1] Shunji Mori. Banga “Image segmentation for Text Extraction” 2012.J. D. Websites [2] http://stackoverflow. Olli S. V. Buehrer “A Shape Recognition Scheme Based on Relative Distances of Feature Points from the Centroid” 1991. [7] Prasad S. [5] Mikael Laine.Wiley”. . Anil K.com/questions/8381514/android-converting-color-image-tograyscale Papers [3] C. K. [4] Oivind Due Trier. Chang. Nevalainen “A Standalone OCR System for Mobile Cameraphones” 2006.