A method for detecting the chopped length of corn stalks based on machine vision

Through machine vision-based detection methods, the problem of inaccurate length measurement after corn stalks is solved, real-time accurate measurement is achieved, and technical support is provided for the intelligent transformation of corn baling machinery.

CN119399256BActive Publication Date: 2025-04-01JILIN UNIVERSITY
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510006055.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-03
Publication Date
2025-04-01
Estimated Expiration
2045-01-03

AI Technical Summary

Technical Problem

During the chopping process, existing corn straw baling and harvesting machinery has problems such as large operation losses, different cutting lengths and low intelligence levels, which makes it difficult to achieve real-time accurate measurement of the length after chopping of straw.

Method used

Using machine vision-based detection methods, image data of chopped straw is acquired and processed, and image enhancement, target extraction and length detection are used to perform image enhancement, target extraction and length detection, real-time accurate measurement of the length after chopping of straw is achieved.

Benefits of technology

Real-time accurate measurement of the length of straw after chopping is realized, filling the gap in the field of intelligent testing in the existing technology, and providing technical support for the intelligent transformation of corn baling machinery.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119399256B_ABST
    Figure CN119399256B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for detecting the chopped length of corn stalks based on machine vision, and relates to the technical field of intelligent corn stalk harvesting. The method comprises: obtaining an image to be detected, and inputting the image to be detected into a pre-trained model to obtain the length corresponding to each corn stalk in the image to be detected; the training process of the model is: performing transformation processing in the airspace on the experimental image data to obtain enhanced image data; segmenting and extracting the enhanced image data, and marking it, determining the area corresponding to each connected region, and calculating the actual length of the corn stalk corresponding to each area based on the minimum circumscribed rectangle fitting, and determining whether to adjust the model parameters based on the actual physical length and the actual length. The present invention realizes the real-time and accurate measurement of the length of the chopped stalks, and provides technical support for the intelligent transformation of corn baling machinery.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0002] my country produces about 3.21 tons of corn straw every year, accounting for 37.3% of the total crop straw production. It has low density, large volume, and scattered distribution, making it difficult to collect and comprehensively utilize. With the rapid development of animal husbandry and circular economy, the use of corn straw for feed has become the main direction of comprehensive utilization of straw. After corn straw is chopped, baled, harvested, and processed for feed, it is rich in nutrients and has good palatability. It has become an important source of high-quality forage. However, at this stage, my country's demand for high-quality forage is expected to have a gap of 50 million tons, so it is urgent to promote the development of the corn straw baling for feed industry. On the other hand, the existing corn straw baling and harvesting machinery has problems such as large operating losses, inconsistent cutting lengths, and low intelligence levels, which also seriously restricts the filling of the gap between straw supply and demand.

[0003] The chopping process is a key link in corn straw baling. The chopped straw effectively reduces the storage, transportation and feeding costs. Therefore, the length of the chopped straw is a key indicator affecting the quality of subsequent feed. In order to obtain a reasonable chopping length, mechanical screening is often used to ensure the chopping quality. Chinese invention patent application CN 111670691 B discloses a reciprocating multi-directional straw chopping and crushing device with a length screening function, which is provided with a crushing screen to ensure the length of the straw chopping. However, during its operation, it is very easy to have problems such as straw blockage and high power consumption, and it is impossible to directly obtain the operating status information for real-time adjustment of the operating parameters of the chopping device, and it is impossible to simultaneously ensure the chopping efficiency and chopping quality. Therefore, how to accurately detect the length of the chopped straw in real time is crucial to improving the quality of the chopping operation and ensuring the high-quality and efficient baling of corn straw for feeding. Summary of the invention

[0004] The technical problem to be solved by the present invention is to address the deficiencies of the prior art and specifically provide a method for detecting the chopped length of corn stalks based on machine vision, which is as follows:

[0005] 1) In the first aspect, the present invention provides a method for detecting the chopped length of corn stalks based on machine vision, and the specific technical scheme is as follows:

[0006] Obtain an image to be detected, and input the image to be detected into a pre-trained model to obtain the length corresponding to each corn stalk in the image to be detected;

[0007] Among them, the training process of the pre-training model is specifically as follows:

[0008] Acquire experimental image data of corn stalks, perform spatial transformation processing on the experimental image data to obtain enhanced image data, and obtain the actual physical length of the corn stalks corresponding to the experimental image data;

[0009] The enhanced image data is segmented and extracted, and the connected areas obtained by the segmentation are marked, and the area corresponding to each connected area is determined. The length of the corn stalk corresponding to each area is calculated based on the minimum circumscribed rectangle fitting, and each length is converted to determine the actual length. Based on the actual physical length and the actual length, it is determined whether to adjust the model parameters. When the result is determined that no adjustment is required, the current model parameters are output, and the trained model is determined based on the current model parameters.

[0010] The beneficial effects of the corn stalk chopped length detection method based on machine vision provided by the present invention are as follows:

[0011] The collected chopped straw images are processed through image enhancement, target extraction and length detection algorithms, which enables real-time and accurate measurement of the length of the straw after chopped straw, filling the gap in the existing field of intelligent detection of chopped straw length and providing technical support for the intelligent transformation of corn baling machinery.

[0012] Based on the above solution, the present invention can also be improved as follows.

[0013] Furthermore, the transformation processing in the spatial domain includes at least one of grayscale processing, grayscale transformation processing, smoothing filtering processing and histogram equalization processing.

[0014] Furthermore, the segmentation extraction includes: threshold segmentation processing, edge detection processing and morphological opening and closing operation processing.

[0015] Furthermore, the detection operators in the edge detection process include: Roberts operator, Sobel operator, Prewitt operator and Canny operator.

[0016] 2) In the second aspect, the present invention also provides a corn stalk chopped length detection system based on machine vision, and the specific technical solution is as follows:

[0017] The detection module is used to: obtain the image to be detected, and input the image to be detected into the pre-training model to obtain the length corresponding to each corn stalk in the image to be detected;

[0018] Among them, the training process of the pre-training model is specifically as follows:

[0019] Acquire experimental image data of corn stalks, perform spatial transformation processing on the experimental image data to obtain enhanced image data, and obtain the actual physical length of the corn stalks corresponding to the experimental image data;

[0020] The enhanced image data is segmented and extracted, and the connected areas obtained by the segmentation are marked, and the area corresponding to each connected area is determined. The length of the corn stalk corresponding to each area is calculated based on the minimum circumscribed rectangle fitting, and each length is converted to determine the actual length. Based on the actual physical length and the actual length, it is determined whether to adjust the model parameters. When the result is determined that no adjustment is required, the current model parameters are output, and the trained model is determined based on the current model parameters.

[0021] Based on the above solution, the present invention can also be improved as follows.

[0022] Furthermore, the transformation processing in the spatial domain includes at least one of grayscale processing, grayscale transformation processing, smoothing filtering processing and histogram equalization processing.

[0023] Furthermore, the segmentation extraction includes: threshold segmentation processing, edge detection processing and morphological opening and closing operation processing.

[0024] Furthermore, the detection operators in the edge detection process include: Roberts operator, Sobel operator, Prewitt operator and Canny operator.

[0025] 3) In a third aspect, the present invention further provides an electronic device, comprising a processor, wherein the processor is coupled to a memory, wherein the memory stores at least one computer program, and wherein the at least one computer program is loaded and executed by the processor so that the electronic device implements any of the above methods.

[0026] 4) In a fourth aspect, the present invention further provides a computer-readable storage medium, wherein at least one computer program is stored in the computer-readable storage medium, and the at least one computer program is loaded and executed by a processor to enable a computer to implement any of the above methods.

[0027] It should be noted that the beneficial effects achieved by the technical solutions of the second to fourth aspects of the present invention and the corresponding possible implementation methods can be found in the above-mentioned technical effects of the first aspect and its corresponding possible implementation methods, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Other features, objects and advantages of the present invention will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:

[0029] Figure 1 This is one of the flow charts of a method for detecting the chopped length of corn stalks based on machine vision according to an embodiment of the present invention;

[0030] Figure 2The second flowchart of a method for detecting the chopped length of corn stalks based on machine vision according to an embodiment of the present invention;

[0031] Figure 3 A schematic diagram of an original image of chopped corn stalks in a method for detecting chopped length of corn stalks based on machine vision according to an embodiment of the present invention;

[0032] Figure 4 A schematic diagram of a grayscale image of chopped corn stalks of a method for detecting chopped corn stalk length based on machine vision according to an embodiment of the present invention;

[0033] Figure 5 A schematic diagram of a chopped corn stalk image after nonlinear grayscale transformation of a method for detecting chopped corn stalk length based on machine vision according to an embodiment of the present invention;

[0034] Figure 6 This is a schematic diagram of a chopped corn stalk image after 5*5 median filtering in a method for detecting chopped corn stalk length based on machine vision according to an embodiment of the present invention;

[0035] Figure 7 A schematic diagram of a chopped corn stalk image after threshold segmentation based on the Otsu method in a method for detecting chopped corn stalk length based on machine vision according to an embodiment of the present invention;

[0036] Figure 8 A schematic diagram of a chopped straw image after edge detection based on a Sobel operator in a method for detecting chopped corn straw length based on machine vision according to an embodiment of the present invention;

[0037] Fig. 9 A schematic diagram of a chopped straw image after a morphological disk structure opening operation of a method for detecting chopped corn straw length based on machine vision according to an embodiment of the present invention;

[0038] Fig.10 The third flowchart of a method for detecting the chopped length of corn stalks based on machine vision according to an embodiment of the present invention;

[0039] Fig.11 The figure is a structural frame diagram of an electronic device. DETAILED DESCRIPTION

[0040] In order to make the objectives, technical solutions and advantages of the present invention more clear, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.

[0041] like Figure 1 Figure 2 as well as Fig.10 As shown, a method for detecting the chopped length of corn stalks based on machine vision according to an embodiment of the present invention comprises the following steps:

[0042] S1, obtaining an image to be detected, and inputting the image to be detected into a pre-trained model to obtain the length corresponding to each corn stalk in the image to be detected;

[0043] Among them, the training process of the pre-training model is specifically as follows:

[0044] Acquire experimental image data of corn stalks, perform spatial transformation processing on the experimental image data to obtain enhanced image data, and obtain the actual physical length of the corn stalks corresponding to the experimental image data;

[0045] The enhanced image data is segmented and extracted, and the connected areas obtained by the segmentation are marked, and the area corresponding to each connected area is determined. The length of the corn stalk corresponding to each area is calculated based on the minimum circumscribed rectangle fitting, and each length is converted to determine the actual length. Based on the actual physical length and the actual length, it is determined whether to adjust the model parameters. When the result is determined that no adjustment is required, the current model parameters are output, and the trained model is determined based on the current model parameters.

[0046] The beneficial effects of the corn stalk chopped length detection method based on machine vision provided by the present invention are as follows:

[0047] The collected chopped straw images are processed through image enhancement, target extraction and length detection algorithms, which enables real-time and accurate measurement of the length of the straw after chopped straw, filling the gap in the existing field of intelligent detection of chopped straw length and providing technical support for the intelligent transformation of corn baling machinery.

[0048] The specific process of obtaining the experimental image data of corn stalks is as follows:

[0049] A preset number of cut corn stalks are placed in a designated container, and each corn stalk is numbered. The actual physical length of the actual corn stalk corresponding to each number is recorded and stored. The interior of the designated container is photographed by a monocular camera placed in a fixed position to obtain experimental image data, such as Figure 3 shown.

[0050] It should be further explained that in order to improve the subsequent training accuracy of the model during the process of obtaining experimental image data, the cut corn stalks are usually arranged in a partially stacked manner. If the corn stalks cannot be stacked due to the shape of the corn stalks, the original image that has been taken is processed by image rotation to make the experimental image data diverse, and the training set (composed of experimental image data) used for training can also be expanded.

[0051] The specific process of rotating the image is:

[0052] The original image is obtained by a monocular camera. In the original image, a preset range is determined (the preset range is a regular or irregular area set manually for area locking), and the preset range is used as a sliding window for sliding search in the original image. The area with the largest number of corn stalks in the sliding window is determined, and the area is cropped to obtain the area to be rotated. The corn stalks in the area to be rotated are fitted into line segments, and any line segment is selected. The line segment is rotated in a clockwise or counterclockwise order. During the rotation process, the rotation is performed with the rotation center point as the center of the circle, and the number of line segments intersecting with the line segment is determined in real time. The rotation angle and the position of the rotation center point when the number of intersections corresponding to the line segment is the largest during one rotation are extracted and recorded. The rotation center point starts from one end point of the line segment and gradually moves to the other end point of the line segment. The moving distance is determined according to the length of the line segment. The length of one tenth of the length of the line segment can be selected as the moving distance, or it can be determined by manual definition. When any rotation center point completes one rotation, switch to the next rotation center point to repeat the rotation process and record it. After traversing all the rotation center points on the line segment, all recorded data are sorted in descending order according to the number of intersections to obtain a sorting table, and multiple rotation center points with the largest and identical number of intersections and corresponding rotation angles are extracted in the order in the sorting table, and the rotation center points, rotation angles and line segments are restored one by one to obtain a corn stalk layout diagram rotated according to the above arrangement method, and determine whether there is a situation in the corn stalk layout diagram where the rotated corn stalks cover at least half of the area of ​​any corn stalk;

[0053] If it does not exist, a rotation process is performed according to the rotation center point and the corresponding rotation angle to obtain a filling area for replacing the area to be rotated, and the filling area replaces the area to be rotated to generate a new original image;

[0054] If it exists, the rotation center point and the corresponding rotation angle are eliminated, and the rotation center point, rotation angle and line segment are restored continuously until the rotation center point and the corresponding rotation angle that meet the conditions are selected, and the rotation processing is performed according to the rotation center point and the corresponding rotation angle to obtain a filling area for replacing the area to be rotated, and the filling area replaces the area to be rotated to generate a new original image;

[0055] If, according to the order in the sorting table, there is only one rotation center point and corresponding rotation angle with the largest number of intersections, then after restoring the rotation center point, rotation angle and line segment, a corn stalk layout diagram is obtained, and it is determined whether in the corn stalk layout diagram, the rotated corn stalks cover at least half of the area of ​​any corn stalk. If not, the same processing method as above is used for non-existence. If so, fine-tune the rotation angle to ensure that the area covered by the corn stalks is less than half of any corn stalk while the number of intersections remains unchanged. Re-record the rotation angle, and replace the original rotation angle with the new rotation angle. Perform rotation processing according to the rotation center point and the corresponding new rotation angle to obtain a filling area used to replace the area to be rotated. Replace the area to be rotated with the filling area to generate a new original image.

[0056] The new original image is used as experimental image data, that is, as a training set for subsequent model training.

[0057] Transformation processing in the airspace of the experimental image data can enhance the recognizability of the straw and the background and improve the image quality, including grayscale processing, grayscale transformation processing, smoothing filter processing and histogram equalization processing.

[0058] The grayscale operation converts the RGB image into a grayscale image to facilitate subsequent image processing; Figure 4 As shown in , the grayscale transformation operation recalculates the grayscale value of the grayscale image according to certain rules to increase the dynamic range of the image; Figure 5 As shown, the smoothing filter operation denoises the transformed image to reduce image noise interference; Figure 6 As shown, the histogram equalization operation redistributes the grayscale distribution of the filtered image to improve the overall contrast of the image;

[0059] The grayscale operation converts the input image into a grayscale image by using the function rgb2gray(), the grayscale transformation operation performs nonlinear grayscale transformation on the grayscale image by using the function double(I1)+0.006*double(I1).*(255-double(I1)), the smoothing filtering operation performs median filtering on the grayscale transformed image by using the function medfilt2(I1,[5,5]), and the histogram equalization operation performs histogram equalization on the filtered image by using the function histeq().

[0060] Segmentation extraction can determine the pixel location area occupied by corn stalks and eliminate the influence of interference points and holes in the connected area. It includes: threshold segmentation processing, edge detection processing and morphological opening and closing operation processing.

[0061] The threshold segmentation operation will binarize the enhanced grayscale image according to the threshold value, so that the grayscale image is converted into a black and white image; Figure 7 As shown in FIG, the edge detection operation recognizes the outer edge of the entity contour in the black and white image through convolution operation, and separates the outer contour of the straw in the image; Figure 8 As shown in Figure 2, the morphological opening and closing operation dilates and corrodes the segmented straw area to eliminate small interference points and holes in the area, making the connected area more accurate, as shown in Figure 2. Fig. 9 As shown;

[0062] The threshold segmentation operation performs optimal global threshold processing on the enhanced image by using the function graythresh(), the edge detection operation performs Sobel operator processing on the segmented black and white image by using the function edge(I1,'sobel'), and the morphological opening and closing operation performs an opening operation on the image after edge detection by using the function strel('disk',3).

[0063] The segmented connected regions are marked, the area in the region is calculated, the connected regions with smaller areas are removed, the pixel length after straw crushing is calculated based on the minimum circumscribed rectangle fitting, and the pixel length is converted into the actual physical length based on the calibrated size;

[0064] The labeling process specifically uses the function bwlabel(I1) to label the connected region, uses regionprops(I1,'Area') to calculate the area within the connected region, and uses minboxing() to calculate the minimum circumscribed rectangle fitting of the connected region.

[0065] The actual physical length is used as a validation set to compare and judge the length values ​​output by the model and calculate the initial measurement accuracy;

[0066] If the accuracy is greater than 90%, the initial calibration is completed. If the accuracy is less than 90%, the model parameters are adjusted until the accuracy is greater than 90%.

[0067] Save the measured length and the corresponding image output in jpg format and end.

[0068] If the accuracy is less than 90%, the model parameters are adjusted until the accuracy is greater than 90%. The specific process is as follows:

[0069] Step 1: If the judgment accuracy is less than 90%, jump to step 2;

[0070] Step 2, adjusting the image enhancement module method settings in step 2, and further changing the grayscale transformation and image filtering methods;

[0071] Grayscale transformation methods include linear transformation, exponential transformation and logarithmic transformation, and image filtering methods include median filtering, mean filtering and Gaussian filtering;

[0072] Change the threshold segmentation method. The threshold segmentation method includes three methods: basic global threshold processing, Otsu method processing and local threshold processing.

[0073] Change the selection of target extraction method, change the selection of edge extraction method detection operator, and change the selection of morphological operation method.

[0074] The detection operators in the edge extraction method include Roberts operator, Sobel operator, Prewitt operator and Canny operator, and the morphological operation method includes opening operation and closing operation.

[0075] The present invention has the following beneficial effects:

[0076] 1. The present invention realizes real-time and accurate measurement of the length of corn stalks after chopped based on image processing method. By inputting chopped stalk pictures, the input images are processed by image enhancement, target extraction and length detection algorithms, and the chopped stalk length data can be directly output;

[0077] 2. Based on the detection method, the present invention can adjust the image processing algorithm settings according to different needs to achieve multi-scene processing. Moreover, the system can be effectively deployed in the host computer and applied to actual production operations to provide technical support for improving the quality and efficiency of straw baling operations.

[0078] Furthermore, the transformation processing in the spatial domain includes at least one of grayscale processing, grayscale transformation processing, smoothing filtering processing and histogram equalization processing.

[0079] Furthermore, the segmentation extraction includes: threshold segmentation processing, edge detection processing and morphological opening and closing operation processing.

[0080] Furthermore, the detection operators in the edge detection process include: Roberts operator, Sobel operator, Prewitt operator and Canny operator.

[0081] In the above embodiments, although the steps are numbered S1, S2, etc., these are only specific embodiments given by the present invention. Those skilled in the art may adjust the execution order of S1, S2, etc. according to actual conditions, which is also within the protection scope of the present invention. It can be understood that in some embodiments, some or all of the above embodiments may be included.

[0082] The present invention also provides a corn stalk chopped length detection system based on machine vision, and the specific technical scheme is as follows:

[0083] The detection module is used to: obtain the image to be detected, and input the image to be detected into the pre-training model to obtain the length corresponding to each corn stalk in the image to be detected;

[0084] Among them, the training process of the pre-training model is specifically as follows:

[0085] Acquire experimental image data of corn stalks, perform spatial transformation processing on the experimental image data to obtain enhanced image data, and obtain the actual physical length of the corn stalks corresponding to the experimental image data;

[0086] The enhanced image data is segmented and extracted, and the connected areas obtained by the segmentation are marked, and the area corresponding to each connected area is determined. The length of the corn stalk corresponding to each area is calculated based on the minimum circumscribed rectangle fitting, and each length is converted to determine the actual length. Based on the actual physical length and the actual length, it is determined whether to adjust the model parameters. When the result is determined that no adjustment is required, the current model parameters are output, and the trained model is determined based on the current model parameters.

[0087] Based on the above solution, the present invention can also be improved as follows.

[0088] Furthermore, the transformation processing in the spatial domain includes at least one of grayscale processing, grayscale transformation processing, smoothing filtering processing and histogram equalization processing.

[0089] Furthermore, the segmentation extraction includes: threshold segmentation processing, edge detection processing and morphological opening and closing operation processing.

[0090] Furthermore, the detection operators in the edge detection process include: Roberts operator, Sobel operator, Prewitt operator and Canny operator.

[0091] It should be noted that the beneficial effects of the corn stalk chopped length detection system based on machine vision provided by the above embodiment are the same as the beneficial effects of the corn stalk chopped length detection method based on machine vision, which will not be repeated here. In addition, when the system provided by the above embodiment realizes its functions, it only takes the division of the above functional modules as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the system can be divided into different functional modules according to actual conditions to complete all or part of the functions described above. In addition, the system and method embodiments provided by the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.

[0092] like Fig.11As shown, an electronic device 300 according to an embodiment of the present invention includes a processor 320, the processor 320 is coupled to a memory 310, and the memory 310 stores at least one computer program 330, and the at least one computer program 330 is loaded and executed by the processor 320, so that the electronic device 300 implements any of the above methods, specifically:

[0093] The electronic device 300 may have relatively large differences due to different configurations or performances, and may include one or more processors 320 (Central Processing Units, CPU) and one or more memories 310, wherein the one or more memories 310 store at least one computer program 330, and the at least one computer program 330 is loaded and executed by the one or more processors 320, so that the electronic device 300 implements a method for detecting the chopped length of corn stalks based on machine vision provided in the above embodiment. Of course, the electronic device 300 may also have components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output, and the electronic device 300 may also include other components for realizing the functions of the device, which will not be described in detail here.

[0094] A computer-readable storage medium according to an embodiment of the present invention stores at least one computer program, and the at least one computer program is loaded and executed by a processor so that a computer implements any one of the above methods.

[0095] Optionally, the computer readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, etc.

[0096] In an exemplary embodiment, a computer program product or a computer program is also provided, the computer program product or the computer program comprising computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the electronic device performs any of the above methods.

[0097] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects and represent the definition of a specific order or sequence. The order of use of similar objects can be interchanged where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than the order shown or described.

[0098] Those skilled in the art know that the present invention can be implemented as a system, method or computer program product. Therefore, the present disclosure can be specifically implemented in the following forms, namely: it can be complete hardware, it can be complete software (including firmware, resident software, microcode, etc.), or it can be a combination of hardware and software, which is generally referred to as "circuit", "module" or "system" herein. In addition, in some embodiments, the present invention can also be implemented in the form of a computer program product in one or more computer-readable media, and the computer-readable medium contains computer-readable program code.

[0099] Any combination of one or more computer-readable media may be used. A computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. Computer-readable storage media include, but are not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any combination of the above. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, device or device.

[0100] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present invention.

Claims

1. A method for detecting the chopped length of corn stalks based on machine vision, characterized in that: include: Obtain an image to be detected, and input the image to be detected into a pre-trained model to obtain the length corresponding to each corn stalk in the image to be detected; Among them, the training process of the pre-training model is specifically as follows: Acquire experimental image data of corn stalks, perform spatial transformation processing on the experimental image data to obtain enhanced image data, and obtain the actual physical length of the corn stalks corresponding to the experimental image data; Segment and extract the enhanced image data, mark the connected areas obtained by the segmentation, determine the area corresponding to each connected area, calculate the length of the corn stalk corresponding to each area based on the minimum circumscribed rectangle fitting, convert each length to determine the actual length, determine whether to adjust the model parameters based on the actual physical length and the actual length, and when the result is determined to be no adjustment, output the current model parameters, and determine the trained model based on the current model parameters; In order to improve the subsequent training accuracy of the model during the process of acquiring experimental image data, the cut corn stalks are usually arranged in a partially stacked manner. If the corn stalks cannot be stacked due to their shape, the original image that has been taken is processed by image rotation. The specific process of rotating the image is: The original image is acquired through a monocular camera, and a preset range is determined in the original image, wherein the preset range is a regular or irregular area set artificially for area locking, and the preset range is used as a sliding window for sliding search in the original image, and the area with the largest number of corn stalks in the sliding window is determined, and the area is cropped to obtain the area to be rotated, and the corn stalks in the area to be rotated are fitted into line segments, and any line segment is selected, and the line segment is rotated in a clockwise or counterclockwise order. During the rotation process, the line segment is rotated with the rotation center point as the center of the circle, and the number of line segments intersecting with the line segment is determined in real time, and the rotation angle and the position of the rotation center point when the number of intersections corresponding to the line segment is the largest during one rotation are extracted and recorded, and the rotation center point starts from one end point of the line segment and gradually moves toward the line segment. The other end point is moved, and the moving distance is determined according to the length of the line segment. The length of one tenth of the length of the line segment can be selected as the moving distance, or it can be determined by manual definition. When any rotation center point completes a rotation process, switch to the next rotation center point to repeat the rotation process and record it. After traversing all the rotation center points on the line segment, all the recorded data are arranged in descending order according to the number of intersections to obtain a sorting table. According to the order in the sorting table, multiple rotation center points with the largest and identical number of intersections and corresponding rotation angles are extracted, and the rotation center points, rotation angles and line segments are restored one by one to obtain a corn stalk layout diagram rotated according to the above arrangement method, and determine whether there is a situation in the corn stalk layout diagram where the rotated corn stalks cover at least half of the area of ​​any corn stalk; If it does not exist, a rotation process is performed according to the rotation center point and the corresponding rotation angle to obtain a filling area for replacing the area to be rotated, and the filling area replaces the area to be rotated to generate a new original image; If it exists, the rotation center point and the corresponding rotation angle are eliminated, and the rotation center point, rotation angle and line segment are restored continuously until the rotation center point and the corresponding rotation angle that meet the conditions are selected, and the rotation processing is performed according to the rotation center point and the corresponding rotation angle to obtain a filling area for replacing the area to be rotated, and the filling area replaces the area to be rotated to generate a new original image; If, according to the order in the sorting table, there is only one rotation center point with the largest number of intersections and a corresponding rotation angle, then after restoring the rotation center point, the rotation angle and the line segment, a corn stalk layout diagram is obtained, and it is determined whether in the corn stalk layout diagram, the rotated corn stalks cover at least half of the area of ​​any corn stalk. If not, the same processing method as that of the non-existence in the above text is used. If so, the rotation angle is fine-tuned to satisfy the condition that the area covered by the corn stalks is less than half of any corn stalk while the number of intersections remains unchanged. The rotation angle is re-recorded, and the new rotation angle replaces the original rotation angle. Rotation processing is performed according to the rotation center point and the corresponding new rotation angle to obtain a filling area for replacing the area to be rotated, and the filling area replaces the area to be rotated to generate a new original image. The new original image is used as experimental image data, that is, as a training set for subsequent model training.

2. The method for detecting the chopped length of corn stalks based on machine vision according to claim 1, characterized in that: The transformation processing in the spatial domain includes at least one of grayscale processing, grayscale transformation processing, smoothing filtering processing and histogram equalization processing.

3. The method for detecting the chopped length of corn stalks based on machine vision according to claim 1, characterized in that: The segmentation extraction includes: threshold segmentation processing, edge detection processing and morphological opening and closing operation processing.

4. The method for detecting the chopped length of corn stalks based on machine vision according to claim 3, characterized in that: The detection operators in the edge detection process include: Roberts operator, Sobel operator, Prewitt operator and Canny operator.

5. A machine vision-based corn stalk chopped length detection system, using the machine vision-based corn stalk chopped length detection method as claimed in claim 1, characterized in that: The system includes: The detection module is used to: obtain the image to be detected, and input the image to be detected into the pre-training model to obtain the length corresponding to each corn stalk in the image to be detected; Among them, the training process of the pre-training model is specifically as follows: Acquire experimental image data of corn stalks, perform spatial transformation processing on the experimental image data to obtain enhanced image data, and obtain the actual physical length of the corn stalks corresponding to the experimental image data; The enhanced image data is segmented and extracted, and the connected areas obtained by the segmentation are marked, and the area corresponding to each connected area is determined. The length of the corn stalk corresponding to each area is calculated based on the minimum circumscribed rectangle fitting, and each length is converted to determine the actual length. Based on the actual physical length and the actual length, it is determined whether to adjust the model parameters. When the result is determined that no adjustment is required, the current model parameters are output, and the trained model is determined based on the current model parameters.

6. The machine vision-based corn stalk chopped length detection system according to claim 5, characterized in that: The transformation processing in the spatial domain includes at least one of grayscale processing, grayscale transformation processing, smoothing filtering processing and histogram equalization processing.

7. The machine vision-based corn stalk chopped length detection system according to claim 5, characterized in that: The segmentation extraction includes: threshold segmentation processing, edge detection processing and morphological opening and closing operation processing.

8. The machine vision-based corn stalk chopped length detection system according to claim 7, characterized in that: The detection operators in the edge detection process include: Roberts operator, Sobel operator, Prewitt operator and Canny operator.

9. An electronic device, characterized in that: The electronic device comprises a processor, the processor is coupled to a memory, at least one computer program is stored in the memory, and the at least one computer program is loaded and executed by the processor so that the electronic device implements the method according to any one of claims 1 to 4.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one computer program, and the at least one computer program is loaded and executed by a processor so that a computer implements the method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • A reciprocating multi-directional straw chopping and shredding device with length screening function

    CN111670691B

  • Ore image granularity detection algorithm based on image processing technology

    CN111047555A

  • Part layer height dimension detection method and device for laser wire feeding additive manufacturing

    CN119151917A