# The System of Anti-bud Injury in Seedcane Cutting Based on Computer Vision

Yiqi Huang, Xi Qiao, Jian Yang

► To cite this version:

Yiqi Huang, Xi Qiao, Jian Yang. The System of Anti-bud Injury in Seedcane Cutting Based on Computer Vision. 6th Computer and Computing Technologies in Agriculture (CCTA), Oct 2012, Zhangjiajie, China. pp.251-259, 10.1007/978-3-642-36124-1_31. hal-01348106

HAL Id: hal-01348106

https://inria.hal.science/hal-01348106

Submitted on 22 Jul 2016

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>
# The System of Anti-bud Injury in Seedcane Cutting Based on Computer Vision

Yiqi Huang¹, Xi Qiao¹, Jian Yang¹

¹College of Mechanical Engineering, Guangxi University, 530004, nanning, China

**Abstract.** This article establishes a system of anti-bud injury in sugarcane cutting based on computer vision using MATLAB software as a development platform. The seedcane cutter box cuts twice each turn. Match the accurate shutter trigger time interval according to the rotation speed of the cutter, the transportation speed of sugarcane, in order to make the position of collected image of the target happen to be the next cutting site. Image processing is based on digital image processing tools of Matlab, and the image is processed from two aspects of the cane edge of the curve smoothness and internode surface color using Matlab by which sort out the image suitable for the identification of sugarcane internode, and then deal with the collected images by filtering denoising and binarization to determine whether the cutter cuts sugarcane internode. When the recognition threshold is 3500, the recognition accuracy of this system is 99%. After modifying the recognition threshold to 4700, its recognition accuracy is 100%.

**Key words:** MATLAB, Injury bud, Cut sugarcane, Iterative threshold, Internode

## Introduction

China is one of the largest sugarcane-producing countries, as the third largest sugar-producing country in the world. Development of sugarcane industry directly affects our country's tens of millions of sugarcane farmers' livelihood and the development of sugar industry [1]. The majority of the sugarcane-producing states in the world have realized the mechanization of sugarcane cultivation to a certain extent, but there are deficiencies about it. The foreign planter has a good performance and the function tends to perfect, but it not yet equipped with professional device of anti-injured buds, and it's too expensive, with too complex institutions, so the foreign planter is difficult to popularize in sugarcane-producing areas of China. However, the domestic planter is more difficult to achieve the purpose of automatic anti-injury buds
in the process of sugarcane species cut. At present, the field research at home and
abroad still stays at an early exploratory stage. There are some similar researches,
such as Lu Shang-ping extracted and recognized sugarcane internodes' characteristics
based on machine vision [2]. Abroad, Moshashai K of Iran used grayscale image
threshold segmentation method to do a preliminary study on sugarcane internodes'
recognition [3].

Our country has the large sugarcane cultivation area. However, in the sugarcane
planting process, two main problems exist, one is the low degree of automation
planting, and another is the high of bud injury rate in the automation planting process.
With the continuous development of the machinery industry and the improvement of
computer technology [4], this paper uses the technology of computer image processing
to effectively process the cane image and analysis the characteristic parameters. This
device consists of computer and camera. The study in the paper is to use MATLAB
software to process the collected images and judgment the cutter cut the sugarcane
internode. The biggest feature of image processing technology is to use a machine or
computer instead of the human eye and brain to directly get the target image, and then
process the target image and extract the effective and specific information to achieve
the perception of object. Especially with the continuous development of image
processing computer equipment, the high frequency of CPU, the high-capacity
physical memory and image digitizing equipment are constantly updated to make the
collection of the fast moving and multi-purpose image become a reality[5-7].

# 1 Device Structure

The cane was transported to the cutter box by the clamping mechanism of the
roller, with the synchronization between Conveyor speed and cutting hob speed. A
pair of hob in cutter box cutting twice each turn. According to the rotation speed of
the cutter, the accurate shutter trigger time interval has been designed to match with
it so that the collected image of target happens to be the next cutting site. Collected
target image transmitted through the data cable to the computer, the images were
processed and identified by MATLAB software, then to estimate whether they are
sugarcanes. At last, computer feedback the information to the motor controller, the
controller drive motor to move the clamping mechanism 15mm, to avoid cutter
cutting sugarcane in order to reduce the rate of injury bud. Structure of the device
shown in Figure 1.1:

1、Cutter box 2、Video camera 3、Clamping mechanism 4、Computer 5、
Cane
<figure><img src="image_2.png" /><figcaption>Fig 1.1 Structure diagram</figcaption></figure>

## 2 Image Acquisition

Use MVC360MF digital camera for image acquisition of the target. The speed of the sugar cane transported by clamping mechanism is the same with the line speed of hob which inside the cutter box. They are 0.1m/s-0.3m/s in proper function. The camera image acquisition rate is 110 fps, so the cane has moved about 1mm-3mm in the time of acquisition of an image. According to the agronomic requirements, the sugarcane stem segments for two or three buds. For example, Guangxi generally grown black fruit sugarcane (black sugar cane), randomly selected *q* internodes of the *P* black canes, and measure the length of each internode, then calculate the average length of the sugarcane internode:

$$ \bar{X} = \frac{\sum_{P=1}^{Pq} \sum_{q=1}^{Pq} X_{Pq}}{Pq} \quad (2.1) $$

The $X_{Pq}$ is the length of the n-th internode of the N-th cane

In this paper, taking the sugarcane stem segments for 150mm meets the agricultural demands. In order to make the collected sugarcane image consistent with the sugarcane cutting parts, the time of collection interval(fps) must be designed to match with the conveying speed of the cane. So that it correctly position the cutting parts and avoid redundant image information. The formula of calculate the frame interval as follows[9]:

$$ F = (150-1000V1) / 1000V1 \quad (2.2) $$

Of which: *F* - frame interval; *V* - cane conveyor speed (m/s); *l* = 0.009s for the time required to capture single image;
# 3 Image Process

## 3.1 Image Pretreatment

The study object in image processing is the internodes and stem of sugarcane. For example black cane, compare with the stem, there are significant changes in the shape and color of the sugarcane internode. Overall, its morphology is characterized by the different of the edge curve smoothness of the seedcane, the sugarcane internode color and the cicatricle shape in the internode.

In case to accurately extract the useful information of the image, it is necessary to pretreat the image. For a clear distinction between the image of sugarcane internode and sugarcane stem, and show obvious characteristics in each image, use the method of currently used to process the image, for example: Gray-scale adjustment、Filtering noise and Morphological processing. Gray-scale adjustment is the use of contrast enhancement method to enhance the contrast of the various parts of the image. Filtering noise is that use the method of neighborhood average to reduce the noise, which can effectively eliminate the Gaussian noise. Expression for:

$$g(x, y) = \frac{1}{H} \sum_{(i,j) \in S} f(x-i, y-j) \quad (3.1)$$

Of which: *H* is the total number of pixels contained within the neighborhood *S*; *S* is a predetermined neighborhood (the neighborhood does not include point of (x, y)).

Neighborhood average, cause image blur. So in this study, take the threshold neighborhood average. A (3×3) window move along the image (line by line, row by row), Find the average of all pixel gray values. Unless pending pixel in the window. If the absolute value of pending pixel gray value minus the average value beyond a predetermined threshold, the pixel gray-scale use of average value instead of; otherwise, keep the pixel gray-scale invariant. Formula of the threshold neighborhood average:

$$g(x, y) = \begin{cases} \frac{1}{H} \sum_{(i,j) \in S} f(x-i, y-j) & (3.2) \\ f(x, y) & \end{cases}$$
$$ \left| f(x, y) - \frac{1}{H} \sum_{(i,j) \in S} f(x - i, y - j) \right| > Z \\ \left| f(x, y) - \frac{1}{H} \sum_{(i,j) \in S} f(x - i, y - j) \right| \leq Z $$

Of which: Z is predetermined threshold value.

Image pretreatment steps are as follows:First, Gray-scale conversion of the original image.Then add Gaussian noise which mean is zero and variance is 0.2 into the grayscale image. Pretreatment of sugarcane internode image and sugarcane stem image show in the Figure 3.1 and the Figure 3.2. Internode and stems distinguish significantly, the gray-scale of Image changes tend to be gentler in the sugarcane stem pretreatment image.

<figure><img src="image_3.png" /><figcaption>Fig 3.1 Pretreatment of sugarcane internode image Fig 3.2 Pretreatment of sugarcane stem image</figcaption></figure>

## 3.2 Image Binarization

Binarization of the image is that set the grayscale of the point in the image into 0 or 1, in other words, the whole image appear black and white[10-12]. Select the appropriate threshold through 256 brightness levels in the image into two kinds, the image was binarized still reflect the global and local features of image. The two-dimensional matrix elements of the binary image only by 0 and 1. The binary image can be seen as one special image which includes only black and white. Suppose the original image pixel size is $M \times N$, and $0 \le I(i, j) \le (L-1)$, formula of the threshold:

$$ T = \left( \sum_{K=1}^{L-1} N_K \times K \right) / (M \times N) \quad (3.3) $$

Of which: $N_K$ is the number of the pixel grayscale values is K.
$$ \text{From that can get the binary image, and } B(i, j) = \begin{cases} 1 & I(i, j) > T \\ 0 & I(i, j) \le T \end{cases}. $$

Black sugarcane internode and stem color have clear difference between black and white. Binarization is conducive to the computer identify the target. The key of Image binarization processing is to select the threshold, that direct impact on the final result.

In threshold processing, generally the most commonly and simple way is artificial selection. Adjust the *T* of the binarization threshold, by a large number tests of threshold adjustment, find that the target of image binarization is very clear when *T* is between 0.5 and 0.7. The internode and the stem can be very obvious distinction after binary the images of the internode and the stem. This way is based on subjective thinking of people, it usually chooses out a satisfactory threshold. But the system requires no man-made intervention to automatically select the threshold. So this system selects an iterative method to automatically select the appropriate threshold for each image.

According to the results of the image pretreatment, sum the value of the matrix elements of the gray image, and then averaging would calculate the iterative initial threshold:

$$ T_0 = \frac{\sum_{i=0}^{n-1} \sum_{j=0}^{m-1} K_{ij}}{M \times N} \quad (3.4) $$

$K_{ij}$: The value of point $(i, j)$ which is the point of the image pixel size $M \times N$ is $K$.

Assume that the gray value of gray-scale image with *L* levels (0~L-1), According to the Threshold *T* divided the image into two regions—$R_1$ and $R_2$, formulas of the average gray value($\mu_1$ and $\mu_2$) of the regions $R_1$ and $R_2$:

$$ \mu_1 = \frac{\sum_{i=0}^{T_1-1} in_i}{\sum_{i=0}^{T_1-1} n_i} \quad \mu_2 = \frac{\sum_{i=T_1}^{L-1} in_i}{\sum_{i=T_1}^{L-1} n_i} \quad (3.5) $$

$n_i$: The number of the level *i* of the gray level appeared

After calculated $\mu_1$ and $\mu_2$, with the following formula to calculate the new threshold $T_{i+1}$:

$$ T_{i+1} = \frac{1}{2}(u_1 + u_2) \quad (3.6) $$

Then put the results of the 3.6-style into the 3.5 and 3.6-cycle, if $|T_{i+1} - T_i| \le 0.1$, select $T_{i+1}$ as the binarization threshold.

Selected results of the iteration as the binarization threshold, the result of the pretreatment image binarized as Figure 3.3 shown in. After processed, outline of black sugarcane internode has become more clearer, showing more prominent details of the image, the position of the sugarcane internode is also available to identify; The white part of the black sugarcane stem image is not existed, more to improve the accuracy of the stem and the internode can be correctly identified.

<figure><img src="image_4.png" /><figcaption>Fig 3.3 Image of black sugarcane nodes and stem processed by binarization</figcaption></figure>
## 3.3 Process Image Data and Judge the Result

For the computer to accurately determine the sugarcane internode and stem, need to inverted image and flip the gray values of the binary image. In a word, it transfers black to white and white to black. And then sum the values of all pixels, the formula as follow:

$$A = \sum_{i=0}^{n-1} \sum_{j=0}^{m-1} B[i, j] \quad (3.7)$$

Of which: $B[i, j]$ is the tag values of the point, $m$ is total number of marker pixel $i$, $n$ is total number of marker pixel $j$.

Binary image corresponds to a value, experiment showed that the value of sugarcane internode is far less than the sugarcane stem. By compare the values, Computer can accurately identify the sugarcane internode and stem. Then it issues commands to the motor controller.

## 3.4 Experimental Results and Analysis

Take 100 samples tested, including 84 pictures of sugarcane stems, 16 pictures of sugarcane internode. Each picture sum A value in the image processing, statistical results as shown in figure 3.4

<figure><img src="image_5.png" /><figcaption>Fig 3.4 A value of sugarcane internode charts</figcaption></figure>

Seen from chart 3.4, a value of sugarcane stem is generally between 5900-6300, a value of sugarcane internode is generally between 3500-2600, specific statistical data as shown in Table 3.1. In experiment, select 3500 to identify the critical value, resulting in a miscarriage of justice. After change the critical to 4700, whether the node or the stem have large buffer, all samples of the recognition accuracy rate is 100%.

<table><caption>Table 3.1</caption><thead><tr><th>Statistical</th><th>Number</th><th>A&#773;</th><th>A<sub>min</sub></th><th>A<sub>max</sub></th></tr></thead><tbody><tr><td>sugarcane stem</td><td>84</td><td>6153.1</td><td>5978</td><td>6300</td></tr><tr><td>sugarcane internode</td><td>16</td><td>3154.3</td><td>2664</td><td>3505</td></tr><tr><td>the recognition accuracy rate</td><td></td><td>99%</td><td></td><td></td></tr></tbody></table>

The system studied in this article was based on the develop platform of MATLAB, compared with the traditional image processing methods, MATLAB seldom need own programming, the program directly through the function call, this save a lot of time. In addition, this related to all data and mathematical formulas by using MATLAB to call and calculate the results, fast calculation, which is the other image processing software don't have[13].
## 4 Conclusions

This study selected sugarcane node and stem as the research object, and using machine vision to track parts of cutter cutting sugarcane preliminary build a sugarcane cutting test rig based on computer vision.

Using the neighborhood average to make the target of image prominent, internodes and stems obviously distinguished, and the image gray-scale changes tend to be more gentle which is good for the next processing.

Using an iterative approach to obtain the threshold of the binarization procedure, which can eliminate the influence of human factors.

The recognition system was tested with a result of 100% recognition accuracy, and the algorithm execution time of a single image is 0.634s which provide a reference for domestic and foreign sugarcane machinery not equipped with anti-hurt bud cut-off device, and fill the blank of the image processing technology at home and abroad in the application of sugarcane stem cutting.

Using computer image processing technology to achieve fast and accurate judgment of the cutter when cutting sugarcane parts and reduce the rate of sugarcane internodes of injured buds, sugarcane production costs, and save the sugarcane speices, and improve labor productivity. The visual device solves the technical bottleneck of the mechanization of sugarcane injury prevention bud, besides, this device can also solve the problems of high costs of field test, and improve the sugarcane cutting automaticity.

There are definitely some issues needed to be studied further in this article: to develop the appropriate algorithms for different types of sugarcane; to improve the developed algorithm, such as improving the pretreatment algorithm and the threshold value selection; how can the existing cutter better cope with this system.

## 5 Acknowledgements

This work was financially supported by Guangxi Key Laboratory of Manufacturing System &Advanced Manufacturing Technology (Grant No. 10-046-07S04).

## References

[1] http://zhidao.baidu.com/question/68598663.html?fr=ala0 2011/4/21

[2] Lu shangping, Wen youxian, Gewei Penghui. Recognition and Features Extraction of Sugarcane Nodes Based on Machine Vision[J]. Journal Of Agricultural Machinery, 2010, (10):190-194.

[3] K.Moshashai, M.Almasi, S.Minaei, A.M.Borghei. Identification of sugarcane nodes using image processing and machine vision technology[J]. International Journal of Agricultural Research, 2008, 3 (5): 357~364.

[4] Chen chaojun, Xu jianyun. Sugarcane Cultivation Science[M]. Guangxi: Guangxi Science and Technology Press, 2009/11.

[5] Ma Xun. Precision Metering Device performance image processing techniques to detect[J]. Journal Of Agricultural Machinery, 2001, (7): 34-37

[6] Hu shaoxing. Metering device performance testing technology based on computer vision[D]. Changchu: Jilin University, 2001.

[7] Hu shaoxing. Filing performance image processing detection metering device[J]. Journal Of Agricultural Engineering, 2002, 29(5):56-59.

[8] http://wenku.baidu.com/view/51ffae7202768e9951e738f1.html 2011/10/15

[9] Li wei. Seeding precision detection technology based on computer vision research[J]. Doctor Dissertation of China Agricultural University. 6, 2004.
[10] Qing xiangpei. MATLAB image processing and interface programming[M].Beijing: Publishing House of electronic industry, 2009.3: 227-254

[11] Dong,Q.Y.,C.C.Song,C.S.Ben and L.Q.Chun,2006,On-line measurement of deposit dimension in spray forming using image processing technology.J.Mater.Process.Technol.,172(2):195-201.

[12]Dworkin,S.B.andT.J.Nye,2006.Image Processing for machine vision measurement of hot formed parts.J.Mater.Process.Technol.,174(1):1-6.

[13] Qiao xi, Huang yiqi. MATLAB in precision seeding machine monitoring device in Application Research[J].Chinese Agricultural Mechanization, 2011, (2)108-110.
<figure><img src="image_6.png" /></figure>