Map image segmentation method and cleaning robot

By determining the pixel boundary line and boundary pixels in the map image of the cleaning robot, and using the pixel boundary line for map segmentation, the problem of low accuracy of map segmentation in the prior art is solved, and a more accurate segmentation effect is achieved.

CN120235890APending Publication Date: 2025-07-01ANKER INNOVATIONS TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311867282.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-29
Publication Date
2025-07-01

AI Technical Summary

Technical Problem

In the prior art, there is a deviation of 1 to 2 pixels during the map image segmentation process, resulting in low segmentation accuracy.

Method used

By determining the pixel boundary line and boundary pixel in the map image, the segmented boundary area is divided into multiple second contour segmentation areas according to the pixel boundary line, and the pixel boundary line is used as the real segmentation line for map segmentation.

Benefits of technology

The accuracy of map segmentation is improved, so that the segmentation particle size is accurate to each pixel, and the boundary pixels are reasonably allocated to the corresponding outline area, reducing the error of random division to nearby areas.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120235890A_ABST
    Figure CN120235890A_ABST
Patent Text Reader

Abstract

The invention relates to a map image segmentation method and a cleaning robot. The method is applied to the cleaning robot and specifically comprises the following steps of: executing a positioning step: determining a pixel boundary line and a boundary pixel in a map image according to a pre-segmentation line in the map image of the cleaning robot; determining a first contour segmentation area corresponding to the pre-segmentation line in the map image according to the boundary pixel; and according to the pixel boundary line, segmenting a segmentation boundary region formed by the boundary pixels and the first contour segmentation region into a plurality of second contour segmentation regions to obtain a map segmentation result. By adopting the method, the map image segmentation accuracy can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and particularly to a method for map image segmentation and a cleaning robot. Background Art

[0002] With the development of image processing technology, map image segmentation technology has emerged. After the cleaning robot obtains a pre-segmentation line, it can automatically perform map image segmentation according to the pre-segmentation line.

[0003] In traditional technology, usually a pixel sequence with a pixel width is first determined in the map image according to the pre-segmentation line, and then this pixel sequence is used as the real segmentation line to divide the map image into multiple contour regions.

[0004] However, in the above map segmentation process, the above pixel sequence will be randomly divided into the contour regions near the pixel sequence, which will cause a deviation of 1 to 2 pixels in the finally obtained map segmentation result, and the accuracy of map image segmentation remains to be discussed. Summary of the Invention

[0005] Based on this, in view of the above technical problems, it is necessary to provide a method for map image segmentation and a cleaning robot that can improve the accuracy of map image segmentation.

[0006] In a first aspect, the present application provides a method for map image segmentation, which is applied to a cleaning robot. The method includes:

[0007] Performing a positioning step: determining a pixel boundary line and boundary pixels in the map image according to a pre-segmentation line in the map image of the cleaning robot;

[0008] Determining a first contour segmentation region corresponding to the pre-segmentation line in the map image according to the boundary pixels;

[0009] According to the pixel boundary line, dividing the segmentation boundary region composed of the boundary pixels and the first contour segmentation region into multiple second contour segmentation regions to obtain a map segmentation result.

[0010] In one embodiment, the determining a pixel boundary line and boundary pixels in the map image according to a pre-segmentation line in the map image of the cleaning robot includes:

[0011] Locating target pixels intersecting with the pre-segmentation line in the map image, and locating a target pixel edge corresponding to the pre-segmentation line among the pixel edges of the target pixels; connecting all the target pixel edges along the pixel edges of the image pixels in the map image to obtain the pixel boundary line; searching for pixels within the neighborhood range of the pixel boundary line to obtain boundary pixels.

[0012] In one embodiment, locating the target pixel edge corresponding to the pre-segmentation line among the pixel edges of the target pixel includes:

[0013] Obtain the midpoint position information of all pixel edges of the target pixel, and calculate the position distances from all pixel edges of the target pixel to the pre-segmentation line according to the midpoint position information; select the pixel edge with the minimum position distance as the target pixel edge of the target pixel.

[0014] In one embodiment, according to the pixel boundary line, dividing the segmentation boundary region formed by the boundary pixels and the first contour segmentation region into a plurality of second contour segmentation regions to obtain a map segmentation result includes:

[0015] According to the pixel boundary line, divide the segmentation boundary region formed by the boundary pixels into each unilateral boundary region; if the number of regions of the first contour segmentation region is two or more, then merge the boundary pixels in each unilateral boundary region into the corresponding first contour segmentation region respectively to obtain a plurality of second contour segmentation regions; if the number of regions of the first contour segmentation region is single, then merge the boundary pixels in the unilateral boundary region close to the first contour segmentation region into the first contour segmentation region to obtain a second contour segmentation region, and determine the unilateral boundary region far from the first contour segmentation region as a new second contour segmentation region.

[0016] In one embodiment, before determining the pixel boundary line and boundary pixels in the map image according to the pre-segmentation line of the map image, the method further includes:

[0017] Determine the line position information of all pre-segmentation lines in the map image; according to the line position information, select irrelevant pre-segmentation lines to form X segmentation line sets, where X is a positive integer; perform the positioning step for each of the segmentation line sets respectively.

[0018] In one embodiment, the method further includes:

[0019] Merge the map segmentation results corresponding to the pre-segmentation lines in the X segmentation line sets to obtain a target map segmentation result.

[0020] In one embodiment, before determining the line position information of all region segmentation lines in the map image, the method further includes:

[0021] Receive the dividing line information transmitted by the terminal device, where the dividing line information is used to determine the line position information of all regional dividing lines in the map image; after merging the map segmentation results corresponding to the pre-dividing lines in the X dividing line sets to obtain the target map segmentation result, the method further includes: Transmit the target map segmentation result to the terminal device, where the terminal device is used to display the target map segmentation result.

[0022] In one embodiment, the map image includes a foreground part and a background part; the determining, according to the boundary pixels, a first contour segmentation region corresponding to the pre-dividing line in the map image includes:

[0023] Replace and update all boundary pixels in the foreground part of the map image with pixels of the background region to obtain an updated map image; perform a connected region search in the foreground part of the updated map image, and use the found connected region as the first contour segmentation region corresponding to the pre-dividing line.

[0024] In one embodiment, the method further includes:

[0025] Determine a first pixel sequence and a second pixel sequence in a preset direction in the map image, where the first pixel sequence and the second pixel sequence are adjacent; obtain a first pixel count in the first pixel sequence and a second pixel count in the second pixel sequence; if the absolute value of the difference between the first pixel count and the second pixel count is greater than a preset threshold, then select a pre-dividing line in the region between the first pixel sequence and the second pixel sequence.

[0026] In a second aspect, the present application also provides a map image segmentation device applied to a cleaning robot, and the device includes:

[0027] A positioning module for performing a positioning step: determining a pixel boundary line and boundary pixels in the map image according to a pre-dividing line in the map image of the cleaning robot;

[0028] A determining module for determining a first contour segmentation region corresponding to the pre-dividing line in the map image according to the boundary pixels;

[0029] A splitting module for splitting the segmentation boundary region composed of the boundary pixels and the first contour segmentation region into a plurality of second contour segmentation regions according to the pixel boundary line to obtain a map segmentation result.

[0030] In a third aspect, the present application also provides a cleaning robot. The cleaning robot includes a body, a driving component, a cleaning component, a detection sensor, a memory, and a processor. The driving component, the cleaning component, and the detection sensor are all installed on the body. The driving component is used to drive the body to move on a working surface. The cleaning component is used to clean the working surface. The memory stores a computer program. When the processor executes the computer program, the following steps are implemented:

[0031] Execute a positioning step: According to a pre-segmentation line in the map image of the cleaning robot, determine a pixel boundary line and boundary pixels in the map image; according to the boundary pixels, determine a first contour segmentation region corresponding to the pre-segmentation line in the map image; according to the pixel boundary line, divide the segmentation boundary region composed of the boundary pixels and the first contour segmentation region into a plurality of second contour segmentation regions to obtain a map segmentation result.

[0032] In a fourth aspect, the present application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon. When the computer program is executed by a processor, the following steps are implemented:

[0033] Execute a positioning step: According to a pre-segmentation line in the map image of the cleaning robot, determine a pixel boundary line and boundary pixels in the map image; according to the boundary pixels, determine a first contour segmentation region corresponding to the pre-segmentation line in the map image; according to the pixel boundary line, divide the segmentation boundary region composed of the boundary pixels and the first contour segmentation region into a plurality of second contour segmentation regions to obtain a map segmentation result.

[0034] In a fifth aspect, the present application also provides a computer program product. The computer program product includes a computer program. When the computer program is executed by a processor, the following steps are implemented:

[0035] Execute a positioning step: According to a pre-segmentation line in the map image of the cleaning robot, determine a pixel boundary line and boundary pixels in the map image; according to the boundary pixels, determine a first contour segmentation region corresponding to the pre-segmentation line in the map image; according to the pixel boundary line, divide the segmentation boundary region composed of the boundary pixels and the first contour segmentation region into a plurality of second contour segmentation regions to obtain a map segmentation result.

[0036] The above-mentioned map image segmentation method and cleaning robot first determine pixel boundary lines and boundary pixels in the map image according to pre-segmentation lines in the map image of the cleaning robot, and then determine a first contour segmentation region corresponding to the pre-segmentation line in the map image according to the boundary pixels; according to the pixel boundary lines, the segmentation boundary region composed of the boundary pixels and the first contour segmentation region are cut into multiple second contour segmentation regions to obtain a map segmentation result. In this way, on the one hand, it realizes map segmentation with pixel boundary lines composed of boundaries of multiple pixels as the real segmentation lines instead of using the pixel sequence itself as the real segmentation line for map segmentation. The granularity of map segmentation can be accurate to each pixel, so the accuracy of map segmentation can be improved; on the other hand, according to the pixel boundary lines, the boundary pixels at the segmentation boundary can be reasonably allocated to the corresponding contour regions instead of randomly dividing the pixels at the segmentation boundary into the nearby contour regions, so the accuracy of map segmentation can be further improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 FIG. is a schematic diagram of map image segmentation in the prior art in an embodiment;

[0038] Figure 2 FIG. is a schematic flowchart of a map image segmentation method in an embodiment;

[0039] Figure 3 FIG. is a schematic diagram of target pixels intersecting with pre-segmentation lines in an embodiment;

[0040] Figure 4 FIG. is a schematic diagram of the edge of a target pixel in an embodiment;

[0041] Figure 5 FIG. is a schematic diagram of pixel boundary lines in an embodiment;

[0042] Figure 6 FIG. is a schematic diagram of boundary pixels in an embodiment;

[0043] Figure 7 FIG. is a schematic diagram illustrating a special map segmentation situation in an embodiment;

[0044] Figure 8 FIG. is a schematic flowchart of generating a map segmentation result in an embodiment;

[0045] Figure 9 FIG. is a schematic diagram of the map segmentation effect of pre-segmentation line A in an embodiment;

[0046] Figure 10 FIG. is a schematic diagram of the map segmentation effect of pre-segmentation line B in an embodiment;

[0047] Figure 11Schematic diagram of the map segmentation effect after merging the map segmentation results of the pre-segmentation line A and the pre-segmentation line B in an embodiment;

[0048] Figure 12 Structural block diagram of a map image segmentation device in an embodiment;

[0049] Figure 13 Internal structure diagram of a cleaning robot in an embodiment. Detailed implementation manners

[0050] In order to make the objectives, technical solutions and advantages of the present application clearer and more understandable, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0051] With the development of image processing technology, map image segmentation technology has emerged. After the cleaning robot obtains the pre-segmentation line, it can automatically perform map image segmentation according to the pre-segmentation line. Currently, usually, a pixel sequence with a pixel width is first determined in the map image according to the pre-segmentation line, and then this pixel sequence is used as the real segmentation line to divide the map image into multiple contour regions. However, in the above map segmentation process, the above pixel sequence will be randomly divided into the contour regions near the pixel sequence, which will cause a deviation of 1 to 2 pixels in the finally obtained map segmentation result, and the accuracy of map image segmentation remains to be discussed.

[0052] As Figure 1 shown, Figure 1 is a schematic diagram of map image segmentation in the prior art. Figure 1 Each grid in it represents a pixel, and the blackened column of pixels is the pixel sequence used as the real segmentation line. This pixel sequence will be randomly divided into the upper contour region or the lower contour region of the pixel sequence, which easily causes a deviation of 1 to 2 pixels in the upper contour region or the lower contour region, and the accuracy of map image segmentation is not high.

[0053] In one embodiment, as Figure 2 shown, a map image segmentation method is provided. In this embodiment, this method is described by taking its application to a cleaning robot as an example. In this embodiment, the method includes the following steps:

[0054] Step 202, perform a positioning step: Determine a pixel boundary line and boundary pixels in the map image according to the pre-segmentation line in the map image of the cleaning robot.

[0055] Among them, the user of the cleaning robot can operate on the display screen of the terminal device, and accordingly, pre-segmentation lines will be generated in the map image of the cleaning robot; the map image of the cleaning robot is an image identifying the passable area of the cleaning robot, and specifically can be a binary image; the foreground part of the map image can be the map area corresponding to the passable area of the cleaning robot, and the background part of the map image can be the map area corresponding to the non-passable area of the cleaning robot or the map area of the unknown area. In the map image, the foreground part can be represented by white pixels, and the background part can be represented by black pixels.

[0056] As an example, the two end points of the above pre-segmentation line can fall on the boundary of the foreground part in the map image. The pre-segmentation line is used to segment the foreground part of the map image, so as to perform room area segmentation in the map image.

[0057] As an example, step 202 includes: determining target pixels intersecting with the pre-segmentation line in the foreground part of the map image; selecting the connection line formed by the target pixel edges of the target pixels as the pixel boundary line; and taking all the pixels in the foreground part of the map image that have an intersection with the pixel boundary line as boundary pixels.

[0058] As Figure 3 shown, Figure 3 each square grid in represents an image pixel in the map image, Figure 3 and the square grids in the dark area part represent the target pixels intersecting with the pre-segmentation line.

[0059] It should be noted that the above pre-segmentation line can be drawn by the user on the display interface of the mobile terminal, or the cleaning robot can autonomously select it in the map image. For example, the cleaning robot can select the pre-segmentation line at the door position area between room areas.

[0060] In one embodiment, the map image segmentation method further includes:

[0061] Determining a first pixel sequence and a second pixel sequence in a preset direction in the map image, where the first pixel sequence and the second pixel sequence are adjacent; obtaining the number of first pixels in the first pixel sequence and the number of second pixels in the second pixel sequence; and if the absolute value of the difference between the number of first pixels and the number of second pixels is greater than a preset threshold, then selecting a pre-segmentation line in the area between the first pixel sequence and the second pixel sequence.

[0062] Among them, if the number of spaced pixels between the first pixel sequence and the second pixel sequence in the preset direction is less than a preset pixel number threshold, it is considered that the first pixel sequence and the second pixel sequence are adjacent in the preset direction.

[0063] Specifically, determine a first pixel sequence and a second pixel sequence in a preset direction in the map image, where the first pixel sequence and the second pixel sequence are adjacent in the preset direction, and the preset direction is the horizontal direction or the vertical direction; detect the number of first pixels in the first pixel sequence and the number of second pixels in the second pixel sequence, and calculate the absolute value of the difference between the number of first pixels and the number of second pixels. If the absolute value of the difference is greater than a preset threshold, determine the area between the first pixel sequence and the second pixel sequence as the target area, and this target area is the door position area between two room areas; select a pre-segmentation line in the target area. For the pixel sequence in the preset direction, the extension direction of the pixel sequence is perpendicular to the preset direction.

[0064] As an example, selecting a pre-segmentation line in the target area includes:

[0065] Select the diagonal of the target area as the pre-segmentation line; or select the boundary line of the target area in the preset direction as the pre-segmentation line.

[0066] Step 204, determine the first contour segmentation area corresponding to the pre-segmentation line in the map image according to the boundary pixels.

[0067] As an example, step 204 includes: using the segmentation boundary area composed of boundary pixels to segment the foreground part in the map image to obtain the first contour segmentation area.

[0068] In one embodiment, the map image includes a foreground part and a background part; determining the first contour segmentation area corresponding to the pre-segmentation line in the map image according to the boundary pixels includes:

[0069] In the map image, replace and update all the boundary pixels in the foreground part with the pixels in the background area to obtain an updated map image; perform a connected region search in the foreground part of the updated map image, and use the found connected region as the first contour segmentation area corresponding to the pre-segmentation line.

[0070] Wherein, in this embodiment, the foreground part of the map image before map segmentation is regarded as a complete connected domain.

[0071] Specifically, replace all the boundary pixels in the foreground part of the map image with the pixels in the background area to obtain an updated map; perform a connected region search in the foreground part of the updated map image, and use the found connected region as the first contour segmentation area corresponding to the pre-segmentation line.

[0072] Step 206, according to the pixel boundary line, divide the segmentation boundary area composed of boundary pixels and the first contour segmentation area into multiple second contour segmentation areas to obtain the map segmentation result.

[0073] As an example, step 206 includes: forming a plurality of second contour segmentation regions in the map image by merging the boundary pixels on both sides of the pixel boundary line in the segmentation boundary region into the corresponding first contour segmentation regions respectively; using the map image in which the plurality of second contour segmentation regions are formed as the map segmentation result.

[0074] In the above map image segmentation method, first, according to the pre-segmentation line in the map image of the cleaning robot, the pixel boundary line and boundary pixels are determined in the map image, and then, according to the boundary pixels, the first contour segmentation region corresponding to the pre-segmentation line is determined in the map image; according to the pixel boundary line, the segmentation boundary region composed of boundary pixels and the first contour segmentation region are cut into a plurality of second contour segmentation regions to obtain the map segmentation result. In this way, on the one hand, it realizes map segmentation with the pixel boundary line composed of pixel boundaries as the real segmentation line instead of using the pixel sequence itself as the real segmentation line, and the granularity of map segmentation can be accurate to each pixel, so the accuracy of map segmentation can be improved; on the other hand, according to the pixel boundary line, the boundary pixels at the segmentation boundary can be reasonably allocated to the corresponding contour regions instead of randomly dividing the pixels at the segmentation boundary into the nearby contour regions, so the accuracy of map segmentation can be further improved.

[0075] In one embodiment, determining the pixel boundary line and boundary pixels in the map image according to the pre-segmentation line in the map image of the cleaning robot includes:

[0076] Locating the target pixels intersecting with the pre-segmentation line in the map image, and locating the target pixel edge corresponding to the pre-segmentation line among the pixel edges of the target pixels; connecting all the target pixel edges along the pixel edges of the image pixels in the map image to obtain the pixel boundary line; searching for the pixels within the neighborhood range of the pixel boundary line to obtain the boundary pixels.

[0077] Wherein, each pixel in the map image can be considered as a square, so there are four pixel edges for each pixel.

[0078] Specifically, according to the line position information of the pre-segmentation line in the map image, the target pixels intersecting with the pre-segmentation line are located in the map image; for each target pixel, according to the distances between the pixel edges of the target pixel and the pre-segmentation line, the target pixel edge is selected among the pixel edges of the target pixel; all the target pixel edges are connected along the pixel edges of the image pixels in the map image to obtain the pixel boundary line; all the pixels within the neighborhood range of the pixel boundary line are used as the boundary pixels.

[0079] As an example, the neighborhood range can be an image area range spaced a preset number of pixels from the pixel boundary line, and the preset number of pixels can be 1 pixel or 2 pixels, etc.

[0080] As shown Figure 4 in Figure 4 the figure, each square grid represents an image pixel, and the side of each square is a pixel side, Figure 4 and the thickened pixel sides in the figure are target pixel sides; further, by connecting all the target pixel sides along the pixel sides of the image pixels, a pixel boundary line can be obtained, as shown Figure 5 in Figure 5 the figure, the line formed by connecting the thickened pixel sides is the pixel boundary line.

[0081] Furthermore, as shown Figure 6 in the figure, image pixels that intersect with the pixel boundary line can be selected as boundary pixels, Figure 6 and the image pixel marked as "A" in the figure is the boundary pixel.

[0082] In one embodiment, locating the target pixel side corresponding to the pre-segmentation line among the pixel sides of the target pixel includes:

[0083] Obtaining the midpoint position information of all the pixel sides of the target pixel, and calculating the position distances from all the pixel sides of the target pixel to the pre-segmentation line according to the midpoint position information; selecting the pixel side with the minimum position distance as the target pixel side of the target pixel.

[0084] Specifically, for each target pixel, determining the midpoint position information of all the pixel sides of the target pixel in the map image; calculating the position distances between the midpoints of all the pixel sides of the target pixel and the pre-segmentation line according to the midpoint position information and the line position information of the pre-segmentation line; selecting the pixel side with the minimum position distance among all the pixel sides of the target pixel as the target pixel side of the target pixel.

[0085] In the above embodiment, first, the target pixels intersecting with the pre-segmentation line are located in the map image, and then, according to the midpoint position information of all the pixel sides of the target pixel, the position distances from the midpoints of all the pixel sides of the target pixel to the pre-segmentation line are calculated, and the pixel side with the minimum position distance is selected as the target pixel side of the target pixel, so that the target pixel sides closest to the pre-segmentation line can be selected to form a pixel boundary line, ensuring that the pixel boundary line is not too far from the pre-segmentation line, guaranteeing the selection accuracy of the pixel boundary line, and thus searching for the pixels within the neighborhood range of the pixel boundary line to obtain boundary pixels, ensuring the search accuracy of the boundary pixels.

[0086] It should be noted that in some special map segmentation cases, such as Figure 7As shown, the intersection line between the white area and the gray area is the pixel boundary line. At this time, if the upper and lower pixels intersecting the pixel boundary are used as boundary pixels, it is obvious that there is only the first contour segmentation area in the area below the pixel boundary line. If all the boundary pixels are merged into the first contour segmentation area, the topmost white pixel obviously does not belong to the first contour segmentation area. If it is forced to be merged into the first contour segmentation area, it will affect the accuracy of map image segmentation.

[0087] In one embodiment, as Figure 8 shown, according to the pixel boundary line, the segmentation boundary area composed of boundary pixels and the first contour segmentation area are cut into multiple second contour segmentation areas to obtain the map segmentation result, including:

[0088] Step 302, according to the pixel boundary line, divide the segmentation boundary area composed of boundary pixels into each unilateral boundary area.

[0089] As an example, step 302 includes: using the pixel boundary line as the area boundary line, and dividing the segmentation boundary area composed of boundary pixels into multiple unilateral boundary areas.

[0090] As an example, the number of multiple unilateral boundary areas can be 2. The area above the pixel boundary line in the segmentation boundary area can be used as one unilateral boundary area, and the area below the pixel boundary line in the segmentation boundary area can be used as another unilateral boundary area.

[0091] As an example, the area to the left of the pixel boundary line in the segmentation boundary area can be used as one unilateral boundary area, and the area to the right of the pixel boundary line in the segmentation boundary area can be used as another unilateral boundary area.

[0092] Step 304, if the number of areas of the first contour segmentation area is two or more, then merge the boundary pixels in each unilateral boundary area into the corresponding first contour segmentation area respectively to obtain multiple second contour segmentation areas.

[0093] As an example, step 304 includes: if the number of areas of the first contour segmentation area is two or more, then for each unilateral boundary area, by replacing the boundary pixels in the unilateral boundary area with the pixels in the first contour segmentation area closest to the unilateral boundary area, merge the boundary pixels in the unilateral boundary area into the closest first contour segmentation area to obtain the second contour segmentation area.

[0094] Step 306, if the number of regions in the first contour segmentation region is single, merge the boundary pixels in the unilateral boundary region close to the first contour segmentation region into the first contour segmentation region to obtain a second contour segmentation region, and determine the unilateral boundary region far from the first contour segmentation region as the new second contour segmentation region.

[0095] As an example, Step 306 includes: if the number of regions in the first contour segmentation region is single, merge the boundary pixels in the unilateral boundary region close to the first contour segmentation region into the first contour segmentation region by replacing the boundary pixels in the unilateral boundary region close to the first contour segmentation region with the pixels in the first contour segmentation region to obtain a second contour segmentation region; and directly use the unilateral boundary region far from the first contour segmentation region as the new second contour segmentation region.

[0096] In the above embodiment, after the map image is segmented by using the segmentation boundary region composed of boundary pixels, the segmentation boundary region composed of boundary pixels is divided into each unilateral boundary region with the pixel boundary line as the regional boundary line; in this way, when the number of regions in the first contour segmentation region is multiple, the boundary pixels in each unilateral boundary region can be directly merged into the nearest first contour segmentation region respectively to obtain multiple second contour segmentation regions; when the number of regions in the first contour segmentation region is single, the boundary pixels in the unilateral boundary region close to the first contour segmentation region can be merged into the first contour segmentation region to form a second contour segmentation region, and the unilateral boundary region far from the first contour segmentation region is directly used as another second contour segmentation region. In this way, according to the segmentation situation of the first contour segmentation region, the segmentation boundary region and the first contour segmentation region are reasonably segmented into multiple second contour segmentation regions, rather than directly merging the segmentation boundary region blindly into the first contour segmentation region, and the attribution division of the segmentation boundary region is more accurate, so the accuracy of map image segmentation can be improved.

[0097] In one embodiment, before determining the pixel boundary line and boundary pixels in the map image according to the pre-segmentation line of the map image, the map image segmentation method further includes:

[0098] Determine the line position information of all pre-segmentation lines in the map image; according to the line position information, select irrelevant pre-segmentation lines to form X segmentation line sets, where X is a positive integer; perform the positioning step for each segmentation line set respectively.

[0099] Among them, since the user can draw multiple segmentation lines on the display screen of the terminal device at one time, there will be multiple segmentation lines in the map image. Currently, the above map image segmentation process of Steps 202 to 206 is performed separately for each segmentation line; two pre-segmentation lines being irrelevant may mean that there is no intersection between the two pre-segmentation lines.

[0100] Specifically, locate the line position information of all pre-segmentation lines in the foreground part of the map image; according to the line position information of all pre-segmentation lines, divide all pre-segmentation lines into X sets of segmentation lines, where X is a positive integer, and there are no intersections among the pre-segmentation lines in each set of segmentation lines in the foreground part of the map image; perform the above positioning step for each set of segmentation lines respectively to generate the map segmentation results of the pre-segmentation lines in all sets of segmentation lines.

[0101] Furthermore, the map segmentation results corresponding to all pre-segmentation lines in the X sets of segmentation lines can be merged into one map image to obtain the final target map segmentation result.

[0102] It should be noted that merging means merging and displaying the map segmentation effects corresponding to all pre-segmentation lines in one map image. As an example, as Figure 9 shown, the map segmentation effect of pre-segmentation line A is to divide the map image into 2 upper and lower regions, as Figure 10 shown, the map segmentation effect of pre-segmentation line B is to divide the map image into 2 left and right regions, as Figure 11 shown, the map segmentation effects of pre-segmentation line A and pre-segmentation line B are merged, and the map image is divided into four regions: upper left, upper right, lower left, and lower right.

[0103] In the above embodiment, when performing map image segmentation, all pre-segmentation lines will be first divided into X sets of segmentation lines, where X is a positive integer, and there are no intersections among the pre-segmentation lines in the set of segmentation lines; then, for each set of segmentation lines, perform the map image segmentation process in steps 202 to 206 above, and finally merge the map segmentation results of all sets of segmentation lines into one map image to obtain the final target map image segmentation result, which realizes map segmentation in batches according to all pre-segmentation lines instead of performing map image segmentation for each pre-segmentation line separately, so the efficiency of map image segmentation can be improved.

[0104] In one embodiment, before determining the line position information of all region segmentation lines in the map image, the map image segmentation method further includes:

[0105] Receiving the segmentation line information transmitted by the terminal device, where the segmentation line information is used to determine the line position information of all region segmentation lines in the map image.

[0106] Among them, the user of the cleaning robot can operate on the display screen of the terminal device to draw a segmentation line, and the terminal device can locate the line coordinates of the segmentation line according to the segmentation line drawn on the display screen and transmit the line coordinates as the segmentation line information to the cleaning robot, where the line coordinates can be the coordinates of the two end points of the segmentation line.

[0107] In one embodiment, after merging the map segmentation results corresponding to the pre-segmentation lines in the X sets of segmentation lines to obtain the target map segmentation result, the map image segmentation method further includes:

[0108] Transmitting the target map segmentation result to a terminal device, where the terminal device is used to display the target map segmentation result.

[0109] Wherein, the target map segmentation result can be a segmented map image, and different second contour segmentation regions in the map image are displayed and distinguished in different colors; after the cleaning robot obtains the target map segmentation result, it can transmit the target map segmentation result to the terminal device, so that the terminal device can directly display the target map segmentation result on the display screen.

[0110] In one embodiment, first, according to the line position information of the pre-segmentation line in the map image, locate the target pixels intersecting the pre-segmentation line in the map image; for each target pixel, determine the midpoint position information of all pixel edges of the target pixel in the map image; according to the midpoint position information and the line position information of the pre-segmentation line, calculate the position distance between the midpoints of all pixel edges of the target pixel and the pre-segmentation line; select the pixel edge with the minimum position distance among all pixel edges of the target pixel as the target pixel edge; connect all the target pixel edges along the pixel edges of the image pixels in the map image to obtain a pixel boundary line; and use all the pixels within the neighborhood range of the pixel boundary line as boundary pixels.

[0111] Further, replace all the boundary pixels in the foreground part of the map image with the pixels of the background area to obtain an updated map image; search for connected regions in the foreground part of the updated map image, and use the found connected regions as the first contour segmentation regions corresponding to the pre-segmentation lines; use the pixel boundary line as the regional boundary line, and divide the segmentation boundary region composed of boundary pixels into each unilateral boundary region; if the number of regions of the first contour segmentation region is two or more, then for each unilateral boundary region, by replacing the boundary pixels in the unilateral boundary region with the pixels in the first contour segmentation region closest to the unilateral boundary region, merge the boundary pixels in the unilateral boundary region into the closest first contour segmentation region to obtain the second contour segmentation region; if the number of regions of the first contour segmentation region is single, then by replacing the boundary pixels in the unilateral boundary region close to the first contour segmentation region with the pixels in the first contour segmentation region, merge the boundary pixels in the unilateral boundary region close to the first contour segmentation region into the first contour segmentation region to obtain the second contour segmentation region; and directly use the unilateral boundary region far from the first contour segmentation region as the new second contour segmentation region; use the map image forming multiple second contour segmentation regions as the map segmentation result.

[0112] In the above embodiments, on the one hand, the pixel boundary lines composed of the boundaries of multiple pixels are used as the real segmentation lines for map segmentation, rather than using the pixel sequence itself as the real segmentation line for map segmentation. The granularity of map segmentation can be accurate to each pixel, so the accuracy of map segmentation can be improved; on the other hand, according to the pixel boundary lines, the boundary pixels at the segmentation boundary can be reasonably allocated to the corresponding contour regions, rather than randomly dividing the pixels at the segmentation boundary into the nearby contour regions. Therefore, the accuracy of map segmentation can be further improved.

[0113] It should be understood that although the steps in the flowcharts involved in the above embodiments are shown in sequence according to the indications of the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless there is a clear indication in this article, the execution of these steps has no strict order limit, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be executed alternately or alternately with at least a part of other steps or steps or stages in other steps.

[0114] Based on the same inventive concept, an embodiment of the present application also provides a map image segmentation device for implementing the map image segmentation method described above. The solution provided by this device to solve the problem is similar to the solution described in the above method. Therefore, the specific limitations in one or more embodiments of the map image segmentation device provided below can refer to the limitations on the map image segmentation method in the above text, and will not be repeated here.

[0115] In one embodiment, as Figure 9 shown, a map image segmentation device is provided, including: a positioning module 402, a determination module 404, and a segmentation module 406, where:

[0116] The positioning module 402 is configured to perform a positioning step: determine a pixel boundary line and boundary pixels in the map image according to a pre-segmentation line in the map image of the cleaning robot.

[0117] The determination module 404 is configured to determine a first contour segmentation region corresponding to the pre-segmentation line in the map image according to the boundary pixels.

[0118] The segmentation module 406 is configured to divide the segmentation boundary region composed of the boundary pixels and the first contour segmentation region into multiple second contour segmentation regions according to the pixel boundary line, and obtain a map segmentation result.

[0119] In one embodiment, the positioning module is further configured to:

[0120] Locate target pixels intersecting the pre-segmentation line in the map image, and locate the target pixel edges corresponding to the pre-segmentation line among the pixel edges of the target pixels; connect all the target pixel edges along the pixel edges of the image pixels in the map image to obtain the pixel boundary line; search for pixels within the neighborhood range of the pixel boundary line to obtain boundary pixels.

[0121] In one embodiment, the positioning module is further configured to:

[0122] Obtain the midpoint position information of all the pixel edges of the target pixel, and calculate the position distances from all the pixel edges of the target pixel to the pre-segmentation line according to the midpoint position information; select the pixel edge with the minimum position distance as the target pixel edge of the target pixel.

[0123] In one embodiment, the segmentation module is further configured to:

[0124] According to the pixel boundary line, divide the segmentation boundary region composed of the boundary pixels into each unilateral boundary region; if the number of regions of the first contour segmentation region is two or more, merge the boundary pixels in each unilateral boundary region into the corresponding first contour segmentation region respectively to obtain a plurality of second contour segmentation regions; if the number of regions of the first contour segmentation region is single, merge the boundary pixels in the unilateral boundary region close to the first contour segmentation region into the first contour segmentation region to obtain a second contour segmentation region, and determine the unilateral boundary region far from the first contour segmentation region as a new second contour segmentation region.

[0125] In one embodiment, the map image segmentation device further includes:

[0126] A pre-segmentation line acquisition module, configured to determine the line position information of all the pre-segmentation lines in the map image; according to the line position information, select irrelevant pre-segmentation lines to form X segmentation line sets, where X is a positive integer; perform the positioning step for each of the segmentation line sets respectively.

[0127] In one embodiment, the map image segmentation device further includes:

[0128] A merging module, configured to merge the map segmentation results corresponding to the pre-segmentation lines in the X segmentation line sets to obtain a target map segmentation result.

[0129] In one embodiment, the map image segmentation device further includes:

[0130] A receiving module, configured to receive the dividing line information transmitted by the terminal device, where the dividing line information is used to determine the line position information of all area dividing lines in the map image.

[0131] In one embodiment, the map image segmentation device further includes:

[0132] A sending module, configured to transmit the target map segmentation result to the terminal device, where the terminal device is configured to display the target map segmentation result.

[0133] In one embodiment, the map image includes a foreground part and a background part; the determining module is further configured to:

[0134] Replace and update all boundary pixels in the foreground part in the map image with pixels of the background area to obtain an updated map image; perform a connected region search in the foreground part of the updated map image, and use the found connected region as the first contour segmentation region corresponding to the pre-segmentation line.

[0135] In one embodiment, the map image segmentation device further includes:

[0136] A pre-segmentation line obtaining module, configured to determine a first pixel sequence and a second pixel sequence in a preset direction in the map image, where the first pixel sequence and the second pixel sequence are adjacent; obtain a first pixel number in the first pixel sequence and a second pixel number in the second pixel sequence; if the absolute value of the difference between the first pixel number and the second pixel number is greater than a preset threshold, select a pre-segmentation line in the area between the first pixel sequence and the second pixel sequence.

[0137] Each module in the above map image segmentation device can be implemented in whole or in part by software, hardware, and their combination. The above modules can be embedded in or independent of the processor in the cleaning robot in the form of hardware, or stored in the memory in the cleaning robot in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0138] In one embodiment, a cleaning robot is provided, and its internal structure diagram can be as Figure 10As shown in the figure. The cleaning robot includes a body, a processor, a memory, a communication interface, an input device, a driving component, a cleaning component, and a detection sensor connected through a system bus. The driving component, the cleaning component, and the detection sensor are all installed on the body. The driving component is used to drive the body to move on the working surface, and the cleaning component is used to clean the working surface. Among them, the processor of the cleaning robot is used to provide computing and control capabilities. The memory of the cleaning robot includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the cleaning robot is used to communicate with an external terminal in a wired or wireless manner. The wireless manner can be implemented through WIFI, a mobile cellular network, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a method for map image segmentation.

[0139] Those skilled in the art can understand that Figure 10 the structure shown in the figure is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the cleaning robot to which the solution of this application is applied. The specific cleaning robot may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.

[0140] In one embodiment, a cleaning robot is further provided, including a memory and a processor. A computer program is stored in the memory. When the processor executes the computer program, the steps in the above method embodiments are implemented.

[0141] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by the processor, the steps in the above method embodiments are implemented.

[0142] In one embodiment, a computer program product is provided, including a computer program. When the computer program is executed by the processor, the steps in the above method embodiments are implemented.

[0143] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memories. Non-volatile memories can include read-only memory (ROM), magnetic tapes, floppy disks, flash memories, optical memories, high-density embedded non-volatile memories, resistive random access memories (ReRAM), magnetoresistive random access memories (MRAM), ferroelectric random access memories (FRAM), phase change memories (PCM), graphene memories, etc. Volatile memories can include random access memory (RAM) or external cache memories, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided in the present application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided in the present application can be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logics, data processing logics based on quantum computing, etc., without limitation.

[0144] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered to be within the scope described in this specification.

[0145] The above-described embodiments merely represent several implementation manners of the present application. The description thereof is relatively specific and detailed, but it should not be construed as a limitation on the patent scope of the present application. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.

Claims

1. A method for map image segmentation, characterized in that, Applied to a cleaning robot, the method includes: Performing a positioning step: determining a pixel boundary line and boundary pixels in the map image according to a pre-segmentation line in the map image of the cleaning robot; Determining a first contour segmentation region corresponding to the pre-segmentation line in the map image according to the boundary pixels; Cutting the segmentation boundary region formed by the boundary pixels and the first contour segmentation region into a plurality of second contour segmentation regions according to the pixel boundary line to obtain a map segmentation result.

2. The method according to claim 1, wherein The determining a pixel boundary line and boundary pixels in the map image according to a pre-segmentation line in the map image of the cleaning robot includes: Locating target pixels intersecting with the pre-segmentation line in the map image, and locating a target pixel edge corresponding to the pre-segmentation line among the pixel edges of the target pixels; Connecting all the target pixel edges along the pixel edges of the image pixels in the map image to obtain the pixel boundary line; Searching for pixels within the neighborhood range of the pixel boundary line to obtain boundary pixels.

3. The method according to claim 2, wherein The locating a target pixel edge corresponding to the pre-segmentation line among the pixel edges of the target pixels includes: Obtaining the midpoint position information of all the pixel edges of the target pixel, and calculating the position distances from all the pixel edges of the target pixel to the pre-segmentation line according to the midpoint position information; Selecting the pixel edge with the minimum position distance as the target pixel edge of the target pixel.

4. The method according to claim 1, characterized in that The cutting the segmentation boundary region formed by the boundary pixels and the first contour segmentation region into a plurality of second contour segmentation regions according to the pixel boundary line to obtain a map segmentation result includes: Dividing the segmentation boundary region formed by the boundary pixels into respective unilateral boundary regions according to the pixel boundary line; If the number of regions of the first contour segmentation region is two or more, merging the boundary pixels in each of the unilateral boundary regions into the corresponding first contour segmentation region to obtain a plurality of second contour segmentation regions; If the number of regions of the first contour segmentation region is single, merging the boundary pixels in the unilateral boundary region close to the first contour segmentation region into the first contour segmentation region to obtain a second contour segmentation region, and determining the unilateral boundary region far from the first contour segmentation region as a new second contour segmentation region.

5. The method according to claim 1, wherein Before the determining a pixel boundary line and boundary pixels in the map image according to a pre-segmentation line of the map image, the method further includes: Determining the line position information of all the pre-segmentation lines in the map image; Selecting irrelevant pre-segmentation lines to form X segmentation line sets according to the line position information, where X is a positive integer; Performing the positioning step for each of the segmentation line sets respectively.

6. The method according to claim 5, wherein The method further includes: Merging the map segmentation results corresponding to the pre-segmentation lines in the X segmentation line sets to obtain a target map segmentation result.

7. The method according to claim 6, characterized in that, Before the determining the line position information of all the region segmentation lines in the map image, the method further includes: Receiving segmentation line information transmitted by a terminal device, where the segmentation line information is used to determine the line position information of all the region segmentation lines in the map image; After merging the map segmentation results corresponding to the pre-segmentation lines in the X sets of the segmentation lines to obtain a target map segmentation result, the method further includes: Transmitting the target map segmentation result to the terminal device, where the terminal device is used to display the target map segmentation result.

8. The method according to claim 1, characterized in that, The map image includes a foreground part and a background part; determining the first contour segmentation region corresponding to the pre-segmentation line in the map image according to the boundary pixels includes: Replacing and updating all boundary pixels in the foreground part of the map image with pixels in the background region to obtain an updated map image; Performing a connected region search in the foreground part of the updated map image, and taking the found connected region as the first contour segmentation region corresponding to the pre-segmentation line.

9. The method according to claim 1, wherein The method further includes: Determining a first pixel sequence and a second pixel sequence in a preset direction in the map image, where the first pixel sequence and the second pixel sequence are adjacent; Obtaining a first pixel quantity in the first pixel sequence and a second pixel quantity in the second pixel sequence; If the absolute value of the difference between the first pixel quantity and the second pixel quantity is greater than a preset threshold, selecting a pre-segmentation line in the region between the first pixel sequence and the second pixel sequence.

10. A cleaning robot, comprising a body, a driving assembly, a cleaning assembly, a detection sensor, a memory, and a processor. The driving assembly, the cleaning assembly, and the detection sensor are all mounted on the body. The driving assembly is used to drive the body to move on a working surface, the cleaning assembly is used to clean the working surface, and the memory stores a computer program. It is characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 9.