automatic pest identification using edge detection and colour moments (2)

4
Automatic Pest Identification using Edge Detection and Colour Moments 1 Priyadharshini.E, 2 N.M.Santron, and 3 Prethesh Kumar Bhalotia 1 Student Department of Computer Applications, SSN College of Engineering, Kanchipuram Dt. 603110 [email protected] 2 Student Department of Computer Applications, SSN College of Engineering, Kanchipuram Dt. 603110 [email protected] 3 Student Department of Computer Applications, SSN College of Engineering, Kanchipuram Dt. 603110 [email protected] AbstractThe main aim of this paper is to develop a model for pest identification in agricultural crops. Using this model, the user can identify the pest incidence on it and can obtain solutions for its control. The model is divided into two modules namely: edge detection and colour matching. The first module focuses on detecting the presence of insect using edge detection and the second module identifies the type of insect using colour matching. KeywordsAgriculture, Edge detection, Canny edge detection, Histogram, Colour Moments I. INTRODUCTION India is an Agriculture based country and seventy percent of the population depends on Agriculture. When pests have an effect on the crops, there will be an incredible decrease in production and finally affecting the national growth directly. In most of the cases pests are seen on the leaves or stems of the plant. Therefore identification of plants, leaves, stems and finding out the pest, percentage of the pest incidence, symptoms of the pest attack, plays a key role in successful cultivation of crops. In order to increase the crop productivity, farmers approach experts to seek their advice regarding the treatment of incidence of pest and suggestions for control. Sometimes they have to go long distances to contact experts. Even though they go such distances expert may not be available at that time. Sometimes, the expert whom a farmer contacts, may not be in a position to advise the farmer with the available information and knowledge. In these cases seeking the expert advice is very expensive and time consuming. In case if the pest incidence is not spotted in the beginning stage, the pests will spread to nearby farms and results in massive destruction. II. PROBLEM SPECIFICATION The proposed system Pest Control on crops is consisting of two modules. They are: Edge detection and colour matching. To proceed with these modules the first step is to pre-process the source image by using Gaussian filter. The features are extracted by using edge detection technique called canny edge detection technique. The second module is the colour matching module where the pest details in the database are compared with the feature extracted data. The whole process of pest detection is shown in figure (1). The source image are taken from Texas university database (Ref: http://insects.tamu.edu/imagegallery/ ). A sample image details were shown in figure (2). The listed insects in figure (2) are Chewing Insects. Figure (1) Pest Detection Model

Upload: meswamy

Post on 26-Mar-2015

227 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Automatic Pest Identification Using Edge Detection and Colour Moments (2)

Automatic Pest Identification using Edge Detection and Colour Moments

1Priyadharshini.E, 2 N.M.Santron, and 3Prethesh Kumar Bhalotia 1Student

Department of Computer Applications, SSN College of Engineering,

Kanchipuram Dt. 603110 [email protected]

2Student Department of Computer Applications,

SSN College of Engineering, Kanchipuram Dt. 603110 [email protected]

3Student

Department of Computer Applications, SSN College of Engineering,

Kanchipuram Dt. 603110 [email protected]

Abstract— The main aim of this paper is to develop a model for pest identification in agricultural crops. Using this model, the user can identify the pest incidence on it and can obtain solutions for its control. The model is divided into two modules namely: edge detection and colour matching. The first module focuses on detecting the presence of insect using edge detection and the second module identifies the type of insect using colour matching. Keywords— Agriculture, Edge detection, Canny edge detection, Histogram, Colour Moments

I. INTRODUCTION

India is an Agriculture based country and seventy percent of the population depends on Agriculture. When pests have an effect on the crops, there will be an incredible decrease in production and finally affecting the national growth directly. In most of the cases pests are seen on the leaves or stems of the plant. Therefore identification of plants, leaves, stems and finding out the pest, percentage of the pest incidence, symptoms of the pest attack, plays a key role in successful cultivation of crops. In order to increase the crop productivity, farmers approach experts to seek their advice regarding the treatment of incidence of pest and suggestions for control. Sometimes they have to go long distances to contact experts. Even though they go such distances expert may not be available at that time. Sometimes, the expert whom a farmer contacts, may not be in a position to advise the farmer with the available information and knowledge. In these cases seeking the expert advice is very expensive and time consuming. In case if the pest incidence is not spotted in the beginning stage, the pests will spread to nearby farms and results in massive destruction.

II. PROBLEM SPECIFICATION

The proposed system Pest Control on crops is consisting of two modules. They are: Edge detection and colour matching. To proceed with these modules the first step is to pre-process the source image by using Gaussian filter. The features are extracted by using edge detection technique called canny edge detection technique. The second module is the colour matching module where the pest details in the database are compared with the feature extracted data.

The whole process of pest detection is shown in figure (1). The source image are taken from Texas university database (Ref: http://insects.tamu.edu/imagegallery/ ). A sample image details were shown in figure (2). The listed insects in figure (2) are Chewing Insects.

Figure (1) Pest Detection Model

Page 2: Automatic Pest Identification Using Edge Detection and Colour Moments (2)

Figure (2) Chewing Insects

A. Moving Object Identification

The insect is identified by finding the moving object in the frame. By calculating the difference of two images captured from same area, moving object can be identified. Once the moving object is identified, extract that area to detect the edges in it. Finding the moving object before applying the edge reduces the noise rate and also the computations.

Let N be the number of frames and n be the frame number. Let ∆ be the difference of frames as follows:

∆ = (n-1)th frame - nthframe In figure (3) the first image refers n-1th frame, second

image refers to the nth frame and the third image refers ∆.

Figure (3) Finding Moving Object

The White part refers the difference between the input images. That refers to the moving object. The area around the moving object should be extracted.

Figure (4) Extracted area around the feature

B. Edge detection

Edge detection refers to the process of identifying and locating sharp discontinuities in an image. The discontinuities are abrupt changes in pixel intensity which characterize boundaries of objects in a scene. Variables involved in the selection of an edge detection operator includes as follows • Edge orientation: The geometry of the operator

determines a characteristic direction in which it is most sensitive to edges. Operators can be optimized to look for horizontal, vertical, or diagonal edges.

• Noise environment: Edge detection is difficult in noisy images, since both the noise and the edges contain high-frequency content. Attempts to reduce the noise result in blurred and distorted edges. Operators used on noisy images are typically larger in scope, so they can average enough data to discount localized noisy pixels. This results in less accurate localization of the detected edges.

• Edge structure: Not all edges involve a step change in intensity. Effects such as refraction or poor focus can result in objects with boundaries defined by a gradual change in intensity. The operator needs to be chosen to be responsive to such a gradual change in those cases. Newer wavelet-based techniques actually characterize the nature of the transition for each edge in order to distinguish, for example, edges associated with hair from edges associated with a face.

C. Canny Edge detection algorithm

The Canny edge detection algorithm is known to many as the optimal edge detector. Canny's intentions were to enhance the many edge detectors already out at the time he started his work. He was very successful in achieving his goal and his ideas and methods can be found in his paper, "A Computational Approach to Edge Detection". In his paper, he followed a list of criteria to improve current methods of edge detection. The first and most obvious is low error rate. It is important that edges occurring in images should not be missed and that there be NO responses to non-edges. The second criterion is that the edge points be well localized.

In order to implement the canny edge detector algorithm, a series of steps we followed based on our application

Insect name Description Damage

adults have forewings which are mottled

grayish-brown and have an expanse of about 1

1/4 inches

hind wings are silver white with a darker front

margin

bright green with dark lateral stripes, the

larvae are about 1 1/4 inches long

adults are grayish moths, about 1/3 inch long

larvae feed on the

underside of

leaves, leaving

shothole type males have the wings with a row of three

diamond-shaped yellow spots where they

meet down the middle of the back

folded wings flare outward and upward toward

their tips

hind wings have a fringe of long hairs

larvae, which rarely exceed 1/3 inch, are pale

yellowish-green with fine, scattered, erect

black hairs over the body

they wiggle actively when disturbed

pupa is in a gauzy sack so thin and loosely spun

that it hardly conceals the pupa about 3/8 inch

long

BEET ARMYWORMlarvae may

defoliate plants

DIAMONDBACK MOTHusually, outer

leaves are

attacked

Page 3: Automatic Pest Identification Using Edge Detection and Colour Moments (2)

i. The first step is to filter out any noise in the original image before trying to locate and detect any edges. And because the Gaussian filter can be computed using a simple mask, it is used exclusively in the Canny algorithm. The Gaussian mask used in my implementation is shown below.

ii. After smoothing the image and eliminating the noise, the next step is to find the edge strength by taking the gradient of the image. The Sobel operator performs a 2-D spatial gradient measurement on an image. Then, the approximate absolute gradient magnitude (edge strength) at each point can be found. The Sobel operator uses a pair of 3x3 convolution masks, one estimating the gradient in the x-direction (columns) and the other estimating the gradient in the y-direction (rows). They are shown below:

The magnitude, or edge strength, of the gradient is then approximated using the formula:

|G| = |Gx| + |Gy| iii. The direction of the edge is computed using the gradient in the x and y directions. However, an error will be generated when sum X is equal to zero. So in the code there has to be a restriction set whenever this takes place. Whenever the gradient in the x direction is equal to zero, the edge direction has to be equal to 90 degrees or 0 degrees, depending on what the value of the gradient in the y-direction is equal to. If GY has a value of zero, the edge direction will equal 0 degrees.

Otherwise the edge direction will equal 90 degrees. The formula for finding the edge direction is just:

Theta = invtan (Gy / Gx)

iv. Once the edge direction is known, the next step is to relate the edge direction to a direction that can be traced in an image. So if the pixels of a 5x5 image are aligned as follows:

x x x x x x x x x x x x a x x x x x x x x x x x x

Then, it can be seen by looking at pixel "a", there are only four possible directions when describing the surrounding pixels - 0 degrees (in the horizontal direction), 45 degrees (along the positive diagonal), 90 degrees (in the vertical direction), or 135 degrees (along the negative diagonal). So now the edge orientation has to be resolved into one of these four directions depending on which direction it is closest to (e.g. if the orientation angle is found to be 3 degrees, make it zero degrees). v. After the edge directions are known, non-maximum suppression now has to be applied. Non-maximum suppression is used to trace along the edge in the edge direction and suppress any pixel value (sets it equal to 0) that is not considered to be an edge. This will give a thin line in the output image. Figure (5) After detecting the edges

III. COLOUR MATCHING

Colour moments are measures that can be used differentiate images based on their features of colour. Once calculated, these moments provide a measurement for colour similarity between images. These values of similarity can then be compared to the values of images indexed in a database for tasks like image retrieval. The basis of colour moments lays in the assumption that the distribution of colour in an image can be interpreted as a probability distribution. Probability distributions are characterized by a number of unique moments (e.g. Normal distributions are differentiated by their mean and variance). It therefore follows that if the colour in an image follows a certain probability distribution, the moments of that distribution can then be used as features to identify that image based on colour.

Page 4: Automatic Pest Identification Using Edge Detection and Colour Moments (2)

MOMENT 1 – Mean :

MOMENT 2 - Standard Deviation :

MOMENT 3 – Skewness :

A function of the similarity between two image distributions is defined as the sum of the weighted differences between the moments of the two distributions. Formally this is:

Where: H , I : are the two image distributions being compared i : is the current channel index (e.g. 1 = H, 2 = S, 3 = V) r : is the number of channels (e.g. 3) Ei1, Ei2 : are the first moments (mean) of the two image distributions

: are the second moments (std) of the two image distributions

: are the third moments (skewness) of the two image distributions wi : are the weights for each moment

IV. CONCLUSION

A novel method has been introduced for identifying the Pest and detecting the pest type. We tested our algorithm for various images. There are some disadvantages while considering light since we are using colour moments. This can be rectified by using histogram methods. Presently we are working on adopting histogram methods.

REFERENCES [1] Ehsan Nadernejad “Edge Detection Techniques: Evaluations and

Comparisons”. Applied Mathematical Sciences, Vol. 2, 2008, no. 31, 1507 - 1520.

[2] Paul Bao, Lei Zhang, and Xiaolin Wu, “Canny Edge Detection Enhancement by Scale Multiplication” IEEE TRANSACTIONS ON PATTERN ANALYSIS AND MACHINE INTELLIGENCE, VOL. 27, NO. 9, SEPTEMBER 2005

[3] Shih Jau-Ling and Chen Ling-Hwei, “ Color Image Retrieval Based on Primitives of Color Moments” Lecture Notes in Computer Science, 2002, Volume 2314/2002, 19-27, DOI: 10.1007/3-540-45925-1_8.

[4] Florica Mindru, TheoMoons, and Luc Van Gool “COLOR-BASED MOMENT INVARIANTS FOR VIEWPOINT AND ILLUMINATION INDEPENDENT RECOGNITION OF PLANAR COLOR PATTERNS” Thesis.

[5] Images taken from the data base of texas university wesite http://insects.tamu.edu/imagegallery/

Image File Mean (R,G,B)

SD (R,G,B)

Skew (R,G,B)

32.2697 27.5776 25.8594

71.6262 64.8439 63.6933

91.0489 86.1210 86.8712

28.8451 27.3571 18.1350

57.9662 52.2783 42.0060

76.6682 69.5969 60.9845

9.3551 8.1644 6.1485

31.4335 28.1354 22.6484

49.9757 45.9737 39.1242

18.3069 16.2749 5.4213

57.6766 51.1715 19.8088

82.9678 73.4773 32.1288

24.2741 19.0499 9.0604

62.0421 49.6161 27.9210

86.2623 70.6894 44.8747

30.1699 24.7666 20.6847

59.6233 49.9581 42.9357

72.3847 61.9873 54.6724

30.0994 24.4765 17.4749

58.8759 50.2513 39.3106

71.1542 64.1398 54.5075