47
11 CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN INDIA Sugarcane is the oldest crop known to man and it is a major crop of tropical and sub-tropical regions worldwide. India is the second largest country in sugarcane production in the world. The economic importance of the sugarcane is much more that is signified by its share in gross cropped area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays a major role in the economy of sugarcane growing areas and hence improving sugarcane production will greatly help in economic prosperity of the farmers associated with sugarcane cultivation. In India, many sugar units have transformed themselves into Sugar-Agro industrial Complexes, producing a variety of chemicals and utility products from sugarcane. 1.2 CONSTRAINTS IN SUGARCANE PRODUCTION In India, sugarcane is cultivated over an area of 4.36 million hectare with an annual production of 281.8 million tones and productivity 64.6 t/ha. Even though the yield per hectare of sugarcane in India is increased substantially from 30.9 tons in 1930 to 66.8 tons in 2009, the productivity of sugarcane is still lower when compared to other countries. Sugarcane is a suitable crop for Maharashtra farmers as there is suitable climate for its cultivation. However, Tamil Nadu is now ahead to Maharashtra regarding sugarcane yield. Though Maharashtra covers only 18 % area of total sugar cane cultivation, it contributes to 35 % in the country’s total sugar production because of higher recovery of sugar than any other state. Sugarcane is a long duration crop and faces various abiotic stresses like

CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

  • Upload
    others

  • View
    5

  • Download
    2

Embed Size (px)

Citation preview

Page 1: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

11

CHAPTER 1

INTRODUCTION

1.1 SUGARCANE PRODUCTION IN INDIA

Sugarcane is the oldest crop known to man and it is a major crop of

tropical and sub-tropical regions worldwide. India is the second largest

country in sugarcane production in the world. The economic importance of

the sugarcane is much more that is signified by its share in gross cropped

area. Sugarcane is one the most efficient crops in the world in converting

solar energy into chemical energy. Sugarcane plays a major role in the

economy of sugarcane growing areas and hence improving sugarcane

production will greatly help in economic prosperity of the farmers associated

with sugarcane cultivation. In India, many sugar units have transformed

themselves into Sugar-Agro industrial Complexes, producing a variety of

chemicals and utility products from sugarcane.

1.2 CONSTRAINTS IN SUGARCANE PRODUCTION

In India, sugarcane is cultivated over an area of 4.36 million hectare

with an annual production of 281.8 million tones and productivity 64.6 t/ha.

Even though the yield per hectare of sugarcane in India is increased

substantially from 30.9 tons in 1930 to 66.8 tons in 2009, the productivity of

sugarcane is still lower when compared to other countries.

Sugarcane is a suitable crop for Maharashtra farmers as there is suitable

climate for its cultivation. However, Tamil Nadu is now ahead to Maharashtra

regarding sugarcane yield. Though Maharashtra covers only 18 % area of

total sugar cane cultivation, it contributes to 35 % in the country’s total sugar

production because of higher recovery of sugar than any other state.

Sugarcane is a long duration crop and faces various abiotic stresses like

Page 2: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

12

shortage of water, high temperature during summer, low temperature during

winter, flooding during rainy season, nutritional stress, salinity, alkalinity and

biotic stresses like fungal diseases as brown spot, red rot, smut, wilt, rust,

pokka boeng, grassy shoot disease by photo plasma, bacterial, viral diseases

like sugarcane mosaic virus, yellow leaf syndrome, sugarcane streak mosaic,

pests like sugarcane borer, white fly, white wooly aphid, insects like

sugarcane borer, scales, white fly, white wooly aphid, mille bugs and white

grub which are responsible for reduced sugarcane yield and sugar

productivity. Further, it is also susceptible to many diseases and pests

resulting in lower yield and sugar content hence it has to be replaced.

1.3 BROWN SPOT DISEASE:

This is one of the important foliar diseases of sugarcane. It occurs at the

seventh month from cultivation. The severity of the disease depends up on the

environmental conditions such as high relative humidity, cloudiness and

heavy dews. The disease appears to be more rapidly on following heavy

application of nitrogenous fertilizers. Typical mature eye spot symptoms are

characterized by reddish – brown elliptical lesion (0.5 to 0.4 mm long, 0.5 to

2 mm wide) with yellowish – brown margins. Reddish brown to yellowish

brown runners extend upward from individual lesions towards the leaf apex.

Where multiple infections occur, the entire leaf can become necrotic due to

the combine effect spot and runner formation. The observable eye spot

symptoms are minute, water soaked spots that occur on younger leaves. The

spots become more elongated, resembling the shape of the eye and turns

almost straw coloured in a few days. Finally, the central portion of the spots

becomes reddish brown surrounded by straw coloured tissue. The spots and

runners coalesce together to form large parches of reddish brown withered

tissues. Occasionally the pathogen also attacks the spindle and from there it

moves down the terminal portion of the stalk causing top rot. This is known

Page 3: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

13

as the acute form of the disease. The main reason for choosing this disease for

our detection is, it is the major disease which affects most of the places in

Karnataka and Tamil Nadu.

1.4 IMAGE PROCESSING FOR DETECTION

The image processing is a powerful tool that can be used in agricultural

applications for following purposes: to detect the diseased crop, to quantify

affected area by disease, to find shape of affected area, to determine colour of

affected area and also to determine size & shape of crops. Image information

is crucial in detection of different diseases by the understanding of image

symptoms which is necessary for solution of problem. This proposed system

uses the photographs and textual descriptions. This system consists of

database containing information about different diseases of sugarcane and

different coloured images of these diseases. The textual inputs and images are

used to detect and diagnose the diseases. The users can identify the disease

and choose the right treatment for management of diseases.

In agricultural science, images are the efficient and good source of data

and information. This desktop and web application use digital image

processing to detect, quantify and classify the sugarcane diseases with the

help of images. Diseases occur in any part of sugarcane. Image processing

uses the defected part and detects the disease. Image processing is divided

into three classes namely, classification, quantification and detection. In each

class, they are further divided into subclasses according to the algorithm. This

application is very useful for farmers and can control the loss of production in

the sugarcane.

Image segmentation is a convenient and effective method for detecting

foreground objects in images with stationary background. Background

subtraction is a commonly used class of techniques for segmenting objects of

Page 4: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

14

interest in an image. This task has been widely used. Background subtraction

techniques can be seen as a two-object image segmentation and, often, need to

cope with illumination variations and sensor capturing artifacts such as blur.

Specular reflections, background clutter, shading and shadows in the images

are major factors which must be addressed. Therefore, in order to reduce the

scene complexity, it might be interesting to perform image segmentation

focusing on the object‘s description only. We use a background subtraction

method based on K-means clustering technique which is done in the

MATLAB software. Amongst several image segmentation techniques, K-

means based image segmentation shows a trade-off between efficient

segmentation and cost of segmentation.

1.5 ANDROID STUDIO

Android-based smart phones are in vogue due to the flexibility they

offer for customization. Unlike Apple’s iOS, Google Android offers better

user experience in terms of applications. The Android application

development kit is an open-source Linux-based operation system, which has

its own middleware and key applications. Android Studio is the official IDE

for Android app development, based on IntelliJ IDEA. On top of IntelliJ's

powerful code editor and developer tools, Android Studio offers even more

features that enhance your productivity when building Android apps. Android

studio provides apps with a flexible gradle-based build system and it builds

variants and multiple APK file generation. The code templates in this, helps to

build common app features.

A rich layout editor is built here to support for drag and theme editing

and lint tools are there to catch performance, usability, version compatibility

and other problems. And code shrinking with Pro Guard and resource

shrinking with gradle are provided in the android studio which also performs

Page 5: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

15

built-in support for Google cloud platform such that making it easy to

integrate Google cloud messaging an app engine.

The platform for app development in Android is Java. This means that

you use the Java library and code the applications in Java, C, and C++

programming language. Google provides a Java API to get started and

compiles your files into classes. Java is a commonly used language and

many programmers know it, it can run on a virtual machine (VM) so no need

to recompile for different phones, better security, many development tools

available for Java, and Java is a known industry language with most phones

compatible with it.

Page 6: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

16

CHAPTER 2

SEGMENTATION AND FEATURE EXTRACTION

2.1 IMAGE PROCESSING

Nowadays image processing technique is one the emerging techniques

for the processing of images like segmentation, extraction and comparison.

The human perception has the capability to acquire, integrate and interpret all

the abundant visual information around us. It is challenging to impart such

capabilities to a machine in order to interpret the visual information

embedded in still images, graphics and video or moving images in our

sensory world. It is thus important the techniques of storage, processing,

transmission, recognition and finally interpretation of such visual scenes. The

first step towards designing an image analysis system is digital image

acquisition using sensors in optical or thermal wavelength. A two dimensional

image that is recorded by these sensors is the mapping of three dimensional

visual world. The captured two dimensional signals are sampled and

quantized to yield digital images. Sometimes we receive noisy images that are

degraded by some degrading mechanisms. One common source of image

degradation is the optical lens system in a digital camera that acquires the

visual information. If the camera is not appropriately focused then we get

blurred images. Here the blurring mechanism is the defocusing of the camera.

2.1.1 SEGMENTATION

In such cases, we need appropriate techniques of refining the images so

that the resultant images are of better visual quality, free from aberrations and

noises. Image enhancement, filtering and restoration have been some of the

important applications of image processing since the early days of the field.

Segmentation is the process that subdivided an image into a number of

Page 7: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

17

uniformly homogeneous regions. Each homogeneous region is a constituent

part or object in the entire scene. That is, segmentation of an image is defined

by a set of regions that are connected and non-overlapping, so that each pixel

in a segment in the image acquires a unique region label that indicates the

region it belongs to. It is one of the most important elements in automated

image analysis, mainly because at this step the objects or other entities of

interest are extracted from an image for subsequent processing, such as

description and recognition. For example, in case of an aerial image into two

parts- land segment and water body or ocean segment. Thereafter the objects

on the land part of the scene need to be appropriately segmented and

subsequently classified.

Segmentation can be classified as follows,

i. Region Based

ii. Edge Based

iii. Threshold

iv. Feature Based Clustering

v. Model Based

2.1.1.1 REGION BASED

In this technique pixels that are related to an object are grouped for

segmentation .The thresholding technique is bound with region based

segmentation. The area that is detected for segmentation should be closed.

Region based segmentation is also termed as “Similarity Based

Segmentation”. Hence there will not be any gap due to missing edge pixels in

this region based segmentation. The boundaries are identified for

segmentation. In each and every step at least one pixel is related to the region

and is taken into consideration. After identifying the change in the colour and

texture, the edge flow is converted into a vector.

Page 8: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

18

2.1.1.2 EDGE BASED

Segmentation can also be done by using edge detection techniques. In

this technique the boundary is identified to segment. Edges are detected to

identify the discontinuities in the image. Edges on the region are traced by

identifying the pixel value and it is compared with the neighbouring pixels.

For this classification they use both fixed and adaptive feature of Support

Vector. In this edge based segmentation, there is no need for the detected

edges to be closed. There are various edge detectors that are used to segment

the image.

In the Canny edge detector has some step by step procedure for

segmentation is mentioned, which is as follows:

i. To reduce the effect of noise, the surface of the image is smoothened

by using Gaussian Convolution.

ii. Sobel operator is applied to the image to detect the edge strength and

edge directions.

iii. The edge directions are taken into considerations for non-maximal

suppression i.e., the pixels that are not related to the edges are detected

and then, they are minimized.

iv. Final step is removing the broken edges i.e., the threshold value of an

image is calculated and then the pixel value is compared with the

threshold that is obtained. If the pixel value is high than the threshold

then, it is considered as an edge or else it is rejected.

The technique that is used for segmenting the remote sensing image has

high spatial resolution. The two step procedures for segmentation are

extracting the edge information from the edge detector and then the pixels are

labelled. The advantage of this technique is retrieving information from the

weak boundary too. Spatial resolution for segmentation improves positional

Page 9: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

19

accuracy. Based on the edge flow, the image is segmented. It identifies the

direction of the change in colour and texture of a pixel in an image to

segment. Segmentation can also be done through edges. There will be some

gap between the edges as it is not closed. So, the gap is filled by edge linking.

The broken edges are extended in the direction of the slope for the link to get

the connectivity for segmentation.

2.1.1.3 THRESHOLD BASED

Thresholding is the easiest way of segmentation. It is done through that

threshold values which are obtained from the histogram of those edges of the

original image. The threshold values are obtained from the edge detected

image. So, if the edge detections are accurate then the threshold too.

Segmentation through thresholding has fewer computations compared to other

techniques. Segmentation is based on “histon”. For a particular segment there

may be set of pixels which is termed as “his ton”. Roughness measure is

followed by a thresholding method for image segmentation. Segmentation is

done through adaptive thresholding. The gray level points where the gradient

is high, is then added to thresholding surface for segmentation. The drawback

of this segmentation technique is that it is not suitable for complex images.

2.1.1.4 FEATURE BASED CLUSTERING

Segmentation is also done through Clustering. They followed a

different procedure, where most of them apply the technique directly to the

image but here the image is converted into histogram and then clustering is

done on it. Pixels of the colour image are clustered for segmentation using an

unsupervised technique Fuzzy C. This is applied for ordinary images. If it is a

noisy image, it results to fragmentation. A basic clustering algorithm i.e., K-

means is used for segmentation in textured images. It clusters the related

pixels to segment the image. Segmentation is done through feature clustering

Page 10: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

20

and there it will be changed according to the colour components.

Segmentation is also purely depending on the characteristics of the image.

Features are taken into account for segmentation. Difference in the intensity

and colour values are used for segmentation. For segmentation of colour

image they use Fuzzy Clustering technique, which iteratively generates colour

clusters using Fuzzy membership function in colour space regarding to image

space.

The technique is successful in identifying the colour region. Real time

clustering based segmentation. A Virtual attention region is captured

accurately for segmentation. Image is segmented coarsely by multi

thresholding .It is then refined by Fuzzy C-Means Clustering. The advantage

is applied to any multispectral images. Segmentation approach for region

growing is K-Means Clustering. A Clustering technique for image

segmentation is done with cylindrical decision elements of the colour space.

The surface is obtained through histogram and is detected as a cluster by

thresholding. Seeded Growing Region (SRG) is used for segmentation. It has

a drawback of pixel sorting for labelling. So, to overcome this boundary

oriented parallel pixel labelling technique is obtained to SRG.

2.1.1.5 MODEL BASED

Markov Random Field (MRF) based segmentation is known as Model

based segmentation. An inbuilt region smoothness constraint is presented in

MRF which is used for colour segmentation. Components of the colour pixel

tuples are considered as independent random variables for further processing.

MRF is combined with edge detection for identifying the edges accurately.

MRF has spatial region smoothness constraint and there are correlations

among the colour components. Expectation-Maximization (EM) algorithm

values the parameter is based on unsupervised operation.

Page 11: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

21

Multi resolution based segmented technique named as “Narrow Band”.

It is faster than the traditional approach. The initial segmentation is performed

at coarse resolution and then at finer resolution. The process moves on in an

iterative fashion. The resolution based segmentation is done only to the part

of the image. So, it is fast. The segmentation may also be done by using

Gaussian Markov Random Field (GMRF) where the spatial dependencies

between pixels are considered for the process. Gaussian Markov Model

(GMM) based segmentation is used for region growing. The extension of

Gaussian Markov Model(GMM) that detects the region as well as edge cues

within the GMM framework. The feature space is also detected by using this

technique.

2.1.2 FEATURE EXTRACTION

After extracting each segment, the next task is to extract a set of

meaningful features such as texture, colour and shape. These are important

measureable entities which give measures of various properties of image

segments. Some of the texture properties are coarseness, smoothness,

regularity, etc., while the common shape descriptors are length, breadth,

aspect ratio, area, location, perimeter, compactness, etc. Each segmented

region in a scene may be characterised by a set of such features.

2.1.3 ALGORITHM FOR SEGMENTATION AND FEATURE

EXTRACTION

The algorithm used here is K-means clustering. There are two pre-

processing steps that are needed in order to implement the K-means clustering

algorithm:

i. The phase starts first by creating device-independent colour space

transformation structure. In a device independent colour space, the

Page 12: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

22

coordinates used to specify the colour will produce the same colour

regardless of the device used to draw it. Thus, we created the colour

transformation structure that defines the colour space conversion.

ii. Then, we applied the device-independent colour space transformation,

which converts the colour values in the image to the colour space

specified in the colour transformation structure.

iii. The colour transformation structure specifies various parameters of the

transformation. A device dependent colour space is the one where the

resultant colour depends on the equipment used to produce it. For

example the colour produced using pixel with a given RGB values will

be altered as the brightness and contrast on the display device used.

Thus the RGB system is a colour space that is dependent.

The K-means clustering algorithm tries to classify objects (pixels in our

case) based on a set of features into K number of classes. The classification is

done by minimizing the sum of squares of distances between the objects and

the corresponding cluster or class centroid [10; 7]. However, K-means

clustering is used to partition the leaf image into four clusters in which one or

more clusters contain the disease in case when the leaf is infected by more

than one disease. In our experiments multiple values of number of clusters

have been tested. Best results were observed when the number of clusters was

3 or 4.

Page 13: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

23

CHAPTER 3

PROPOSED SYSTEM

The application developed here takes the diseased image as the input. It

is then segmented using K-means segmentation as it produces tighter clusters

than any other especially when they are globular. The segmented image is

then feature extracted. We have stored the diseased and unaffected image as a

database in the android application. So the extracted image is compared with

that reference image. The results are described as whether the leaf affected

with the brown spot disease or not and the remedies are also displayed.

3.1 BLOCK DIAGRAM

InputImage

ReferenceImage

Fig 3.1 Block Diagram of proposed system.

K-means segmentation

K-means segmentation

Feature Extraction

Feature Extraction

ComparisonResult

Page 14: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

24

3.2 SMART PHONE

A smart phone is a mobile phone with an advanced mobile operating

system which combines features of a personal computer operating system

with other features useful for mobile or handheld use. They typically combine

the features of a cell phone with those of other popular mobile devices, such

as personal digital assistant (PDA), media player and GPS navigation unit.

Most smart phones can access the Internet, have a touch screen user interface,

with either an LCD, OLED, AMOLED, LED or similar screen, can run third-

party apps, music players and are camera phones. Most smart phones

produced from 2012 onwards also have high-speed mobile broadband 4G

LTE internet, motion sensors, and mobile payment. Smart phones are used

everywhere and hence nowadays farmers are aware of that. So the main use of

implementing the app to detect crop disease is that it can reach the farmers

easily

Page 15: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

25

CHAPTER 4

SOFTWARE DESCRIPTION

4.1 MATLAB

MATLAB was written originally to provide easy access to matrix

software developed by the LINPACK (linear system package) and EISPACK

(Eigen system package) projects. It is a high-performance language for

technical computing. It integrates computation, visualization, and

programming environment. Furthermore, it is a modern programming

language environment. It has sophisticated data structures, contains built-in

editing and debugging tools, and supports object-oriented programming.

These factors make MATLAB an excellent tool for teaching and research.

MATLAB has many advantages compared to conventional computer

languages (e.g., C, FORTRAN) for solving technical problems. It is an

interactive system whose basic data element is an array that does not require

dimensioning. It has powerful built-in routines that enable a very wide variety

of computations. It also has easy to use graphics commands that make the

visualization of results immediately available. Specific applications are

collected in packages referred to as toolbox. There are toolboxes for signal

processing, symbolic computation, control theory, simulation, optimization,

and several other fields of applied science and engineering.

It is being used as a platform for laboratory exercises and the problems

classes in the Image Processing half of the Computer Graphics and Image

Processing course unit. It is a data analysis and visualisation tool designed to

make matrix manipulation as simple as possible. In addition, it has powerful

graphics capabilities and its own programming language.

Page 16: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

26

It is started from within the Windows environment by clicking the icon

that should be on the desktop. MATLAB’s IDE has five components: the

Command Window, the Workspace Browser, the Current Directory Window,

the Command History Window and zero or more Figure Windows that are

active only to display graphical objects. The Command window is where

commands and expressions are typed, and results are presented as appropriate.

The workspace is the set of variables that have been created during a session.

They are displayed in the Workspace Browser. The current directory window

displays the contents of the current working directory and th0e paths of

previous working directories.

4.1.1 MATLAB RESULT

Fig 4.1 Input diseased image

Page 17: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

27

Fig 4.2 Image of cluster1

Fig 4.3 Image of cluster2

Page 18: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

28

Fig 4.4 Image of cluster3 (diseased part)

4.2 MATLAB BUILDER FOR JAVA

MATLAB Builder for Java (also called Java Builder) is an extension to

MATLAB Compiler. Use Java Builder to wrap MATLAB functions into one

or more Java classes that make up a Java component, or package. Each

MATLAB function is encapsulated as a method of a Java class and can be

invoked from within a Java application.

4.2.1 USING THE DEPLOYMENT TOOL

The Deployment Tool provides a graphical user interface to Java

Builder. While you are still in MATLAB, issue the following command to

open the Deployment Tool: deploy tool

Use the Deployment Tool to perform the following tasks:

Create a project Add m-file Build Package

Page 19: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

29

4.2.2 REQUIREMENTS FOR MATLAB BUILDER FOR

JAVA

i. System Requirements

ii. Limitations and Restriction

iii. Settings for Environment Variables (Development Machine)

4.2.3 SYSTEM REQUIREMENTS

System requirements and restrictions on use for MATLAB Builder for

Java are as follows:

i. All requirements for the MATLAB Compiler; see “Installation and

Configuration” in the MATLAB Compiler documentation.

ii. Java Development Kit (JDK) 1.8 or later must be installed.

iii. Java Runtime Environment (JRE) that is used by MATLAB and MCR.

4.2.4 LIMITATIONS AND RESTRICTIONS

In general, limitations and restrictions on the use of Java Builder are the

same as those for the MATLAB Compiler. “Limitations and Restrictions” are

given in the MATLAB Compiler documentation for details.

4.2.5 ENVIRONMENT VARIABLES

Before starting to program, the environmental variable must be set on

your development machine to be compatible with MATLAB Builder for Java.

Environment variables are a set of dynamic named values that can affect the

Page 20: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

30

way running processes will behave on a computer. They are part of the

environment in which a process runs.

To set the PATH environment variable permanently on Windows, do:

Control Panel → System → Advanced → Environment Variables.

Specify the following environment variables:

i. JAVA_HOME Variable

ii. Java CLASSPATH Variable

iii. Native Library Path Variables

Fig 4.5 Setting environmental variables

4.2.5.1 JAVA_HOME

Variable Java Builder uses the JAVA_HOME variable to locate the

Java Software Development Kit (SDK) on your system. It also uses this

variable to set the versions of the javac.exe and jar.exe files it uses during the

build process.

Path name : JAVA_HOME

Path value: C:\Program Files\Java\jdk1.8.0_72

Page 21: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

31

4.2.5.2 JAVA CLASSPATH

To build and run a Java application that encapsulates MATLAB the

system needs to find .jar files containing the MATLAB libraries and the class

and method definitions that you have developed and built with Java Builder.

To tell the system how to locate the .jar files it needs, specify a class path

either in the java c command or in your system environment variables. Java

uses the CLASSPATH variable to locate user classes needed to compile or

run a given Java class. The class path contains directories where all the .class

and/or .jar files needed by your program reside. These .jar files contain any

classes that your Java class depends on. When you compile a Java class that

uses classes contained in the com.mathworks.toolbox.javabuilder package,

you need to include a file called javabuilder.jar on the Java class path.

Path name: CLASSPATH

Pathvalue:

C:\ProgramFiles\MATLAB\R2012a\toolbox\javabuilder\jar\javabuilder.jar

4.2.5.3 LIBRARY PATH

The operating system uses the native library path to locate native

libraries that are needed to run your Java class. See the following list of

variable names according to operating system:

Path name: LD_LIBRARY_PATH

Path value: C:\Program Files\MATLAB\MATLAB Compiler

Runtime\v717\runtime;C:\Program Files\MATLAB\MATLAB Compiler

Runtime\v717\runtime\win32;C:\Program Files\MATLAB\MATLAB

Compiler Runtime\v717\sys;

Page 22: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

32

4.2.6 CREATING JAVA COMPONENT

To create a component need to write M-code and then create a project

in MATLAB Builder for Java that encapsulates the code. In general, the steps

are as follows:

1 .Write, test, and save the MATLAB code to be used as the basis for the

Java component.

2. Set the environment variables that are required on a development machine.

3. In MATLAB, issue the following command to open the Deployment Tool:

deploy tool

4. Use the Deployment Tool to create a project that contains one or more

classes.

i. Create the project by clicking the New Project icon in the toolbar.

ii. Specify the project name and location. By default the project name is

assigned to be the name of the package to be created. You can change

the default.

iii. Add class names for classes that you want to create as part of the Java

package

iv. Add one or more M-files that you want to encapsulate in each class.

v. Add helper files as needed to support the classes.

vi. Save the project.

5. Build the package. The build process for a project copies a Java wrapper

class in the \src subdirectory of your project directory. It also copies a .jar file

and .ctf file in the \distrib subdirectory of your project directory. The files in

the \distrib directory define your Java component. The .ctf is a component

technology file, which is required to support components that encapsulate

Page 23: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

33

MATLAB functions when running them on a user machine that does not have

the MATLAB desktop installed.

6 .Test the component and rebuild it as needed. After testing the component

on your development platform, you can reopen the project if necessary and

proceed to the next step.

7. Optionally, create a package to distribute the component and the required

files to developers.

8. Save the project. Java Builder saves the project in a .prj file.

Fig 4.6.Create project for java package

Page 24: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

34

Fig.4.7 Build the Matlab file using deploytool

Fig 4.8 Output folder generated after built

Page 25: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

35

4.2.7 DEVELOPING AN APPLICATION

1. If the component is not already installed on the machine where you want to

develop your application, unpack and install the component as follows: a.

Copy the package that was created in the last step in “Creating a Java

Component” .If the package is a self-extracting executable, paste the package

in a directory on the development machine, and run it. If the package is a .zip

file, unzip and extract the contents to the development machine

2. Set the environment variables that are required on a development machine.

3. Import the MATLAB libraries and the component classes into code with

the Java import function. For example:

import com.mathworks.toolbox.javabuilder.*;

import componentname.classname; or import componentname.*;

4. Use the new function in Java code to create an instance of each classs to

use in the application.

5. Call the class methods with any Java class.

6. Handle data conversion as needed. When invoking a method on a Java

Builder component, the input parameters received by the method must be in

the MATLAB internal array format. To manually convert to one of the

standard MATLAB data types, use MWArray classes in the package

com.mathworks.toolbox,javabuilder, “Using MWArray Classes” for an

introduction to the classes and see

com.mathworks.toolbox.javabuilder.MWArray for reference information for

this class library.

7. Build and test the Java application.

Page 26: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

36

4.2.8 DEPLOYING AN APPLICATION

To deploy application, make sure that the installer that created for the

application takes care of supporting the components created by MATLAB

Builder for Java. In general, this means that the MCR must be installed on the

target machine, in addition to the application files. Users must also set paths

and environment variables correctly. “Deploying to End Users” are given in

the MATLAB Compiler documentation.

4.3 ANDROID STUDIO OVERVIEW:

Android Studio is the official integrated development

environment (IDE) for Android platform development. Based

on JetBrains' IntelliJ IDEA software, Android Studio is designed specifically

for Android development. It is available for download on Windows, Mac OS

X and Linux, and replaced Eclipse Android Development Tools (ADT) as

Google's primary IDE for native Android application development.

To develop an app, Android applications are primarily written in the

Java programming language. During development the developer creates the

Android specific configuration files and writes the application logic in the

Java programming language.

Fig.4.9 Android studio

Page 27: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

37

4.3.1 ANDROID DEVELOPMENT TOOLS

The Android development tooling converts these application files,

transparently to the user, into an Android application. When developers

trigger the deployment in their IDE, the whole Android application is

compiled, packaged, deployed and started. The Android tools provide

specialized editors for Android specific files. Most of Android's configuration

files are based on XML. In this case these editors allow you to switch

between the XML representation of the file and a structured user interface for

entering the data.

4.3.1.1 JAVA DEVELOPMENT KIT

The Java Development Kit (JDK) is an implementation of either one of

the Java SE, Java EE or Java ME platforms released by Oracle Corporation in

the form of a binary product aimed at Java developers on Solaris, Linux, Mac

OS X or Windows. The JDK includes a private JVM and a few other

resources to finish the development of a Java Application. Since the

introduction of the Java platform, it has been by far the most widely used

Software Development Kit (SDK).

4.3.1.2 ANDROID SDK

The Android Software Development Kit (Android SDK) contains the

necessary tools to create, compile and package Android applications. Most of

these tools are command line based. The primary way to develop Android

applications is based on the Java programming language.

Page 28: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

38

SDK Manager can be launched by the following ways:

From the Android Studio File menu: File > Settings > Appearance

&Behaviour > System Settings > Android SDK.

From the Android Studio Tools menu: Tools > Android > SDK Manager.

4.3.1.3 ANDROID DEBUG BRIDGE

The Android SDK contains the Android debug bridge (adb), which is a

tool that allows you to connect to a virtual or real android device, for the

purpose of managing the device or debugging your application.

4.3.2 INSTALLATION OF ANDROID STUDIO

4.3.2.1 ENVIRONMENT VARIABLES

Path name:PATH

Path value: C:\Program Files\Java\jdk1.7.0_80\bin;C:\Program

Files\MATLAB\R2012a\runtime\win32;C:\Program

Files\MATLAB\MATLAB Compiler Runtime\v717\runtime\win32;

4.3.2.2 SYSTEM REQUIREMENTS

Development for Android can be done on a reasonably sized computer.

An SSD speeds up the start of the Android emulator significantly.

i. Microsoft® Windows® 8/7/Vista (32- or 64-bit)

ii. 2 GB RAM minimum, 4 GB RAM recommended

iii. 400 MB hard disk space

iv. At least 1 GB for Android SDK, emulator system images, and caches

v. 1280 x 800 minimum screen resolution

Page 29: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

39

vi. Java Development Kit (JDK) 7

vii. Optional for accelerated emulator: Intel® processor with support for

Intel® VT-x, Intel® EM64T (Intel® 64), and Execute Disable (XD) Bit

functionality

4.3.2.3 ANDROID SDK MANAGER

The Android SDK Manager allows installing specific versions of the

Android API and also to install and delete Android packages.

Select Tools→ Android→ SDK Manager or the SDK Manager icon in

the toolbar of Android Studio to open the Android SDK manager. Press

the OK button to start installation. After the installation is completed the

select option is available. The SDK Platforms tab is used to install API

versions, which the SDK Tools is used to install the development tools.

Fig.4.10 Setting for SDK platforms

Page 30: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

40

Fig.4.11 Setting for SDK tools

4.3.2.4 ANDROID EMULATOR AND AVD

The Android tooling contains an Android device emulator. This

emulator can be used to run an Android Virtual Device(AVD), which

emulates a real Android phone.

AVDs allow testing Android applications on different Android versions

and configurations without access to the real hardware. Virtual devices give

the possibility to test your application for selected Android versions and

specific configurations. During the creation of AVD it is necessary to define

the configuration for the virtual device.

Page 31: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

41

Fig 4.12 Android Virtual Device Manager

Fig.4.13 Configuration of AVD manager

Page 32: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

42

4.3.3 MANAGING PROJECTS WITH ANDROID STUDIO

Step 1: Create a New Project

To create a new project, click File > New Project.

The next window, configure the name of your app, the package name, and the

location of your project.

Fig 4.14 Quick start of android studio

Fig.4.15 creating a new project

Page 33: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

43

Step 2: Select Form Factors and API Level

The next window to select the form factors supported by your app, such as

phone, tablet, TV, Wear, and Google Glass. The selected form factors become

the application modules within the project. For each form factor, we can also

select the API Level for that app.

Fig.4.16 Selecting SDK platform

Page 34: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

44

Step 3: Add Activity:

The next screen to select an activity type to add to y app.This screen displays

a different set of activities for each of the form factors you selected earlier.

Choose an activity type then click Next.

Fig.4.17 Adding an activity to project

Page 35: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

45

Step 4: Configure Your Activity:

The next screen lets you configure the activity to add to your app.

Fig.4.18 Customize the Activity

Page 36: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

46

4.3.4 DEFAULT PROJECT STRUCTURE

At the final stage it going to be a open development tool to write the

application code. Default project structures in android studio are as shown in

fig 3.19 and fig 3.20.

Fig.4.19 Activity_main.xml (default file)

Fig.4.20 MainActivity.xml (default file)

Page 37: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

47

Fig.4.21 Project structure

4.3.5 CREATION OF VIRTUAL DEVICE

Define a new Android Virtual Device (AVD) by opening the AVD

Manager via Tools→ Android→ AVD Manager. Afterwards press

the Create Virtual Device... button.

Fig.4.22 Creating a new Virtual Device

Page 38: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

48

To start the application on your virtual device

Select Run→ Run 'app' to start own application. This opens a dialog in which

you can select your device to deploy application. After choosing AVD,

emulator will be launched to run the code.

Fig 4.23 Starting of the AVD

Fig.4.24 Choose AVD to launch emulator

Page 39: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

49

Fig 4.25. Virtual Device

4.3.6 ADDING JAR FILE TO THE LIBRARY OF ANDROID STUDIO

Following instructions for adding a local jar file as a library to a

module are

1.Create a 'libs' folder in the top level of the module directory (the same

directory that contains the 'src' directory).

2.Add jar file in the output folder of java package and matlab folder

Untitled1->src->untitled1.jar

C:/programfile/Matlab/toolbox/javabuilder/jar/javabuilder.jar

After adding these two jar files, make them as libraryof android studio

Page 40: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

50

Fig.4.26.Project structure after adding jar file

4.3.7 COMPARISON OF IMAGES IN JAVA

The code written in MATLAB is converted into jar file and is added to

the java package as shown above. Now the jar function is called and the

image comparison is made in java. These are some of the ways to compare

the images in java which are as follows.

i. Locating the Region of Interest (Where the Objects appear in the given

image)

ii. Re-sizing the ROIs in to a common size

iii. Subtracting ROIs

iv. Calculating the Black and White Ratio of the resultant image after

subtraction.

It mainly focuses on finding some regions of a given image that

matches with the images in the image store rather than searching for equality

of the objects in given images. There is an algorithm to find similar regions in

Page 41: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

51

a set of images and provides some sample code based on image segmentation

and region manipulation to compare the equality of two images.

1. Pre-process the image, if needed (e.g. to enhance contrast, filter noise,

etc.).

2. Do the image segmentation process in which the image is converted to

regions which contain pixels that are similar to pixels in the same regions and

different from pixels to other regions. This can be done using region-growing,

mathematical morphology, clustering or classification algorithms. With the

regions, create descriptors for them. Descriptors are calculated from the

region and can include shape, area, perimeter, number of holes, general colour

of the region, texture, orientation, position, etc.

3. If needed, do Re-Segmentation of the image, in which regions are

merged if they are considered as belongings to the same object. Note that this

step may require some high-level knowledge of the objects and the task in

general, seldom being fully automatic and often being task-dependent.

4. If needed, filter the regions that seem relevant to the task in hand,

eliminating small regions or regions which are deemed unrelated to the task

(again this may require some knowledge about the task).

5. Store the region's descriptor of the image for further processing. Repeat

those steps for other images.

6. Use the descriptors for comparison of the contents of the images, using

some of many algorithms for pattern matching, classification, clustering,

artificial intelligence and data mining in general.

Page 42: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

52

CHAPTER 5

RESULTS AND DISCUSSION

5.1 SPLASH SCREEN

This is the start-up screen of our project only the display will be shown

here.

Fig 5.1 Splash screen

5.2 MAIN SCREEN

After the start-up screen, the first step for the capturing input image will

be done in this.

Fig 5.2 Main screen

Page 43: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

53

5.3 GETTING IMAGE FROM GALLERY

The diseased image of the sugarcane is initially captured and stored in

the gallery. In this process, the stored gallery image is taken into the app for

comparison.

Fig 5.3 Getting image from gallery

5.4 COMPARISON OF TWO IMAGES

The diseased image is chosen here for comparison. Thereby the remedy

is displayed.

Fig 5.4 Comparing the diseased image with reference image

Page 44: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

54

If the unaffected normal sugarcane leaf is chosen, then the app will

identify that the crop is unaffected.

Fig 5.5 Comparing the unaffected image with the reference image

Page 45: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

55

CHAPTER 6

CONCLUSION

The project mainly focuses on the diseases that affect the

sugarcane leaves. Most of the farmers even now are not aware of the

remedies for the diseases. They use to take the diseased part to the

research university and find out the remedies for it. Mainly to

overcome the inconvenience of the farmers this project provides a

better solution for finding out the corrective measures.

In our project, we have analysed only one disease of the

sugarcane. Further, we can enhance this technology for analysing

many diseases of the crops and thus this is one the smartest

technologies used for controlling the reduction in the agricultural

fields.

Page 46: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

56

CHAPTER 7

REFERENCES

[1] Sanjay B. Patil et al.,” LEAF DISEASE SEVERITY MEASUREMENT

USING IMAGE PROCESSING”,International Journal of Engineering and

Technology Vol.3 (5), 2011, 297-301.

[2] R. Viswanathan, Role of Biocontrol Agents for Disease Management in

Sustainable Agriculture pp. 399–430 © Research India Publications,”Recent

Advances in Sugarcane Disease Management Senior Scientist (Plant

Pathology)”, Sugarcane Breeding Institute, Indian Council of Agricultural

Research, Coimbatore 641007

[3] Li, Q., Wang, M., & Gu, W. (2012, November).” Computer Vision Based

System for Apple Surface Defect Detection”. Computers and Electronics in

Agriculture, 36, 215-223.

[4] Leemans, V., Magein, H., & Destain, M. F. (2009). “Defect Segmentation

on Jonagold‘ Apples using Color Vision and a Bayesian Classification

Method”. Computers and Electronics in Agriculture, 23, 43-53.

[5] Sankarana, S., Mishraa, A., Ehsania, R., & Davisb, C. (2010). A Review of

Advanced Techniques for Detecting Plant Diseases. Computers and

Electronics in Agriculture, 72, 1-13.

[6] H. Al-Hiary, S. Bani-Ahmad, M. Reyalat, M. Braik and Z. ALRahamneh,

Al-Balqa’ Applied University, Salt Campus, Jordan-Fast and Accurate

Detection and Classification of Plant Diseases. International Journal of

Computer Applications Volume 17– No.1, March 2011.

Page 47: CHAPTER 1 INTRODUCTION 1.1 SUGARCANE PRODUCTION IN … · area. Sugarcane is one the most efficient crops in the world in converting solar energy into chemical energy. Sugarcane plays

57

[7] Hana R. Esmaeel Department of Inform. & Comm. Engg., Al-Nahrain

University, Iraq Volume 5, Issue 5, May 2015 ISSN: 2277 128X

“International Journal of Advanced Research in Computer Science and

Software Engineering Research Paper Available online at: www.ijarcsse.com

Apply Android Studio (SDK) Tools “.

[8] R. Viswanathan, G. P. Rao,” Disease Scenario and Management of

Major Sugarcane Diseases in India”, December 2011, Volume

13, Issue 4, pp 336-353 First online: 04 November 2011.

[9]Karl Magnusson, Studsvik Scandpower,Malardalens Hogskola,June 2011”

Integrating Java with a MATLAB environment “