report on rice project

65
DECLARAT ION I hereby declare that project entitled “ Online Classification of Rice Using Image Processing” is the work carried out at DU-2, Central Scientific Instruments Organization as requirement for the award of degree of Btech at A.C.E.T,Punjab Technical University under the guidance of Dr. H.K. Sardana. Kamalpreet Kaur Certified that the above statement made by the student is correct to the best of our knowledge and belief. 1

Upload: faizsliet

Post on 22-Oct-2014

122 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Report on Rice Project

DECLARATION

I hereby declare that project entitled “Online Classification of Rice Using Image

Processing” is the work carried out at DU-2, Central Scientific Instruments

Organization as requirement for the award of degree of Btech at A.C.E.T,Punjab

Technical University under the guidance of Dr. H.K. Sardana.

Kamalpreet Kaur

Certified that the above statement made by the student is correct to the best of our

knowledge and belief.

HOD: col. Gurmukh singh Dr. H.K.Sardana Scientist G CSIO, Chandigarh

1

Page 2: Report on Rice Project

ABSTRACT

Online Classification of Rice is developed for providing online service for the

classification of rice grains using flatbed scanning and image processing. Here the neural based

algorithm is used for classification of rice into 10 classes i.e. admixture, red, discolor, chalky,

organic, small broken, big broken, Sound (Healthy), inorganic and damaged. The classification is

based on physical parameter (Length, width, Area) along with color properties (Red, chalky,

discolours).

The procedure requires client to have a PC with Flat Bed Scanner and internet

connection to the server configured to provide this service. Client has to upload rice image on the

server and he will get the brief and detail report of rice classification including colour watershed

image of rice sample which has indexing of rice grains. Detailed report (in zipped format)

contains all physical and color features of each rice grain along with class it belongs to and is

available for downloading.

It yields the better accuracy than the more time consuming manual method. The

developed system for rice classification takes less time in comparison to manual method.

2

Page 3: Report on Rice Project

ORGANIZATION PROFILE

Central Scientific Instruments Organization

Sector 30 C, CHANDIGARH - 160030

CSIO is the foremost national laboratory for research, design and development of scientific

instruments. It is one of the constituent laboratories of the Council of Scientific & Industrial

Research (CSIR), which is administratively under The Central Scientific Instruments

Organization (CSIO); Chandigarh is the Department of Scientific & Industrial Research of the

Government of India. CSIR, India was constituted in 1942 as an autonomous body under the

provision of the Registration of Societies Act   XXI of 1860. Situated in Sector-30C in

Chandigarh, CSIO occupies an area of 120 acres. The CSIO campus comprises R & D

laboratories, Indo-Swiss Training Center and a housing colony.

3

Page 4: Report on Rice Project

CSIO presently employs 116 scientists, 108 technical officers, 413 scientific and technical

supporting personnel and 156 administrative and other staff.

It covers various disciplines like applied physics, bioengineering, industrial electronics,

analytical instrumentation, digital & microprocessor based electronics, optics, electron optics,

fiber optics, holography, electron & ion beam based instrumentation, metallurgy and mechanical

engineering etc. CSIO will be completing its 50th year by 30th Oct, 2009.

It covers various disciplines like:

Applied physics

Bioengineering

Industrial electronics

Analytical instrumentation

Digital & microprocessor based electronics

Optics, electron optics

Fiber optics

Holography

Electron & ion beam based instrumentation,etc

1.1 HISTORICAL PERSPECTIVE

4

Page 5: Report on Rice Project

CSIO was started in October 1959 in pursuance to the recommendations of a committee

set up by the planning commission to formulate a scheme for the development of

scientific instrument industry in India. Initially, it was located in the CSIR building at

New Delhi. It moved to Chandigarh in 1962. An austere four-story building and the

accompanying workshop were

Inaugurated in December 1967 by the then President of

India, Dr. Zakir Hussain. Another four-story block was

added in 1976 for library, technical information and R &

D activities. Indo-Swiss Training Center (I.S.T.C) was

established at CSIO with Swiss assistance to meet the

growing demands for well-trained instruments

technologists. Dr. Fritz: Real, the President of the Swiss

Foundation laid its corner stone in December 1962. Pandit Jawaharlal Nehru, the first

Prime Minister of INDIA, inaugurated the center in 1963. Shri M.C. Chagla opened the

school building in December 1964, the then Union Education Minister. Shri Shivraj V.

Patil, Vice-President, CSIR and minister of state inaugurated a 500 seating capacity

auditorium for science and technology, Atomic Energy, Space, Electronics & Ocean

Development in April 1985.

1.2 MAIN AREAS OF ACTIVITIES

1. Research, Design and Development of Scientific & Industrial Instruments,

Components and Systems.

2. Service, Maintenance, Testing and Calibration of Instruments / Components.

3. Human Resource Development in the Area of Instrumentation. 

4. Technical Assistance to Industry.

1.3 Decision Unit-2

DU-2 is one if the divisions of the CSIO. And all the projects in this division are

under the supervision of the H.O.D. DR. H.K. Sardana (Scientist F)

There are so many projects, which are being developed in this division. These are:

Cephalometric Analysis

Page 6: Report on Rice Project

Web Application for rice.

HHSS (Hand held step scanner) for visual impaired persons.

Electronic Portal Imaging Device(EPID)

Fake currency detector.

Real Time Image Processing Of Spackle in Fiber Optics Sensors.

2. INTRODUCTION

Rice is an important staple food for a large part of the world's human population,

especially in Southeast Asia. It is the grain with the second highest worldwide

production, after maize. Rice is probably the most important grain with regards to human

nutrition and caloric intake, providing more than one fifth of the calories consumed

worldwide by the human species.Its quality is based on a variety of properties such as the

cooking texture, color (whiteness and chalkiness), size, shape and the number of

broken rice kernels. Quality of edible products in general is based on a combination of

subjective and objective factors. Whether a produce is acceptable for an intended use is

determined by quality testing based on a fixed set of criteria.

Page 7: Report on Rice Project

Different countries (e.g. USA and Japan, Spain, Philippines and Australia) use different

components of quality of agro products. In the present phase of determining the rice

quality, we are considering the visual appearance and the related measurements.

Rice Grain size and shape, Chalk, Color other parameters are used to classify more than

20 varieties of rice. Length (mm), Width (mm), Length and width ratio are also

independently (with very close margins) used to classify varieties of rice.

]

2.1 Technique

The aim of this research is to classify and grade rice grain sample according to FCI (Food

Corporation of India) standard. Manual inspection is very laborious, requires trained

personnel and results in a significant amount of incorrect classified rice kernels. The

length and width of rice kernels is generally measured using a sliding calliper one by one.

Broken rice kernels have normally only half of the value of whole or head rice. The head

rice yield, i.e., the weight percentage of whole kernels remaining after milling is one of

the most important physical characteristics that determines rice quality. The amount of

broken rice kernels are specified when buying milled rice.

Page 8: Report on Rice Project

The method developed for the determination of the color (whiteness and chalkiness),

size, shape and size distribution of rice and the amount of broken rice kernels using

Flatbed scanner (FBS) and image analysis software. A sample layer of milled rice grains

is placed on the sample holder which is placed on the glass plate of the scanner and

covered with a black sheet of paper. The sample holder was made of transparency and a

black sheet joined together at one end. Transparency was used so that the glass of the flat

bed scanner does not get damaged due to continuous use to place rice kernels.The image

will be acquired by PC through FBS. FBS images provide uniform illumination

independent of external light conditions.

2.2 Rice Quality

There are many varieties of rice. The main distinction is between long and

medium sized grains. The many diverse uses of rice both domestically and for

export, require that quality to be evaluated according to its suitability for specific

end uses. Quality is based on a combination of subjective and objective factors.

Whether rice is acceptable for an intended use is determined by quality testing

based on a fixed set of criteria. Rice is consumed as a whole grain. Therefore

physical properties such as size, shape, uniformity, and general appearance are of

utmost importance.

Rice quality is influenced by characteristics under genetic control,

environmental conditions, and processing techniques. In the latter case,

characteristics are principally a function of handling, storage, and distribution.

The genetic makeup of a particular variety dictates to a large degree the grain

quality characteristics. Plant breeders continually refine and improve genetic

traits of new varieties required to produce the most desirable products.

Page 9: Report on Rice Project

2.3Milled Rice ClassesGrain size and shape are among the first criteria of rice quality that breeders consider in

developing new varieties. Grain type categories are based upon physical qualities: length,

width, area, and perimeter. The rice kernels appear in varying sizes and shapes.

S.No Rice Description Image

1. Admixture Mixture of lower quality rice.

2. Organic Material which are eatable.

3. Large broken Milled rice with length less than

three quarters but more than one

quarter of the average length of the

whole kernel.

4. Small broken Milled rice with length less than one

quarter of the average length of the

whole kernel.

5. Sound Only these types of kernels have the

required quality. They are having

standard length and width.

Page 10: Report on Rice Project

6. Red Red portion on the surface of rice.

7. Damaged Rice which is discoloured form the

tip of the rice kernel.

8. Discolour Yellowish colour on the surface of

the rice.

9. Chalky kernels Which have characteristics similar to

those of sound kernels, but they have

a large chalky portion in the centre,

back, or belly endosperm that affects

their appearance and hence consumer

acceptance.

10. Inorganic Material which is not rice, e.g. stones

etc.

2.4 Components

1. Flat bed Scanner

Flatbed scanner (FBS) will be used for acquiring rice sample image for the

determination of the size, shape, distribution of rice for the determination of the amount

of broken rice kernels. A standard flatbed scanner also called desktop scanner to be used

to obtained images of the rice kernels. FBS scanners are the most versatile and commonly

used scanners found in all offices.

Page 11: Report on Rice Project

Flatbed scanner (FBS)

2. Computer

Under develop system is to be incorporated in any existing computer system, that fulfil

the prescribed specifications of the developing system software.

3. Sample Holder

Sample holder is a container to hold rice sample. The base of the holder is transparent

glass. Sample layer of test rice sample is to be lain on this transparent area of holder for

imaging.

Page 12: Report on Rice Project

4. Internet Connection: Internet Connection is needed to interact with the server. After

acquisition of the image the file has to be uploaded to the web server using Internet

Connection.

2.5 ARCHITECTURE OF THE SYSTEM

a) Basic Steps: The basic steps in the classification and grading of rice are as follows:

1. Scan the sample.

2. Upload the image.

3. Feature calculation.

4. Grading of rice.

5. Classification of rice.

6. Report Generation.

Page 13: Report on Rice Project

Classification and grading of rice basic steps

b) Process to know the class and grade of rice: The steps involved in classification of

rice are-

Put the sample holder on the scanner.

Put the sample rice on the sample holder.

Scan the sample.

Open the Internet Connection.

Enter through authenticated login id.

Upload the acquired image.

Image will be sent to Application Server automatically.

Binariesation of the image.

Watershed the image.

Feature Extraction.

Report generation.

Wrapping up all the results and sending back to web server.

Download the results.

c) Phases of the project

Scanning

Classification of rice

Grade of rice

Feature calculation

Grading of rice

Input Sample

Report Generation

Uploading

Page 14: Report on Rice Project

According to the analysis of the requirement of the candidate system and the process, the

basic phases were decided for the system. In the designing of the system modules, these

phases will be consulted. There are following modules in the project:

I. Client Server Communication Module: In this module, the website is to be

designed. It should be highly interactive in nature. The purpose behind designing

of the User Interface is as follows:

1. It should be User-Friendly and easily understandable.

2. It should be fully interactive.

3. The User should be alerted with proper messages about the errors and the

messages should be easily understandable and should guide the user right way.

4. The client/user can easily upload the image and download the results and user can

also download its pervious results.

II. Image acquisition Module: In Image Acquisition Module, image is acquired by

scanner. A standard flat bed scanner also called desktop scanner is used to obtain

images of the rice kernels The FBS is used with a sample holder. The sample

holder is made of transparency and a black sheet joined together at one end. The

black sheet used is dull; this is to avoid the effects of reflection. Transparency was

used so that the glass of the flat bed scanner does not get damaged due to

continuous use to place rice kernels. FBS are the most versatile and commonly

used scanners. The interface between the scanner and PC is provided through

USB port. It acquires image of the rice sample from the scanner and provides

input to the image processing module.

III. Image processing Module: To perform image processing on an image, you need

an image processing control, a system control, and at least one image control. The

first step in image processing is preprocessing the image which includes various

processing operations like binariesing, smoothing, watershed are performed on

the image.

IV. Binarization: A binarization method binaries an image by extracting lightness as

a feature amount from the image. It reduces an image to monochrome image

(binary image). To identify the rice kernel in the FBS image, a binary image can

be prepared by defining a range of brightness values in the original grey scale

Page 15: Report on Rice Project

image as shown in figure below belonging to the foreground (rice kernels) and

rejecting all of the other pixels to the background. This operation is called

threshold.

.

Rice Grain on the Scanner (real Image)

This process is done after scanning of image in order to easily differentiate rice grains

from background. For Binarization, thresholding is done in which one threshold value is

set. All values above that threshold will be outputted as one (1) and values below

threshold are outputted as zero (0).

V. Water shedding: After thresholding the aim is to separate the joined rice kernels if any.

This is done by applying water shedding on the image. Watershed transformation is

applied in conjunction with other processing operations to separate blobs from each

other. A minimum in the image is defined as a pixel or a set of connected pixels that is

lower in value (or elevation) than all its neighboring pixels. During water shedding color

is extracted and in the image each blob is separated from other by removing border blobs.

Watershed transformation, as shown in figure below, is applied in conjunction with

other. When two or more blobs touch each other then it becomes difficult for the system

to classify them because the system consider them as one blob due to which its

Geometrical parameters increases, which may not lie in the normal range, hence that

cannot be classified. This problem is water shedding which needs to be overcome. This

Page 16: Report on Rice Project

watershed transform is then added with the original image to separate each rice kernels,

as shown in the figure. The Figure highlights the watershed implemented to separate the

joining blobs. Watershed is able to separate only those blobs in which there is neck

formation at the point of contact. This watershed image is anted with the gray scale

image to remove border Blobs, these Border blobs are removed to separate the grains to

extract red, green and blue color components.

VI. Feature Extraction Module

Blobs are areas of touching pixels that are in the same logical pixel state; this is called the

foreground state, while the alternate state is called the background state. Blobs are

considered to consist of either zero or non-zero pixels, depending on the foreground

setting. Feature extraction is required for both classification as well as grading. Feature

extraction includes both Geometrical Features (like Area, Perimeter, Compactness,

Roughness, Elongation) and Color Features(such as Red (%),Discolor (%),Chalky

(%),Damaged (%),Sound (%)).

Figure: Watershed Transformation image

Figure: Touching blobs in a binary image

Page 17: Report on Rice Project

VII. Classification at grain level

Next step after pixel level classification is grain level classification. In this, classification

is done on the basis of geometrical and color parameters. In geometrical features length,

breadth and area of each grain has been taken and in color features sound, chalky

(whiteness), discolor (yellowish), and red color has been considered. Output classes are

admixture, red, discolor, chalky, organic, small broken, big broken, sound and inorganic.

The range selection is done with the help of graphs obtained by the excel sheets of

different samples of a particular class of rice and then taking into account the parameters

on which that particular class depends.

VIII. Creation of Report and make it available for the client

Next step is to create a report in the form of .html file with all the classification details of

the file with more interactive way. Wrapping up all the files used under processing with

the output files as excel and binary images and upload it to web server and enable the

availability to the client.

2.7 PARTIES ENVOLVED

S NO. TYPE USER1. End User Mark fed, Hafed, Apeda, Government of India, CRRI,

Figure : After and Operation of watershed and original image

Page 18: Report on Rice Project

Cuttak, DRRI Hyderabad2. Clients Not Known

Introduction to the Existing System

3.1 Overview of the existing system

Existing System was a desktop application which can classify the rice using Rule

Based Testing. It’s a

It can’t work over the network, and not applicable to provide services.

This application has several restrictions like:

It cannot be given to client for services because several backhand software’s need

to have a licensed like Matrox Imaging, etc.

Under Rule based testing it can tell the results in between 50 to 60 percent correct.

Some snapshots for the existing system are:-

Figure: Main Form for Existing System

Page 19: Report on Rice Project

Figure: Image Acquisition

Page 20: Report on Rice Project

Figure: Output for Existing System

3.2 Problem Assigned

There are many features that are required to be added in the existing web application for

rice classification. There are changes that are needed to be made. These are:-

1. Upload the image along with username and a token along with it for recognition.

2. Work on logout button, so that after logout back button get disable.

3. User can download the required result.

4. Error handling- server send massage to client if wrong image is uploaded.

Page 21: Report on Rice Project

Preliminary Survey and Feasibility Study

An analysis model that is a part of the requirements phase is necessary as the first step for

implementing the user requirements. A systematic investigation of the system was carried

out to determine the functions of the system and how they relate to each other and to any

other system.

One of the most important factors in system analysis is to develop good understanding of

the system and its problems that enables the designers to identify the correct problems,

suggest realistic solutions for them and also develop solutions to satisfy the users thus

making the system acceptable in the organization. Based on the observations made,

requirement specification was prepared and the approval from the higher officials and

approved by the project leader.

4.1 System Objectives

The main objective of the project is to study the requirements of the user, design

a system and implement the system

To study the existing system and conduct the requirements study, then determine

the activities and procedures to be computerized.

To enable the user to upload the image over client server architecture. To make

available the end report to the user so that he can download it.

To make the web server.

4.2 Scope

The server based system with ‘knowledge and data’, can provide sample testing

over internet, leading to national ‘uniform procurement specifications and uniform

testing’. More frequent, more locations and more people can connect to the system,

Page 22: Report on Rice Project

submit sample by employing their own scanner, computer and internet for certified

report.

Manual inspection is very laborious, requires trained personnel and results in a

significant amount of incorrect classified rice. It can calculate microscopic features of

rice which cannot be distinguished visually by human eye very accurately.

4.3 Feasibility Study

When complex problem and opportunities are to be defined, it is generally desirable to

conduct a

Preliminary investigation called a feasibility study. A feasibility study is conducted to

obtain an overview of the problem and to roughly assess whether feasible solution exists

prior to committing substantial resources to a project. Every project is feasible if given

unlimited resource and infinite time. Precious time and money can be saved and untold

professional embarrassment can be averted if an ill conceived system is recognized early

in the definition phase. So a detailed study is carried out to check the workability of the

system. Feasibility study is undertaken to evaluate its workability, impact on the

organization, ability to meet user needs, and effective set of resources. The primary

objective of a feasibility study is to assess three types of feasibility.

1) Technical feasibility: can a solution be supported with existing technology?

2) Economical feasibility: is existing technology cost effective?

3) Operational feasibility: will the solution work in the organization if

implemented?

4.3.1 Technical Feasibility

A systems development project may be regarded as technically feasibility or

‘practical’ if the organization has the necessary expertise and infrastructure to develop,

install, operate and maintain the proposed system. Organizations will need to make this

assessment based on:

Knowledge of current and emerging technological solutions.

Page 23: Report on Rice Project

Availability of technically qualified staff in house for the duration of the project

and subsequent maintenance phase.

Availability of infrastructure in house to support the development and

maintenance of the proposed system.

Where necessary, the financial and/or technical capacity to procure appropriate

infrastructure and expertise from outside.

4.3.2 Economic Feasibility

A systems development project may be regarded as economically feasible or

‘good value’ to the organization if its anticipated benefits outweigh its estimated costs.

These costs may include the time, budget and staff resources invested during the design

and implementation phase as well as infrastructure, support, training and maintenance

costs incurred after implementation.

4.3.3 Operational Feasibility

A systems development project is likely to be operationally feasible if it meets

the ‘needs’ and expectations of the organization. User acceptance is an important

determinant of operational feasibility.

The feasibility study of the proposed system has been carried out in all the three areas.

Technical Feasibility: The proposed system can be easily developed using

resources available in the organization. Hence it is technically feasible.

Economical feasibility: The proposed system can be easily developed using the

resources available in the organization and they do not invest in procurement of

additional hardware or software. The cost of developing the system, including all

the phases have been taken into account and it is strict minimum. Hence the

system is economically feasible.

Operational feasibility: The system has been developed after extensive discussion

with the end user and all the operational requirements has been taken into account

during the planning and implementation stages. Hence the system is operationally

feasible.

Page 24: Report on Rice Project

System Requirement

5.1 Hardware Requirements

S.NO. NAME HARDWARE

1. Scanner Type Flatbed

2. Maximum scan size 11X9 inches

3. Interface USB

4. Optical Resolution 300 dpi

5. Illumination Reflection

6. System should have 128MB RAM

5.2 Software Requirements

S. NO NAME SOFTWARE

1. Database Tools used Excel

SQL SERVER

2. Development Language Visual Basic.Net

Asp.net

VC#.net

3. Libraries used Matrox Imaging Library (MIL)

Neuro Solutions

CGZIP Library

Imaging for windows by

eiStream.

Excel

Page 25: Report on Rice Project

Excel is an electronic spreadsheet program that can be used for storing; organizing and

manipulating data. It is a table which stores various types of data .The data is arranged in

the rows and columns. It has a number of built in features and tools, such as functions,

formulas, charts, and data analysis tools that make it easier to work with large amounts of

data.

Visual Basic.Net

Visual Basic (VB), formerly called Visual Basic .NET (VB.NET), is an object-oriented

computer language based on the .NET Framework. The .NET Framework provides a

managed execution environment, simplified development and integration with a wide

variety of programming languages. The key components of .NET Framework are the

Common Language Runtime (manages the execution of code & provide different

services like garbage collection etc.) and .NET Framework Class Library.

Matrox Imaging Library (MIL)

Matrox Imaging Library (MIL) is a comprehensive collection of software tools for

developing image analysis, machine vision, medical imaging and video analytics

applications. The toolkit features interactive software and programming functions for

image capture, processing, analysis, annotation, display and archiving. It consists of both

systematic and random tests, verifies the accuracy, precision, robustness, and speed of

image processing and analysis operations.

These tools are designed to enhance productivity, thereby reducing the time and effort

required to bring your solution to market.

Following is the list of Active MIL controls:

Image Control: allows allocating and operating on images. These operations

include loading an image from file and transferring image data.

Blob Analysis control- Allows you to identify connected regions of pixels

(blobs) within an image, and then calculate features of these blobs.

Page 26: Report on Rice Project

Image processing control- Allows you to smooth, accentuate, qualify, or modify

selected features of an image using Active MIL processing capabilities.

Graphic Context control- Allows you to annotate or alter images with text, as

well as basic graphics, such as rectangles, arcs, lines, and dots.

System control- Allows you to set up the system on which to run an application. It

also allows you to inquire about system-specific attributes, such as the number of

digitizers supported by the system.

Neuro Solutions

Neuro Solutions is the premier neural network simulation environment. A neural network

is an adaptable system that can learn relationships through repeated presentation of data,

and is capable of generalizing to new, previously unseen data. Some networks are

supervised, in that a human must determine what the network should learn from the data.

Other networks are unsupervised, in that the way they organize information is hard-coded

into their architecture. In classification, the objective is to assign the input patterns to one

of several categories or classes, usually represented by outputs restricted to lie in the

range from 0 to 1, so that they represent the probability of class membership. It uses the

back-propagation through time (BPTT) algorithm. At the core of neural computation are

the concepts of distributed, adaptive and nonlinear computing. Neural networks perform

computation in a very different way than conventional computers, where a single central

processing unit sequentially dictates every piece of the action.

icrosoft SQL Server™ 2008

SQL Server is an SQL-compliant RDBMS. SQL-compliant means that it uses the ANSI

(American National Standard Institute) version of Structured Query Language or ‘SQL’.

SQL is a command that allows us to modify or retrieve information from the database.

SQL Server is designed to store data in the central location (the server) and deliver it on

demand to numerous other locations (the client).

Page 27: Report on Rice Project

System Design

6.1 FLOWCHART:-

Page 28: Report on Rice Project

6.2 E-R Diagram:-

6.3 High Level Design

In the high level design, the program is divided into two parts. Client-Server

communication is developed in asp.net in C# language. This provides the facility of

image uploading and report downloading.

Page 29: Report on Rice Project

Image processing module is developed in VB.net. This will analyze the uploaded image

on server and will generate the corresponding output.

6.4 Data Flow Diagram

Server runs the executable file of image analysis module (developed in VB.net) as a

background process. Executable program get the physical path of uploaded image as an

argument and it will save classification result in .zip file format and colour watershed

image on disk. Client can download processed image and report.

Level 0

Figure: High Level Design Overview

Online Classification of Rice using Image

Processing

Client-Server Communication at

Web Server

Image Processing at Application Server

Online Classification of Rice using Image

Processing

Online Classification of Rice using Image

Processing

Client-Server Communication at

Web Server

Online Classification of Rice using Image

Processing

Client-Server Communication at

Web Server

Client-Server Communication at

Web Server

Client-Server Communication at

Web Server

Client-Server Communication at

Web Server

Image Processing at Application Server

Online Classification of Rice using Image

Processing

Image Processing at Application Server

Image Processing at Application Server

Page 30: Report on Rice Project

Level 1

6.5 What at server side going on

ClientClient ServerServer

Image Processing and Report Generation

Image Processing and Report Generation

Image StorageImage Storage

ReportReport

Requested Page

Image to Upload

Request for Page

Processed Image and Classification Result

Classification result in format of zip folder

Temporary Images

Start process

Page 31: Report on Rice Project

DFD for Image Processing and Report Generation

Figure: Data Flow Diagram

Image Pre-

Processing

Image Pre-

Processing

ThresholdThreshold

Geometrical Parameter Extraction

Geometrical Parameter Extraction

Color Parameter Extraction

Color Parameter Extraction

Neural based

Classification

Neural based

Classification

Report Generatio

n

Report Generatio

n

Image StorageImage

Storage

ReportReport

Color FeatureGeometrical Feature

.zip File

WatershedWatershed

Uploaded Image

Blob

Level 2

Page 32: Report on Rice Project

System Implementation

7.1 PROJECT DESCRIPTION

“Web Application for Rice Classification” is developed for providing

online service for the classification of rice grains. The project work is divided into two

main modules with several sub modules are as following:

1. Client Server Communication Module

2.1 Registering the Client.

2.2 Providing Login Page.

2.3 Upload and download Form.

2.4 Alteration in password and his submitted details.

2.5 Administrator Login Page.

2.6 Controlling all processes by the Administrator.

2. Application Server Side Module

1.1 Triggering Image from Web Server

1.2 Copying Image from Web Server.

1.3 Purge the duplicate files from the Web Server

1.4 Binarizing the Image.

1.5 Smoothening the Image.

1.6 Water shedding the Image

1.7 Feature Extraction into Excel.

1.8 Final Report Generation.

1.9 Wrapping all the required files.

1.10 Saving the Zipped Output File to Web Server.

7.2 Client-Server Communication Module:

The GUI is designed using ASP.NET. This module works on client side. In this, clients

upload the image (scanned) and send to server and getting the results including excel

sheet which classified the rice in different classes, watershed image, original image

and .html format which is brief report including output chart.

Page 33: Report on Rice Project

7.2.1 CLIENT SIDE INTERFACES

(1) Login Form:

In this form user has to fill his unique username and password and as we store the

username and password in a database table name as tbclient. And there is a stored

procedure Clientchecksp checks the password in database on click of login button.

If username and password were correct it goes to next form that is image upload

otherwise a error message is appear on click of login button

Page 34: Report on Rice Project

.

(2) Image Upload Form: In this form user upload the scanned image of rice sample, on the

click of the upload button , the Image would automatically get rename and get save in upload

folder. The new name of image will be (ex. If image name =abc.bmp Before uploading ,After

uploading the image name will be username+current date&time+abc.bmp) ,and the new name of

imge would save automatically in database Image processing would start

automatically(Application Server) then result would save in output folder of web server.

> For Downloading the result click on DownloadResult Button.

> For Previous Result Click on PreviousResult Button then Click on Download Button.

(3) Download form: This form displays the results, which is processed by backend processor.

The results have many file like as colour – watershed image, .html and .xls file becomes

available in a single zip folder and user also get the previous result for downloading.

7.3Application Server Side Module

In the processing of the image, the rice classification of grains would be done using

neural testing. The first step for the application server is to create the Shared Input folder at Web

Server. Whenever a file is encountered the file is copied to application server folder for

processing. The below images are of the Input folder of Web Server, where the original image is

saved after uploaded by the client and input folder at application server

Page 35: Report on Rice Project

Figure: Input folder at Remote System (i.e. Web Server)

The next step is the processing of image. The preprocessing of the image includes various

processing operations like binarizing, smoothing, water shedding of image. A binarizing

operation reduces an image to monochrome image (binary image). Binary images are useful

when trying to differentiate the rice kernel from the background and to identify their geometric

features. After performing binarizing the image is as shown below

Page 36: Report on Rice Project

Figure: Binaries Image

After binarizing the Watershed transformation is applied in conjunction with other processing

operations to separate blobs from each other and also label the blobs as shown below:

Page 37: Report on Rice Project

Figure: Labeled Watershed Image

The final report of Rice Classification will be produced in the form of .html file which contains

file name, Information regarding various classes of rice on the basis of Weight in Gms , Weight

in Gms (%), Number of Grains and number of Grains in %.Also contain output chart as shown

below:

Page 38: Report on Rice Project

Figure: Final Result

Page 39: Report on Rice Project

All the files are saved at the output folder of the local system which includes the colored labeled

watershed image; excel file, output chart, html final result, etc.

Figure: Output folder at Local System

After completing the processing of original image all the necessary files and images wrapped in

the zip folder. The zip folder containing all required files is shown as below:

Page 40: Report on Rice Project

Zipped files

After wrapping up the results the result is being saved to the output folder of remote system (i.e.

Web Server).

Output Folder of Remote System

So that the result is to be delivered to the client and client will download the output file as a zip

file containing all desired results.

Page 41: Report on Rice Project

System Testing

Software testing entails running software products under known conditions with defined

inputs and documented outcomes that can be compared to their predefined expectations. It is a

time consuming, difficult, and imperfect activity. As such, it requires early planning in order to

be effective and efficient.

Test plans and test cases should be created as early in the software development process

as feasible. They should identify the schedules, environments, resources (personnel, tools, etc.),

methodologies, cases (inputs, procedures, outputs, and expected results), documentation, and

reporting criteria. The magnitude of effort to be applied throughout the testing process can be

linked to complexity, critically, reliability, and/or safety issues (e.g., requiring functions or

modules that produce critical outcomes to be challenged with intensive testing of their fault

tolerance features).

A software testing process should be based on principles that foster effective

examinations of a software product. Applicable software testing tenets include:

The expected test outcome is predefined.

A good test case has a high probability of exposing an error.

A successful test is one that finds an error.

There is independence from coding.

Both application (user) and software (programming) expertise are employed.

Testers use different tools from coders

Examining only the usual case is insufficient.

In order to provide a through and rigorous examination of a software product,

development testing is typically organized into levels. As an example, a software product’s

testing can organized into unit, integration, and system levels of testing.

Testing

Testing is a phase whose basic function is to detect the errors in the software. Testing is done at

different stages within the development phase. System testing makes a logical assumption that if

all parts of the system are correct, the goals will be successfully achieved. Inadequate testing

leads to errors that may not appear until months later, when correction will be extremely

difficult. Another objective of testing is its utility as user oriented vehicle before implementation.

Page 42: Report on Rice Project

Features to be Tested

Following features are to be tested.

1. All the functional features specified in the requirement document are to be tested.

2. The response time of the algorithms used in the project

3. Behavior of the system under adverse conditions like the case where input to the system that is

rice image is not acceptable to the system. Efficiency of the algorithms used in the project

Approach used for testing

For this project Bottom Approach is used for testing. That is the modules at very bottom, which

has no subordinates, are tested. Then these modules are combined with higher-level modules for

testing.

TEST UNITS AND TYPES OF TESTS APPLIED

Different parts for the fulfillment of the project are:

1. Image uploading.

2. Image Processing.

3. Feature Extraction.

4. Image Statistics, Qualifying Criteria and Data collection.

5. Report Generation.

6. Report Distribution.

8.1 Unit Testing

This is the first level of testing. It is essentially for verification of the code for the project. In

regard to this project following modules are tested as follows:

Image uploading

When the client enters the website for testing his sampled rice, he has to acquire an image from

the flatbed scanner with the specified set of the dimensions of the image required i.e. at least

300dpi image without contrast stretching and must be in the reflective mode and 8-bit grayscale.

The image should fulfill the above requirements. The image should be properly uploaded by the

client to the web server.

Page 43: Report on Rice Project

Image Processing

Once the image of the sample is received from client the image is forwarded to the Application

server for image processing operations such as Binaresation and Water shedding is applied.

Testing is very essential so as to see that image is threshold at a right value. This is very essential

because on this value whole features which are to be extracted are dependent.

Feature Extraction

This module is tested for whether it is able to calculate microscopic angle independent features

such as length, breadth, area, perimeter, convex perimeter accurately and are stored popularly in

the excel sheet or not .Testing is also required in this module as the number of rice blobs are also

calculated in this module .If this module is not tested then our software will not work properly.

So testing of this module is very essential for the working of software.

Image Statistics, Qualifying Criteria and Data Collection

This module is tested so as to analyze various statistical features such as excel generation.

Statistical analysis is done so that some features which are otherwise difficult to understand to

the users can be easily explained. So for proper understanding of the user this module is very

necessary. So testing of this module is important because in this module analysis of color

features is done. For this purpose this module needs testing.

Report Generation and Distribution

This module is tested whether the image is processed and the requires output files are generated

correctly and compress it in a zipped format and whether the result files are send to the right

person or not. So testing is required for this step.

8.2 INTEGRATION TESTING

After each module has been tested separately, all the modules are integrated and tested to check

for their performance. This testing is applied to check the interfaces between the different

modules. The design is tested during this testing.

8.3 SYSTEM TESTING

During this, the entire software is tested. This testing is applied after the implementation of the

system. The system is tested after different varieties of rice sample are scanned. It is tested

Page 44: Report on Rice Project

whether the system works properly or not according to the requirements of the system. It is

tested whether the system generates the accurate grade or class of rice

8.4 PROGRAM TESTING

The program is tested for the two types of errors.

A) Syntax errors

B) Logic errors

During checking the Syntax errors, the program code for the project was to be tested against the

rules of the language. And in Logical errors, the data fields and out-of-range items are tested.

Testing for the “Logical errors” play important role to check the correctness of the different

modules

Page 45: Report on Rice Project

Evaluation

This part will evaluate the system in respect to the requirements specified and determine if it

satisfies the goals specified in the project problem definition.

9.1 SOFTWARE SYSTEM ATTRIBUTES

Reliability:

This provides high degree of reliability. The system results in a significant amount of correct

classified rice kernels. This prototype rice grain quality inspection system demonstrated high

performance comparable to subjective human inspection making it more reliable.

Availability:

System is expected to be available more frequently and more people can connect to the system

by only submitting the sample having their own scanner, computer and internet.

Cost:

The cost of user is negligible as the system utilizes the standard scanner and computer. There

may be only registering fee.

Security:

Only Authorized users after entering a valid username and password can access the site for rice

testing.

9.2 Comparison with Related Systems

A high speed machine vision system was designed to sort rice into sound, big broken

(3/4rth of sound), small broken (1/8th of sound), chalky, red, damaged, discolored, admixture,

organic and inorganic with an accuracy ranging from 87-95%. These methods use a CCD video

camera with illumination source for image processing and analysis. Machine vision system is

relatively expensive, influenced by external light conditions and need an experience person to

setup the system. So we are providing a better alternative by introducing this project.

9.3 Quality Factors

This client-server application is very useful in commercial or any other areas, in which rice is

used. It has many qualities as follows:

Page 46: Report on Rice Project

Eight Visual Grading tests take more than 30 minutes of manual labour. The developed

system does it in a few seconds.

The long process of conducting a test manually does not allow enough ‘repetition’ of a

test often leading to unreliable reporting

The cost to the user is nil as the system utilises the standard scanner and computer. There

may only be licensing fee.

A server-based system with complete ‘knowledge and data’, that can provide sample

testing over the internet, leading to national ‘uniform procurement specifications and

uniform testing’

The same system can be customized to suit export requirements and BIS standards

including annual relaxations applicable to all farmers during bad seasons.

Transparency in the testing procedure among various public and private agencies

More frequent, more locations and more people can connect to the system, submit sample

by employing their own scanner, computer and internet for a certified report.

9.4 Risk Factors

Risk factors are the factors that limit the solution of the problem or can course the system failure

at later stages. Following are the risk factors for this project:

1. Sample placement is time-consuming approximately 3 minutes.

2. Care has to be taken that minimum numbers of grains are joined (less than 5%).

3. The result is sample based and not upon the whole quantity.

4. The performance of the system is dependent upon the sample placed by the user.

Page 47: Report on Rice Project

10. Conclusions

This part has provided an evaluation of the system developed in this project. The evaluation has

tried to unveil both the advantages and disadvantages of the final system and shown how the

different requirements specified have been fulfilled. Additionally ideas for future work have

been provided that can be used for future development. This project has designed and

implemented software to classify the grains of rice using image processing and neural testing

At this point of time, the project is able to do the classification and report generation

of sample rice image uploaded by client. The procedure requires client to have a PC with Flat

Bed Scanner and network connection to the server configured to provide this service. Client has

to upload rice image on the server and they will get the brief and detail report of rice

classification including colored watershed image of rice sample which has numbering on each

rice grain. Detailed report contains all physical and color features of each rice grain along with

class it belongs to. Here classification of rice blobs is done on the basis of Neural based

classification algorithm.

Page 48: Report on Rice Project

Future Enhancement

Fuzzy Network Training method can also be used for this client server application, which

becomes more accurate than Neural Network Training method.

At this point of time, client have to first scan the rice image and send it on the server for

processing, work can be done for opening and handling the client scanner by server

according to requirement of process.

Work can be done for making user interfaces more interactive.

Costing according to classes of rice.

Traffic congestion on the network has been an issue since the inception of the client-

server paradigm. As the number of simultaneous client requests to a given server

increases, the server can become severely overloaded

Page 49: Report on Rice Project

References

1) Books:

VB.net: Complete Reference

HTML: Complete Reference

C#.net: Complete Reference

2) Web and URL’s:

www.asp.net/QuickStart/aspnet/ - 36k

http://www.codeproject.com/

http://support.microsoft.com/kb/318597

www.csharpcorner.com/UploadFile/mahesh/DownloadUsingHTTP12132005012752AM/DownloadUsingHTTP.aspx

http://dotnetslackers.com/Community/blogs/haissam/archive/2007/02/02/Run-Executable-file-in-ASP.NET.aspx

http://www.codeproject.com/KB/aspnet/simpleuploadimage.aspx

www.asp.net/QuickStart/aspnet/ - 36k

www.freevbcode.com/ShowCode.asp?ID=4492 - 50k –

www.sourcecodesworld.com