Open access

Machine Vision System for Automatic Weeding Strategy in Oil Palm Plantation using Image Filtering Technique

Written By

Kamarul Hawari Ghazali, Mohd. Marzuki Mustafa and Aini Hussain

Published: October 1st, 2009

DOI: 10.5772/8215

Chapter metrics overview

3,764 Chapter Downloads

View Full Metrics

1. Introduction

Weeding strategy in oil palm plantation plays a significant role in ensuring greater production yields (Azman et al., 2004). Most of the plantation companies are very concerned with weeding practice to guarantee their crop can produce higher productivity as well as to maintain the oil quality. Current practice of weeding strategy in oil palm plantation involves using labour workers. These labour workers carrying a backpack of herbicide and manually spray the weed in the field. It is known that the manual practice of weeding is very inefficient and dangerous to human beings. At present, herbicides are uniformly applied in the field, even though researchers have shown that the spatial distribution of weed is non- uniform. If there are means to detect and identify the non-uniformity of the weed spatial distribution, then it would be possible to reduce herbicide quantities by application only where weeds are located (Lindquist et al., 1998), (Manh at al., 2001). Consequently, an intelligent system for automated weeding strategy is greatly needed to replace the manual spraying system that is able to protect the environment and at the same time, produce better and greater yields. Appropriate spraying technology and decision support systems for precision application of herbicides are available, and potential herbicide savings of 30% to

75% have been demonstrated (Heisal et. al., 1999).

The proposed method of automatic weeding strategy, using a machine vision system, is to detect the existence of weed as well as to distinguish its types. The core component of the machine vision system is an image processing technique that can detect and discriminate between the types of weed. Two types of weed are distinguished namely as narrow and broad. Machine vision methods are based on digital images, within which, geometrical, utilized spectral reflectance or absorbance patterns to discriminate between narrow and broad weed. There are a few methods that used by a researcher in developing machine vision system for herbicide sprayer. A method which utilise shape features to discriminate between corn and weeds have been proposed by Meyer (1994). Other studies classified the scene by means of color information (Cho et al., 1998). In (Victor et al., 2005), a statistical approach has been used to analyze the weed presence in cotton fields. It was reported that the uses of a statistical approach gave very weak detection with a 15% false detection rate.

In this work, we report the image processing techniques that have been implemented which is focused on the filtering technique as well as feature vector extraction and selection of the weed images. Filter techniques have a very close relation to edge detection. Selective edge detection and suppression of noise has usually been achieved by varying the filter size. Small filter sizes preserve high-resolution details but consequently include inhibitive amounts of noise, while larger sizes effectively suppress noise but only preserve low- resolution details (Basu, 2002). A multi-scale filter function was proposed as a solution for effective noise reduction, and involves the combination of edge maps generated at different filter sizes. Multi scale size of filter function can be used to determine the clear of edge detection. Other research work by Canny (1986), Deriche (1987), Shen (1996) and Pantelic (2007) found that the simplest way to detect object edges in an image is by using low and high pass filters. As mentioned earlier, a weeding strategy is an important issue in the palm plantation industry to ensure that palm oil production meets quality control standards. In this work, we will focus on the commonly found weed types in oil palm plantations which are classified and identified as narrow and broad weed. Figure 1 shows the narrow and broad weed type in different image conditions. These types of image will be processed using filtering techniques and the features will be extracted using the continuity measure feature extraction method.

Figure 1.

Images of narrow and broad weed to be classified


2. Methodology

The advancement of digital image processing provides an easy way to process weed images. There are many techniques of image processing that can be used for detection and classification of weed. One of the common techniques used in image processing is to a filter (Graniatto, 2002). The ordinary filters such as low pass, high pass, Gaussian, Sobel and Prewitt are used to enhance the raw image as well as to remove unwanted signal in the original image (Gonzales, 1992). The existing type of filter was designed for general purpose. Thus, it should be modified to fulfil the targeted application. In this paper, low pass and high pass filters have been used to analyze the weed images and we propose a new feature extraction technique. This is to produce a set of feature vectors to represent narrow and broad weed for classification. Figure 2 shows a block diagram of overall methodology of the image processing techniques proposed.

Figure 2.

Methodology of image processing using filter technique

As the first step, the image of weed is captured using a digital camera in RGB format with 240x320 resolutions. The captured image (offline) is then converted to a gray scale image to minimize the array of image. In the image processing part, it is easier to process the pixels in the two dimensional gray images rather than RGB three dimensional arrays. Additionally, the filter technique involves the convolution method which is very fast to process in two dimensional arrays to produce an output that can be used for feature extraction method. The operation of the filtering technique does not change the size of data images 240x320 and it is only filtering the unwanted signal that was designated by the filter function such as low pass, high pass etc. The large value of data is difficult to analyze and process with the purpose of represent the target object. Therefore, it is important to minimize the size of filter output data by applying a feature extraction technique. The feature extraction technique continuity measure (CM) has been proposed to extract and minimize the size of pixels values of the output filter. The final stage in the image processing method is to classify weed according to its types - narrow and broad weed.

The algorithm development in the image processing method can be considered as the brain of the machine vision system. The algorithms work to detect, discriminate as well asclassify the target object in order to be implemented in a real application. The above methodology discussed a technique to develop software engine. As for implementation in a real application, the software engine needs to interface with the mechanical structure to respond receiving signal of detection. An electronic interface circuit is used to ensure the data can be transfer efficiently. A prototype of a real-time sprayer structure weeding strategy has been shown in Figure 3. The mechanical structure equipped with a webcam camera, two tanks to carry different types of herbicide, an agriculture type of liquid sprayer and an electronic board for interfacing with software engine.

Figure 3.

The sprayer structure of the automated weeding strategy


3. Filtering Technique

The basic concept of the filter technique is to remove noise as well as to detect the edges of an object. Smooth or sharp transitions in an image contribute significantly to the low and high frequency content in the image. A two dimensional ideal low pass filter (also known as smoothing spatial filter) is shown below;

H ( u , v ) = { 1 0      i f i f       D ( u , v ) D 0 D ( u , v ) D 0 E1

Where D0 is a specified nonnegative quantity and D (u,v) is the distance from point (u,v) to the origin of the frequency plane. A two dimensional ideal high pass filter is one whose transfer function satisfies the relation

H ( u , v ) = { 0 1       i f i f       D ( u , v ) D 0 D ( u , v ) D 0 E2

Where D0 is the cutoff distance measured from the origin of the frequency plane and D (u,v) is the distance from point (u,v) to the origin of the frequency plane.

The above low and high pass filters have been modified so that they can be applied to weed images in order to detect its type. The low and high pass filters have been defined with different scaling size of filter function as describe below. Five different size of scale of low and high pass filter (as shown in Figure 4) have been tested on the weed images to find the best scaling factor that can be used for edge detection. Different scale size was used to find the best edge detection that can contribute higher efficiencies in classification of weed type.

Figure 4.

Five scales of low and high pass filter function

Implementing these filters on an image will produce an output in the integer number format. This is shown as a simple example in Figure 5. A matrix image with size 2x3 was created to have horizontal straight line edge. A horizontal filter was applied and produced output in an integer matrix number with same scale size as an input image. The output values of the filter show that the edge horizontal line has been detected with integer numbers -9 and 10. This can also be proved by image sample as shown in Figure 6 which is the straight line of edge that has been detected. In this study, horizontal and vertical edges are very important features as the shape of narrow and broad weed are in this form. The narrow weeds are expected to have more vertical and horizontal edge compared to broad images. This unique feature can be used to distinguish between narrow and broad types of weed.

Figure 5.

Filter output of an simple image matrix

Figure 6.

Filter output of an straight line image

Another step was taken to process the output of the filter in order to get minimum numbers of matrix size. As discussed above, both weed types have unique features that can be used to discriminate between the two types. The unique features can be extracted by applying the continuity measure algorithm. The continuity measure feature extraction technique was developed based on the output filter as shown in Figure 7. We found that the filter was able to detect straight lines which represent the edges of narrow weed inside the image frame. The continuity measure technique can be illustrated as shown in Figure 8. The neighbourhood pixel values can be measured by checking its continuity of 3, 5, 7 or 10 with different angle. CM feature extraction method can be described as follows:

  • Measure the continuity of pixel values using values of either 3, 5, 7 or 10

  • If there is no continuity, the pixel values is set to zero

  • For example, if continuity = 3 with angle 00, the following step will be taken

  • If Xn&Xn+1&Xn+2 = 1, remain the pixel value 1

  • If Xn&Xn+1&Xn+2 ≠ 1 all the pixel values set to 0.

Figure 7.

Filter output of narrow images in different scale

Figure 8.

Continuity measurement technique of output filter

The feature vector is expected to give a significant different of narrow and broad based on their respective output of filter. Feature vector obtained from the CM technique has a different value to represent narrow and broad weed. The following Figure 9 shows a plot graph of narrow and broad feature vectors in two different types of filter. The horizontal filter is a low pass function and its values were plotted against the values of the vertical filter of the high pass function. It was found that the narrow and broad feature vectors were located at two different groups of values and it is easy to discriminate the narrow and broad

weed. A linear classification tool y=mx+c was used to determine the best threshold equation for classification.

Figure 9.

Feature vector of narrow and broad class


4. Result and Discussion

The filtering technique together with feature extraction continuity measure was applied to the narrow and broad weed image. More than 500 images have been tested to verify the classification performance. Figure 10 and 11 shows the original image and the output of low and high pass filters with a function describe in equations (1) and (2). From the figure, it is clearly seen that, the low and high pass filters have detected the edges of the objects in the image. The edge of the object in black and white pixel values has been analyzed using CM technique to extract its feature vector.

Figure 10.

a) Narrow image, (b) Output of vertical filter (c) Output of horizontal filter.

Figure 11.

a) Weed image, (b) Output of vertical filter (c) Output of horizontal filter.

CM technique can be measured in different ways either by neighbourhood or degrees of continuity. Fusion between neighbourhood and degrees has been used to represent the features of weed images. It can be fused such as continuity 3 and degrees 45 or continuity 4 and 90 . All the combination of fusion has been tested and we found that the best parameter to fuse is degrees 45 and continuity 5. The feature vector of narrow and broad weed were distributed separately as shown in Figure 12. Therefore, the development of a linear classification can be easily obtain from the basic equation of y=mx+c.

The overall performance of the techniques for classification broad and narrow weed is depicted in table 1. The CM technique with angle of 45 and scale 4 obtained the best result with a correct classification rate of 98% for narrow and broad weed respectively. Slight drop in the performance was noted when the scale were set to 1, 2, 3 and 5, while maintaining the angle at 45 . We found that the CM technique with angle 45 and scale 4 is the most suitable angle since the best classification result is achieved when this value is used.


5. Conclusion

In image processing analysis, filtering is usually use as an enhancement method to remove unwanted signals. However, the function of filter can be extended as an edge detection of objects in the image frame. In this research, a filter has been used to analyze a weed image for classification purposes. The size of filter has been selected from 1 to 5 in order to find the best edge detection of weed shape. At the feature extraction stage, a measurement of neighbourhood continuity has been used to analyze the filter output. The feature extraction technique namely as continuity measure was manage to reduce the size of output filter and the classification equation was successfully obtained by using linear equation. The filter technique associated with continuity measurement has been tested with a total of 500 sample of weed images to clarify and distinguish its respective type. The narrow and broad weed was successfully classified where the correct classification rate for both weed types was 98%. Finally, the image processing technique that was obtained from the filtering analysis, continuity measure as well as linear equation was used in interfacing with hardware system. Further work is ongoing to integrate the software and hardware system in the machine vision technology and to test it into a real field.

Figure 12.

Distribution of feature vector with CM 45 , continuity 5 and filter scaling (a) 1, (b) 2, (c) 3 and (d) 4

Table 1.

Classification rate of CM 45 at different scale and continuity


  1. 1. Azman I. Mohd A. S. Mohd N. 2004 The production cost of oil palm fresh fruit bunches: the case of independent smallholders in Johor, Oil Palm Economic Journal, 3(1), 1022 1030
  2. 2. Lindquist J. L. Dieleman A. J. Mortensen D. A. Johnson G. A. Wyse-Pester D. Y. 1998 Economic importance of managing spatially heterogeneous weed populations. Weed Technology, 12, 7 13
  3. 3. Manh A. G. Rabatel G. Assemat L. Aldon M. J. 2001 Weed leaf image segmentation by deformable templates. Automation and Emerging Technologies, Silsoe Research Institute, 139 146 .
  4. 4. Heisel T. Christensen S. Walter A. M. 1999 Whole-field experiments with site-specific weed management. In Proceedings of the Second European Conference on Precision Agriculture, 2, 759 768
  5. 5. Meyer G. E. Bargen K. V. Woebbecke D. M. Mortensen D. A. 1994 Shape features for identifying young weed using image analysis. American Society of Agriculutre Engineers, 94: 3019, 1994
  6. 6. Cho S. I. Lee D. S. Jeong J. Y. 1998 Weed-plant discrimination by machine vision and artificial neural network. Biosystem Eng, 83(3), 275 280
  7. 7. Victor A. Leonid R. Amots H. Leonid Y. 2005 Weed detection in multi-spectral images of cotton fields. Computers and Electronics in Agriculture, 47(3), 243 260
  8. 8. Basu M. 2002 Gaussian-based edge-detection methods-a survey. IEEE Trans. Syst. Man
  9. 9. Graniatto P. M. Navone H. D. Verdes P. F. Ceccatto H. A. 2002 Weed seeds identification by machine vision. Computers and Electronics in Agriculture, 33,91 103 .
  10. 10. Gonzales R. C. Woods R. E. 1992 Digital image processing. Addison-Wesley Publishing Company, New York.
  11. 11. Canny J. F. 1986 A computational approach to edge detection. IEEE Transactions on Pattern Analysis and Machine Intelligence (PAMI), 8 (6), 679 698 .
  12. 12. Deriche R. 1987 Using Canny’s criteria to derive a recursive implemented optimal edge detector. The International Journal of Computer Vision, 1 (2), 167 187 .
  13. 13. Shen J. 1996 On Multi-Edge detection. CVGIP: Graphical Models and Image Processing, 58 (2), 101 114 .
  14. 14. Pantelic R. S. Ericksson G. Hamilton N. Hankamer B. 2007 Bilateral edge filter: photometrically weighted, discontinuity based edge detection. Journal of Structural Biology 160, 93 102 .

Written By

Kamarul Hawari Ghazali, Mohd. Marzuki Mustafa and Aini Hussain

Published: October 1st, 2009