Machine vision-based method, device and equipment for identifying boundary line between rice and chaff, and medium

By using machine vision technology, combined with image processing and sliding window edge detection, the problem of grain-rice separation error caused by human eye recognition has been solved, realizing automated and efficient grain-rice separation, adapting to different lighting conditions, and improving rice processing efficiency.

CN116012314BActive Publication Date: 2026-04-07WUHAN POLYTECHNIC UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-21
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

In existing technologies, the distinction between paddy rice and scab rice is mainly determined by human visual identification, which leads to subjective errors affecting the efficiency of rice processing and makes it difficult to achieve automation and efficient separation.

Method used

A machine vision-based approach is adopted to identify valley-roughness boundaries through image acquisition, enhancement, grayscale processing, and sliding window vertical edge detection. Combined with image model matching and color information processing, noise and false edges are adaptively removed to improve recognition accuracy.

Benefits of technology

It achieves automated identification of the grain-brown boundary line, reduces errors, improves rice processing efficiency and separation effect, adapts to different lighting conditions, and achieves a recognition success rate of 90%.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116012314B_ABST
    Figure CN116012314B_ABST
Patent Text Reader

Abstract

The application discloses a machine vision-based method, device, equipment and medium for identifying a grain-bran boundary line. The method can include: collecting an image and performing image enhancement; performing image model matching on the enhanced image to obtain a gray-scale image; performing binaryzation processing on the gray-scale image to obtain a binaryzation image; and performing vertical edge detection based on a sliding window according to the binaryzation image to identify the grain-bran boundary line. The application applies machine vision to the grain-bran separation process, and can improve the rice processing efficiency to a certain extent and realize automation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of grain-rice separation technology, and more specifically, to a method, apparatus, equipment, and medium for identifying the grain-rice boundary line based on machine vision. Background Technology

[0002] Rice processing generally involves steps such as raw grain cleaning, hulling, separation of paddy and brown rice mixtures, and milling. The quality of paddy and brown rice mixture separation directly affects the processing efficiency of rice; therefore, optimizing the paddy and brown rice separation process is an important means to improve rice processing efficiency. Paddy and brown rice separation is based on the grain size, density, and stratification characteristics of paddy and brown rice, thus forming a paddy-brown rice boundary line between the paddy and the mixture. Currently, the location of this boundary line is mainly determined by visual identification, and errors caused by subjective judgment can affect the efficiency of the rice processing flow.

[0003] Therefore, it is necessary to develop a method, device, equipment, and medium for identifying valley-rough boundary lines based on machine vision.

[0004] The information disclosed in the background section of this invention is intended only to enhance the understanding of the general background of this invention, and should not be construed as an admission or in any way implying that such information constitutes prior art known to those skilled in the art. Summary of the Invention

[0005] This invention proposes a method, device, equipment, and medium for identifying the boundary between paddy and scab based on machine vision. Applying machine vision to the process of separating paddy and scab can improve rice processing efficiency and achieve automation to a certain extent.

[0006] In a first aspect, embodiments of this disclosure provide a valley-roughness boundary line recognition method based on machine vision, including:

[0007] Acquire images and perform image enhancement;

[0008] Image model matching is performed on the enhanced image to obtain a grayscale image;

[0009] The grayscale image is binarized to obtain a binarized image;

[0010] Vertical edge detection based on a sliding window is performed on the binarized image to identify the valley-roughness boundary.

[0011] Preferably, performing image model matching on the enhanced image to obtain a grayscale image includes:

[0012] Establish matching conditions for color information of rice paddy areas;

[0013] Analyze the matching results of all pixels and determine the classification result of the template to be matched;

[0014] Based on the classification results, the grayscale processing method for the enhanced image is determined.

[0015] Preferably, the classification result is:

[0016]

[0017] Where, mood represents the classification result, and m and n represent the size of the template to be matched.

[0018] Preferably, for an image where mood = mood1, the RGB color model is used for grayscale conversion; for an image where mood = mood2, the RGB color model is converted to the HSI color model before grayscale conversion.

[0019] Preferably, the process of performing vertical edge detection based on a sliding window to identify valley-roughness boundaries using the binarized image includes:

[0020] An initial window C is established, and the binarized image is scanned horizontally with a step size of 1 pixel. After each scan, the pixel values ​​within the window are summed.

[0021] Generate the grayscale fluctuation curve of C, and adaptively remove small-scale grayscale fluctuations in the curve to obtain C1;

[0022] C2 is obtained by removing windows from window C1 whose sum of gray values ​​is less than the mean.

[0023] After performing a first-order difference on window C2, window C3 with the largest first-order difference value in C2 is retained. The position coordinates loc of C3 are calculated through coordinate transformation. These coordinates loc are the actual positions of the valley-roughness boundary line.

[0024] Preferably, the summation of all pixel values ​​within the window is performed using formula (2):

[0025]

[0026] Where C(i) is the sum of pixel gray values ​​in the window after the i-th scan, f2(x,y) is the binarized image, and k1 and k2 are the positions of the left and right ends of the window in the image, respectively.

[0027] Preferably, it further includes:

[0028] The valley-roughness boundary line is verified. If it is inaccurate, the grayscale image is re-binarized to identify the valley-roughness boundary line until the verification is passed.

[0029] As one specific implementation of this disclosure,

[0030] Secondly, embodiments of this disclosure also provide a valley-roughness boundary line recognition device based on machine vision, comprising:

[0031] The preprocessing module acquires images and performs image enhancement.

[0032] The matching module performs image model matching on the enhanced image to obtain a grayscale image.

[0033] The binarization module performs binarization processing on the grayscale image to obtain a binarized image;

[0034] The recognition module performs vertical edge detection based on a sliding window on the binarized image to identify the valley-roughness boundary line.

[0035] Preferably, performing image model matching on the enhanced image to obtain a grayscale image includes:

[0036] Establish matching conditions for color information of rice paddy areas;

[0037] Analyze the matching results of all pixels and determine the classification result of the template to be matched;

[0038] Based on the classification results, the grayscale processing method for the enhanced image is determined.

[0039] Preferably, the classification result is:

[0040]

[0041] Where, mood represents the classification result, and m and n represent the size of the template to be matched.

[0042] Preferably, for an image where mood = mood1, the RGB color model is used for grayscale conversion; for an image where mood = mood2, the RGB color model is converted to the HSI color model before grayscale conversion.

[0043] Preferably, the process of performing vertical edge detection based on a sliding window to identify valley-roughness boundaries using the binarized image includes:

[0044] An initial window C is established, and the binarized image is scanned horizontally with a step size of 1 pixel. After each scan, the pixel values ​​within the window are summed.

[0045] Generate the grayscale fluctuation curve of C, and adaptively remove small-scale grayscale fluctuations in the curve to obtain C1;

[0046] C2 is obtained by removing windows from window C1 whose sum of gray values ​​is less than the mean.

[0047] After performing a first-order difference on window C2, window C3 with the largest first-order difference value in C2 is retained. The position coordinates loc of C3 are calculated through coordinate transformation. These coordinates loc are the actual positions of the valley-roughness boundary line.

[0048] Preferably, the summation of all pixel values ​​within the window is performed using formula (2):

[0049]

[0050] Where C(i) is the sum of pixel gray values ​​in the window after the i-th scan, f2(x,y) is the binarized image, and k1 and k2 are the positions of the left and right ends of the window in the image, respectively.

[0051] Preferably, it further includes:

[0052] The valley-roughness boundary line is verified. If it is inaccurate, the grayscale image is re-binarized to identify the valley-roughness boundary line until the verification is passed.

[0053] Thirdly, embodiments of this disclosure also provide an electronic device, the electronic device comprising:

[0054] Memory, which stores executable instructions;

[0055] A processor that executes the executable instructions in the memory to implement the machine vision-based valley-rough boundary line recognition method.

[0056] Fourthly, embodiments of this disclosure also provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the described machine vision-based valley-rough boundary line recognition method.

[0057] The methods and apparatus of the present invention have other features and advantages that will be apparent from or will be set forth in detail in the accompanying drawings and following detailed description, which together serve to explain the particular principles of the invention. Attached Figure Description

[0058] The above and other objects, features and advantages of the present invention will become more apparent from the more detailed description of exemplary embodiments of the invention in conjunction with the accompanying drawings, wherein the same reference numerals generally represent the same parts.

[0059] Figure 1 A flowchart illustrating the steps of a machine vision-based valley-rough boundary line recognition method according to an embodiment of the present invention is shown.

[0060] Figure 2 A flowchart illustrating the steps of a valley-roughness boundary identification method according to an embodiment of the present invention is shown.

[0061] Figure 3a , Figure 3b , Figure 3c The diagrams show the enhanced image, the grayscale image obtained by the traditional grayscale method, and the grayscale image obtained by this method.

[0062] Figure 4 A schematic diagram of a binarized image according to an embodiment of the present invention is shown.

[0063] Figure 5 A schematic diagram of the grayscale fluctuation transformation processing result according to an embodiment of the present invention is shown.

[0064] Figure 6a , Figure 6b , Figure 6c The diagrams show the original image, the valley-rough boundary line identified by the Canny algorithm, and the valley-rough boundary line identified by this method.

[0065] Figure 7 A block diagram of a valley-rough boundary line recognition device based on a machine vision according to an embodiment of the present invention is shown.

[0066] Explanation of reference numerals in the attached figures:

[0067] 201. Preprocessing module; 202. Matching module; 203. Binarization module; 204. Recognition module. Detailed Implementation

[0068] Preferred embodiments of the invention will now be described in more detail. While preferred embodiments of the invention are described below, it should be understood that the invention can be implemented in various forms and should not be limited to the embodiments set forth herein.

[0069] To facilitate understanding of the solutions and effects of the embodiments of the present invention, four specific application examples are given below. Those skilled in the art should understand that these examples are merely for the purpose of understanding the present invention, and any specific details therein are not intended to limit the present invention in any way.

[0070] Example 1

[0071] Figure 1 A flowchart illustrating the steps of the valley-roughness boundary recognition method according to the present invention is shown.

[0072] like Figure 1As shown, the valley-rough boundary line recognition method based on machine vision includes: step 101, acquiring an image and performing image enhancement; step 102, performing image model matching on the enhanced image to obtain a grayscale image; step 103, performing binarization processing on the grayscale image to obtain a binarized image; step 104, performing vertical edge detection based on a sliding window on the binarized image to identify the valley-rough boundary line.

[0073] In one example, image model matching is performed on the enhanced image to obtain a grayscale image, including:

[0074] Establish matching conditions for color information of rice paddy areas;

[0075] Analyze the matching results of all pixels and determine the classification result of the template to be matched;

[0076] Based on the classification results, determine the grayscale processing method for the enhanced image.

[0077] In one example, the classification result is:

[0078]

[0079] Where, mood represents the classification result, and m and n represent the size of the template to be matched.

[0080] In one example, for the image with mood = mood1, the RGB color model is used for grayscale conversion; for the image with mood = mood2, the RGB color model is converted to the HSI color model before grayscale conversion.

[0081] In one example, vertical edge detection based on a sliding window, identifying valley-roughness boundaries from a binarized image, includes:

[0082] Establish an initial window C, scan the binarized image horizontally with a scan step of 1 pixel, and sum all pixel values ​​within the window after each scan.

[0083] Generate the grayscale fluctuation curve of C, and adaptively remove small-scale grayscale fluctuations in the curve to obtain C1;

[0084] C2 is obtained by removing windows from window C1 whose sum of gray values ​​is less than the mean.

[0085] After performing a first-order difference on window C2, retain window C3 with the largest first-order difference value in C2. Calculate the position coordinates loc of C3 through coordinate transformation. These coordinates loc are the actual position of the valley-roughness boundary line.

[0086] In one example, the summation of all pixel values ​​within the window is performed using formula (2):

[0087]

[0088] Where C(i) is the sum of pixel gray values ​​in the window after the i-th scan, f2(x,y) is the binarized image, and k1 and k2 are the positions of the left and right ends of the window in the image, respectively.

[0089] In one example, it also includes:

[0090] The valley-roughness boundary is verified. If it is inaccurate, the grayscale image is re-binded to identify the valley-roughness boundary until it passes the verification.

[0091] Figure 2 A flowchart illustrating the steps of a valley-roughness boundary identification method according to an embodiment of the present invention is shown.

[0092] Specifically, such as Figure 2 As shown, a variable light source is fixed directly above the paddy-rice separation device, and a standard handheld camera is placed on a tripod. To reduce image distortion and thus minimize deviation in the boundary line position, the handheld camera is aimed above the paddy-rice separation line at the end of the vibrating screen plate. Since the baffle of the paddy-rice separation device creates shadows on both sides of the image, these shadowed areas are ignored during image acquisition. Because the paddy-rice separation device vibrates continuously, to better preserve image information, a method of recording video first and then extracting images frame by frame is used to avoid image blurring caused by direct shooting.

[0093] During image acquisition, noise is often introduced, leading to the loss of some information about the target object. Therefore, image enhancement processing is necessary. Since Gaussian filtering can effectively suppress image noise, it is chosen to eliminate noise, enhance the useful information, and achieve the goal of image enhancement.

[0094] Field research revealed that images of grain-rice separation from different factories often exhibit different color distributions. Even within the same factory, color information varies significantly across different time periods, and the same grayscale processing method cannot satisfy images with varying color information. To address this issue, an image model matching method is proposed. This method pre-classifies image matching and performs grayscale conversion based on different matching results. Since the separating plate of the grain-rice separation device is perpendicular to the horizontal direction, the identification result of the grain-rice boundary line needs to be fitted to a straight line. This paper, taking advantage of this characteristic, proposes a vertical edge detection algorithm based on a sliding window. This method not only eliminates the need for straight-line fitting of edges but also solves the problem of numerous coexisting false edges in the image.

[0095] The HSI color model is an ideal tool for image processing algorithms based on color image description. It represents color signals as three attributes: hue, saturation, and brightness, overcoming the coupling defect between these two attributes in the general RGB color model. In the study of images showing rice grain separation, it was found that the color information of the rice grain region on the left side of the image varies significantly. The traditional RGB color model-based grayscale conversion method is not well applied to all rice grain separation images. When the blue component in the rice grain region is low, the traditional grayscale conversion method does not produce ideal results.

[0096] This method first establishes matching conditions for the color information of the rice region, then selects a template Mask to be matched in the rice region on the left side of the image, and performs color information matching on the Mask. Finally, based on the matching results, the rice-rice separation image is processed using the corresponding grayscale method.

[0097] The specific steps of the image model matching method are as follows:

[0098] 1) Establish matching conditions for color information of rice area. Select an image of size m×n in the left area of ​​the image, i.e. the rice area, as the template to be matched, extract the three-channel color components of each pixel in the Mask, use formula (3) to match the Mask, and store the matching result in matrix M.

[0099]

[0100] Where f(x,y,1), f(x,y,2), and f(x,y,3) are the R, G, and B color components at point (x,y) in the Mask, respectively; M(x,y) is the matching result of the Mask at point (x,y); and {t1,t2,t3,t4,t5,t6} represents the set of parameters that can distinguish the color information of the Mask, with the values ​​of the elements in the set ranging from 0 to 255.

[0101] 2) Calculate the matching results of all pixels in M, and use formula (1) to determine the classification result of Mask.

[0102] 3) Based on the classification result "mood," different grayscale processing methods are applied to the valley separation state images. For images with a matching result "mood = mood1," the RGB color model is directly used for grayscale conversion; for images with "mood = mood2," the RGB color model needs to be converted to the HSI color model before grayscale conversion. The image conversion formula is as follows:

[0103]

[0104]

[0105] I = (R + G + B) / 3 (6)

[0106] in:

[0107]

[0108] Wherein, R, G, and B are the red, green, and blue components of a pixel in the image, respectively, and H, S, and I are the hue, saturation, and brightness components of a pixel in the image, respectively.

[0109] Figure 3a , Figure 3b , Figure 3c The diagrams show the enhanced image, the grayscale image obtained by the traditional grayscale method, and the grayscale image obtained by this method.

[0110] See grayscale processing effect Figures 3a-3c As shown in the figure, the grayscale image obtained using this method is significantly improved, retaining edge details well and making it easier to select the binarization threshold.

[0111] Figure 4 A schematic diagram of a binarized image according to an embodiment of the present invention is shown.

[0112] A comprehensive evaluation was conducted on histogram-thresholding image segmentation, half-thresholding selection image segmentation, iterative thresholding image segmentation, invariant thresholding image segmentation, and inter-class variance adaptive thresholding. Since the maximum inter-class variance segmentation method is the least time-consuming, based on the grayscale characteristics of the image, the misclassification probability of thresholding image segmentation is minimized when the inter-class variance is maximized, thus avoiding, to some extent, situations where some objects are misclassified as background or vice versa. Pixels with grayscale values ​​greater than the threshold are set to 1, and pixels with grayscale values ​​less than the threshold are set to 0. When the boundary position fluctuates significantly, the binarization threshold should be readjusted. The binarization processing results of the valley roughness component image are shown below. Figure 4 As shown.

[0113] Edge information is crucial image feature information, and edge detection methods are a highly attractive topic in image analysis and recognition. Among these, the Canny operator has become the preferred edge detection algorithm due to its strong anti-interference capabilities and low computational complexity. After studying the patterns of valley-roughness separation images, it was found that the global color information of the valley-roughness separation image is gradual, while the local color information of the valley-roughness boundary is abrupt. Since there are a large number of white pixels on the right side of the image after binarization, directly applying the Canny edge detection algorithm will result in many false edges in the results. Currently, before using the Canny edge detection method, it is often necessary to perform opening and closing operations or connected component operations on the image to remove false edges, but this will lose some edge information, which is not conducive to the accurate identification of valley-roughness boundaries.

[0114] To more accurately obtain the edge information of valley-roughness boundary lines, a vertical edge detection algorithm based on a sliding window is proposed. This algorithm combines the color information features of global gradients and local abrupt changes in the valley-roughness separation state image with vertical edge features. It utilizes a sliding window to analyze and filter the pixel information of each column of the binarized image matrix to obtain the location information of the target edge. The specific steps are as follows:

[0115] 1) Create a window C with size height×width, where height is the image height and width is related to the width of the material distribution plate. Scan the image horizontally with a step size of 1 pixel. After each scan, sum all pixel values ​​in the window using formula (2).

[0116] 2) Perform grayscale transformation on window C to obtain C1. In order to quickly find the abrupt and gradual parts in C, first generate the grayscale fluctuation curve of C, and then perform first-order difference on the pixels.

[0117] However, since the fluctuation curve of C is not smooth, the numerical fluctuation after first-order differencing of C is relatively large. Using the standard deviation instead of a manually set threshold, small-scale gray-level fluctuations in the curve are adaptively removed to obtain C1. Specifically, this is described as iterating through all the extreme points in C, if there exists k... i k j Make the extreme point pair (pe(k) i ,C(k i )),te(k j ,C(k j Simultaneously satisfy:

[0118]

[0119] In formula (8):

[0120]

[0121] Figure 5 A schematic diagram of the grayscale fluctuation transformation processing result according to an embodiment of the present invention is shown.

[0122] Then point Pr(k) peak ,C(k peak The peaks ()) represent large-scale peaks. The search strategy for troughs is similar. The grayscale fluctuation curves of C and C1 are shown below. Figure 5 As shown, the horizontal axis X represents the total number of windows, and the vertical axis Y represents the total grayscale value within each window. By performing grayscale transformation on the fluctuation curve of C, some noise can be removed, reducing the amount of information while reflecting the global trend information of the grayscale fluctuation curve, thus exhibiting a certain degree of real-time performance.

[0123] 3) Perform the first filtering on window C1 to obtain C2. After removing windows where the sum of grayscale values ​​is less than the mean, C2 is obtained.

[0124] C2={C1(i)|C1(i)>mean(C1)} (10)

[0125] 4) Perform a second filtering on window C2 to obtain C3. After performing first-order differencing on window C2, retain window C3 with the largest first-order differencing value in C2, i.e.

[0126] C3={C2(i)|max(diff(C2(i)))} (11)

[0127] Using the lower left corner of the image as the origin, scale down the actual length and width of the factory sieve plate proportionally and establish a coordinate system. Calculate the position coordinates loc of C3 through coordinate transformation. These coordinates loc are the actual position of the valley-rough boundary line.

[0128] The boundary line position of the valley separation state image varies within a certain range. To increase the accuracy of the algorithm and reduce the impact of changes in illumination intensity, error is utilized. The positions of the boundary lines identified at adjacent time points are compared. If the difference in positions exceeds the error range, the binarization threshold T is adjusted, and the boundary lines are re-identified. The error range is calculated using formula (12).

[0129]

[0130] Where n1 and n2 are the maximum permissible error set manually and the adaptive error of the algorithm, respectively. ω is a parameter that balances the maximum allowable error set manually and the adaptive error of the algorithm. ω∈[0,1]. When ω is 0, the error range depends entirely on the manual setting; when ω is 1, the error range is adaptively adjusted by the algorithm.

[0131] Figure 6a , Figure 6b , Figure 6c The diagrams show the original image, the valley-rough boundary line identified by the Canny algorithm, and the valley-rough boundary line identified by this method.

[0132] Using 1000 valley-rough separation state images as the experimental sample, 100 images were sampled every hour, for a total of ten groups, with each sampling time not exceeding 5 minutes. To test the adaptability of the method, the sample included two valley-rough separation state images with significantly different color information. To simulate actual lighting changes in a factory, three lighting conditions—weak light, normal light, and strong light—were applied to the valley-rough separation state images, and the method was compared with the Canny algorithm in edge detection to test its reliability. The experimental results are as follows: Figures 6a-6cAs shown.

[0133] Depend on Figures 6a-6c It can be seen that the Canny algorithm preserves the details of the boundary line edge well and can identify the contour information of the edge, but some false edges will appear, which will interfere with the localization of the boundary line and be detrimental to the line fitting operation in the next step. In addition, the Canny algorithm is not very adaptable to the lighting conditions. False edges are more likely to appear under low light and strong light conditions. The frequent occurrence of false edges is analyzed because there are still scattered rice grains in the mixed area of ​​rice and chaff in the rice-rice separation image. The binarized image needs to remove connected components, which will lead to false edges after edge recognition. Our method has a more ideal effect on the rice-rice boundary line recognition, without the generation of false edges, and can identify clear vertical edges in rice-rice separation images under three lighting conditions. Moreover, our method can directly identify the vertical rice-rice boundary line without the need for line fitting, thus preserving the edge information of the rice-rice boundary line to a greater extent and increasing the real-time performance and accuracy of our method.

[0134] To verify the accuracy of the valley-roughness boundary position obtained based on this method, experiments were conducted under three lighting conditions. The actual position of the dividing plate in each group of single images was set as the actual value location1, and the valley-roughness boundary positions calculated based on the Canny algorithm and this method were set as the measured values ​​location2 and location3, respectively. The average values ​​of the absolute and relative errors of the boundary position in each group were calculated to verify the feasibility of this method. The relative errors of the valley-roughness boundary position in each group are shown in Table 1.

[0135] Table 1

[0136]

[0137] Table 1 shows that after processing the valley-rough separation image, the relative error of the boundary line using the Canny algorithm ranges from 5.6% to 9.2%. Under low light conditions, the relative error of the Canny algorithm for boundary line identification is relatively large, and the relative error results for each group fluctuate significantly, easily affected by complex lighting and image color information. After processing by this method, the relative error of the boundary line ranges from 3.8% to 5.7%, and the relative error results under the three lighting conditions are concentrated between 4% and 5%, with smaller fluctuations and stronger adaptability to different lighting conditions. Compared with the traditional Canny edge detection algorithm, this method improves the accuracy of valley-rough boundary line location identification.

[0138] Based on the location data of the paddy-brown dividing line, this method can control the relative error of the dividing line position to about 5% by properly managing the lighting conditions. The results show that this method for obtaining the location information of the paddy-brown dividing line is feasible and meets the requirements of rice processing production.

[0139] Since the measurement is done manually, the actual position of the dividing plate cannot completely represent the theoretical position of the valley-rough boundary. Therefore, the absolute error Δx of the boundary position is smaller than the mean error in formula (12). The experimental group was deemed to have successfully identified the grains. Further investigation revealed that, to minimize the amount of mixed paddy rice in the paddy-brown mixing zone, workers would place the separating plate slightly to the right during operation. This caused the actual value of the dividing line, location1, to be larger, resulting in a systematic error. By manually compensating for the measured value, location3, the absolute error of the dividing line after compensation is shown in Table 2. It can be seen that compensating for the position of the paddy-brown dividing line reduced the absolute error, keeping it within 3 cm, and achieving a 90% success rate, which better reflects the actual situation.

[0140] Table 2

[0141]

[0142] Note: "√" indicates that the boundary between the paddy and turmeric fields was successfully identified; "×" indicates that the boundary between the paddy and turmeric fields failed to be identified.

[0143] 1) To achieve accurate identification of the valley-roughness boundary, this method proposes a valley-roughness boundary recognition method based on vertical edge detection, combined with machine vision. The valley-roughness separation image is processed through image model matching, boundary detection, and boundary verification. Based on different image color information, a method for valley-roughness separation image model matching is proposed: color images are pre-classified for matching, and the images are converted to grayscale based on different matching results.

[0144] 2) To address the issues of coexistence of pseudo-edges and loss of edge details in traditional edge detection algorithms, a vertical edge detection algorithm based on a sliding window is proposed, which combines the vertical edge features of valley-rough separation images. This algorithm performs discrimination calculations on the pixel information of each column of the image through a vertical window, and finally obtains the position information of the valley-rough boundary line.

[0145] 3) Experimental results show that compared with the traditional Canny edge detection algorithm, this method can control the absolute error and relative error of the boundary line position to 3cm and 5% respectively, and the success rate of boundary line recognition after manual compensation is 90%. This method can meet the production needs of the grain separation device and lay the foundation for the automatic control of the material distribution plate.

[0146] Example 2

[0147] Figure 7 A block diagram of a valley-rough boundary line recognition device based on a machine vision according to an embodiment of the present invention is shown.

[0148] like Figure 7As shown, the machine vision-based valley-rough boundary recognition device includes:

[0149] Preprocessing module 201 acquires images and performs image enhancement;

[0150] Matching module 202 performs image model matching on the enhanced image to obtain a grayscale image;

[0151] Binarization module 203 performs binarization processing on grayscale images to obtain binarized images;

[0152] The recognition module 204 performs vertical edge detection based on a sliding window on the binarized image to identify the valley-roughness boundary line.

[0153] In one example, image model matching is performed on the enhanced image to obtain a grayscale image, including:

[0154] Establish matching conditions for color information of rice paddy areas;

[0155] Analyze the matching results of all pixels and determine the classification result of the template to be matched;

[0156] Based on the classification results, determine the grayscale processing method for the enhanced image.

[0157] In one example, the classification result is:

[0158]

[0159] Where, mood represents the classification result, and m and n represent the size of the template to be matched.

[0160] In one example, for the image with mood = mood1, the RGB color model is used for grayscale conversion; for the image with mood = mood2, the RGB color model is converted to the HSI color model before grayscale conversion.

[0161] In one example, vertical edge detection based on a sliding window, identifying valley-roughness boundaries from a binarized image, includes:

[0162] Establish an initial window C, scan the binarized image horizontally with a scan step of 1 pixel, and sum all pixel values ​​within the window after each scan.

[0163] Generate the grayscale fluctuation curve of C, and adaptively remove small-scale grayscale fluctuations in the curve to obtain C1;

[0164] C2 is obtained by removing windows from window C1 whose sum of gray values ​​is less than the mean.

[0165] After performing a first-order difference on window C2, retain window C3 with the largest first-order difference value in C2. Calculate the position coordinates loc of C3 through coordinate transformation. These coordinates loc are the actual position of the valley-roughness boundary line.

[0166] In one example, the summation of all pixel values ​​within the window is performed using formula (2):

[0167]

[0168] Where C(i) is the sum of pixel gray values ​​in the window after the i-th scan, f2(x,y) is the binarized image, and k1 and k2 are the positions of the left and right ends of the window in the image, respectively.

[0169] In one example, it also includes:

[0170] The valley-roughness boundary is verified. If it is inaccurate, the grayscale image is re-binded to identify the valley-roughness boundary until it passes the verification.

[0171] Example 3

[0172] This disclosure provides an electronic device comprising: a memory storing executable instructions; and a processor executing the executable instructions in the memory to implement the aforementioned machine vision-based valley-rough boundary line recognition method.

[0173] An electronic device according to an embodiment of the present disclosure includes a memory and a processor.

[0174] This memory is used to store non-transitory computer-readable instructions. Specifically, the memory may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may, for example, include random access memory (RAM) and / or cache memory. The non-volatile memory may, for example, include read-only memory (ROM), hard disk, flash memory, etc.

[0175] The processor may be a central processing unit (CPU) or other form of processing unit with data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device to perform desired functions. In one embodiment of this disclosure, the processor is used to execute computer-readable instructions stored in the memory.

[0176] Those skilled in the art will understand that, in order to solve the technical problem of how to achieve a good user experience, this embodiment may also include well-known structures such as communication buses and interfaces, and these well-known structures should also be included within the protection scope of this disclosure.

[0177] For a detailed description of this embodiment, please refer to the corresponding descriptions in the foregoing embodiments, which will not be repeated here.

[0178] Example 4

[0179] This disclosure provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the machine vision-based valley-rough boundary line recognition method.

[0180] A computer-readable storage medium according to embodiments of the present disclosure stores non-transitory computer-readable instructions. When these non-transitory computer-readable instructions are executed by a processor, all or part of the steps of the methods described in the foregoing embodiments of the present disclosure are performed.

[0181] The aforementioned computer-readable storage media include, but are not limited to: optical storage media (e.g., CD-ROM and DVD), magneto-optical storage media (e.g., MO), magnetic storage media (e.g., magnetic tape or portable hard drive), media with built-in rewritable non-volatile memory (e.g., memory card), and media with built-in ROM (e.g., ROM cartridge).

[0182] Those skilled in the art should understand that the above description of the embodiments of the present invention is only intended to illustrate the beneficial effects of the embodiments of the present invention, and is not intended to limit the embodiments of the present invention to any of the examples given.

[0183] The various embodiments of the present invention have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments.

Claims

1. A method for identifying valley-roughness boundaries based on machine vision, characterized in that, include: Acquire images and perform image enhancement; Image model matching is performed on the enhanced image to obtain a grayscale image; The grayscale image is binarized to obtain a binarized image; Vertical edge detection based on a sliding window is performed on the binarized image to identify the valley-roughness boundary line; Specifically, the process of performing vertical edge detection based on a sliding window and identifying valley-roughness boundaries using the binarized image includes: Create an initial window The binarized image is scanned horizontally with a step size of 1 pixel. After each scan, the pixel values ​​within the window are summed. generate The grayscale fluctuation curve is obtained by adaptively removing small-scale grayscale fluctuations from the curve. ; For windows After removing windows where the sum of gray values ​​is less than the mean, we get ; For window After first difference, retain The window with the largest first-order difference Calculated through coordinate transformation Position coordinates The coordinates This is the actual location of the valley-rough boundary line.

2. The valley-roughness boundary recognition method based on machine vision according to claim 1, wherein, Image model matching is performed on the enhanced image to obtain a grayscale image, including: Establish matching conditions for color information of rice paddy areas; Analyze the matching results of all pixels and determine the classification result of the template to be matched; Based on the classification results, the grayscale processing method for the enhanced image is determined.

3. The valley-roughness boundary recognition method based on machine vision according to claim 2, wherein, The classification result is as follows: (1) Where, mood represents the classification result, and m and n represent the size of the template to be matched. for At point The matching results at the specified location.

4. The valley-roughness boundary recognition method based on machine vision according to claim 3, wherein, for The image is converted to grayscale using the RGB color model; for The image is converted from the RGB color model to the HSI color model and then grayscale is processed.

5. The valley-roughness boundary recognition method based on machine vision according to claim 1, wherein, Summing all pixel values ​​within the window using formula (2): (2) in, For the first The sum of the pixel grayscale values ​​within the window after each scan The image after binarization. , These represent the positions of the left and right ends of the window in the image, respectively, and m represents the size of the template to be matched.

6. The valley-roughness boundary recognition method based on machine vision according to claim 1, wherein, Also includes: The valley-roughness boundary line is verified. If it is inaccurate, the grayscale image is re-binarized to identify the valley-roughness boundary line until the verification is passed.

7. A valley-rough boundary line recognition device based on machine vision, characterized in that, include: The preprocessing module acquires images and performs image enhancement. The matching module performs image model matching on the enhanced image to obtain a grayscale image. The binarization module performs binarization processing on the grayscale image to obtain a binarized image; The recognition module performs vertical edge detection based on a sliding window on the binarized image to identify the valley-roughness boundary line; Specifically, the process of performing vertical edge detection based on a sliding window and identifying valley-roughness boundaries using the binarized image includes: Create an initial window The binarized image is scanned horizontally with a step size of 1 pixel. After each scan, the pixel values ​​within the window are summed. generate The grayscale fluctuation curve is obtained by adaptively removing small-scale grayscale fluctuations from the curve. ; For windows After removing windows where the sum of gray values ​​is less than the mean, we get ; For window After first difference, retain The window with the largest first-order difference Calculated through coordinate transformation Position coordinates The coordinates This is the actual location of the valley-rough boundary line.

8. An electronic device, characterized in that, The electronic device includes: Memory, which stores executable instructions; A processor that executes the executable instructions in the memory to implement the valley-rough boundary line recognition method based on machine vision as described in any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the valley-rough boundary line recognition method based on machine vision as described in any one of claims 1-6.

Citation Information

Patent Citations

  • Method and system for automatically recognizing images of stalks and leaves of corns

    CN103116747A

  • Edge recognition method and system based on adaptive threshold, and storage medium

    CN113538491A