智慧农业 (Jan 2024)
Automated Flax Seeds Testing Methods Based on Machine Vision
Abstract
ObjectiveFlax, characterized by its short growth cycle and strong adaptability, is one of the major cash crops in northern China. Due to its versatile uses and unique quality, it holds a significant position in China's oil and fiber crops. The quality of flax seeds directly affects the yield of the flax plant. Seed evaluation is a crucial step in the breeding process of flax. Common parameters used in the seed evaluation process of flax include circumference, area, length axis, and 1 000-seed weight. To ensure the high-quality production of flax crops, it is of great significance to understand the phenotypic characteristics of flax seeds, select different resources as parents based on breeding objectives, and adopt other methods for the breeding, cultivation, and evaluation of seed quality and traits of flax.MethodsIn response to the high error rates and low efficiency issues observed during the automated seed testing of flax seeds, the measurement methods were explored of flax seed contours based on machine vision research. The flax seed images were preprocessed, and the collected color images were converted to grayscale. A filtering and smoothing process was applied to obtain binary images. To address the issues of flax seed overlap and adhesion, a contour fitting image segmentation method based on fused corner features was proposed. This method incorporated adaptive threshold selection during edge detection of the image contour. Only multi-seed target areas that met certain criteria were subjected to image segmentation processing, while single-seed areas bypassed this step and were directly summarized for seed testing data. After obtaining the multi-seed adhesion target areas, the flax seeds underwent contour approximation, corner extraction, and contour fitting. Based on the provided image contour information, the image contour shape was approximated to another contour shape with fewer vertices, and the original contour curve was simplified to a more regular and compact line segment or polygon, minimizing computational complexity. All line shape characteristics in the image were marked as much as possible. Since the pixel intensity variations in different directions of image corners were significant, the second derivative matrix based on pixel grayscale values was used to detect image corners. Based on the contour approximation algorithm, contour corner detection was performed to obtain the coordinates of each corner. The resulting contour points and corners were used as outputs to further improve the accuracy and precision of subsequent contour fitting methods, resulting in a two-dimensional discrete point dataset of the image contour. Using the contour point dataset as an input, the geometric moments of the image contour were calculated, and the optimal solution for the ellipse parameters was obtained through numerical optimization based on the least squares method and the geometric features of the ellipse shape. Ultimately, the optimal contour was fitted to the given image, achieving the segmentation and counting of flax seed images. Meanwhile, each pixel in the digital image was a uniform small square in size and shape, so the circumference, area, and major and minor axes of the flax seeds could be represented by the total number of pixels occupied by the seeds in the image. The weight of a single seed could be calculated by dividing the total weight of the seeds by the total number of seeds detected by the contour, thereby obtaining the weight of the individual seed and converting it accordingly. Through the pixelization of the 1 yuan and 1 jiao coins from the fifth iteration of the 2019 Renminbi, a summary of the circumference, area, major axis, minor axis, and 1 000-seed weight of the flax seeds was achieved. Additionally, based on the aforementioned method, this study designed an automated real-time analysis system for flax seed testing data, realizing the automation of flax seed testing research. Experiments were conducted on images of flax seeds captured by an industrial camera.Results and DiscussionsThe proposed automated seed identification method achieved an accuracy rate of 97.28% for statistically distinguishing different varieties of flax seeds. The average processing time for 100 seeds was 69.58 ms. Compared to the extreme erosion algorithm and the watershed algorithm based on distance transformation, the proposed method improved the average calculation accuracy by 19.6% over the extreme erosion algorithm and required a shorter average computation time than the direct use of the watershed algorithm. Considering the practical needs of automated seed identification, this method did not employ methods such as dilation or erosion for image morphology processing, thereby preserving the original features of the image to the greatest extent possible. Additionally, the flax seed automated seed identification data real-time analysis system could process image information in batches. By executing data summarization functions, it automatically generated corresponding data table folders, storing the corresponding image data summary tables.ConclusionsThe proposed method exhibits superior computational accuracy and processing speed, with shorter operation time and robustness. It is highly adaptable and able to accurately acquire the morphological feature parameters of flax seeds in bulk, ensuring measurement errors remain within 10%, which could provide technical support for future flax seed evaluation and related industrial development.
Keywords