Abstract
This study proposes a new method for detecting curved and straight crop rows in images captured in maize fields during the initial growth stages of crop and weed plants. The images were obtained under perspective projection with a camera installed onboard and conveniently arranged at the front of a tractor. The final goal was the identification of the crop rows which are crucial for precise autonomous guidance and site-specific treatments, including weed removal based on the identification of plants outside the crop rows. Image quality is affected by uncontrolled lighting conditions in outdoor agricultural environments and by gaps in the crop rows (due to lack of germination or defects during planting). Also, different plants heights and volumes occur due to different growth stages affecting the crop row detection process. The proposed method was designed with the required robustness to cope with the above undesirable situations and it consists of three sequentially linked phases: (i) image segmentation, (ii) identification of starting points and (iii) crop row detection. The main contribution is the ability of the method to detect curved crop rows as well as straights rows even with irregular inter-row spaces. The method performance has been tested in terms of accuracy and time processing.
Similar content being viewed by others
Avoid common mistakes on your manuscript.
Introduction
Machine vision systems onboard autonomous tractors, are useful tools for crop row detection in wide-row crops (Emmi et al. 2014; RHEA 2014). Crop row detection is crucial for site-specific treatments (Gée et al. 2008; Montalvo et al. 2012; Romeo et al. 2012; Guerrero et al. 2013). In such vehicles, the navigation is based on Global Positioning System (GPS), although GPS technology provides good accuracy (Emmi et al. 2014) for precise guidance, when small deviations occur, crop row detection is also crucial for correction (Kise and Zhang 2008; Rovira-Más et al. 2003).
Outdoor agricultural environments are affected by uncontrolled lighting conditions (sudden shadows, excessive or poor illumination) affecting the image quality. Also, gaps can be present in the crop rows due to lack of germination, defects during planting or pests/disease. High weed density with similar spectral signature to crops may appear in the inter-row spaces and close to the crop rows producing false widths in the imaged crop rows and hence fake crop rows during detection. Different plant heights and volumes (due to several growth stages) can also create severe problems. Curved crop rows with irregular inter-row spaces, together with terrain side slopes, movements of the tractor in irregular terrains or due to deviations during navigation, add another degree of difficulty. Curved crop rows could be common in some fields due to the land topography. These do not only appear in agricultural terraces, but also in flat parcels of lands with irregular geometry.
Different imaging-based approaches have been conducted for detecting crop rows; some of them combine two or more techniques and all apply prior knowledge mapped as different constraints (number of crop rows to be detected, camera system geometry, inter-row space, expected crop row positions and orientations, intrinsic and extrinsic camera parameters, vanishing point or imaging perspective projection). The following is a list of methods and categories:
-
(a)
Hough transform (HT): initially proposed by Hough (1962) is based on computing accumulations of counts corresponding to crop rows. HT was applied for straight crop row detection in several wide row crops (cauliflowers, sugar beet and wheat) by Marchant (1996), Astrand and Baerveldt (2005), Bakker et al. (2008, 2011), Rovira-Más et al. (2005), Han et al. (2012), Tellaeche et al. (2008a, b). Modifications of the HT have also been applied by Ji and Qi (2011) with a gradient-based Random HT and Gée et al. (2008) with a Double HT. Leemans and Destain (2006) applied previous knowledge with respect to crop row position and direction in order to restrict the search in the Hough space. Jafri and Deravi (1995) developed a method for detecting parabolic curves reducing the size of the accumulator from 4D to 3D for parabolas with different orientations. Inspired by the idea of HT, accumulation of green pixels along lines of exploration where crop rows are expected were the approaches applied by Olsen (1995) and Romeo et al. (2012).
-
(b)
Linear regression: estimations of slope (m) and intercept (b) are obtained for straight crop rows with equation y = mx + b. Least squares is the common method for fitting, sometimes combined with other strategies. Cotton, cereal and maize are crops where this technique has been applied (Billingsley and Schoenfisch 1997; Sogaard and Olsen 2003; Tillett and Hague 1999; Hague et al. 2006; Montalvo et al. 2012; Guerrero et al. 2013; Xue and Ju 2010; Vidović and Scitovski 2014).
-
(c)
Horizontal strips: the image is split into horizontal clusters (multi-Regions Of Interest) of wide row crops (wheat, maize, soybean), where the gravity centers determine the crop rows considering their alignments and fitting straight lines by least squares or applying the HT (Sogaard and Olsen 2003; Fontaine and Crowe 2006; Sainz-Costa et al. 2011; Burgos-Artizzu et al. 2011; Jiang et al. 2015).
-
(d)
Vanishing point: parallel straight crop rows in the 3D scene under perspective projection are imaged intersecting at this point and only these rows are considered in the image (Pla et al. 1997) or combined with the HT (Romeo et al. 2012; Jiang et al. 2016).
-
(e)
Filtering: parallel crop rows in the 3D scene show specific features and patterns after filtering. Hague and Tillett (2001) applied band-pass filtering in the frequency domain. Bossu et al. (2009) and Vioix et al. (2002) applied wavelets and Gabor filtering in the spatial domain.
-
(f)
Stereo vision: crop row location and elevation maps were obtained from two stereo-cameras (Kise and Zhang 2008), sometimes combined with an inertial measurement unit (Rovira-Más et al. 2008). Kise et al. (2005) detected a point per image for guiding navigation in both straight and curved paths.
-
(g)
Regular patterns: template matching with dynamic programming for optimization was applied by Vidović et al. (2016) for straight and curved crop row detection in different crop types (maize, celery, potato, onion, sunflower and soybean) and growth stages. This method can work with an a priori unknown number of crop rows and unknown field geometry. However, it assumes that all the crop rows are equally spaced for each image row. The images originally captured were resized to 320 × 240 pixels in order to reduce the required computation time without significant loss of information. A major resolution (e.g. 640 × 480) increases considerably the execution times, even when a compiled programming language (e.g. C++) is used. Moreover, the performance diminishes on some top crop rows of the image due to the perspective projection (the repetitive pattern is lost on this part of the image) and the significant presence of grass in the image.
According to the above considerations, a new global strategy was designed for detecting both straight and curved crop rows in wide row crops, under the above mentioned adverse environmental conditions and even with irregular inter-row spaces. This is the main contribution of the paper, achieving similar or better performances than other existing strategies proposed for straight and curved crop row detection with regular inter-row spacing, achieving clear improvements in irregular inter-row spaces as well as straight and curved crop rows co-existing in the same image. The proposed strategy exploits the performance of some partial procedures involved in the above referenced methods and includes new procedures integrated in the global strategy to achieve a valid procedure for the maximum number of situations in crop row detection. The main considerations were:
-
(a)
The monocular camera (no stereo vision) system geometry and number of crop rows is known. However, they can vary depending on the machine vision system (sensor and optical system) selected.
-
(b)
The use of multi-ROIs limits the search space in the image, so that the HT works appropriately.
-
(c)
Linear regression is applied for the best fitting of linear/quadratic polynomials to the crop rows, with the assumption that both kinds of crop rows could appear in the same image. This implies that no regular patterns or filters were considered for capturing specific features based on parallel crop row alignments. Moreover, the linear regression does not need a previous estimation about the crop row locations for posterior adjusting, unlike in Guerrero et al. (2013).
Materials and methods
The images used in this study were captured during February and March 2015 on an experimental field of maize at the San Francisco Research Station, Tulcán-Carchi, Ecuador, located 2787 m above sea level (Latitude 0.62ºN and Longitude −77.75ºW), covering an area of two ha. The terrain is irregular with slopes of up to 12°. All acquisitions were spaced approximately six days apart over 45 days, i.e. they were obtained under different environmental lighting conditions and different growth stages of maize and weed plants. Figure 1 shows illustrative examples of the images captured on the field. In (a) low presence of weeds, in (b) different shadows are projected on the ground, increasing the degree of difficulty for the image processing with respect to the greenness extraction, (c) different sizes of maize plants and presence of gaps, with lengths up to 1.20 m in the same crop row. The gaps were due to errors during the sowing or perhaps because the maize seeds had not emerged yet. Furthermore, images acquired under different lighting conditions are shown in (d) clear day, (e) cloudy day and (f) sunny day. The crop rows were spaced 0.85 m, with variations ranging from 0.75 to 0.95 m, particularly in curved crop rows.
The images were obtained with a goPro Hero 3+ black edition color camera, model CHDHX-302 and Manufactured by Woodman Labs, Inc. (USA, California). This device is equipped with an image sensor size 1/2.3″, pixel size 1.55 µm and focal length of 3 mm. The camera was mounted on the front of a New Holland TD90 tractor moving at an average speed of 3 km/h (~0.83 m/s). The machine vision system arrangement onboard the tractor was established at a height of 2 m from the ground and with the optical axis inclined 45º with respect to the ground (pitch angle) and without lateral displacements (i.e. with roll and yaw angles set to 0º). This arrangement together with the focal length and the sensor resolutions allow determining the correspondence of distances and areas in the 3D scene to pixels on the image by applying a simple transformation between co-ordinate systems.
The digital images were captured under perspective projection and stored as 24-bit color images with resolutions of 3000 × 2250 pixels (7 Mpx) saved in RGB color space in the JPG format. Nevertheless, only a reduced area on the ground is of interest either for applying site-specific treatments or as reference for guiding, it is the Region of Interest (ROI). The size and location of the ROI must be specified considering (i) the number of crop rows to be detected and (ii) the imaged ROI that contains enough resolution (in pixels) to identify unambiguously green plants (crop and weed) from soil and also with sufficient points to estimate the equations that define the crop rows. In the proposed approach, four crop rows were selected for detection, which is the number used in the RHEA (2014) project and reported by Emmi et al. (2014) because the implements had four couples of burners, each couple acting on a crop row. Considering the four crop rows and the inter-row space of 0.85 m, the total width of the ROI is 3.4 m. The ROI was set to start at 3 m in front of a virtual vertical axis traversing the center of the image plane in the camera to avoid other elements in front of the tractor being imaged. The length of the ROI was fixed at 5 m to provide sufficient image resolution as explained above and based on camera system arrangements (Pajares et al. 2016). The ROI area in the 3D scene (field) is mapped under perspective projection in an image resolution of 2000 × 650 pixels (width × length), which represents approximately the 20% of the full original image and is always located at the same position inside the image. Figure 2(a) shows the ROI enclosed in the rectangle, which corresponds to the imaged 3D area in the maize field. Nevertheless, the method can be easily adapted for detecting any number of crop rows with the corresponding camera setting. Considering the 5 m length of the ROI and the 0.83 m/s speed, the tractor takes about 6 s to travel that distance when a new image, with the next consecutive ROI, is acquired. The image processing time plus the time spent to activate the implements, when required, must be below 6 s to consider real-time processing.
The images were processed by Matlab from MathWorks (2015), release 8.5 (R2015a), using an Intel Core i7 2.0 GHz processor, 8 GB RAM and Windows 8.1 Pro operating system (64-bits). The proposed algorithm was developed using the graphical user interface development environment (GUIDE) incorporated into Matlab.
Image processing method
The proposed image processing procedure was designed to consist of three main phases: (i) image segmentation, (ii) identification of starting points and (iii) crop row detection. Figure 3 shows the full structure, including the flow chart. This process is illustrated with a representative image showing the results at the different steps.
Segmentation
Because of the need to detect curved crop rows, it is crucial to identify crop plants, with the maximum precision as possible. The precision obtained by Montalvo et al. (2013) achieved around 93% crop identification. This value stablishes a lower limit. So, a detection rate above the 93% is necessary in order to distinguish crop from weed that also have similar spectral signatures. This is because, unlike in methods designed for straight crop row detection, there is no prior information or applicable geometric constraints for estimating crop row positions. Furthermore, crop row discontinuity, together with the random distribution of weeds, reinforces the need to achieve the maximum discrimination level in crops as possible, with the limit of 93% established above. In this regard, the double thresholding proposed by Montalvo et al. (2013), had improved performance against other existing strategies involving supervised learning (Guerrero et al. 2012). Indeed, the double thresholding is dynamically self-adjusting, without learning, to the highly changeable environmental conditions common in agricultural tasks. In the experimental area there exist invasive weeds (e.g. Brassica campestris, Pennisetum clandestinum, Rumex crispus, Calendula arvensis), including some species with green-reddish tones (e.g. Polygonum nepalense). Thus, the double thresholding is well suited for distinguishing these invasive weeds from crop plants. This distinction is of special relevance for detecting curved crop row. Under these considerations, the segmentation phase was designed with the following four subsequent processes:
-
(a)
ROI determination, as specified above. Figure 2a shows a ROI enclosed in the rectangle.
-
(b)
Greenness identification, the ExG index (Woebbecke et al. 1995) was selected because of its performance after exhaustive studies with different indices (Guijarro et al. 2011) without apparent improvements. Figure 4a shows the resulting grayscale image after applying ExG to the ROI.
-
(c)
Double thresholding, based on the Otsu’s method (Otsu 1979), where the first thresholding discriminates green plants and soil and the second, crops and weeds, once it is applied on the discriminated green plants. Figure 2b shows weeds and crops in the ROI and Fig. 4b the resulting binary image after thresholding and once weeds have already been identified. However, some weeds may still remain due to high similarity in spectral signature to crops, Fig. 2a.
-
(d)
Morphological operations, opening (Onyango and Marchant 2003) and majority operations (size 3 × 3) are applied to remove insignificant small patches and spurious pixels over the binary image; Fig. 4c shows the resulting image. A diamond-shaped structuring element for opening with a distance of 2 pixels from the structuring element origin to the points of the diamond suffices.
Identification of starting points
The ROI concept with sub-ROIs and the HT were applied here to determine significant points on the base of the ROI, Fig. 5, which determine the starting points for the crop rows. The HT was used because it is a strong technique in the presence of noise or when there are hidden or incomplete parts in the objects (Cuevas et al. 2010).
Given the binary image, obtained as described in the previous phase containing white pixels that belong to crops and weeds (not identified above, Fig. 2a), a set of four starting points was identified to find the crop rows as follows:
-
(a)
The ROI is divided into two horizontal strips or sub-ROIs of equal size (top and bottom), Fig. 5. The underlying idea is that, with this division, curved and straight crop rows can be approximated by piecewise linear segments into the bottom strip.
-
(b)
The HT was applied to the bottom strip for identifying pixel alignments that represent the expected four piecewise linear segments. The polar representation (Gonzalez and Woods 2010) was used (ρ = x cos θ + y sin θ), where ρ is the distance of the straight line to the origin and θ is the angle that forms the normal with the x-axis. To convert the Hough parameters (ρ, θ) to the parameter space of the image with slope (m) and intercept (b), the following equations were used:
$$m = - \frac{\cos \theta }{\sin \theta },\quad b = \frac{\rho }{\sin \theta }$$(1) -
(c)
Four peaks are identified in the Hough polar space, which determine four m and b parameters associated with four straight lines, which are drawn on the bottom strip on the ROI verifying that they cross both the lower and upper lines in this sub-ROI (Fig. 5). The four lines must contain differences in ρ greater than 300 pixels. This value was obtained considering that the ROI is 2000 pixels width with 500 pixels per crop row on average, i.e. representing a margin of tolerance close to the 40% of the distance in pixels between crop rows, which is the reference percentage value when a different number of crop rows is to be identified. Prior contextual knowledge was also applied restricting the angle θ to range in [−45°, 45°] with sufficient flexibility to consider important crop row inclinations with respect to the horizontal base of the ROI. The HT accumulator was designed with resolutions of 1 pixel and 1° respectively in polar co-ordinates. The intersection points between the detected straight lines with the lower line in the sub-ROI determine the four starting points located at image co-ordinates (x, y) at the base of the sub-ROI. Figure 5 shows four starting points and four piecewise linear segments (reference lines). The slope (m) of each line indicates the direction from which to explore the plants within the bottom strip of the ROI. However, the high presence of weeds and gaps can cause errors in the detection of starting points. Thus, if the number of starting points is less than four, the image is rejected and then a new image is captured and processed.
Crop rows detection
Curved and/or straight crop rows are detected according to the following steps: (a) extraction of candidate points from reference lines; (b) regression analysis for fitting polynomial equations (straight/quadratic) and (c) final crop row selection and verification.
Extraction of candidate points for the crop rows
After the process applied to obtain binary images, like the one shown in Fig. 4c, an extra morphological dilation process is applied to expand the segmented plants (crops and weeds). The structuring element used is a horizontal line 20 pixels in length (parameter w = 20). Dilation can fill gaps in the horizontal direction and the plants appear with a greater amount of green mass. The size of 20 pixels represents an expansion of about 35 mm of plants at the base of the ROI (2000 pixels in 3.4 m) at the 3D scene in the field (not on the imaged ROI) as explained above, which is a suitable value for the set of images tested. Figure 6a shows the result obtained after applying this step on the image from Fig. 4c. Depending on the growth stage of plants, this value can be decreased or increased when weed pressure is high or low respectively.
The full ROI on the dilated image is split into 4 horizontal sub-strips of equal length, obtaining five lines (including upper and bottom edges of the ROI). This number of lines has been established after trial and error for the set of images used for experimentation. Figure 6b shows the five horizontal lines labeled from 1 to 5 from bottom to top in the ROI.
The expected crop rows are sequentially extracted from left to right (labeled from 1 to 4). For each expected crop row, a set of 5 points distributed along potential crop row alignments was obtained. These points are to be located on the horizontal lines labeled with 1 to 5. Points 1 to 3 at the bottom of the ROI (Fig. 7) are obtained by computing inter-sections between the corresponding reference straight line (Fig. 5) and the three horizontal lines (labeled as 1-3) that divide the ROI (Fig. 6b). The remaining two points at the top of the ROI were obtained as follows:
-
(1)
The point B placed at the top edge in the ROI (horizontal line #5) is obtained by extending the reference straight line (points 1, 2 and 3), Fig. 8.
-
(2)
The point A, also placed at the same line #5, Fig. 8, is obtained by shifting the point B to the left of the image a number of pixels along the x-coordinate. In this case, the value has been established in 200 pixels by experimentation and corresponds, on average, to 0.67 m in the 3D scene at this part of the ROI in the maize field (not on the corresponding imaged area), representing the 80% of the inter-crop row space (0.85 m).
-
(3)
From point A to B do (external loop):
-
(a)
A parabola was fitted by applying least squares using the following four points: A, 3, 2, 1 (Figs. 8, 9).
-
(b)
Point C onto the horizontal line #4 was obtained at the intersection between the previous fitted parabola and line #4, Fig. 9.
-
(c)
Point D placed at same line #4 was obtained by adding a threshold to the x-coordinate of point C (Fig. 9). This value was set as a third of the previous displacement between B and A, i.e. 66 pixels corresponding on average to 0.16 m in the 3D scene at this part of the ROI.
-
(a)
From point C to D do (internal loop):
-
(d)
A parabola (line drawn on the upper half in Fig. 10a) was fitted by least squares using five points: A, C, 3, 2, 1. The number of white pixels along the curved segment \(A\bar{C}3\) of the fitted parabola was obtained and points A, C stored.
-
(e)
The x co-ordinate of point C was increased by a threshold set to 20 pixels. This value matches the length of the horizontal structuring element used during the dilation operation applied above in Fig. 6a (parameter w).
-
(f)
Steps (d) and (e) were repeated until the internal loop ends. The internal loop is executed four times, producing four parabolas as shown in Fig. 10b. The four parabolas were estimated considering the five points (A, C, 3, 2, 1), thus they do not match exactly and do not cross these points necessarily.
-
(g)
The x co-ordinate of the point A was increased by a threshold set to 20 pixels as before (parameter w).
-
(h)
Steps from (a) to g) were repeated until the external loop ends. The external loop was executed 10 times and two points A and C (two squares in Fig. 11a) were identified at the top of the ROI (lines #5 and #4 respectively) where the curved segment \(A\bar{C}3\) had the greatest accumulation of white pixels. A number of 50 white pixels was set by experimentation as the minimum amount to be considered as a segment belonging to a crop row. Otherwise, the segment is assumed as large gaps and the image is rejected, then a new image is captured and processed. A set of five significant points (labeled from 1 to 5 in Fig. 11b) distributed along the crop row were identified and stored.
The full procedure (steps 1 to 3a–h) was repeated for the remaining starting points. Figure 12 shows the result of this process (sets of asterisks).
Regression analysis
Once the set of five significant points, along each crop row, were obtained (asterisks in Fig. 12) according to the previous process and containing the corresponding starting point, polynomials of degree one (straight line) and two (quadratic curve) were fitted by least squares technique. The parabola defined by these five significant points distributed along the crop row is adjusted to crop rows in the tested images. Five points proved sufficient to define a curve and adjust properly to the curvature of the crop row. For straights lines, the coefficients to be estimated were the slope (m) and the intercept (b); for the quadratic polynomials, the coefficients estimated were a, b and c, Eq. 2.
Figure 13a, b show the graphics of the two fitted polynomials (straight and quadratic) to each crop row in the ROI. In (a) the polynomials are drawn on the binary image and in (b) on the original color image.
The least squares technique also gives the norm of residues that is a measurement of quality of the fitting. The lower the norm, the better is the fitting. The norm of residues, Eq. 3, is defined as the difference between the experimental values and the ones predicted by the model.
where n is the number of points, x the experimental values and \(\hat{x}\) the predicted ones by the model.
Final crop row selection and verification
Two steps were performed in this process: (i) the selection of rows and (ii) the verification of the selected rows. In the first step, the polynomial (either straight or quadratic) that best fits each crop row was selected. The selection was carried out according to the minimum value of the norm of residues (R), Fig. 13c shows the four curved crop rows selected from Fig. 13a.
In the second step, a validation of the previously selected polynomials was performed. Two things are verified: (i) separation between rows, and (ii) row orientation. In the first case, two consecutive rows must maintain a known distance of separation at the bottom of the ROI. A greater separation distance expresses some anomaly. Perhaps the seeds sown in the furrows have not fully germinated. Figure 14a shows the distance between two points at the bottom of the ROI. Based on this assumption, the verification rule can be expressed as follows: if the distance is greater than a threshold, the whole image is rejected, otherwise it is accepted. In this study, the threshold was established by experimentation to be 600.
In the second case, two detected rows should not cross each other within the ROI or when they are extended outside the bottom ROI. Figure 14b shows two rows intersecting. This situation appears due to the high weed pressure. The crossing point (\(X_{cross} ,Y_{cross}\)) is obtained by equating two straight line equations and the verification rule is as follows: if y co-ordinate (\(Y_{cross}\)) is less than or equal to zero, the whole image is accepted, otherwise rejected.
In general, if any of the previously described anomalies are present, the entire image is rejected, otherwise it is accepted. As a final result, the automatic method gives the image of maize crop with four detected curved and straight rows and mathematically modeled. As noted above, this number is sufficient for automatic vehicle guidance and is also convenient for destroying weeds that are located on the inter-row spaces, according to the ideas of the RHEA (2014) project.
Regarding left/right concavity in curved crop rows, the method was designed for curved crop rows with concavity oriented towards the left, Fig. 13c. It is useful when the tractor is moving forward and crop row concavity is oriented towards the left. However, when the tractor comes to the end of the field and starts to move back, crop row concavity will be oriented towards the right. In this case, the method works as follows:
-
(a)
A vertical specular reflection process is applied on ROI with curved crop rows oriented towards the right (Fig. 15a) obtaining a new ROI with crop row curvature oriented towards the left (Fig. 15b). Namely, the last column of the ROI becomes the first one, penultimate column becomes the second, antepenultimate column becomes the third and so on.
-
(b)
Crop rows are detected on curves oriented towards the left by using the proposed method as explained above obtaining five points on each crop row (Fig. 12).
-
(c)
A horizontal translation operation is applied to each point on curved crop rows by using Eq. 4 obtaining five new points for each crop row.
$$P(i,j)\mathop \to \limits_{translation} \hat{P}(i, columns - j + 1)$$(4)where columns value represents the number of columns of the ROI (columns = 2000).
-
(d)
A straight or quadratic curve is fitted by least squares (Eq. 2) using the new translated points (\(\hat{P}\)) for each crop row. These curves are oriented towards the right as expected.
Results and discussion
The images used for testing belong to maize crops containing curved and straight crop rows as explained above (Fig. 1). Different levels of weed infestation and gaps have been considered in the sets of images. First case, the proposed method was tested with a low level of weed, i.e., up to 5% of coverage according to the classification scale proposed by Maltsev (1962). The percentage of weed coverage was obtained by applying the quadrant method as follows:
where A weed is the area that is covered by weeds and A sampled is the sampled area, i.e. 0.5 m × 0.5 m = 0.25 m2.
Higher level of weed (>5%) could cause incorrect crop row detection or deviations regarding the expected furrows. As mentioned before, when this drawback is detected by the method, the image is rejected, Fig. 14b. Low, medium and high weed pressure means respectively in the ROI: less than 5%, between 5 and 12% and between 12 and 25%. Weed pressures above 25% lead to a high probability of failure. The 5% is a limit derived from the rating scale proposed by Maltsev (1962).
Second case, different levels of gaps: low = 1 gap up to 0.40 m, medium = 2 gaps up to 0.80 m and high = 3 gaps up to 1.20 m. More than three gaps (>1.20 m) were not considered because the probability of failure is greater than 50% with the camera system geometry and specifications used in the experiments, where the ROI represents 3.4 m × 5 m (width × length). Both, gaps and high weed pressure affect significantly the performance of the proposed method on curved and straight crop rows, mainly in the first ones.
Moreover, the minimum radius of curvature of the tested curved crop rows in the field was 19 m. This measurement was obtained by applying topographic calculations. A smaller radius makes it difficult to navigate the tractor in the field and the risk of damaging crops is high.
Ground truth images
The performance of the proposed method was compared according to the similarity of their results to ground truth manually obtained for each image. The ground truth was obtained as follows. Based on visual observation in the images, an expert defined at least five points lying on a crop row in a test image, including the points for the four crop rows crossing the base of the ROI. An application developed in Matlab, based on the curve fitting toolbox, was used to fit automatically a quadratic curve passing through these points.
A total of 920 images with plants under different growth stages (up to 45 days) were randomly selected for testing. The test images were divided into three sets: Set-1 containing only straight crop rows with 120 images, Set-2 containing curved crop rows equally spaced (horizontally) with 300 images and Set-3 containing curved crop rows non-equally spaced with 500 images. Figure 16 shows examples of ground truth from each test image. Set-1 from (a) to (c), Set-2 from (d) to (f) and Set-3 from (g) to (j).
Comparison methods and performance measures
Hereinafter, the proposed method for detecting both curved and straight crop rows is denoted by DAGP (Detection by Accumulation of Green Pixels). Its performance was studied in terms of quantitative analysis and the methods used for comparison were the following: (i) Standard Hough Transform (HT) proposed by Hough (1962), which has been broadly used for straight crop row detection. Several constraints were applied for improving the performance of this approach, such as number of lines to be detected equal to four, the inclination angle ranging between −45° and 45°, the resolution of the distance and the angle fixed to 1 pixel and 1°, respectively. (ii) Linear regression based on the Theil-Shen estimator (LTS) proposed by Guerrero et al. (2013) to adjust the crop rows. (iii) Linear regression based on least squares (LRQ) proposed by Montalvo et al. (2012), which uses templates for restricting the areas where crop rows are expected. (iv) Crop row detection (CRD) proposed by Romeo et al. (2012), based on image perspective projection that looks for maximum accumulation of segmented green pixels along straight alignments. (v) Template matching followed by Global Energy Minimization (TMGEM) proposed by Vidovic et al. (2016), which detects regular patterns and uses a dynamic programming technique for determining an optimal crop model.
A measure referred to as crop row detection accuracy (CRDA) was defined for performance and is computed by matching horizontal co-ordinates (x i ) for each crop row obtained by each method under evaluation (HT, LTS, LRQ, CRD, TMGEM) to the corresponding ground truth values (\(\hat{x}_{i}\)) according to the matching score by Eq. 6.
where d is the inter-row space in pixels for each image row.
Then the average of the matching scores for all image rows is computed, which represents a value ranging [0, 1] and is obtained by Eq. 7. Values close to 1 determine the best performances.
where n is the number of crop rows to detect (i.e. n = 4), r is the number of image rows (i.e. r = 650).
CRDA was used for the evaluation on straight crop rows (Set-1) and curved crop rows equally spaced (Set-2). A slight variant of CRDA was proposed in this paper and used for the evaluation on curved crop rows non-equally spaced (Set-3). This new matching score is referred to as CRDA*, which uses maximum(d) instead of d value in Eq. 6.
Evaluation of the DAGP method
The performance of the DAGP for detecting both straight and curved crop rows was evaluated through three tests (Test 1–3). CRDA was used as the performance measure for Tests 1 and 2, while CRDA* was for Test 3. In Test 1, DAGP was compared to the HT, LTS, LRQ and CRD on the image Set-1. In Test 2, DAGP was compared against TMGEM on the image Set-2 and in Test 3, it was compared to the TMGEM on the image Set-3. HT, CDR and DAGP were implemented in Matlab, while that LTS, LRQ and TMGEM in C++. Below the Test 1–3 are detailed.
In Test 1, the average values, standard deviations and rankings of CRDA for image Set-1 are presented in Table 1. From these results, it can be seen that for average values, DAGP performance is higher than HT but slightly lower than other methods LTS, LRQ, CDR on straight crop rows. In Test 2, the values of CRDA for image Set-2 are presented in Table 2. From these results, it can be seen that for average values, DAGP is also slightly lower than TMGEM method on curved crop rows equally spaced. Regarding the standard deviations, it can be seen that all fall within the same order of magnitude. Thus, considering together means and standard deviations, DAGP achieves similar performances to LTS, LRQ, CDR and TMGEM but outperformed HT.
In Test 3, the values of CRDA* for image Set-3 are presented in Table 3. From these results, it can be seen that for average values, DAGP outperforms the TMGEM method on curved crop rows non-equally spaced. DAGP has average CRDA* of 0.856, while that TMGEM has 0.548.
From the Tests 1–3, it can be seen that the results of DAGP vary slightly among them. Therefore, it can be concluded that the proposed method is moderately insensitive to curvature of crop rows and can detect straight and curved crop rows equally and non-equally spaced with high accuracy in maize fields by using a vision system conveniently arranged onboard of a tractor with a previous knowledge of the curvature (either toward left or right) of the crop rows. Figure 16a–j shows illustrative examples representing 10 images from the 920 available (Set 1–3). The computed crop rows are shown together with the CRDA and CRDA* values respectively, according to the extrinsic and intrinsic parameters of the visual system.
The computational cost was also computed. Table 4 shows the averaged processing times in percentage (%) and milliseconds (ms) of the overall method as well as distinguishing between the image processing modules for the three sets of tested images. DAGP had an average total execution time of 692, 712 and 721 ms for each image set 1–3 respectively. The segmentation module accounted for 43.6% of total time, identification of starting points 7.5% and crop row detection 49.0%.
Considering that, in general, agricultural vehicles work at speeds ranging between 3 and 6 km h−1, this means that in the worst case (6 km h−1) to travel the 5 m of the ROI (length) the vehicle needs 3 s, which is much greater than 721 ms (in the worst case) required for image processing. In addition, it must be considered that the running time was measured in Matlab GUIDE using an interpreted programming language. It may decrease significantly if the method is implemented by using a compiled programming language (e.g. C++), running on a real-time platform and operating system, e.g. LabView and CRio as in the RHEA (2014) project. Under this implementation, the processing time could be reduced by about 40%, as reported in RHEA, improving considerably the execution time, which could be useful for real-time applications and it is a topic for future research.
Impact of crop row curvature
The performance of the method has also been evaluated for detecting curved crop rows oriented toward the right (Fig. 15a) and it was tested on 50 additional images containing straight and curved crop rows. The results obtained were similar to those presented in Tables 1, 2 and 3. The extra execution time required for both the vertical specular reflection process and translation operations is less than 20 ms, i.e. the additional time proves to be insignificant and acceptable for the method.
Table 5 shows the range of coefficients of higher degree for both types of row. This means that the crop rows analyzed are limited to a group of straight and curved rows, because of these ranges that define the mathematical models, Eq. 2, i.e. straight rows with the slope (m) and quadratics with the coefficient of curvature (a). Thanks to this study, the limits of these parameters for each type of row have been achieved. This allows an important improvement during the verification process, when the rows must be accepted or rejected depending on the computed values for the coefficients (m, a) being in or out of these ranges.
Finally, regarding limitations of the proposed method, two constraints on application should be considered: (i) the concavity of crop rows (either left or right) must be known a priori and (ii) the limited application to different crop row arrangements and the extrinsic and intrinsic camera parameters.
Conclusions
The study proposes a new computer vision method to detect curved and straight crop rows in maize fields for initial growth stages in crops and weeds (up to 45 days). The approach consists of three linked phases: segmentation, identification of starting points and crop row detection.
It has been proven to be robust enough under uncontrolled lighting conditions by using a camera mounted on the front of a tractor with in imaging perspective projection. It has been successfully tested with plants under different growth stages as well as with incomplete rows and different weed pressures and irregularly distributed in the inter-row spaces (Fig. 1). In short, the proposed method works properly on straight crop rows (CRDA >0.91 in Table 1), curved crop rows equally spaced (CRDA >0.86 in Table 2) and curved crop rows non-equally spaced (CRDA* >0.85 in Table 3) with concavity oriented toward left or right (not simultaneously, Fig. 15a, b), which is known a priori, in adverse and unexpected situations which could appear during the crop row detection procedure, which are common in uncontrolled agricultural environments with acceptable results and processing times (≤721 ms in Table 4).
Additionally, the robustness of the proposed automatic method is complemented by the two previously indicated procedures: (i) Selection and verification rows, where several anomalies can be assumed such as the number of detected rows, the separation of the crop rows (Fig. 14a) and their intersection (Fig. 14b), due to the significant presence of gaps and weeds. (ii) Controlling the crop rows with value ranges of the greater degree coefficient for each line type (m, a) as described in Table 5.
References
Astrand, B., & Baerveldt, A. J. (2005). A vision based row-following system for agricultural field machinery. Mechatronics, 15(2), 251–269.
Bakker, T., van Asselt, K., Bontsema, J., Muller, J., & van Straten, G. (2011). Autonomous navigation using a robot platform in a sugar beet field. Biosystems Engineering, 109(4), 357–368.
Bakker, T., Wouters, H., van Asselt, K., Bontsema, J., Tang, L., Müller, J., et al. (2008). A vision based row detection system for sugar beet. Computers and Electronics in Agriculture, 60, 87–95.
Billingsley, J., & Schoenfisch, M. (1997). The successful development of a vision guidance system for agriculture. Computers and Electronics in Agriculture, 16(2), 147–163.
Bossu, J., Gée, Ch., Jones, G., & Truchetet, F. (2009). Wavelet transform to discriminate between crop and weed in perspective agronomic images. Computers and Electronics in Agriculture, 65, 133–143.
Burgos-Artizzu, X. P., Ribeiro, A., Guijarro, M., & Pajares, G. (2011). Real-time image processing for crop/weed discrimination in maize fields. Computers and Electronics in Agriculture, 75(2), 337–346.
Cuevas, E., Zaldívar, D., & Pérez, M. (2010). Procesamiento digital de imágenes con Matlab y Simulink (Digital image processing with Matlab and Simulink). Madrid, Spain: Ra-Ma Editorial.
Emmi, L., Gonzalez-de-Soto, M., Pajares, G., & Gonzalez-de-Santos, P. (2014). Integrating sensory/actuation systems in agricultural vehicles. Sensors, 14, 4014–4049.
Fontaine, V., & Crowe, T. (2006). Development of line-detection algorithms for local positioning in densely seeded crops. Canadian Biosystems Engineering, 48, 19–29.
Gée, C., Bossu, J., Jones, G., & Truchetet, F. (2008). Crop/weed discrimination in perspective agronomic images. Computers and Electronics in Agriculture, 60(1), 49–59.
Gonzalez, R., & Woods, R. (2010). Digital image processing (3rd ed.). Upper Saddle River, NJ, USA: Pearson/Prentice Hall.
Guerrero, J. M., Guijarro, M., Montalvo, M., Romeo, J., Emmi, L., Ribeiro, A., et al. (2013). Automatic expert system based on images for accuracy crop row detection in maize fields. Expert Systems with Applications, 40(2), 656–664.
Guerrero, J. M., Pajares, G., Montalvo, M., Romeo, J., & Guijarro, M. (2012). Support Vector Machines for crop/weeds identification in maize fields. Expert Systems with Applications, 39, 11149–11155.
Guijarro, M., Pajares, G., Riomoros, I., Herrera, P. J., Burgos-Artizzu, X. P., & Ribeiro, A. (2011). Automatic segmentation of relevant textures in agricultural images. Computers and Electronics in Agriculture, 75(1), 75–83.
Hague, T., & Tillett, N. D. (2001). A bandpass filter-based approach to crop row location and tracking. Mechatronics, 11, 1–12.
Hague, T., Tillett, N. D., & Wheeler, H. (2006). Automated crop and weed monitoring in widely spaced cereals. Precision Agriculture, 7(1), 21–32.
Han, Y. H., Wang, Y. M., Kang, F. (2012). Navigation line detection based on support vector machine for automatic agriculture vehicle. In Proceedings of the international conference on automatic control and artificial intelligence (ACAI 2012) (pp. 1381–1385). Institution of Engineering and Technology (IET), Xiamen, China.
Hough, P. V. C. (1962). Method and means for recognizing complex patterns. US Patent Office No. 3069654.
Jafri, M., Deravi, F. (1995). Efficient algorithm for the detection of parabolic curves, In Proceedings of the SPIE 2356 (pp. 53–61). Vision Geometry III.
Ji, R., & Qi, L. (2011). Crop-row detection algorithm based on Random Hough Transformation. Mathematical and Computer Modelling, 54(3–4), 1016–1020.
Jiang, G., Wang, Z., & Liu, H. (2015). Automatic detection of crop rows based on multi-ROIs. Expert Systems with Applications, 42(5), 2429–2441.
Jiang, G., Wang, X., & Wang, Z. (2016). Wheat rows detection at the early growth stage based on Hough transform and vanishing point. Computers and Electronics in Agriculture, 123, 211–223.
Kise, M., & Zhang, Q. (2008). Development of a stereovision sensing system for 3D crop row structure mapping and tractor guidance. Biosystems Engineering, 101(2), 191–198.
Kise, M., Zhang, Q., & Rovira-Más, F. (2005). A stereovision-based crop row detection method for tractor-automated guidance. Biosystems Engineering, 90(4), 357–367.
Leemans, V., & Destain, M. F. (2006). Line cluster detection using a variant of the Hough transform for culture row localisation. Image Vision Computing, 24(5), 541–550.
Maltsev, A. I. (1962). Weed vegetation of the USSR and measures of its control. Leningrad-Moscow: Selkhozizdat. p. 272 (in Russian).
Marchant, J. (1996). Tracking of row structure in three crops using image analysis. Computers and Electronics in Agriculture, 15(2), 161–179.
MathWorks, Inc. (2015). Matlab Release 2015a. Accessed December 17, 2016, from http://www.mathworks.com/products/new_products/release2015a.html.
Montalvo, M., Guerrero, J. M., Romeo, J., Emmi, L., Guijarro, M., & Pajares, G. (2013). Automatic expert system for weeds/crops identification in images from maize fields. Expert Systems with Applications, 40(1), 75–82.
Montalvo, M., Pajares, G., Guerrero, J. M., Romeo, J., Guijarro, M., Ribeiro, A., et al. (2012). Automatic detection of crop rows in maize fields with high weeds pressure. Expert Systems with Applications, 39(15), 11889–11897.
Olsen, H. J. (1995). Determination of row position in small-grain crops by analysis of video images. Computers and Electronics in Agriculture, 12(2), 147–162.
Onyango, C. M., & Marchant, J. A. (2003). Segmentation of row crop plants from weeds using colour and morphology. Computers and Electronics in Agriculture, 39(3), 141–155.
Otsu, N. (1979). Threshold selection method from gray-level histograms. IEEE Transactions on Systems, Man and Cybernetics, 9(1), 62–66.
Pajares, G., García-Santillán, I., Campos, Y., Montalvo, M., Guerrero, J. M., Emmi, L., et al. (2016). Machine-vision systems selection for agricultural vehicles: A guide. Journal of Imaging, 2, 34.
Pla, F., Sanchiz, J. M., Marchant, J. A., & Brivot, R. (1997). Building perspective models to guide a row crop navigation vehicle. Image and Vision Computing, 15, 465–473.
RHEA. (2014). Proceedings of the Second International Conference on Robotics and Associated High-Technologies and Equipment for Agriculture and Forestry. New trends in mobile robotics, perception and actuation for agriculture and forestry (P. Gonzalez-de-Santos & A. Ribeiro Eds.). Madrid-Spain: PGM. [Spanish Research Council-CAR]. http://www.rhea-project.eu/Workshops/Conferences/Proceedings_RHEA_2014.pdf (last accessed December 17, 2016).
Romeo, J., Pajares, G., Montalvo, M., Guerrero, J. M., Guijarro, M., & Ribeiro, A. (2012). Crop row detection in maize fields inspired on the human visual perception. Scientific World Journal, 10 pp.
Rovira-Más, F., Zhang, Q., & Reid, J. F. (2008). Stereo vision three-dimensional terrain maps for precision agriculture. Computers and Electronics in Agriculture, 60(2), 133–143.
Rovira-Más, F., Zhang, Q., Reid, J. F., & Will, J. D. (2003). Machine vision based automated tractor guidance. International Journal Smart Engineering System Design, 5(4), 467–480.
Rovira-Más, F., Zhang, Q., Reid, J. F., & Will, J. D. (2005). Hough-transform-based vision algorithm for crop row detection of an automated agricultural vehicle. Journal of Automobile Engineering, 219(8), 999–1010.
Sainz-Costa, N., Ribeiro, A., Burgos-Artizzu, X. P., Guijarro, M., & Pajares, G. (2011). Mapping wide row crops with video sequences acquired from a tractor moving at treatment speed. Sensors, 11(7), 7095–7109.
Sogaard, H. T., & Olsen, H. J. (2003). Determination of crop rows by image analysis without segmentation. Computers and Electronics in Agriculture, 38(2), 141–158.
Tellaeche, A., BurgosArtizzu, X., Pajares, G., & Ribeiro, A. (2008a). A vision-based method for weeds identification through the Bayesian decision theory. Pattern Recognition, 41(2), 521–530.
Tellaeche, A., BurgosArtizzu, X., Pajares, G., Ribeiro, A., & Fernández-Quintanilla, C. (2008b). A new vision-based approach to differential spraying in precision agriculture. Computers and Electronics in Agriculture, 60(2), 144–155.
Tillett, N., & Hague, T. (1999). Computer-vision based hoe guidance for cereals an initial trial. Journal of Agricultural Engineering Research, 74, 225–236.
Vidović, I., Cupec, R., & Hocenski, Ž. (2016). Crop row detection by global energy minimization. Pattern Recognition, 55, 68–86.
Vidović, I., & Scitovski, R. (2014). Center-based clustering for line detection and application to crop rows detection. Computers and Electronics in Agriculture, 109, 212–220.
Vioix, J. B., Douzals, J. P., Truchetet, F., Assemat, L., & Guillemin, J. P. (2002). Spatial and spectral method for weeds detection and localization. EURASIP Journal on Advances in Signal Processing, 7, 679–685.
Woebbecke, D. M., Meyer, G. E., Vonbargen, K., & Mortensen, D. A. (1995). Color indexes for weed identification under various soil, residue, and lighting conditions. Transactions of the ASAE, 38(1), 259–269.
Xue, J., & Ju, W. (2010). Vision-based guidance line detection in row crop fields. In Proceedings of the third IEEE international conference on intelligent computation technology and automation (ICICTA 2010) (Vol. 3, pp. 1140–1143). New York: IEEE Computer Society.
Acknowledgements
The research leading to these results has been funded by Universidad Politécnica Estatal del Carchi (Ecuador). Also, part of the research has been inspired on the RHEA project funded by the European Union Seventh Framework Programme [FP7/2007-2013] under Grant Agreement nº 245986 in the Theme NMP-2009-3.4-1 (Automation and robotics for sustainable crop and forestry management). Thanks are due to the anonymous referees and editor for their very valuable and detailed comments and suggestions.
Author information
Authors and Affiliations
Corresponding author
Rights and permissions
About this article
Cite this article
García-Santillán, I., Guerrero, J.M., Montalvo, M. et al. Curved and straight crop row detection by accumulation of green pixels from images in maize fields. Precision Agric 19, 18–41 (2018). https://doi.org/10.1007/s11119-016-9494-1
Published:
Issue Date:
DOI: https://doi.org/10.1007/s11119-016-9494-1