Indian Agro Based Pest Region Detection by clustering and Pseudo- Color Image Processing

DOI : 10.17577/IJERTV7IS030229

Download Full-Text PDF Cite this Publication

Text Only Version

Indian Agro Based Pest Region Detection by clustering and Pseudo- Color Image Processing

Nisha Agrawal1, Sanjukta Urma1, Sonam Padhan1, Ram Ch. Barik2*

Department of Computer Science & Engineering, Vikash Institute of Technology, Bargarh

Abstract: As far as food security, quality of life along with a stable agricultural economy is concerned it is of utmost importance to detect and identify plant pests. It can be achieved through this research project by determining various combinations of K-means clustering algorithm and the correspondence filters. Paddy being a major crop it is necessary to develop appropriate techniques to detect pests thereby optimizing the pesticide use. The application of image analysis in the field of agricultural science is be an effective tool which provides optimal crop protection, improvement in crop productivity along with better management system. To avoid errors and time involved in manual inspections, automation has been favorites to keeping track to pest infections. In this paper, estimation of pest densities in paddy fields through programmed estimation and extraction system is done adapting various image processing techniques. This research not only widens the application of image processing techniques but also provides an effortless, quick and accomplished solution to pest detection and identification in paddy cultivation.

Keywords: HSV (Hue Saturation Value),


    The agricultural land in India comprises a large variety of cultures. Most of the Indian people (70% of total population) connected with agriculture. Establishment of

    Any Image processing problem always based on a raw image to be input after processing by image processing technique yields a knowledge based image from which some valuable information can be predicted and analyzed. Basically a 2-D image mathematically represented as multiplication of Illumination and reflectance property.

    (, ) = (, ) × (, ) (1)

    In equation1 f(x,y), i(x, y),r(x,y)signifies the intensity of the pixel, illumination property, reflectance property respectively. The grey image has 128 × 128, 256 × 256, 512 × 512 resolutions.

    This paper introduces and analyses a novel segmentation method after the basic image processing filtering steps. Empirically the segmentation in this paper was applied to both Binary plane and Color plane.

    In case of binary plane over the black background the foreground object are represented as white object. The image Im(x, y) can be mathematically expressed in equation 2.In the binary image, zero (0) represent as black and one

    (1) represent as white [2].

    modern techniques in agriculture lead to increase in quantity and quality of crop,. But reduction of landscape and harmful pests reduce the production .we cannot increase the

    Im(x,y)={ = 1 for points on the object

    = 0 for background points


    landscape so to stop reduction we have to reduce effects of pests. The disease cause by pests of the plants like tomato, cotton, sugarcane and crop yielding on their leaves and stream by Mealy bug. For harmless cultivation we have to identify the cause of disease in plants for better outcome. Asian people take rice as their important source of food. By

    harmful pests rice may lose its quantity and quality. Farmers

    In case of color plane HSV color based clustering has been done[1].Equation 3 depicts each color component of HSV

    Hue(H) = { if B G}

    360 if B >

    1/2[(R G) + (R B)]

    = cos1 { 2 2}

    face many losses regarding these pest and disease. They applied the traditional method for escaping like regular spray based on schedules. The chemical is harmful to not

    [(R G)

    Saturation(S) = 1

    + (R G)(G B)]


    [min(R, G, B)]

    only to the pests but also to the crops. There is various ways

    ( ) 1

    R + G + B

    to identify these diseases which are very time consuming. In this digital world a technology i.e. solve this complexity is

    Value V

    = (R + G + B) (3)


    Image processing by automatic detection system. Automatic detection is the right way by using image processing for identifying crops.

    In this paper the image take from leaves in crop field were taken and it applied through various processing techniques.


Gouri C. Khadabadi et. Al. gave an overview for detecting diseases in various type of vegetables by using automatic vegetable diseases identification by machine inspection for farmers, gardeners, home makers who cannot afford the services of an expert agronomist [3]. Paul Boissarda et. Al. proposed a cognitive vision system that combines image

processing, learning and knowledge based techniques for early detection of bio agressors[4].

Yan Li Chunlei Xia Jangmyung Lee states the Multi fractal analysis for the segmentation process for the detection of small size pests from the leaf surface which is based on local singularity and global image characters with the regional minima selection stategy [5]. Manisha Bhange et. Al. derive a web based tool that helps farmers for identifying fruit disease based on parameter like color ,morphology, CCV and K-Means clustering which is compared with the trained data sets[6].M.A. Ebrahimi, et. Al. gave a useful method for greenhouse monitoring against pest attacks. Using SVM classification method with different kernel function was used for classification of parasites and detection of thrips which threaten strawberry plants [7].Yue Shi ,et. Al. proposes a spectral vegetation indices-based kernel discriminant approach (SVIKDA) for the detection and classification of yellow rust [8].

    1. Image Acquisition

      Images are procured using high resolution camera and these scanned images are displayed in a two dimensional matrices having pixels as its elements. These matrices are conditional on matrix size and its field of view. Images are stored in Image file and shown as a gray scale image. The approaches of a gray scale image are ranging from 0 to 255, where 0 displays total black colour and 255 displays pure white colour. Even for color images three different color plane used Entries between these ranges vary in intensity from black to white. Even though for acquisition of an image highly sophisticated scanning machine used but still for prediction only one scanned image is not sufficient to diagnose pest in the crops. But scanning the same image may not be same due to camera aperture setting, focal length. So enhancement is the ultimate solution before knowledge based prediction or detection.

      1. Pest Image Dataset Harlequin cabbage bug:

        The other name of Harlequin cabbage bug is the calico bug,

        Spinach flea beetle:

        It is one type of beetle which is glossy bluish black and midriff color is reddish or yellow .it is based on spinach and beet leaves. Plants is main feed of the adult flea beetles, which eating the stems petals and surface of the leaves and also root feed by some flea beetle larvae.

        Colorado potato beetle:

        The other name of Colorado potato beetle is color ado beetle. The main pets of potato crops are the potato bugs or the ten-lined potato beetle, the ten-striped spearman .Its body is yellow/orange color land 10 millimeters long and has significant beetles name Colorado and tomato and eggplant crops are by it.

        Rice bug:

        The rice weevil also known as stored product pets which assault various crops like wheat, rice, and maize. The length of the adult is around 2mm log with a long snout. The color of the bod is black/brown, but we found four orange/red spot are arrange in a cross on the wing cover while we do close examination. Adult rice weevils are to be extend for up to two years. Female lay give egg 300 over their lifetime and 2-6 per day.

    2. Pre-processing Stage for Image Enhancement

      In this stage image is upgraded in the way that finer details are refined and noise is detached from the image. Most commonly used enhancement and noise degradation techniques are accomplished that can give finest possible results. Enhancement will result in more prominent edges and a sharpened image is obtained, noise will be shortened thus dropping the blurring effect from the image. In addition to enhancement, image segmentation will likewise be adapted. This refined and enhanced image will help in detecting edges and refining the superiority of the overall image. Edge detection will lead to the discovery of the exact location of pest region. In general the image smoothing can be mathematically denoted in equation 4.

      fire bug or harlequin. This bug is marked with yellow,

      (, ) =



      , ( + , + )


      orange, and red marking and it is also a black stinkbug which is belong to the pentatomidae family. It is also one




      type of insects known as phytophogous. Along with cabbage it also found in ornamental flower cleome, radishus, broccoli. It is also major pets for this crops. The beginning of blotching at the feeding site. When the people of all age chew on the leaves of plant such as cabbage, broccoli ,kale, turnip, raddish, horseradish ,mustard and rape etc.

      Caterpillar Tomato Worm:

      It is large in size and its body color is green having 4 inches long. It is fat and having five pairs of peolegs. The tomato plants are harm by the Hornworms. They feed on leaves of plant as well as nibble on green unripe fruit. One of the largest caterpillars in America is Hornworms which are impressive in size.

      Where (, ) is enhanced gray level pixel Intensity of image, ,is weighted mask and ( + , + )gray level pixel Intensity function in both spatial x and y coordinate. The value of m and n depends on the mask size of -1 to 1 for 3 × 3 mask, -2 to 2 for 5 × 5 mask and so on.

      1. Image Smoothing

        Smoothing of the image can be done by using any of the low pass linear and non-linear filters such as box filter, weighted average filter, Median filter etc. These filters can remove the noise by smoothing the image texture.

      2. Image Sharpening

        Sharpening of the image can be done by using different high pass filters. Noise is being eliminated by using different low pass filters, the image need to be sharpened because the

        image need sharp edges which will help to identify the boundary of the pest region of interest. Gaussian high pass filter gives very high rated results and used very extensively to enhance the finer specifics of the project.

      3. Histogram Processing

Histogram processing is a important phase of image enhancement to magnify the contrast using Histogram Equalization by calculating () probability density function (PDF) of s which is output or processed gray level and () probability density function of input gray level r. To equally distribute the gray level Cumulative density function (CDF) need to be calculated [5, 6]. Another most important Histogram processing technique is Histogram specification or Histogram Matching to match a target histogram by finding cumulative probability density function of z as () using the equilibrium as . Mathematically Histogram Equalization can be denoted in equation

  1. PDF plotting for Green Plane

    = () = ( ) () ()


    Figure 1 shows the PDF of the grey level of RGB plane of the input image. Again figure 2 show the same image in grey plane or black and white plane.

    1. Colorado potato beetle Larva

    2. PDF plotting of Red Plane

  2. PDF plotting for blue plane

Fig. 1 a) original image containing pest b),c),d) represent the histogram plot of R,G,B plane respectively.

    1. Noise Reduction

      Noise is an external source of unwanted signal diluted or making contamination to the original signal. Pest images is being noisy from different sources which can be reduced using image processing low pass and high pass filter in both spatial and frequency domain. Removing noises using computational approach is still manual but So many automated algorithms were being proposed in recent past.

      Fig.2 specify Colorado potato beetle Larva noisy image.

    2. Segmentation using K-Means Clustering

Clustering is a process of allotment or ordering a given sector unlabelled pattern into a number of clusters such that identical patterns are authorized to a group, which is examined as a cluster. Segmentation is an elementary








Image Acquisition


images. The crucial objective of the image segmentation is

to isolate an image into commonly modified and exhausted

Contrast Stretching, Noise Reduction

regions such that each region of importance is spatially

Object Segmentation In Binary Plane Noise Reduction

Object Segmentation using Clustering in HSV Plane

continuous and the pixels within the region are homogeneous with esteem to a predefined standard. K- means is one of the famous clustering methods because it is simpler and easier in computation. It is the simplest unsupervised learning algorithms that solve the well known clustering problems.

The algorithm calculates the latent features from the input data or signals as a vector space and performs the natural clustering [2]. The points are categorized around centroids

Add Pseudo Color to better Prediction

or cluster centers ii= 1,2, k that are obtained by minimizingthe objective or distance represented in equation



= ( )



Where there are k clusters , = 1,2, , and is the centroid or mean point of all the points .

Let us examine an image with resolution of x × y and the image has to be gathered into k number of cluster. Let p(x,

y) be an input pixels to be cluster and ck be the cluster centres. The algorithm for k-means clustering is resulting as:

  1. Compute number of cluster k and centre.

  2. For each pixel of an image, calculate the Euclidean distance d, between the centre and each pixel of an image applying the relation given below equation 7.

    = (, ) (7)

  3. Assign all the pixels to the closest centre based on distance d.

  4. After all pixels have been selected, recalculate new position of the centre using the relation given below.

    = (, ) (8)

  5. Repeat the process until it captures the resistance or error value.

  6. Reform the cluster pixels into image.


      A cluster can be described as a collection of pixels where all the pixels in assured group defined by identical relationship. Clustering is unsupervised learning because the algorithm naturally classifies objects based on user given condition. Here K-Means clustering algorithm for segmentation of the image is used for pest region detection from the scanned images. The proposed block diagram is as shown.

      Region of Interest (ROI) Pest Detected

      Fig.3 specifies the overall process proposed method using K-means clustering and HSV based segmentation


As pest affects most of the crop in India by virtue of which Farmers community faces major challenges during crop assessment. This paper introduces a novel pest region detection technique over the crop. For better identification pseudo-color image processing methods used to detect pest area.

Fig.4. a) Background of Colorado potato leaf image b) Colorado Potato blob over leaf c) Segmentation in Binary plane d) Segmentation by adding Pseudo-color to Object(paste area) e)Colorado Potato blob over leaf HSV based k-means clustering of object segmentation [8].

Fig 5. a) Background of Spinach Flea Beetle image b) Spinach Flea Beetle blob over leaf c) Segmentation in Binary plane d) Segmentation by adding Pseudo-color to Object (paste area) e)Spinach Flea Beetle blob over leaf f) HSV based k-means clustering of object segmentation[9].

Fig 6. a) Background Harlequin cabbage Bug b) Colorado Potato blob over leaf c) Segmentation in Binary plane d) Segmentation by adding Pseudo- color to Object (paste area) e) Colorado Potato blob over leaf f)HSV based k-means clustering of object segmentation.

Fig 7. a) Background of Caterpillar Tomato worm b)Caterpillar Tomato worm blob over leaf c) Segmentation in Binary plane d) Segmentation by adding Pseudo-color to Object (paste area) e)Caterpillar Tomato worm blob over leaf f) HSV based k-means clustering of object segmentation.

Fig 7. a) Background of Rice Hispa b) Colorado Potato blob over leaf c) Segmentation in Binary plane d) Segmentation by adding Pseudo-color to Object (paste area) e)Colorado Potato blob over leaf f) HSV based k-means clustering of object segmentation[10].


India is a land of cultivation. But almost 40% of harvesting was being reduced due to the effect of pest over crops. Even if there are many pesticides were being evolved for those pests but detecting the pest using high end video objects tracking and Image processing methods helps immensely to Agriculture domain. In this paper the authors have taken a nice attempt to detect the region of pest over the crop, vegetables using segmentation, pseudo-coloring approach. K-means cluster portioned the object from background first by adding Hue, Saturation, Value (HSV) based color segmentation. The detection is done in two fold process first pest is segmented from background in Binary plane then a pseudo-color is added to the detected pest region for proper

identification. In the second case HSV based color object segmentation is processed. As this paper gives a unique approach of clustering based pest detection and identification method.


  1. Rupali Patil, Sayali Udgave, Supriya More, Dhanashri Nemishte, Monika Kasture, Grape Leaf Disease Detection Using K-means Clustering Algorithm. International Research Journal of Engineering and Technology, Volume: 03 Issue: 04


  2. Sunita Agrawal, Bharati Raidu , Kusum Agrawal , R. C. Barik, Prediction of Cancerous Cell by Cluster Based Biomedical CT Image and Analysis, IOSR Journal of Dental and Medical Sciences, Volume 16, Issue 2 Ver. IV (February. 2017), PP 67-73.

  3. Gouri C. Khadabadi, Vijay S. Rajpurohit, Arun kumar ,V.B. Nargund, Disease Detection in Vegetables Using Image Processing Techniques: A Review, International Journal of Emerging Technology in Computer science &Electronics, Volume 14,Issue 2-APRIL 2015.

  4. Paul Boissard, Vincent Martin, Sabine Moisan, A cognitive vision approach to early pest detection in greenhouse crops, computers and electronics in agriculture.

  5. Yan Li Chunlei Xia Jangmyung Lee, Detection of Small- sized Insect Pest in Greenhouses Based on Multi fractal Analysis, International journal for Light and Electron Optics(2015).

  6. Manisha Bhange, H. A. Hingoliwala, Smart Farming: Pomegranate Disease Detection Using Image Processing, Second International Symposium on Computer Vision and the Internet (VisionNet15).

  7. M. A. Ebrahimi, M. H. Khoshtaghaza, S. Minaei, B. Jamshidi, Vision-based pest detection based on SVM classification method, Computer and Electronics in Agriculture 137(2017)52-58.

  8. Yue Shi, Wenjiang Huang ,Juhua Luo, Linsheng Huang, Xianfeng Zhou, Detection and discrimination of pests and diseases in winter wheat based on spectral indices and kernel discriminant analysis, Computers and Electronics in Agriculture 141(2017)171-180.

  9. Spinach Flea Beetle image,


  11. Rice Hispa image,

  12. management/insects/item/rice-hispa

Leave a Reply