Grass boundary detection method and device, mowing robot, and storage medium
By performing semantic segmentation and binarization on grassland region images, grassland boundaries are automatically detected, solving the problems of low efficiency and poor accuracy in grassland boundary delineation, and achieving efficient and accurate grassland boundary detection.
Patent Information
- Application Number
- CN202210869099.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-22
- Publication Date
- 2026-01-06
- Estimated Expiration
- 2042-07-22
AI Technical Summary
Existing technologies for grassland boundary delineation are inefficient and inaccurate, requiring manual delineation which leads to large errors.
By performing semantic segmentation and binarization on grassland area images, grassland contours are extracted, target grassland contours are selected, and traversal is performed based on preset interest points and traversal parameters to automatically detect grassland boundaries.
It improves the accuracy and efficiency of grassland boundary detection and delineation, avoiding the problems of poor accuracy and low efficiency caused by manual delineation.
Smart Images

Figure CN116824124B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, specifically to a method, apparatus, lawnmower robot, and storage medium for detecting grassland boundaries. Background Technology
[0002] Lawn-mowing robots are widely used for maintaining home lawns and trimming large lawns. They integrate technologies such as motion control, multi-sensor fusion, and path planning. To control a lawn-mowing robot to perform its mowing tasks, its mowing path needs to be planned to ensure complete coverage of the entire work area.
[0003] Currently, before mowing operations can be carried out, the boundaries of the grass area need to be manually demarcated. It is evident that the current grass boundary demarcation scheme is not only inefficient, but also results in poor accuracy of the demarcated grass boundaries due to manual demarcation. Summary of the Invention
[0004] This application provides a method, apparatus, lawnmower robot, and storage medium for grassland boundary detection, which can improve the accuracy of grassland boundary detection and thus improve the efficiency and accuracy of grassland boundary delineation.
[0005] In a first aspect, embodiments of this application provide a grassland boundary detection method, including:
[0006] Semantic segmentation is performed on the region image containing the grassland area to obtain the target image corresponding to the grassland area;
[0007] The target image is binarized, and the grassland outline corresponding to the grassland area is extracted from the processed image.
[0008] Based on the contour area corresponding to the grassland contour, a target grassland contour is selected from the grassland contours.
[0009] The target grassland outline is traversed based on preset interest point information and preset traversal parameters to obtain the grassland boundary corresponding to the grassland region.
[0010] Optionally, in some embodiments, the step of traversing the target grassland outline according to preset interest point information and preset traversal parameters to obtain the grassland boundary corresponding to the grassland region includes:
[0011] Determine the jump step size corresponding to the preset traversal parameters;
[0012] Extract the area range corresponding to the preset point of interest in the preset direction from the preset point of interest information;
[0013] Based on the step length and region range, the outline of the target grassland is traversed to obtain the grassland boundary corresponding to the grassland region.
[0014] Optionally, in some embodiments, the step of traversing the target grassland outline based on the step length and region range to obtain the grassland boundary corresponding to the grassland region includes:
[0015] Based on the jump step length, multiple reference points are set in the area corresponding to the point of interest, and the distance between adjacent reference points is greater than the jump step length.
[0016] Traverse each contour edge of the target grassland contour and determine the reference point corresponding to the contour point in the preset direction during the traversal as the target point;
[0017] Once a target contour point is determined, the next traversal is performed within the region according to the traversal parameters.
[0018] Output the set of boundary points based on the traversal results, and determine the grassland boundary corresponding to the grassland region based on the set of boundary points.
[0019] Optionally, in some embodiments, it further includes:
[0020] If the coordinates of the target point being traversed in the preset direction are detected to be outside the area range, then the next traversal is performed within the area range according to the traversal parameters.
[0021] Optionally, in some embodiments, selecting the target grassland contour based on the contour area corresponding to the grassland contour includes:
[0022] Based on the area of the grassland outline, the extracted grassland outlines are sorted from largest to smallest.
[0023] In the sorted grassland outlines, select a preset number of grassland outlines as target grassland outlines in descending order.
[0024] Optionally, in some embodiments, after binarizing the target image, the process further includes:
[0025] The processed image is reduced in size, and then the reduced image is dilated to obtain the dilated image.
[0026] Extracting the grass contour corresponding to the grass region in the processed image includes: extracting the grass contour corresponding to the grass region in the expanded image.
[0027] Optionally, in some embodiments, performing semantic segmentation on the region image containing the grassland region to obtain the target image corresponding to the grassland region includes:
[0028] Obtain the preset semantic segmentation model;
[0029] The numerical values of the region image containing the grassland area are fed into the semantic segmentation model to obtain the label corresponding to each pixel in the region image;
[0030] Based on the label corresponding to each pixel in the region image, the target image corresponding to the grassland region is segmented from the region image.
[0031] Secondly, embodiments of this application provide a grassland boundary detection device, comprising:
[0032] The segmentation module is used to perform semantic segmentation on a region image containing a grassland region to obtain a target image corresponding to the grassland region.
[0033] The processing module is used to perform binarization processing on the target image;
[0034] The extraction module is used to extract the grass contour corresponding to the grass area in the processed image;
[0035] The selection module is used to select a target grassland contour from the grassland contours based on the contour area corresponding to the grassland contour.
[0036] The traversal module is used to traverse the outline of the target grassland according to preset interest point information and preset traversal parameters to obtain the grassland boundary corresponding to the grassland region.
[0037] In this embodiment, after semantic segmentation of a region image containing a grassland area to obtain a target image corresponding to the grassland area, the target image is binarized, and the grassland contour corresponding to the grassland area is extracted from the processed image. Then, a target grassland contour is selected from the grassland contours based on the contour area corresponding to the grassland contour. Finally, the target grassland contour is traversed according to preset interest point information and preset traversal parameters to obtain the grassland boundary corresponding to the grassland area. In the grassland boundary detection scheme provided in this application, the grassland contour corresponding to the grassland area is extracted from the binarized target image. Subsequently, the target grassland contour is traversed according to preset interest point information and preset traversal parameters to obtain the grassland boundary corresponding to the grassland area. This method delineates the grassland, avoiding the problems of poor segmentation accuracy and low segmentation efficiency caused by manual grassland segmentation. Therefore, this scheme can improve the accuracy of grassland boundary detection, and thus improve the efficiency and accuracy of grassland boundary segmentation. Attached Figure Description
[0038] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0039] Figure 1a This is a schematic diagram of a scenario for the grassland boundary detection method provided in the embodiments of this application;
[0040] Figure 1b This is a schematic flowchart of the grassland boundary detection method provided in the embodiments of this application;
[0041] Figure 1c This is a schematic diagram of the semantic segmentation model provided in the embodiments of this application;
[0042] Figure 2 This is a schematic diagram of the grassland boundary detection device provided in the embodiments of this application;
[0043] Figure 3 This is a schematic diagram of the structure of the lawnmower robot provided in the embodiments of this application. Detailed Implementation
[0044] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0045] It should be noted that when a component is referred to as "fixed to" or "set on" another component, it can be directly on or indirectly on that other component. When a component is referred to as "connected to" another component, it can be directly connected to or indirectly connected to that other component. Furthermore, a connection can be for both fixing and circuit connection purposes.
[0046] It should be understood that the terms "length", "width", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", and "outer" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing the embodiments of the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the present invention.
[0047] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of the embodiments of this application, "a plurality of" means two or more, unless otherwise explicitly specified.
[0048] This application provides a grassland boundary detection method, apparatus, lawnmower robot, and storage medium.
[0049] Specifically, the lawn boundary detection device can be integrated into the microcontroller unit (MCU) of the lawnmower robot, or into a smart terminal or server. An MCU, also known as a single-chip microcomputer, is a chip-level computer formed by appropriately reducing the frequency and specifications of a central processing unit (CPU) and integrating peripheral interfaces such as memory, timer, USB, analog-to-digital converter / digital-to-analog converter, UART, PLC, and DMA, allowing for different control combinations for different applications. The lawnmower robot can move automatically, avoid collisions, and automatically return to its charging station within its designated range. It features safety detection and battery level monitoring, and has a certain climbing ability, making it particularly suitable for lawn mowing and maintenance in home gardens and public green spaces. Its characteristics include: automatic mowing, grass clipping removal, automatic rain protection, automatic charging, automatic obstacle avoidance, compact size, electronic virtual fence, and network control.
[0050] The terminal can be a smartphone, tablet, laptop, desktop computer, smartwatch, etc., but is not limited to these. The terminal and the server can be connected directly or indirectly through wired or wireless communication. The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. This application does not impose any restrictions on these aspects.
[0051] For example, please see Figure 1a This application provides a lawn mowing system, including a lawn mowing robot 10, a server 20, and a user device 30 that are connected to each other. The lawn mowing robot 10 is equipped with a vision sensor P, which is located behind the ultrasonic sensor. This avoids blocking the ultrasonic sensor and affecting some of the obstacle avoidance functions of the lawn mowing robot 10.
[0052] Specifically, before the lawnmower 10 performs the mowing operation, it can collect images within its field of view. When the lawnmower 10 collects an image of a region containing a grass area, it performs semantic segmentation on the image to obtain the target image corresponding to the grass area. Then, the lawnmower 10 performs binarization on the target image and extracts the grass contour corresponding to the grass area in the processed image. Then, the lawnmower 10 selects the target grass wheel in the grass contour based on the contour area corresponding to the grass contour. Finally, the lawnmower 10 traverses the target grass contour according to preset interest point information and preset traversal parameters to obtain the grass boundary corresponding to the grass area.
[0053] The grassland boundary detection scheme provided in this application extracts the grassland contour corresponding to the grassland region from the binarized target image. Then, it traverses the target grassland contour according to preset interest point information and preset traversal parameters to obtain the grassland boundary corresponding to the grassland region. This method divides the grassland, avoiding the problems of poor division accuracy and low division efficiency caused by manual division. Therefore, this scheme can improve the accuracy of grassland boundary detection, and thus improve the efficiency and accuracy of grassland boundary division.
[0054] The following sections provide detailed descriptions of each example. It should be noted that the order in which the embodiments are described is not intended to limit the priority of the embodiments.
[0055] A grassland boundary detection method includes: performing semantic segmentation on a region image containing a grassland region to obtain a target image corresponding to the grassland region; performing binarization processing on the target image and extracting the grassland contour corresponding to the grassland region in the processed image; selecting a target grassland contour from the grassland contours based on the contour area corresponding to the grassland contour; and traversing the target grassland contour according to preset interest point information and preset traversal parameters to obtain the grassland boundary corresponding to the grassland region.
[0056] Please see Figure 1b , Figure 1b This is a flowchart illustrating the grassland boundary detection method provided in this application embodiment. The specific flow of the grassland boundary detection method is as follows:
[0057] 101. Perform semantic segmentation on the image containing the grassland region to obtain the target image corresponding to the grassland region.
[0058] The image of the region can be an RGB color image, that is, an image in RGB color mode. RGB color mode is an industry color standard that obtains various colors by varying the red (R), green (G), and blue (B) color channels and superimposing them. RGB represents the colors of the red, green, and blue channels. For example, specifically, a camera installed on a lawnmower can capture an image of a region containing grass. After acquiring the image, semantic segmentation of the region image can be performed based on deep learning to obtain the target image corresponding to the grass region. Optionally, in some embodiments, the step "semantically segmenting the image of the region containing grass to obtain the target image corresponding to the grass region" may specifically include:
[0059] (11) Obtain the preset semantic segmentation model;
[0060] (12) Input the numerical values of the region image containing the grassland region into the semantic segmentation model to obtain the label corresponding to each pixel in the region image;
[0061] (13) Based on the label corresponding to each pixel in the region image, segment the target image corresponding to the grassland region in the region image.
[0062] For example, this semantic segmentation model is built upon the DeepLabV3plus model; please refer to [link / reference]. Figure 1c The semantic segmentation model provided in this application includes a 2x downsampling convolutional module (a), an interpolation upsampling convolutional module (b), an output convolutional module (c), an ASSP module (d), and a cascaded fusion module (d). Each 2x downsampling convolutional module uses depthwise separating convolutions to construct the residual module, reducing model parameters and computational cost. Simultaneously, to obtain more accurate grass boundaries, this semantic segmentation model adds a shallow spatial feature layer compared to the original DeepLabV3plus. This facilitates the acquisition of more detailed information, thereby improving the accuracy of grass boundary recognition and reducing boundary blurring or jagged boundaries caused by the loss of spatial detail information. The ASSP module uses the same parameters as the original DeepLabV3plus to increase the model's receptive field. The cascaded fusion module uses a cascaded 3x3 convolutional layer and a 1x1 convolutional layer to fuse features from different layers, and finally uses a 1x1 convolutional layer and an interpolation upsampling layer as the output layer module.
[0063] 102. Perform binarization on the target image and extract the grassland contour corresponding to the grassland area in the processed image.
[0064] To facilitate the subsequent identification of the grassland boundary in the target image, this application binarizes the target image. Binarization means setting the grayscale value of the pixels in the image to 0 or 255, which means presenting the entire image with a clear visual effect of only black and white.
[0065] After binarizing the target image, the grass contour corresponding to the grass region can be extracted from the processed image. It's important to note that contours are a crucial image feature and can sometimes be easily confused with edges. Edges are areas of significant image variation, while contours are the edge lines that constitute shapes and objects, and are part of the edge itself. For binary images with simple shapes, object contours and edges coincide. In OpenCV, the `findContours` function can be used to extract contour information from an image; optionally, it can be used to extract the grass contour corresponding to the grass region in the processed image.
[0066] To reduce the complexity of subsequent calculations, optionally, in some embodiments, the processed image can be reduced in size and then dilated to smooth the edge contours. That is, after the step "binarize the target image", the process may further include: reducing the size of the processed image and dilating the reduced image to obtain the dilated image.
[0067] Optionally, in some embodiments, the step "extracting the grass contour corresponding to the grass region in the processed image" may specifically include: extracting the grass contour corresponding to the grass region in the dilated image.
[0068] For example, the size of the processed image can be reduced by 0.5 times, that is, the size of the reduced image is half the size of the processed image, and then a dilation operation can be performed on the reduced image to smooth the edge contours.
[0069] 103. Select the target grassland contour from the grassland contours based on the contour area corresponding to the grassland contour.
[0070] For example, the grassland contours can be arranged in a preset order according to their corresponding contour areas. Then, a target grassland contour can be selected from the sorted grassland contours. That is, optionally, in some embodiments, the step "selecting a target grassland contour from the grassland contours based on the contour areas corresponding to the grassland contours" may specifically include:
[0071] (21) Sort the extracted grassland contours from largest to smallest according to the contour area corresponding to the grassland contour.
[0072] (22) In the sorted grassland outlines, select a preset number of grassland outlines as target grassland outlines in descending order.
[0073] Optionally, in some embodiments, the extracted grassland contours are sorted from largest to smallest, and the top 3 grassland contours in the sorted grassland contours are selected as the target grassland contours. The number of selections can be set according to the actual situation. For example, if only one grassland contour is extracted, then that grassland contour is selected as the target grassland contour.
[0074] 104. Traverse the outline of the target grassland according to the preset interest point information and preset traversal parameters to obtain the grassland boundary corresponding to the grassland region.
[0075] For example, specifically, the step size and interest point information of the traversal can be preset. The interest point information can include the area range corresponding to the preset interest point in a preset direction. Then, based on the step size and the area range corresponding to the preset interest point in the preset direction, the outline of the target grassland is traversed to obtain the grassland boundary corresponding to the grassland area. That is, optionally, in some embodiments, the step "traversing the outline of the target grassland according to the preset interest point information and preset traversal parameters to obtain the grassland boundary corresponding to the grassland area" can specifically include:
[0076] (31) Determine the jump step size corresponding to the preset traversal parameters;
[0077] (32) Extract the area range corresponding to the preset interest point in the preset direction from the preset interest point information;
[0078] (33) Based on the step length and area range, the outline of the target grassland is traversed to obtain the grassland boundary corresponding to the grassland area.
[0079] Specifically, the range of the interest point region Roi along the first direction (e.g., the x-axis direction) of the contour can be pre-defined as [x_min, x_max], and the step size M for contour traversal can be set. Then, N reference points with equal or unequal spacing are set within the Roi range in combination with the step size M, wherein the distance between adjacent reference points is greater than the step size M. At the same time, the Id sequence numbers corresponding to the N values are defined, such as: x_value = {x_0, x_1, x_2, ..., x_N-3, x_N-2, x_N-1}; x_id = {N-2, ..., 3, 1, 0, 2, 4, ..., N-1}. Then, the contour is traversed to obtain all points at defined positions in the second direction (i.e., the y-axis direction) perpendicular to the first direction, thereby determining the grassland boundary. That is, optionally, in some embodiments, the step "traversing the target grassland contour based on the step size and the region range to obtain the grassland boundary corresponding to the grassland region" can specifically include:
[0080] (41) Based on the step size, multiple reference points are set in the region corresponding to the point of interest, and the distance between adjacent reference points is greater than the step size.
[0081] (42) Traverse each contour edge of the target grassland contour and determine the reference point corresponding to the contour point in the preset direction during the traversal as the target point;
[0082] (43) Once a target point is determined, the next traversal is performed within the region based on the traversal parameters;
[0083] (44) Output the set of boundary points based on the traversal results, and determine the grassland boundary corresponding to the grassland area based on the set of boundary points.
[0084] For example, specifically, during the traversal process, the reference point corresponding to the contour point in the preset direction is determined as the target point. After each target point is determined, a skip traversal can be performed. That is, after determining a target point, the next contour point is traversed based on the step size M to reduce the number of traversals and thus improve the efficiency of determining the mowing boundary. In addition, it should be noted that when the coordinates of the reference point in the second direction perpendicular to the first direction exceed the area range, the next contour point can be traversed based on the step size M. That is, optionally, in some embodiments, the grassland boundary detection method of this application may further include: if the coordinates of the target point currently being traversed in the preset direction are detected to exceed the area range, the next traversal is performed within the area range according to the traversal parameters.
[0085] Add all target points to the boundary point set. Then, the start and end points of the line segments can be retained. That is, target points a, b, and c are all located on the same line segment, and target point b is located between target points a and c. Therefore, target point b can be removed. Optionally, the target points can also be vectorized into polygons, rectangles, or ellipses, etc., which can be adjusted according to the actual situation. After processing the boundary point set, the grassland boundary corresponding to the grassland area is output.
[0086] The above completes the grassland boundary detection process.
[0087] In this embodiment, after semantic segmentation of a region image containing a grassland area to obtain the target image corresponding to the grassland area, the target image is binarized, and the grassland contour corresponding to the grassland area is extracted from the processed image. Then, a target grassland contour is selected from the grassland contours based on the contour area corresponding to the grassland contour. Finally, the target grassland contour is traversed according to preset interest point information and preset traversal parameters to obtain the grassland boundary corresponding to the grassland area. In the grassland boundary detection scheme provided in this application, the grassland contour corresponding to the grassland area is extracted from the binarized target image. Subsequently, the target grassland contour is traversed according to preset interest point information and preset traversal parameters to obtain the grassland boundary corresponding to the grassland area. This method divides the grassland, avoiding the problems of poor segmentation accuracy and low segmentation efficiency caused by manual grassland segmentation. Therefore, this scheme can improve the accuracy of grassland boundary detection, and thus improve the efficiency and accuracy of grassland boundary segmentation.
[0088] Please see Figure 2 , Figure 2 This is a schematic diagram of the structure of a grassland boundary detection device provided in an embodiment of this application. The grassland boundary detection device may include a segmentation module 201, a processing module 202, an extraction module 203, a selection module 204, and a traversal module 205, as follows:
[0089] The segmentation module 201 is used to perform semantic segmentation on the region image containing the grassland region to obtain the target image corresponding to the grassland region.
[0090] For example, specifically, the segmentation module 201 can acquire regional images containing grass areas through a camera installed on the lawnmower robot. After acquiring the regional image, it can perform semantic segmentation of the regional image based on deep learning to obtain the target image corresponding to the grass area.
[0091] Optionally, in some embodiments, the segmentation module 201 may be specifically used to: obtain a preset semantic segmentation model; input the region image values containing the grassland region into the semantic segmentation model to obtain the label corresponding to each pixel in the region image; and segment the target image corresponding to the grassland region from the region image based on the label corresponding to each pixel in the region image.
[0092] The processing module 202 is used to perform binarization processing on the target image.
[0093] Optionally, the processing module 202 can extract the grass contour corresponding to the grass region in the processed image using the findContours function.
[0094] Optionally, in some embodiments, the processing module 202 may also be used to: perform image reduction processing on the processed image, and perform dilation operation on the reduced image to obtain a dilated image.
[0095] Extraction module 203 is used to extract the grass contour corresponding to the grass area in the processed image.
[0096] Optionally, in some embodiments, the extraction module 203 may be specifically used to: extract the grass contour corresponding to the grass region in the dilated image.
[0097] Selection module 204 is used to select a target grassland contour from the grassland contours based on the contour area corresponding to the grassland contour.
[0098] For example, the selection module 204 can arrange the grassland contours in a preset order according to the contour area corresponding to the grassland contours. Then, select the corresponding target grassland contours from the sorted grassland contours. That is, optionally, in some embodiments, the selection module 204 can be used to: sort the extracted grassland contours from largest to smallest according to the contour area corresponding to the grassland contours; and select a preset number of grassland contours as target grassland contours from the sorted grassland contours in a descending order.
[0099] The traversal module 205 is used to traverse the outline of the target grassland according to the preset interest point information and preset traversal parameters to obtain the grassland boundary corresponding to the grassland area.
[0100] For example, specifically, the step size and interest point information of the traversal can be preset. The interest point information can include the area range corresponding to the preset interest point in the preset direction. Then, the traversal module 205 traverses the target grassland outline based on the step size and the area range corresponding to the preset interest point in the preset direction to obtain the grassland boundary corresponding to the grassland area.
[0101] Optionally, in some embodiments, the traversal module 205 may specifically include:
[0102] The determination unit is used to determine the jump step size corresponding to the preset traversal parameters;
[0103] The extraction unit is used to extract the area range corresponding to the preset interest point in the preset direction from the preset interest point information;
[0104] The traversal unit is used to traverse the target grassland outline based on the step size and region range to obtain the grassland boundary corresponding to the grassland region.
[0105] Optionally, in some embodiments, the traversal unit may specifically be used to: set multiple reference points in the region corresponding to the point of interest based on the step size, wherein the distance between adjacent reference points is greater than the step size; traverse each contour edge of the target grassland contour, and determine the reference point corresponding to the contour point in the preset direction as the target point during the traversal process; after determining a target point, perform the next traversal within the region according to the traversal parameters; output the boundary point set according to the traversal result, and determine the grassland boundary corresponding to the grassland region based on the boundary point set.
[0106] In this embodiment, after the segmentation module 201 performs semantic segmentation on the region image containing the grassland region to obtain the target image corresponding to the grassland region, the processing module 202 performs binarization processing on the target image. Then, the extraction module 203 extracts the grassland contour corresponding to the grassland region from the processed image. Next, the selection module 204 selects the target grassland contour from the grassland contours based on the contour area corresponding to the grassland contour. Finally, the traversal module 205 traverses the target grassland contour according to preset interest point information and preset traversal parameters to obtain the grassland boundary corresponding to the grassland region. In the grassland boundary detection scheme provided in this application, the grassland contour corresponding to the grassland region is extracted from the binarized target image. Subsequently, the target grassland contour is traversed according to preset interest point information and preset traversal parameters to obtain the grassland boundary corresponding to the grassland region. This method divides the grassland, avoiding the problems of poor segmentation accuracy and low segmentation efficiency caused by manual grassland segmentation. Therefore, this scheme can improve the accuracy of grassland boundary detection, and thus improve the efficiency and accuracy of grassland boundary segmentation.
[0107] Furthermore, embodiments of this application also provide a lawnmower robot, such as... Figure 3 As shown, it illustrates the structural diagram of the lawnmower robot involved in the embodiments of this application, specifically:
[0108] The lawnmower robot may include components such as a control module 301, a traveling mechanism 302, a cutting module 303, and a power supply 304. Those skilled in the art will understand that... Figure 3 The lawnmower structure shown does not constitute a limitation on the lawnmower itself, and may include more or fewer parts than shown, or combine certain parts, or have different part arrangements. Wherein:
[0109] The control module 301 is the control center of the lawnmower robot. Specifically, the control module 301 may include a central processing unit (CPU), memory, input / output ports, system bus, timer / counter, digital-to-analog converter, and analog-to-digital converter, etc. The CPU executes various functions and processes data of the lawnmower robot by running or executing software programs and / or modules stored in the memory, and by calling data stored in the memory. Preferably, the CPU may integrate an application processor and a modem processor. The application processor mainly handles the operating system and applications, while the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the CPU.
[0110] The memory can be used to store software programs and modules. The CPU executes various functional applications and data processing by running the software programs and modules stored in the memory. The memory can mainly include a program storage area and a data storage area. The program storage area can store the operating system, application programs required for at least one function (such as sound playback, image playback, etc.), etc.; the data storage area can store data created based on the use of the lawnmower robot, etc. In addition, the memory can include high-speed random access memory, and can also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory can also include a memory controller to provide the CPU with access to the memory.
[0111] The traveling mechanism 302 is electrically connected to the control module 301 and is used to respond to the control signals transmitted by the control module 301 to adjust the traveling speed and direction of the lawn mower robot, thereby realizing the self-moving function of the lawn mower robot.
[0112] The cutting module 303 is electrically connected to the control module 301 and is used to respond to the control signals transmitted by the control module to adjust the height and speed of the cutting disc to achieve grass cutting.
[0113] Power supply 304 can be logically connected to control module 301 through power management system, thereby enabling functions such as charging, discharging, and power consumption management through power management system. Power supply 304 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0114] Although not shown, the lawnmower robot may also include a communication module, a sensor module, a prompting module, etc., which will not be described in detail here.
[0115] The communication module is used for receiving and sending signals during the information transmission and reception process. It establishes a communication connection with user equipment, base stations, or servers to realize the transmission and reception of signals with user equipment, base stations, or servers.
[0116] The sensor module is used to collect internal or external environmental information and feeds the collected environmental data back to the control module for decision-making, enabling the lawnmower robot to achieve precise positioning and intelligent obstacle avoidance. In this embodiment, the sensor module includes at least a vision sensor for collecting graphic codes in the working environment. Optionally, the sensor module may also include: ultrasonic sensors, infrared sensors, collision sensors, rain sensors, lidar sensors, inertial measurement units, wheel speedometers, position sensors, and other sensors, without limitation.
[0117] The notification module is used to inform the user of the current working status of the lawnmower robot. In this solution, the notification module includes, but is not limited to, indicator lights and buzzers. For example, the lawnmower robot can use indicator lights to indicate the current power status, motor operating status, and sensor operating status. As another example, when a malfunction or theft of the lawnmower robot is detected, an alarm can be triggered via a buzzer.
[0118] Specifically, in this embodiment, the processor in the control module 301 loads the executable files corresponding to the processes of one or more applications into the memory according to the following instructions, and the processor runs the applications stored in the memory to achieve various functions, as follows:
[0119] Semantic segmentation is performed on the region image containing the grassland area to obtain the target image corresponding to the grassland area; the target image is binarized, and the grassland contour corresponding to the grassland area is extracted from the processed image; the target grassland contour is selected from the grassland contours based on the contour area corresponding to the grassland contour; the target grassland contour is traversed according to the preset interest point information and preset traversal parameters to obtain the grassland boundary corresponding to the grassland area.
[0120] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0121] In this embodiment, after semantic segmentation of a region image containing a grassland area to obtain the target image corresponding to the grassland area, the target image is binarized, and the grassland contour corresponding to the grassland area is extracted from the processed image. Then, a target grassland contour is selected from the grassland contours based on the contour area corresponding to the grassland contour. Finally, the target grassland contour is traversed according to preset interest point information and preset traversal parameters to obtain the grassland boundary corresponding to the grassland area. In the grassland boundary detection scheme provided in this application, the grassland contour corresponding to the grassland area is extracted from the binarized target image. Subsequently, the target grassland contour is traversed according to preset interest point information and preset traversal parameters to obtain the grassland boundary corresponding to the grassland area. This method divides the grassland, avoiding the problems of poor segmentation accuracy and low segmentation efficiency caused by manual grassland segmentation. Therefore, this scheme can improve the accuracy of grassland boundary detection, and thus improve the efficiency and accuracy of grassland boundary segmentation.
[0122] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0123] Therefore, embodiments of this application provide a storage medium storing multiple instructions that can be loaded by a processor to execute steps in any of the grassland boundary detection methods provided in embodiments of this application. For example, the instructions can execute the following steps:
[0124] Semantic segmentation is performed on the region image containing the grassland area to obtain the target image corresponding to the grassland area; the target image is binarized, and the grassland contour corresponding to the grassland area is extracted from the processed image; the target grassland contour is selected from the grassland contours based on the contour area corresponding to the grassland contour; the target grassland contour is traversed according to the preset interest point information and preset traversal parameters to obtain the grassland boundary corresponding to the grassland area.
[0125] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0126] The storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0127] Since the instructions stored in the storage medium can execute the steps of any of the grassland boundary detection methods provided in the embodiments of this application, the beneficial effects that any of the grassland boundary detection methods provided in the embodiments of this application can achieve can be realized. For details, please refer to the previous embodiments, which will not be repeated here.
[0128] The above provides a detailed description of a grassland boundary detection method, device, lawnmower robot, and storage medium provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method of detecting a grass boundary, characterized by, The method comprises the following steps: performing semantic segmentation on a region image containing a grass region to obtain a target image corresponding to the grass region; performing binaryzation processing on the target image, and extracting a grassland contour corresponding to the grass region in the processed image; selecting a target grassland contour in the grassland contour based on the contour area corresponding to the grassland contour; determining a skip step length corresponding to a preset traversal parameter; extracting a region range corresponding to a preset interest point in a preset direction from preset interest point information; traversing the target grassland contour based on the skip step length and the region range, comprising: setting a plurality of reference points in the region corresponding to the interest point based on the skip step length, and the distance between adjacent reference points is greater than the skip step length; traversing each contour edge of the target grassland contour, and determining that the reference point corresponding to the contour point in the preset direction in the traversal process is a target point; when the reference point coordinate in a second direction perpendicular to the preset direction exceeds the region range, traversing the next contour point based on the skip step length; thereby obtaining a grassland boundary corresponding to the grass region.
2. The method of claim 1, wherein, Further comprising: each time a target point is determined, the next traversal is performed in the region range according to the traversal parameter; outputting a boundary point set according to the traversal result, and determining a grassland boundary corresponding to the grass region based on the boundary point set.
3. The method according to claim 1 or 2, characterized in that, The method further comprises the following steps: sorting the extracted grassland contours in descending order according to the contour area corresponding to the grassland contour; selecting a preset number of grassland contours as target grassland contours in descending order in the sorted grassland contours.
4. The method according to claim 1 or 2, characterized in that, After the binaryzation processing on the target image, the method further comprises the following steps: performing image reduction processing on the processed image, and performing an expansion operation on the reduced image to obtain an expanded image; extracting the grassland contour corresponding to the grass region in the expanded image.
5. The method according to claim 1 or 2, characterized in that, The method further comprises the following steps: obtaining a preset semantic segmentation model; inputting the region image containing the grass region into the semantic segmentation model to obtain a label corresponding to each pixel in the region image; segmenting the target image corresponding to the grass region from the region image based on the label corresponding to each pixel in the region image.
6. A grass boundary detection apparatus characterized by comprising: The method comprises the following steps: a segmentation module for performing semantic segmentation on a region image containing a grass region to obtain a target image corresponding to the grass region; a processing module for performing binaryzation processing on the target image; an extraction module for extracting a grassland contour corresponding to the grass region in the processed image; a selection module for selecting a target grassland contour in the grassland contour based on the contour area corresponding to the grassland contour; a traversal module for determining a skip step length corresponding to a preset traversal parameter; extracting a region range corresponding to a preset interest point in a preset direction from preset interest point information; The target grassland contour is traversed based on the skip step length and the region range, including: a plurality of reference points are set in the region corresponding to the interest point based on the skip step length, and the distance between adjacent reference points is greater than the skip step length; Each contour edge of the target grassland contour is traversed, and a reference point corresponding to a contour point in a preset direction in the traversal process is determined as a target point; when the reference point in a second direction perpendicular to the preset direction exceeds the region range, the next contour point is traversed based on the skip step length; and a grassland boundary corresponding to the grassland region is obtained.
7. A mowing robot comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein, The processor implements the steps of the grassland boundary detection method according to any one of claims 1 to 5 when executing the program.
8. A storage medium, characterized by A computer program is stored thereon, and the computer program implements the steps of the grassland boundary detection method according to any one of claims 1 to 5 when executed by a processor.
Citation Information
Patent Citations
Rapid lawn semantic segmentation and boundary detection method
CN110399840A
Contour estimation method of dense fibroblasts
CN112070789A