# GainTKW: A Measurement System of Thousand Kernel Weight Based on the Android Platform
## 1 Introduction  
As a complex agronomic trait, grain yield is multiplicatively determined by three components: the number of spikes per area, grain number per spike, and grain weight. Grain weight is usually represented by 1000-kernel weight. Thousand kernel weight (TKW) is an important parameter for the evaluation of variety breeding. TKW is not only directly related to the grain yield and milling quality of grain, but also has an impact on the seedling vigor and growth indirectly affecting the yield [1]. TKW was also found to be closely associated with kernel size traits as well, such as kernel length (KL), kernel width (KW), kernel thickness (KT), and the kernel length/width ratio (\(L/W\)) [2]. As a result, TKW is frequently used in crop research as a measurement indicator [3]. The measurement of the thousand kernel weight includes weighing and counting the kernels. Weight data is obtained from scales and traditional methods based on manual counting are used to count the kernels [4]. As manual counting is time-consuming and labor-intensive with subjective results, electronic counting devices [5] are also commonly used. The machine is accurate at slow speeds but cannot ensure precision at higher speeds. In addition, the machine cannot handle a wide range of kernel sizes and is noisy. The counting machine equipped with a laser can overcome these shortcomings but it is expensive, bulky and can only be used in laboratories. The operation is also complex and cumbersome. A less costly and easier to implement a method to count the kernels isimage processing technology [6]. It can achieve satisfactory results if the recognition algorithm is efficient enough. This study solves the counting problem using the image processing method. Counting kernels using on image processing occurs in two steps. First is the image segmentation that separates the kernels from the image background. Then the kernels themselves are separated so that the number of kernels can be calculated. Good image segmentation is the foundation of the counting accuracy. There are many segmentation algorithms such as threshold [7], edge detection [8] and clustering [9]. The touching kernels increase the difficulty of counting the kernels correctly. In order to solve this problem, different methods of separating touching kernels have been reported in the literature, such as the morphological operations [10], the ellipse fitting algorithm [11; 12], the concave points matching algorithm [13; 14] and the watershed segmentation algorithm [15]. The morphological method is simple but the frequency of erosion and dilation is dependant on human experience [10]. The ellipse fitting algorithm is time-intensive and does not perform well on elongated shapes [12]. The concave points matching algorithm is prone to oscillation and the results presented are poor when separating more than three touching kernels [14]. The watershed algorithm is a widely-used segmentation method that uses local gradient difference in touching areas and identifies dividing lines through a simulation process of water flooding, from kernel areas under the pixel gradient constraints. The traditional watershed algorithm is prone to over segmentation [16]. Kernel segmentation and separating algorithms based on image processing are mostly performed on a computer or laptop, which can be inconvenient [17]. With the development of mobile intelligent terminals, mobile devices have changed the way of living and people's behaviors. Modern mobile devices contain digital cameras with high resolution. The Android mobile phone platform provides third-party developers with a wide ranging, free environment, allowing users to capture and process images wherever necessary. A number of applications on mobile devices have been developed for agricultural applications, such as grain phenotyping [18], estimating citrus yield [19], identifying plant species [20], weed identification [21], estimating soil-color [22] and so on.