Crop row detection method and device, electronic equipment and storage medium
By acquiring spectral images and point cloud data for edge detection and alignment, and combining the clustering results of environmental depth maps, a crop row detection model was constructed using a YOLO network. This solved the problems of accuracy and stability in crop row detection under varying light conditions and weed occlusion, achieving high-precision crop row detection.
Patent Information
- Application Number
- CN202510950596.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-10
- Publication Date
- 2025-11-11
AI Technical Summary
Existing crop row detection technologies lack accuracy and stability under varying light conditions and weed cover, making it difficult to meet the high-precision requirements of precision agriculture.
By acquiring spectral images and point cloud data, edge detection and alignment are performed. Combined with the clustering results of the environmental depth map, a crop row detection model is constructed using the YOLO network to detect crop rows.
It improves the accuracy and robustness of crop row detection, adapts to complex environmental conditions, enhances the ability to distinguish between crops and weeds, and improves the reliability of detection.
Smart Images

Figure CN120931679A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of digital agricultural machinery technology, and in particular to a crop row detection method, device, electronic equipment, and storage medium. Background Technology
[0002] In the current era of booming precision agriculture, crop row detection, as a key component, plays a crucial role. It provides precise navigation information for agricultural machinery, enabling automated and intelligent field operations such as precision sowing, fertilization, spraying, and harvesting, effectively improving agricultural production efficiency, reducing costs, and minimizing resource waste. Currently, crop row detection systems have been applied to some extent in large-scale rice and corn cultivation fields, but most still rely on basic image processing technology or manual observation.
[0003] However, existing image processing techniques have many limitations in crop row detection. On the one hand, these methods are extremely sensitive to environmental conditions; changes in lighting conditions such as shadows and reflections can significantly alter image features, causing many image processing methods to fail. On the other hand, when there is a lot of overlapping weeds in the field, crop rows are easily obscured, and existing technologies struggle to effectively process this, resulting in inaccurate detection results that fail to meet the high precision and stability requirements of precision agriculture for crop row detection. Summary of the Invention
[0004] This invention provides a crop row detection method, apparatus, electronic device, and storage medium to address the shortcomings of existing image processing-based crop row detection methods, which suffer from low detection accuracy and stability.
[0005] This invention provides a method for detecting crop rows, comprising: Acquire spectral images and point cloud data of the crop area to be detected; Edge detection is performed on the spectral image to obtain the crop row linear parameters; Based on the initial crop row straight line corresponding to the crop row linear parameters, it is aligned with the point cloud data to obtain an environmental depth map; The crop row detection results are obtained by combining the initial crop row straight line and the clustering results of the environmental depth map.
[0006] According to a crop row detection method provided by the present invention, the step of performing edge detection on the spectral image to obtain crop row linear parameters includes: Edge extraction is performed on the spectral image to obtain a binarized image; The binarized image is divided into blocks to obtain block images; Based on the detection threshold, Hough space peak points are selected from each of the image blocks. Based on the peak points of the Hough space, the linear parameters of the crop rows are calculated; The detection threshold is dynamically adjusted based on the area size of the crop region to be detected and the crop planted therein.
[0007] According to a crop row detection method provided by the present invention, the step of obtaining crop row detection results by combining the initial crop row straight line and the clustering results of the environmental depth map includes: By combining the initial crop row straight line and the clustering results of the environmental depth map, a set of candidate crop row points is obtained; The candidate crop row point set and the spectral image are input into the crop row detection model to obtain the crop row detection results output by the crop row detection model; The crop row detection model is constructed based on the YOLO network.
[0008] According to a crop row detection method provided by the present invention, the step of obtaining a candidate crop row point set by combining the clustering results of the initial crop row straight line and the environmental depth map includes: Based on the clustering algorithm, the points in the environmental depth map are clustered to obtain density clustering results; Based on the density clustering results, the occlusion area is determined; Based on the density clustering results and the initial crop row lines, the shading area is interpolated to obtain the candidate crop row point set.
[0009] According to a crop row detection method provided by the present invention, the step of interpolating the occlusion region based on the density clustering result and the initial crop row line to obtain the candidate crop row point set includes: Based on the initial crop row straight line, intra-row interpolation and / or inter-row interpolation are performed on the shading area to obtain the candidate crop row point set.
[0010] According to a crop row detection method provided by the present invention, the method obtains crop row detection results by combining the initial crop row straight line and the clustering results of the environmental depth map, and then includes: Analyze the crop row detection results to obtain geometric constraints; Based on the aforementioned geometric constraints, a mechanical motion path is generated; The geometric constraints include row spacing constraints and crop row direction constraints.
[0011] The present invention also provides a crop row detection device, comprising: The acquisition unit acquires spectral images and point cloud data of the crop area to be detected. An edge detection unit performs edge detection on the spectral image to obtain crop row linear parameters; The alignment unit aligns the initial crop row straight line corresponding to the crop row linear parameters with the point cloud data to obtain an environmental depth map. The fusion unit combines the initial crop row straight line and the clustering results of the environmental depth map to obtain the crop row detection results.
[0012] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the crop row detection method as described above.
[0013] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the crop row detection method as described above.
[0014] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the crop row detection method as described above.
[0015] The crop row detection method, apparatus, electronic device, and storage medium provided by this invention obtain crop row linear parameters by performing edge detection on spectral images. Furthermore, based on the initial crop row straight lines corresponding to the crop row linear parameters, they are aligned with point cloud data to obtain an environmental depth map. Combining the clustering results of the initial crop row straight lines and the environmental depth map, the crop row detection results are obtained. This improves the reliability of crop row detection under complex environmental conditions and enhances the ability to distinguish between crops and weeds, thereby improving the accuracy and robustness of crop row detection. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0017] Figure 1 This is one of the flowcharts of the crop row detection method provided by the present invention; Figure 2 This is the second flowchart of the crop row detection method provided by the present invention; Figure 3 This is a schematic diagram of the structure of the crop row detection system provided by the present invention; Figure 4 This is a schematic diagram of the structure of the crop row detection device provided by the present invention; Figure 5This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0018] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0019] To address the above problems, this invention provides a crop row detection method that achieves high accuracy and robustness under shading conditions. Figure 1 This is one of the flowcharts of the crop row detection method provided by the present invention, such as... Figure 1 As shown, the method includes: Step 110: Obtain the spectral image and point cloud data of the crop area to be detected.
[0020] Here, the crop area to be detected refers to the target area where crop row detection is needed, such as farmland, and the crops here could be corn, sorghum, etc. Additionally, the spectral image here refers to an image that reflects the spectral information of the crop area to be detected at different wavelengths. Based on the spectral features reflected in the spectral image, crops and weeds can be distinguished. The point cloud data here contains the three-dimensional coordinate information of each point in the crop area to be detected.
[0021] Specifically, this can be achieved by equipping a mobile device with a multispectral or hyperspectral sensor, as well as a lidar system. Then, following a preset movement path, the area of the crop to be detected is scanned and photographed to obtain spectral images and point cloud data. The mobile device here can be a drone or a ground-based mobile platform.
[0022] Step 120: Perform edge detection on the spectral image to obtain the crop row linear parameters.
[0023] Here, crop row linear parameters refer to parameters representing the position and orientation of crop rows extracted from the spectral image through edge detection, such as the slope and intercept of a straight line, providing a reference for subsequent point cloud data alignment. It is understood that the crop row linear parameters here can include the linear parameters of multiple crop rows in the crop region to be detected.
[0024] Specifically, firstly, preprocessing operations such as denoising and contrast enhancement can be performed on the acquired spectral image to improve the accuracy of subsequent edge detection. For example, median filtering can be used to remove noise, and histogram equalization can be used to enhance contrast. Then, an edge detection algorithm, such as the Hough transform algorithm, can be selected to perform edge detection on the preprocessed image to obtain the set of points that make up the initial crop row line. Next, the crop row linear parameters for the initial crop row can be calculated using multiple points on the initial crop row line.
[0025] Step 130: Align the initial crop row straight line corresponding to the crop row linear parameters with the point cloud data to obtain an environmental depth map.
[0026] Here, the initial crop row straight line refers to the straight line determined by the crop row linear parameters in the spectral image. It is used for alignment with the point cloud data and can serve as a bridge connecting spectral information and point cloud data. Furthermore, the initial crop row straight line can reflect the approximate direction and distribution of crop rows in the two-dimensional image. Additionally, the environmental depth map here refers to the image generated based on the aligned point cloud data. It can reflect the depth information of objects such as crops, weeds, and ridges in the crop area to be detected, providing a basis for further determining crop rows in occluded areas.
[0027] Specifically, the initial crop row line coordinates in the spectral image can then be transformed into the coordinate system of the point cloud data. Using the transformed line coordinates, the corresponding region in the point cloud data is found. By matching the line with planar or linear features in the point cloud data, the coordinates of the point cloud data are adjusted to align with the initial crop row line. Furthermore, based on the aligned point cloud data, the depth value corresponding to each pixel is calculated to obtain an environmental depth map.
[0028] Step 140: Combine the initial crop row straight line and the clustering results of the environmental depth map to obtain the crop row detection results.
[0029] Specifically, clustering algorithms can be used to cluster points in the environmental depth map to obtain clustering results, which can then be used to determine occlusion areas. By combining the clustering results with the initial crop row lines, crop rows in the occlusion areas can be supplemented, for example, through row data interpolation and inter-row supplementation. Additionally, the intersecting lines in the initial crop row lines can be corrected using the clustering results to obtain corrected crop row lines. Then, the supplemented point set for the occlusion areas and the corrected crop lines can be merged to obtain multiple crop row lines, thus yielding the crop row detection results.
[0030] It should be noted that by combining the clustering results of the initial crop row lines and the environmental depth map, the advantages of both types of data are fully utilized, improving the accuracy, stability, and adaptability of crop row detection. Under complex environmental conditions, such as changes in light intensity, abundant weeds, or overlapping crop rows, the location of crop rows can be initially determined using spectral information, and then accurate detection can be performed by combining it with three-dimensional spatial information, effectively solving the problem of insufficient handling of occluded areas in existing technologies.
[0031] Meanwhile, the detection algorithm provided in this embodiment of the invention has strong versatility and can be applied to row detection of different types of crops, providing strong technical support for the development of precision agriculture.
[0032] The method provided in this invention obtains crop row linear parameters by performing edge detection on a spectral image. Furthermore, based on the initial crop row straight line corresponding to the crop row linear parameters, it is aligned with point cloud data to obtain an environmental depth map. Combining the clustering results of the initial crop row straight line and the environmental depth map, the crop row detection result is obtained. This improves the reliability of crop row detection under complex environmental conditions and enhances the ability to distinguish between crops and weeds, thereby improving the accuracy and robustness of crop row detection.
[0033] Based on any of the above embodiments, step 120 includes: Edge extraction is performed on the spectral image to obtain a binarized image; The binarized image is divided into blocks to obtain block images; Based on the detection threshold, Hough space peak points are selected from each of the image blocks. Based on the peak points of the Hough space, the linear parameters of the crop rows are calculated; The detection threshold is dynamically adjusted based on the area size of the crop region to be detected and the crop planted therein.
[0034] Specifically, firstly, a preprocessed image can be obtained by performing preprocessing operations such as filtering on the spectral image. Then, an edge detection algorithm, such as the Canny edge detection operator, can be used to extract edges from the preprocessed image to obtain a binarized image. Finally, the binarized image can be divided into blocks to obtain several block images.
[0035] Furthermore, a detection threshold can be determined for the Hough transform algorithm. This threshold can refer to a preset range of linear parameters, such as the slope and intercept. Thus, by performing a Hough transform on each image block, for each edge point in the block, voting is conducted in the Hough space based on its coordinates and the preset range of linear parameters, such as the slope and intercept. The number of votes for each parameter combination is counted. Based on the dynamically adjusted detection threshold, points corresponding to parameter combinations with a vote count greater than the threshold are selected in the Hough space; these points are the peak points in the Hough space.
[0036] The detection threshold can be dynamically adjusted based on the size of the crop area to be detected and the crops planted there. It should be noted that a larger crop area may contain more crop rows, requiring a lower detection threshold to detect more Hough space peaks and ensure coverage of all crop rows. Conversely, a smaller area allows for a higher detection threshold to avoid detecting too many false peaks.
[0037] Furthermore, different crops have different morphological characteristics. For example, corn rows are usually wide and regular, while wheat rows may be relatively narrow and dense. For crops with strong regularity, the detection threshold can be appropriately increased to screen out more accurate peak points; for dense or irregular crops, the detection threshold can be appropriately decreased to ensure that all possible crop rows can be detected.
[0038] It should be noted that existing solutions typically require field-specific calibration, reducing their applicability across crop types or terrains. In contrast, the method provided in this invention, based on monitoring thresholds adjusted for the actual crop environment, is suitable for diverse farmland environments.
[0039] Finally, the corresponding linear parameter can be calculated for each peak point in the Hough space. This calculated linear parameter can then be used as the crop row linear parameter. It should be noted that since the Hough transform may detect multiple similar peak points, these peak points may correspond to the same crop row. To obtain a more accurate crop row linear parameter, a clustering algorithm, such as K-means clustering, can be used to cluster similar peak points, and then the parameters of the peak points in each cluster are averaged to obtain the final, more accurate crop row linear parameter.
[0040] The method provided in this invention dynamically adjusts the detection threshold based on the area size and crop characteristics of the crop region to be detected, which can improve the accuracy of Hough space peak point detection and avoid missed or false detections of crop rows. Furthermore, calculating crop row linear parameters based on Hough space peak points yields more accurate and stable crop row linear parameters, providing a reliable navigation basis for subsequent crop row detection and precision agriculture operations.
[0041] It should be noted that, in order to further improve the accuracy of crop row detection, based on any of the above embodiments, step 140 includes: By combining the initial crop row straight line and the clustering results of the environmental depth map, a set of candidate crop row points is obtained; The candidate crop row point set and the spectral image are input into the crop row detection model to obtain the crop row detection results output by the crop row detection model; The crop row detection model is constructed based on the YOLO network.
[0042] Specifically, firstly, the initial crop row line can be correlated with the clustering results. For each cluster, it is checked whether it overlaps with or is close to the initial crop row line. If the condition is met, the points in that cluster are considered as candidate crop row points. At the same time, considering that some crop points may not have been clustered due to occlusion or other reasons, but based on the direction of the initial crop row line, points within a certain range of the line with reasonable depth values can also be included in the candidate crop row point set.
[0043] Then, the candidate crop row point set and spectral image can be input into the crop row detection model, which outputs the final accurate crop row detection result. It should be noted that deep learning models require high computational power, which may be impractical for low-cost agricultural machinery. Therefore, to reduce computational load and lower the cost of path optimization for agricultural machinery, a lightweight neural network can be used to construct the crop row detection model. For example, the crop row detection model here is based on the YOLO network. Furthermore, it can be constructed using the YOLO backbone network. The backbone network is responsible for feature extraction from the input image and mask image, gradually extracting feature maps of different scales through a series of convolutional layers, pooling layers, and residual connections.
[0044] It should also be noted that the YOLO network has advantages such as real-time detection and high detection accuracy. By constructing a crop row detection model based on the YOLO network, the ability to detect crop rows in complex environments can be further improved. Furthermore, the model's multi-scale feature fusion design enables it to adapt to crop row detection tasks of different sizes and shapes.
[0045] Therefore, the method provided in this embodiment of the invention achieves accurate detection of crop rows by comprehensively utilizing information such as spectral images, initial crop row lines, and environmental depth map clustering results, and by constructing an efficient crop row detection model, while controlling the computational load required for detection. Compared with traditional single-information detection methods, this scheme has higher accuracy and robustness, and can better adapt to the complex environment in actual agricultural production.
[0046] Based on any of the above embodiments, combining the clustering results of the initial crop row straight line and the environmental depth map, a candidate crop row point set is obtained, including: Based on the clustering algorithm, the points in the environmental depth map are clustered to obtain density clustering results; Based on the density clustering results, the occlusion area is determined; Based on the density clustering results and the initial crop row lines, the shading area is interpolated to obtain the candidate crop row point set.
[0047] Specifically, firstly, by selecting a clustering algorithm and setting clustering parameters, points in the environmental depth map can be clustered to obtain density clustering results. The clustering algorithm here can be the CAROLIF clustering algorithm. In detail, the clustering process involves calculating the number of other points within the neighborhood radius of each point in the environmental depth map. If the number of points within the neighborhood radius of a point is greater than or equal to the minimum number of points, then that point is marked as a core point. Starting from a core point, all points within its neighborhood are added to the same cluster. Then, for these newly added points, if they are also core points, the clustering continues to expand until no new points can be added.
[0048] Then, the distribution of each cluster can be observed by analyzing the density clustering results. Generally, in crop planting areas, crop points will form one or more dense clusters. However, due to shading and other reasons, some areas may appear that are discontinuous with crop clusters or have lower density. Therefore, a density threshold can be set. If the point density of a region is lower than the threshold and the density difference with the surrounding crop clusters is large, then the region is considered to be a shading region.
[0049] Furthermore, based on the density clustering results and the initial crop row lines, row interpolation can be performed on the shaded areas, such as intra-row interpolation and / or inter-row interpolation, to obtain a candidate crop row point set. Specifically, the approximate direction and distribution of the initial crop row lines can be determined by analyzing them. Then, for each shaded area, the interpolation direction is determined based on the direction of the initial crop row lines. In the interpolation direction, linear interpolation or more complex interpolation methods, such as cubic spline interpolation, are performed based on the depth values and positional information of points in the surrounding crop clusters. Finally, the interpolated points can be merged with the points in the surrounding crop clusters to form a candidate crop row point set.
[0050] It should be noted that by analyzing the density clustering results and combining density differences and spatial continuity criteria, occlusion areas can be accurately identified. This facilitates targeted interpolation processing for occlusion areas, improving the accuracy of candidate crop row point sets. Furthermore, interpolation based on density clustering results and initial crop row lines can fully utilize information from surrounding crop clusters and the direction of crop rows to generate a reasonable candidate crop row point set. The interpolated points can better integrate with surrounding crop clusters, improving the accuracy of crop row detection. Simultaneously, by performing row interpolation on occlusion areas, it can adapt to occlusion areas of different shapes and sizes, thereby improving the robustness of the crop row detection method.
[0051] Based on any of the above embodiments, based on the density clustering results and the initial crop row lines, interpolation is performed on the shading region to obtain the candidate crop row point set, including: Based on the initial crop row straight line, intra-row interpolation and / or inter-row interpolation are performed on the shading area to obtain the candidate crop row point set.
[0052] Specifically, firstly, the direction of interpolation can be determined based on the slope of the initial crop row line. It can be understood that if the absolute value of the slope is less than 1, it indicates that the crop rows are approximately horizontally distributed in the image, and interpolation is mainly performed along the horizontal direction; if the absolute value of the slope is greater than 1, the crop rows are approximately vertically distributed, and interpolation is mainly performed along the vertical direction.
[0053] Furthermore, for intra-row interpolation, at the edge of the occluded area, along a direction perpendicular to the interpolation direction, the nearest non-occluded crop row point to the occluded area is searched. These points can then be used as reference points for intra-row interpolation. For example, if intra-row interpolation is performed horizontally, reference points are found vertically at the edge of the occluded area. Then, using the coordinates of the reference points and a linear calculation formula, the coordinates of the intra-row interpolation points can be calculated to achieve intra-row interpolation.
[0054] It should be noted that by performing intra-row interpolation on occluded areas, points missing within crop rows due to occlusion or other reasons can be effectively recovered, maintaining the continuity of crop rows within the rows. Furthermore, by considering the position of reference points, the interpolated points can better integrate into the surrounding crop rows, improving the accuracy of the candidate crop row point set.
[0055] Furthermore, for inter-row interpolation, the crop rows adjacent to the shading area can be determined based on the position and distribution of the initial crop row lines. This can be achieved by calculating the distance from the center point of the shading area to each crop row line and selecting the two closest crop rows as adjacent crop rows. Further, the interpolation point's position within the rows can be determined based on the average spacing between crop rows and the distance relationship between the shading area and adjacent crop rows, thus realizing inter-row interpolation.
[0056] It should also be noted that by performing inter-row interpolation on the shading area, it helps to supplement crop rows that are missing due to shading or other reasons, maintain a reasonable spacing and distribution between crop rows, generate interpolation points that conform to the actual crop planting patterns, and enhance the integrity of the candidate crop row point set.
[0057] The method provided in this invention comprehensively utilizes intra-row interpolation and inter-row interpolation to cope with various complex occlusion situations and improve the quality of candidate crop row point sets. By reasonably integrating the two interpolation results, the advantages of each can be fully utilized, making the generated candidate crop row point set more accurate and complete, and providing a reliable foundation for subsequent crop row detection.
[0058] Based on any of the above embodiments, step 140 is followed by: Analyze the crop row detection results to obtain geometric constraints; Based on the aforementioned geometric constraints, a mechanical motion path is generated; The geometric constraints include row spacing constraints and crop row direction constraints.
[0059] Specifically, the spacing between adjacent crop rows can be calculated from the crop row detection results, and this spacing can then be used as a row spacing constraint. Alternatively, the direction vector of the crop row can be calculated from the equation of the line corresponding to the crop row detection results, and this direction vector can then be used as a crop row direction constraint. It should be noted that the direction vector here represents the direction in which the crop row extends.
[0060] Therefore, row spacing constraints and crop row direction constraints can be used as geometric constraints. Mechanical movement paths are generated using geometric constraints and path planning algorithms. For example, Dijkstra's algorithm, combined with geometric constraints, can be used to generate mechanical movement paths. It is understandable that the generated mechanical movement paths can be used to instruct machinery to move within the crop area, improving operational efficiency and quality.
[0061] The method provided in this invention accurately extracts row spacing constraints and crop row direction constraints by analyzing the crop row detection results, providing a reliable basis for generating the mechanical movement path. Specifically, the row spacing constraint ensures that the machine can accurately operate on each crop row, avoiding interference with adjacent crop rows; the crop row direction constraint enables the machine to operate along the direction of the crop row, improving operational efficiency and quality.
[0062] In one embodiment, the present invention provides a crop row detection system comprising the following modules: a multispectral imaging unit: capturing high-resolution images in the visible and near-infrared spectral ranges to distinguish crops from weeds based on spectral characteristics.
[0063] Edge detection module: Combines an improved Hough transform algorithm and adaptive threshold to detect linear features corresponding to crop rows.
[0064] Occlusion handling module: The CAROLIF-based clustering algorithm is used to group and interpolate crop points even under occlusion conditions.
[0065] LiDAR unit: Used to generate high-precision 3D point cloud data, which, combined with imaging data, further improves the detection capability of complex terrain and obstructed areas.
[0066] Deep learning enhancement: Integrates a lightweight neural network and performs real-time line recognition and classification based on a pre-trained YOLO backbone network.
[0067] Control and feedback system: Provides adaptive control of agricultural machinery based on detected crop rows to achieve tasks such as spraying, sowing or harvesting.
[0068] Mobile interface: Displays a real-time crop row map through a user-friendly application, allowing users to make adjustments.
[0069] Understandably, the multispectral imaging unit works in conjunction with the lidar to acquire spectral data and 3D structural information of the farmland, respectively. The imaging unit provides spectral features of crops and weeds, while the point cloud data generated by the lidar can be used to supplement spatial depth information, thus accurately identifying crop rows even under conditions of varying crop heights and complex terrain. The edge detection module, combined with image preprocessing steps including denoising, contrast enhancement, and segmentation, ensures more stable extracted linear features. The Hough transform algorithm is optimized to support dynamic threshold adjustment. The occlusion processing module uses the CAROLIF clustering algorithm combined with lidar point cloud data to perform data interpolation and inter-row supplementation in occluded areas, ensuring continuous detection of crop rows. The deep learning model adopts a lightweight network architecture, enabling efficient operation on embedded devices and reducing computational resource requirements. Simultaneously, this model integrates the ability to jointly analyze spatial and spectral features. The control and feedback system analyzes the detected crop row data in real time, generating mechanical operation commands based on inter-row distance and direction to optimize the mechanical movement path. The overall system adopts a modular design, facilitating expansion and upgrades, such as adding other sensors or optimizing the performance of a specific module.
[0070] It should be noted that the method provided in this embodiment of the invention improves the ability to distinguish between crops and weeds and enhances robustness under complex conditions by combining multispectral imaging and lidar. The optimized combination of Hough transform and the CAROLIF algorithm is suitable for diverse farmland environments. A lightweight deep learning model integrating spatial and spectral features achieves high real-time performance. Automated mechanical control based on detection data improves the efficiency of precision agriculture. Modular and scalable design adapts to different crop types and field conditions. Furthermore, an intuitive user interface is provided for monitoring and control. In addition, experimental results show that compared with traditional methods, detection accuracy is improved by 40% and processing time is reduced by 35%.
[0071] Based on any of the above embodiments Figure 2 This is the second flowchart of the crop row detection method provided by the present invention, as shown below. Figure 2 As shown, the method includes: After starting crop row detection, hardware initialization is performed. In detail, the relevant hardware devices can be initialized to ensure that the lidar, BeiDou RTK (Real-Time Kinematic) positioning equipment, etc., are in normal working condition, preparing for subsequent data acquisition.
[0072] Then, task switching is implemented based on multi-threading. Specifically, multi-threading is enabled to execute the following three main tasks in parallel: lidar data acquisition, BeiDou RTK positioning data acquisition, and data processing, thereby improving overall operational efficiency.
[0073] The acquisition of LiDAR data can include the following steps: First, reading the LiDAR data, i.e., reading the raw LiDAR data from the LiDAR device. Then, checking whether a full rotation of LiDAR data sampling has been completed. If a rotation of sampling is not yet complete, continuing to read data; if a rotation of sampling is complete, proceeding to the data decoding stage. Finally, decoding the acquired LiDAR data from the previous rotation, converting it into a format suitable for subsequent analysis.
[0074] The steps for acquiring BeiDou RTK positioning data may include: First, receiving data sent by the BeiDou RTK positioning device through a terminal set on the mobile device to ensure timely data acquisition. Then, decoding the received BeiDou RTK positioning data to extract precise location information, such as longitude, latitude, and altitude.
[0075] The data processing workflow includes: First, clustering is performed to extract boundary points. Cluster analysis is conducted on the decoded LiDAR data to extract the boundary points of the crop rows. Then, data fusion is performed to obtain the absolute coordinates of the boundary points: LiDAR data and BeiDou RTK positioning data are fused, combining the information from both to obtain the absolute coordinates of the crop row boundary points, improving coordinate accuracy. Finally, the processed absolute coordinates of the crop row boundary points are sent to the vehicle-mounted terminal to provide precise guidance information for the navigation and operation of agricultural machinery.
[0076] In one embodiment, Figure 3 This is a schematic diagram of the crop row detection system provided by the present invention, as shown below. Figure 3 As shown, the system includes: a boundary point extraction unit and a path tracking unit.
[0077] The boundary point extraction unit includes a lidar system, a boundary point extraction terminal, and a BeiDou RTK positioning module. The lidar transmits the scanned point cloud data to the boundary point extraction terminal in real time via a network port. Additionally, precise positioning data is transmitted to the boundary point extraction terminal and the vehicle-mounted terminal via an RS232 interface. The boundary point extraction terminal fuses the point cloud and BeiDou RTK positioning data to obtain the boundary points. These boundary points are then sent to the vehicle-mounted terminal.
[0078] The path tracking unit includes an on-board terminal, a steering control mechanism, and a walking control mechanism. The on-board terminal receives crop row boundary point information from the boundary point extraction terminal and positioning data from the BeiDou RTK positioning module via a CAN bus. It integrates and analyzes the received data to calculate the position and attitude information of the agricultural machinery relative to the crop rows, thereby controlling the steering and walking control mechanisms.
[0079] Based on any of the above embodiments Figure 4 This is a schematic diagram of the structure of the crop row detection device provided by the present invention, as shown below. Figure 4 As shown, the device includes: Acquisition unit 410 acquires spectral images and point cloud data of the crop area to be detected; Edge detection unit 420 performs edge detection on the spectral image to obtain crop row linear parameters; Alignment unit 430 aligns with the point cloud data based on the initial crop row straight line corresponding to the crop row linear parameters to obtain an environmental depth map; The fusion unit 440 combines the initial crop row straight line and the clustering results of the environmental depth map to obtain the crop row detection results.
[0080] The apparatus provided in this invention obtains crop row linear parameters by performing edge detection on a spectral image. Furthermore, based on the initial crop row straight line corresponding to the crop row linear parameters, it is aligned with point cloud data to obtain an environmental depth map. Combining the clustering results of the initial crop row straight line and the environmental depth map, crop row detection results are obtained. This improves the reliability of crop row detection under complex environmental conditions and enhances the ability to distinguish between crops and weeds, thereby improving the accuracy and robustness of crop row detection.
[0081] Based on any of the above embodiments, the edge detection unit is specifically used for: Edge extraction is performed on the spectral image to obtain a binarized image; The binarized image is divided into blocks to obtain block images; Based on the detection threshold, Hough space peak points are selected from each of the image blocks. Based on the peak points of the Hough space, the linear parameters of the crop rows are calculated; The detection threshold is dynamically adjusted based on the area size of the crop region to be detected and the crop planted therein.
[0082] Based on any of the above embodiments, the fusion unit is specifically used for: By combining the initial crop row straight line and the clustering results of the environmental depth map, a set of candidate crop row points is obtained; The candidate crop row point set and the spectral image are input into the crop row detection model to obtain the crop row detection results output by the crop row detection model; The crop row detection model is constructed based on the YOLO network.
[0083] Based on any of the above embodiments, the fusion unit is further specifically used for: Based on the clustering algorithm, the points in the environmental depth map are clustered to obtain density clustering results; Based on the density clustering results, the occlusion area is determined; Based on the density clustering results and the initial crop row lines, the shading area is interpolated to obtain the candidate crop row point set.
[0084] Based on any of the above embodiments, the fusion unit is further specifically used for: Based on the initial crop row straight line, intra-row interpolation and / or inter-row interpolation are performed on the shading area to obtain the candidate crop row point set.
[0085] Based on any of the above embodiments, a path planning unit is included after the fusion unit, and the path planning unit is specifically used for: Analyze the crop row detection results to obtain geometric constraints; Based on the geometric constraints, a mechanical motion path is generated; The geometric constraints include row spacing constraints and crop row direction constraints.
[0086] Figure 5 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 5 As shown, the electronic device may include a processor 510, a communications interface 520, a memory 530, and a communication bus 540, wherein the processor 510, communications interface 520, and memory 530 communicate with each other via the communication bus 540. The processor 510 can call logical instructions in the memory 530 to execute a crop row detection method, which includes: acquiring a spectral image and point cloud data of the crop region to be detected; performing edge detection on the spectral image to obtain crop row linear parameters; aligning an initial crop row line corresponding to the crop row linear parameters with the point cloud data to obtain an environmental depth map; and combining the clustering results of the initial crop row line and the environmental depth map to obtain a crop row detection result.
[0087] Furthermore, the logical instructions in the aforementioned memory 530 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0088] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the crop row detection method provided by the above methods. The method includes: acquiring a spectral image and point cloud data of a crop region to be detected; performing edge detection on the spectral image to obtain crop row linear parameters; aligning an initial crop row straight line corresponding to the crop row linear parameters with the point cloud data to obtain an environmental depth map; and combining the clustering results of the initial crop row straight line and the environmental depth map to obtain a crop row detection result.
[0089] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the crop row detection method provided by the above methods. The method includes: acquiring a spectral image and point cloud data of a crop region to be detected; performing edge detection on the spectral image to obtain crop row linear parameters; aligning an initial crop row straight line corresponding to the crop row linear parameters with the point cloud data to obtain an environmental depth map; and combining the clustering results of the initial crop row straight line and the environmental depth map to obtain a crop row detection result.
[0090] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0091] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0092] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for detecting crop rows, characterized in that, include: Acquire spectral images and point cloud data of the crop area to be detected; Edge detection is performed on the spectral image to obtain the crop row linear parameters; Based on the initial crop row straight line corresponding to the crop row linear parameters, it is aligned with the point cloud data to obtain an environmental depth map; The crop row detection results are obtained by combining the initial crop row straight line and the clustering results of the environmental depth map.
2. The crop row detection method according to claim 1, characterized in that, The process of edge detection on the spectral image to obtain crop row linear parameters includes: Edge extraction is performed on the spectral image to obtain a binarized image; The binarized image is divided into blocks to obtain block images; Based on the detection threshold, Hough space peak points are selected from each of the image blocks. Based on the peak points of the Hough space, the linear parameters of the crop rows are calculated; The detection threshold is dynamically adjusted based on the area size of the crop region to be detected and the crop planted therein.
3. The crop row detection method according to claim 1, characterized in that, The crop row detection results are obtained by combining the clustering results of the initial crop row straight line and the environmental depth map, including: By combining the initial crop row straight line and the clustering results of the environmental depth map, a set of candidate crop row points is obtained; The candidate crop row point set and the spectral image are input into the crop row detection model to obtain the crop row detection results output by the crop row detection model; The crop row detection model is constructed based on the YOLO network.
4. The crop row detection method according to claim 3, characterized in that, The clustering results, combining the initial crop row lines and the environmental depth map, yield a candidate crop row point set, including: Based on the clustering algorithm, the points in the environmental depth map are clustered to obtain density clustering results; Based on the density clustering results, the occlusion area is determined; Based on the density clustering results and the initial crop row lines, the shading area is interpolated to obtain the candidate crop row point set.
5. The crop row detection method according to claim 4, characterized in that, The step of interpolating the shading region based on the density clustering results and the initial crop row lines to obtain the candidate crop row point set includes: Based on the initial crop row straight line, intra-row interpolation and / or inter-row interpolation are performed on the shading area to obtain the candidate crop row point set.
6. The crop row detection method according to any one of claims 1 to 5, characterized in that, The crop row detection result is obtained by combining the clustering results of the initial crop row straight line and the environmental depth map, and then includes: Analyze the crop row detection results to obtain geometric constraints; Based on the aforementioned geometric constraints, a mechanical motion path is generated; The geometric constraints include row spacing constraints and crop row direction constraints.
7. A crop row detection device, characterized in that, include: The acquisition unit acquires spectral images and point cloud data of the crop area to be detected. An edge detection unit performs edge detection on the spectral image to obtain crop row linear parameters; The alignment unit aligns the initial crop row straight line corresponding to the crop row linear parameters with the point cloud data to obtain an environmental depth map. The fusion unit combines the initial crop row straight line and the clustering results of the environmental depth map to obtain the crop row detection results.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the crop row detection method as described in any one of claims 1 to 6.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the crop row detection method as described in any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the crop row detection method as described in any one of claims 1 to 6.