Map image segmentation method and cleaning robot

By positioning and filtering suitable boundaries in the map image and selecting the second candidate boundary for segmentation, the problem of inaccurate segmentation in traditional methods is solved, and higher segmentation accuracy and cleaning efficiency are achieved.

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

Patent Information

Application Number
CN202311867672.8
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

Traditional map image segmentation methods are difficult to accurately divide the room area into regular room areas with horizontal and vertical levels, resulting in low segmentation accuracy.

Method used

By acquiring the map image of the passable area of ​​the cleaning robot, a first candidate boundary with a change of the passable width in the preset direction greater than the preset amplitude, a second candidate boundary is selected according to the boundary width and the interval distance, and the map image is then divided into the room area.

Benefits of technology

It improves the accuracy of map image segmentation, can more accurately segment the regular room areas of horizontal and vertical lines, and improves the path planning and cleaning efficiency of the cleaning robot.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120235891A_ABST
    Figure CN120235891A_ABST
Patent Text Reader

Abstract

The invention relates to a map image segmentation method and a cleaning robot. The method comprises the following steps: acquiring a map image of a passable area of the cleaning robot; all first candidate boundaries are positioned in the map image, and the change amplitude of the passable width of the first candidate boundaries in the preset direction is larger than the preset amplitude; according to the boundary width of each first candidate boundary and the spacing distance between the first candidate boundaries, selecting a second candidate boundary from the first candidate boundaries; and according to the second candidate boundary, performing room region segmentation on the map image to obtain a plurality of target room regions. By adopting the method, the accuracy of map image segmentation can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] With the development of image processing technologies, map image segmentation technologies have emerged. Using map image segmentation technologies, the passable areas of a cleaning robot in a map image can be segmented into multiple room areas.

[0003] In traditional technologies, the pre-segmentation lines in a map image are usually directly used as the true segmentation lines, and the passable areas in the map image are segmented into multiple room areas.

[0004] However, this method of directly dividing rooms in a map image according to pre-segmentation lines usually has difficulty in segmenting room areas into regular room areas with horizontal and vertical lines, and the accuracy of map image segmentation is not high. 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, this application provides a method for map image segmentation. The method includes:

[0007] Obtain a map image of the passable area of the cleaning robot;

[0008] Locate each first candidate boundary in the map image, where the change range of the passable width of the first candidate boundary in a preset direction is greater than a preset range;

[0009] Select a second candidate boundary from each of the first candidate boundaries according to the boundary width of each first candidate boundary and the interval distance between each of the first candidate boundaries;

[0010] Perform room area segmentation on the map image according to the second candidate boundary to obtain multiple target room areas.

[0011] In one embodiment, the step of selecting a second candidate boundary from each of the first candidate boundaries according to the boundary width of each first candidate boundary and the interval distance between each of the first candidate boundaries includes:

[0012] Perform the first detection step: Detect the interval distance in the preset direction between adjacent first candidate boundaries in the map image; for each group of the adjacent first candidate boundaries, if the interval distance is less than the preset distance threshold, then retain the first candidate boundary with the lowest boundary width among the adjacent first candidate boundaries in the map image, if the interval distance is greater than or equal to the preset distance threshold, then retain the adjacent first candidate boundaries in the map image; return to perform the first detection step until the interval distance between any adjacent first candidate boundaries retained in the map image is greater than the preset distance threshold; determine the second candidate boundary according to the first candidate boundaries retained in the map image.

[0013] In one embodiment, the determining the second candidate boundary according to the first candidate boundaries retained in the map image includes:

[0014] Perform the second detection step: Detect whether there are intersections between the first candidate boundaries; if there are no intersections between the first candidate boundaries, then determine each of the first candidate boundaries as the second candidate boundary; if there are intersections between the first candidate boundaries, then retain the first candidate boundary with the lowest boundary width among the intersecting first candidate boundaries; return to perform the second detection step until there are no intersections between all the retained first candidate boundaries, and determine the retained first candidate boundaries as the second candidate boundary.

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

[0016] According to the second candidate boundary, segment a plurality of initial room regions in the map image, and detect the area of each of the initial room regions in the map image; merge the initial room regions with an area less than the first preset area threshold with adjacent initial room regions in the map image.

[0017] In one embodiment, after segmenting a plurality of initial room regions in the map image according to the second candidate boundary, the method further includes:

[0018] Detect the ratio of the boundary length of the unknown boundary of each of the initial room regions in the map image, where the unknown boundary is the boundary between the initial room region and the unknown region; merge the initial room regions with a boundary length ratio less than the preset ratio threshold with adjacent initial room regions.

[0019] In one embodiment, after segmenting a plurality of initial room regions in the map image according to the second candidate boundary, the method further includes:

[0020] Obtain the area cleaning type of each of the initial room areas; merge each of the initial room areas in the map image according to each of the area cleaning types.

[0021] In one embodiment, the merging of each of the initial room areas in the map image according to the area cleaning type includes:

[0022] If the area cleaning types of adjacent initial room areas are the same, determine the cumulative total area of the adjacent initial room areas; if the cumulative total area is less than a second preset area threshold, merge the adjacent initial room areas in the map image.

[0023] In one embodiment, the positioning of each first candidate boundary in the map image includes:

[0024] 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 the number of first pixels in the first pixel sequence and the number of second pixels in the second pixel sequence; 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, determine the area between the first pixel sequence and the second pixel sequence as a first candidate boundary.

[0025] In one embodiment, the positioning of each first candidate boundary in the map image includes:

[0026] Determine a first grid sequence and a second grid sequence in a preset direction in the map image, where the first grid sequence and the second grid sequence are adjacent; obtain the number of first grids in the first grid sequence and the number of second grids in the second grid sequence; if the absolute value of the difference between the number of first grids and the number of second grids is greater than a preset threshold, determine the area between the first grid sequence and the second grid sequence as a first candidate boundary.

[0027] In a second aspect, the present application also provides a map image segmentation device. The device includes:

[0028] An acquisition module, configured to acquire a map image of an area where a cleaning robot can pass;

[0029] A positioning module, configured to position each first candidate boundary in the map image, where the change range of the passable width of the first candidate boundary in a preset direction is greater than a preset range;

[0030] A selection module, configured to select a second candidate boundary from each of the first candidate boundaries according to the boundary width of each of the first candidate boundaries and the interval distance between each of the first candidate boundaries.

[0031] A segmentation module, configured to segment the map image into multiple target room areas according to the second candidate boundary.

[0032] In a third aspect, the present application further 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 configured to drive the body to move on a working surface. The cleaning component is configured to clean the working surface. The memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0033] Obtain a map image of the passable area of the cleaning robot; locate each first candidate boundary in the map image, where the variation range of the passable width of the first candidate boundary in a preset direction is greater than a preset range; select a second candidate boundary from each of the first candidate boundaries according to the boundary width of each first candidate boundary and the interval distance between each of the first candidate boundaries; segment the map image into multiple target room areas according to the second candidate boundary.

[0034] In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0035] Obtain a map image of the passable area of the cleaning robot; locate each first candidate boundary in the map image, where the variation range of the passable width of the first candidate boundary in a preset direction is greater than a preset range; select a second candidate boundary from each of the first candidate boundaries according to the boundary width of each first candidate boundary and the interval distance between each of the first candidate boundaries; segment the map image into multiple target room areas according to the second candidate boundary.

[0036] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0037] Obtain a map image of the passable area of the cleaning robot; locate each first candidate boundary in the map image, where the variation range of the passable width of the first candidate boundary in a preset direction is greater than a preset range; select a second candidate boundary from each of the first candidate boundaries according to the boundary width of each first candidate boundary and the interval distance between each of the first candidate boundaries; segment the map image into multiple target room areas according to the second candidate boundary.

[0038] The above map image segmentation method and cleaning robot first obtain a map image of the passable area of the cleaning robot, then locate each first candidate boundary in the map image whose variation range of the passable width in a preset direction is greater than a preset range, and then can screen the second candidate boundary from each first candidate boundary according to the boundary width of each first candidate boundary and the interval distance between each first candidate boundary, which can ensure that the selected second candidate boundary is more suitable as the dividing line between room areas. Thus, segmenting the map image according to the second candidate boundary can accurately segment regular room areas with horizontal and vertical lines in the map image, so the accuracy of map image segmentation can be improved. Description of the Drawings

[0039] Figure 1 It is a schematic flowchart of the map image segmentation method in an embodiment;

[0040] Figure 2 It is a schematic flowchart of selecting a second candidate boundary from each first candidate boundary in an embodiment;

[0041] Figure 3 It is a structural block diagram of the map image segmentation device in an embodiment;

[0042] Figure 4 It is an internal structure diagram of the cleaning robot in an embodiment. Detailed Description of the Embodiment

[0043] In order to make the purpose, technical solution and advantages of the present application clearer, the present application will be further described in detail below with reference to the 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.

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

[0045] Step 202, obtain a map image of the passable area of the cleaning robot.

[0046] Among them, the map image can be a binary image, specifically a binary SLAM image. In the binary image, there are a foreground part and a background part. The foreground part represents the passable area of the cleaning robot, and the background part represents the non-passable area of the cleaning robot. This non-passable area can be an unknown area.

[0047] As an example, the foreground part of the map image can be represented by white pixels, and the white pixel area composed of white pixels is the passable area of the cleaning robot. The background part of the map image can be represented by black pixels, and the black pixel area composed of black pixels is the non-passable area of the cleaning robot.

[0048] Step 204: Locate each first candidate boundary in the map image, where the change amplitude of the passable width of the first candidate boundary in the preset direction is greater than the preset amplitude.

[0049] Among them, the first candidate boundary is the area corresponding to the room door between suspected connected room areas in the map image. If the cleaning robot moves from inside the room area towards the room door, when the cleaning robot reaches the room door, the passable width of the cleaning robot will decrease to a great extent, that is, it changes from the width of the entire room to the width of the room door. At this time, it is considered that the change amplitude of the passable width is greater than the preset amplitude; the preset direction can be the horizontal direction or the vertical direction.

[0050] As an example, step 204 includes: detecting the passable width of the cleaning robot in the map image along the preset direction, and taking the area where the change amplitude of the passable width is greater than the preset amplitude as the first candidate boundary; detecting the passable width of the cleaning robot in the map image along the vertical direction, and taking the area where the change amplitude of the passable width is greater than the preset amplitude as the first candidate boundary.

[0051] In one embodiment, locating each first candidate boundary in the map image includes:

[0052] Determine a first pixel sequence and a second pixel sequence in the preset direction in the map image, where the first pixel sequence and the second pixel sequence are adjacent; obtain the number of first pixels in the first pixel sequence and the number of second pixels in the second pixel sequence; if the absolute value of the difference between the number of first pixels and the number of second pixels is greater than the preset threshold, then determine the area between the first pixel sequence and the second pixel sequence as the first candidate boundary.

[0053] 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 the preset pixel number threshold, it is considered that the first pixel sequence and the second pixel sequence are adjacent in the preset direction.

[0054] 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, then the area between the first pixel sequence and the second pixel sequence is the first candidate boundary. Wherein, for the pixel sequence in the preset direction, the extension direction of the pixel sequence is perpendicular to the preset direction.

[0055] In one embodiment, locating each first candidate boundary in the map image includes:

[0056] Determine a first grid sequence and a second grid sequence in a preset direction in the map image, where the first grid sequence and the second grid sequence are adjacent; obtain the number of first grids in the first grid sequence and the number of second grids in the second grid sequence; if the absolute value of the difference between the number of first grids and the number of second grids is greater than a preset threshold, then determine the area between the first grid sequence and the second grid sequence as the first candidate boundary.

[0057] Wherein, the map image can be a grid map. If the number of spaced grids between the first grid sequence and the second grid sequence in the preset direction is less than a preset grid number threshold, then the first grid sequence and the second grid sequence are considered adjacent in the preset direction.

[0058] Specifically, determine a first grid sequence and a second grid sequence in a preset direction in the map image, where the first grid sequence and the second grid sequence are adjacent in the preset direction, and the preset direction is the horizontal direction or the vertical direction; detect the number of first grids in the first grid sequence and the number of second grids in the second grid sequence, and calculate the absolute value of the difference between the number of first grids and the number of second grids. If the absolute value of the difference is greater than a preset threshold, then the area between the first grid sequence and the second grid sequence is the first candidate boundary. Wherein, for the grid sequence in the preset direction, the extension direction of the grid sequence is perpendicular to the preset direction.

[0059] Step 206, select a second candidate boundary from each first candidate boundary according to the boundary width of each first candidate boundary and the interval distance between each first candidate boundary.

[0060] As an example, step 206 includes: determining each adjacent candidate boundary group among the first candidate boundaries according to the interval distance between the first candidate boundaries, where the interval distance between the first candidate boundaries belonging to the same adjacent candidate boundary group is less than or equal to a preset distance threshold, and the interval distance between the first candidate boundaries belonging to different adjacent candidate boundary groups is greater than the preset distance threshold; selecting the first candidate boundary with the lowest boundary width as the second candidate boundary from each adjacent candidate boundary group according to the boundary width of each first candidate boundary.

[0061] Step 208, segment the map image into multiple target room regions according to the second candidate boundary.

[0062] As an example, step 208 includes: using the second candidate boundary as a dividing line to segment the map image into multiple target room regions.

[0063] In the above map image segmentation method, first obtain the map image of the passable area of the cleaning robot, then locate the first candidate boundaries in the map image where the change range of the passable width in the preset direction is greater than the preset range. Furthermore, the second candidate boundary can be screened from the first candidate boundaries according to the boundary width of each first candidate boundary and the interval distance between the first candidate boundaries. This can ensure that the selected second candidate boundary is more suitable as the dividing line between room regions. Thus, segmenting the map image according to the second candidate boundary can accurately segment regular room regions with horizontal and vertical lines in the map image. Therefore, the accuracy of map image segmentation can be improved.

[0064] It should be noted that currently, the pre-segmentation line in the map image needs to be manually drawn by the user. Compared with the prior art method of manually drawing the pre-segmentation line and then directly segmenting the map image according to the pre-segmentation line, the map image segmentation method in this embodiment can not only improve the accuracy of map image segmentation, but also realize automatic map image segmentation without manual intervention by the user. Therefore, the efficiency of map image segmentation can also be improved.

[0065] In one embodiment, as Figure 2 shown, selecting the second candidate boundary from the first candidate boundaries according to the boundary width of each first candidate boundary and the interval distance between the first candidate boundaries includes:

[0066] Step 302, perform a first detection step: detect the interval distance in the preset direction between adjacent first candidate boundaries in the map image.

[0067] As an example, the interval distance can be the number of pixels; Step 302 includes: performing a first detection step: determining adjacent first candidate boundaries in the map image; detecting the number of pixels between adjacent first candidate boundaries in a preset direction.

[0068] As an example, the map image is a raster map, and the interval distance can be the number of grids; Step 302 includes: performing a first detection step: determining adjacent first candidate boundaries in the map image, and detecting the number of grids between adjacent first candidate boundaries in a preset direction.

[0069] Step 304, for each group of adjacent first candidate boundaries, if the interval distance is less than the preset distance threshold, then retain the first candidate boundary with the lowest boundary width among the adjacent first candidate boundaries in the map image; if the interval distance is greater than or equal to the preset distance threshold, then retain the adjacent first candidate boundaries in the map image.

[0070] As an example, Step 304 includes: for each group of adjacent candidate boundaries, if the interval distance is less than the preset distance threshold, by comparing the boundary widths of the adjacent first candidate boundaries, retain the first candidate boundary with the lowest boundary width among the adjacent first candidate boundaries in the map image, and delete the first candidate boundaries with boundary widths that are not the lowest among the adjacent first candidate boundaries; if the interval distance is greater than or equal to the preset distance threshold, then retain all the first candidate boundaries among the adjacent first candidate boundaries in the map image.

[0071] As an example, the boundary width is the width of the first candidate boundary in the extension direction.

[0072] Step 306, return to perform the first detection step until the interval distance between any adjacent first candidate boundaries retained in the map image is greater than the preset distance threshold.

[0073] Step 308, determine the second candidate boundary according to the first candidate boundaries retained in the map image.

[0074] Among them, in this embodiment, the first detection step can be repeatedly executed until the interval distance between any adjacent first candidate boundaries retained in the map image is greater than the preset distance threshold. At this time, the first candidate boundaries retained in the map image can be used as the finally determined second candidate boundaries.

[0075] As an example, if there are no other first candidate boundaries in the area between two first candidate boundaries in the map image, then these two first candidate boundaries are considered a group of adjacent first candidate boundaries.

[0076] In this embodiment, first, a first detection step is performed: detecting the interval distance between adjacent first candidate boundaries in a preset direction in the map image. Further, since there is usually only one room door in an adjacent same area, and the passable width of the room door is usually lower than the width of other passable positions in the room, for each group of adjacent first candidate boundaries, when the interval distance is less than a preset distance threshold, the first candidate boundary with the lowest boundary width is retained among the adjacent first candidate boundaries; when the interval distance is greater than or equal to the preset distance threshold, the adjacent first candidate boundaries are retained in the map image; the first detection step is executed repeatedly until the interval distance between any adjacent first candidate boundaries retained in the map image is greater than the preset distance threshold. In this way, it can be ensured that the first candidate boundaries retained in the map image are very likely to be the room doors between room areas. Then, the first candidate boundaries retained in the map image are used as the second candidate boundaries, which can ensure the accuracy of screening room doors in the map image.

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

[0078] Step A0, performing a second detection step: detecting whether there are intersections between the first candidate boundaries; if there are no intersections between the first candidate boundaries, determining the first candidate boundaries as the second candidate boundaries; if there are intersections between the first candidate boundaries, retaining the first candidate boundary with the lowest boundary width among the intersecting first candidate boundaries; repeatedly executing the second detection step until there are no intersections between all the retained first candidate boundaries.

[0079] Among them, since the preset direction includes a first direction and a second direction, the first direction can be the horizontal direction and the second direction can be the vertical direction. Therefore, there is a possibility that there are intersections between the first candidate boundaries, but there cannot be a room door in the first direction and a second room door in the same area at the same time.

[0080] Specifically, the second detection step is performed: according to the position information of the first candidate boundaries, detecting whether there are intersections between the first candidate boundaries; if there are no intersections between the first candidate boundaries, directly determining the first candidate boundaries as the second candidate boundaries; if there are intersections between the second candidate boundaries, by comparing the boundary widths of the intersecting first candidate boundaries, retaining the first candidate boundary with the lowest boundary width among the intersecting first candidate boundaries in the map image, and deleting the first candidate boundaries with non - lowest boundary widths among the intersecting first candidate boundaries; repeatedly executing the second detection step until there are no intersections between all the retained first candidate boundaries in the map image.

[0081] As an example, after step A0, at this time, for the first candidate boundaries retained in the map image, the above steps 302 to 308 are executed.

[0082] As an example, the distance between any adjacent first candidate boundaries retained in the map image is greater than the preset distance threshold. At this time, for the first candidate boundaries retained in the map image, the above step A0 is executed, and then the first candidate boundaries retained after executing step A0 can be used as the second candidate boundaries.

[0083] As can be seen from the above, in this embodiment, step A0 can be executed before step 302 or after step 306, and this is not limited herein.

[0084] In the above embodiment, after determining each first candidate boundary in the map image, it is detected whether there are intersections between the first candidate boundaries. If there are no intersections between the first candidate boundaries, each first candidate boundary is determined as the second candidate boundary; if there are intersections between the first candidate boundaries, the first candidate boundary with the lowest boundary width is retained among the intersecting first candidate boundaries; the second detection step is executed again until there are no intersections between all the retained first candidate boundaries, and the retained first candidate boundaries are determined as the second candidate boundaries. In this way, on the basis of determining each first candidate boundary in the map image, by further detecting whether there are intersections between the first candidate boundaries, the second candidate boundaries can be further screened from the first candidate boundaries, so that the screened second candidate boundaries are more suitable as the room doors between the room areas, and the screening of the room doors in the map image is more accurate.

[0085] In one embodiment, according to the second candidate boundaries, the map image is segmented into room areas, including:

[0086] According to the second candidate boundaries, multiple initial room areas are segmented in the map image, and the area of each initial room area is detected in the map image; the initial room areas with an area smaller than the first preset area threshold in the map image are merged with adjacent initial room areas.

[0087] Among them, since the cleaning robot will set cleaning strategies specifically according to each segmented room area, if the area of the segmented room area is too small, it is usually not suitable to be used as a single room area.

[0088] Specifically, taking the second candidate boundaries as the dividing lines, multiple initial room areas are segmented in the map image, and the area of all initial room areas is detected in the map image; if the area of an initial room area is smaller than the first preset area threshold, the adjacent initial room area with the longest intersecting boundary with the initial room area is determined, and the initial room area with an area smaller than the first preset area threshold is merged with the adjacent initial room area.

[0089] In the above embodiments, first, a plurality of initial room areas are segmented in the map image according to the second candidate boundary, and the area of all the initial room areas is detected. If the area of an initial room area is less than the first preset area threshold, the initial room area is merged with an adjacent initial room area. This can avoid the appearance of small, scattered segmented room areas in the map image, making the finally segmented room areas in the map image more reasonable and tidy. Moreover, since the segmented room areas are conducive to reasonably setting cleaning strategies for each room, the result of the map image segmentation better meets the business requirements.

[0090] In one embodiment, after segmenting a plurality of initial room areas in the map image according to the second candidate boundary, the method further includes:

[0091] Detecting, in the map image, the ratio of the boundary length of the unknown boundary of each initial room area, where the unknown boundary is the boundary between the initial room area and the unknown area; and merging the initial room area with an adjacent initial room area if the ratio of the boundary length is less than a preset ratio threshold.

[0092] Wherein, the unknown boundary is the boundary between the initial room area and the unknown area.

[0093] Specifically, detecting the total boundary length and the unknown boundary length of all the initial room areas in the map image, where the unknown boundary is the boundary between the initial room area and the unknown area, calculating the ratio between the unknown boundary length and the total boundary length to obtain the ratio of the boundary length; if the ratio of the boundary length of an initial room area is less than the preset ratio threshold, it indicates that the initial room area basically has no exterior wall and is within other initial rooms, so the initial room area is merged with an adjacent initial room area. This can prevent the situation where a large room area contains a small room area in the map image, making the finally segmented room areas in the map image more conducive to reasonably setting cleaning strategies for each room, and thus better meeting the actual business requirements of the cleaning robot.

[0094] In one embodiment, after segmenting a plurality of initial room areas in the map image according to the second candidate boundary, the method further includes:

[0095] Obtaining the area cleaning type of each initial room area; and merging each initial room area in the map image according to each area cleaning type.

[0096] Among them, after multiple initial room areas are segmented in the map image, corresponding cleaning strategies are usually set for each initial room area. Different cleaning strategies make the initial room areas have different area cleaning types, which are used to identify the cleaning mode and cleaning frequency of the initial room areas, etc. If the area cleaning types of the initial room areas are different, the cleaning mode or cleaning frequency of the initial room areas is different.

[0097] Specifically, determine the area cleaning types of all initial room areas; if the area cleaning types of adjacent initial room areas are the same, then merge the adjacent initial room areas in the map image. This can reasonably merge adjacent room areas with the same area cleaning type, reduce the number of room areas segmented in the map image, make the finally segmented room areas in the map image more integral, and more in line with the actual business needs of the cleaning robot.

[0098] In one embodiment, merging each initial room area in the map image according to the area cleaning type includes:

[0099] If the area cleaning types of adjacent initial room areas are the same, then determine the cumulative total area of the adjacent initial room areas; if the cumulative total area is less than the second preset area threshold, then merge the adjacent initial room areas in the map image.

[0100] Among them, since the battery capacity of the cleaning robot is limited, the finally segmented room areas in the map image should not be too large; the second preset area threshold is greater than the first preset area threshold.

[0101] Specifically, if the area cleaning types of adjacent initial room areas are the same, then detect the cumulative total area of the adjacent initial room areas; if the cumulative total area is less than the second preset area threshold, then merge the adjacent initial room areas in the map image. In this way, on the basis of merging adjacent initial room areas with the same area cleaning type, it is further considered whether the merged room area will be too large and unfavorable for the cleaning robot to work, making the finally segmented room areas in the map image more in line with the actual business needs of the cleaning robot.

[0102] In one embodiment, first obtain the map image of the passable area of the cleaning robot; detect the passable width of the cleaning robot along the preset direction in the map image, and take the area where the change range of the passable width is greater than the preset range as the first candidate boundary; detect the passable width of the cleaning robot along the vertical direction in the map image, and take the area where the change range of the passable width is greater than the preset range as the first candidate boundary.

[0103] After determining each first candidate boundary, perform a first detection step: detect the interval distance between adjacent first candidate boundaries in a preset direction in the map image; for each group of the adjacent first candidate boundaries, if the interval distance is less than a preset distance threshold, by comparing the boundary widths of the adjacent first candidate boundaries, retain in the map image the first candidate boundary with the lowest boundary width among the adjacent first candidate boundaries, and delete the first candidate boundaries among the adjacent first candidate boundaries whose boundary widths are not the lowest; if the interval distance is greater than or equal to the preset distance threshold, retain all the first candidate boundaries among the adjacent first candidate boundaries in the map image; return to perform the first detection step until the interval distance between any adjacent first candidate boundaries retained in the map image is greater than the preset distance threshold.

[0104] After obtaining each first candidate boundary retained in the map image, perform a second detection step: according to the position information of each first candidate boundary, detect whether there are intersections between the first candidate boundaries; if there are no intersections between the first candidate boundaries, directly determine each first candidate boundary as a second candidate boundary; if there are intersections between the second candidate boundaries, by comparing the boundary widths of the intersecting first candidate boundaries, retain in the map image the first candidate boundary with the lowest boundary width among the intersecting first candidate boundaries, and delete the first candidate boundaries among the intersecting first candidate boundaries whose boundary widths are not the lowest; return to perform the second detection step until there are no intersections between all the first candidate boundaries retained in the map image, and use all the first candidate boundaries retained in the map image as second candidate boundaries.

[0105] Further, using the second candidate boundary as a dividing line, divide the map image into multiple initial room areas, and detect the area of all the initial room areas in the map image; if the area of an initial room area is less than a first preset area threshold, determine the adjacent initial room area with the longest intersecting boundary with the initial room area, and merge the initial room area with an area less than the first preset area threshold with the adjacent initial room area; detect the total boundary length and the unknown boundary length of all the initial room areas in the map image, where the unknown boundary is the boundary between the initial room area and the unknown area, calculate the ratio between the unknown boundary length and the total boundary length to obtain the boundary length ratio; if the boundary length ratio of the initial room area is less than a preset ratio threshold, it indicates that there is basically no outer wall in the initial room area and the initial room area is within other initial rooms, so merge the initial room area with the adjacent initial room area.

[0106] In the above embodiments, regular room areas with horizontal and vertical lines can be accurately segmented in the map image, so the accuracy of map image segmentation can be improved.

[0107] It should be understood that although the steps in the flowcharts involved in the above-described 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, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-described embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily executed at the same moment, but can be executed at different moments. The execution order of these steps or stages is not necessarily sequential, but can be executed alternately or in turn with at least a part of the steps or stages in other steps or other steps.

[0108] Based on the same inventive concept, an embodiment of the present application further provides a map image segmentation device for implementing the above-mentioned map image segmentation method. 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.

[0109] In one embodiment, as Figure 3 shown, a map image segmentation device is provided, including: an acquisition module 402, a positioning module 404, a selection module 406, and a segmentation module 408, where:

[0110] The acquisition module is used to acquire a map image of the passable area of the cleaning robot.

[0111] The positioning module is used to locate each first candidate boundary in the map image, where the change range of the passable width of the first candidate boundary in the preset direction is greater than the preset range.

[0112] The selection module is used to select a second candidate boundary from each of the first candidate boundaries according to the boundary width of each of the first candidate boundaries and the interval distance between each of the first candidate boundaries.

[0113] The segmentation module is used to segment the map image into multiple target room areas according to the second candidate boundary.

[0114] In one of the embodiments, the selection module is further used for:

[0115] Perform the first detection step: Detect the interval distance in the preset direction between adjacent first candidate boundaries in the map image; for each group of the adjacent first candidate boundaries, if the interval distance is less than the preset distance threshold, retain the first candidate boundary with the lowest boundary width among the adjacent first candidate boundaries in the map image, if the interval distance is greater than or equal to the preset distance threshold, retain the adjacent first candidate boundaries in the map image; return to perform the first detection step until the interval distance between any adjacent first candidate boundaries retained in the map image is greater than the preset distance threshold; determine the second candidate boundary according to the first candidate boundaries retained in the map image.

[0116] In one embodiment, the selection module is further configured to:

[0117] Perform the second detection step: Detect whether there are intersections between the first candidate boundaries; if there are no intersections between the first candidate boundaries, determine the first candidate boundaries as the second candidate boundaries; if there are intersections between the first candidate boundaries, retain the first candidate boundary with the lowest boundary width among the intersecting first candidate boundaries; return to perform the second detection step until there are no intersections between all the retained first candidate boundaries, and determine the retained first candidate boundaries as the second candidate boundaries.

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

[0119] According to the second candidate boundary, segment a plurality of initial room regions in the map image, and detect the area of each initial room region in the map image; merge the initial room regions with an area less than the first preset area threshold with adjacent initial room regions in the map image.

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

[0121] Detect the proportion of the boundary length of the unknown boundary of each initial room region in the map image, where the unknown boundary is the boundary between the initial room region and the unknown region; merge the initial room regions with a boundary length proportion less than the preset proportion threshold with adjacent initial room regions.

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

[0123] Obtain the area cleaning type of each initial room region; merge each initial room region in the map image according to the area cleaning types.

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

[0125] If the area cleaning types of adjacent initial room areas are the same, determine the cumulative total area of the adjacent initial room areas; if the cumulative total area is less than a second preset area threshold, merge the adjacent initial room areas in the map image.

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

[0127] 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, determine the area between the first pixel sequence and the second pixel sequence as a first candidate boundary.

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

[0129] Determine a first grid sequence and a second grid sequence in a preset direction in the map image, where the first grid sequence and the second grid sequence are adjacent; obtain a first grid number in the first grid sequence and a second grid number in the second grid sequence; if the absolute value of the difference between the first grid number and the second grid number is greater than a preset threshold, determine the area between the first grid sequence and the second grid sequence as a first candidate boundary.

[0130] 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 the processor of the cleaning robot in hardware form or independent of it, or stored in the memory of the cleaning robot in software form, so that the processor can call and execute the operations corresponding to the above modules.

[0131] In one embodiment, a cleaning robot is provided. The cleaning robot can be a terminal, and its internal structure diagram can be as Figure 4As 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 realizes a method for map image segmentation.

[0132] Those skilled in the art can understand that Figure 4 the structure shown in the figure is only a block diagram of some structures related to the solution of the present application, and does not constitute a limitation on the cleaning robot to which the solution of the present 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.

[0133] In one embodiment, a cleaning robot is further provided, which 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 the working surface, and the cleaning component is used to clean the working surface. A computer program is stored in the memory. When the processor executes the computer program, it realizes the steps in the above method embodiments.

[0134] 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, it realizes the steps in the above method embodiments.

[0135] 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, it realizes the steps in the above method embodiments.

[0136] Those of ordinary skill in the art can understand that all or part of the processes in the above-described embodiment methods 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 various methods. Among them, any reference to a memory, database, or other medium used in the various embodiments provided in the present application can include at least one of non-volatile and volatile memories. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, 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 various 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 various embodiments provided in the present application can be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, data processing logics based on quantum computing, etc., without limitation.

[0137] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the various 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 as the scope described in this specification.

[0138] The above-described embodiments only represent several implementation manners of the present application. Their descriptions are relatively specific and detailed, but they should not be construed as limiting 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, The method includes: Obtaining a map image of the passable area of the cleaning robot; Locating each first candidate boundary in the map image, where the variation range of the passable width of the first candidate boundary in a preset direction is greater than a preset range; Selecting a second candidate boundary from each of the first candidate boundaries according to the boundary width of each first candidate boundary and the interval distance between each of the first candidate boundaries; Performing room area segmentation on the map image according to the second candidate boundary to obtain a plurality of target room areas.

2. The method according to claim 1, characterized in that The step of selecting a second candidate boundary from each of the first candidate boundaries according to the boundary width of each first candidate boundary and the interval distance between each of the first candidate boundaries includes: Performing a first detection step: Detecting the interval distance in the preset direction between adjacent first candidate boundaries in the map image; For each group of the adjacent first candidate boundaries, if the interval distance is less than a preset distance threshold, then retaining the first candidate boundary with the lowest boundary width among the adjacent first candidate boundaries in the map image, and if the interval distance is greater than or equal to the preset distance threshold, then retaining the adjacent first candidate boundaries in the map image; Returning to perform the first detection step until the interval distance between any adjacent first candidate boundaries retained in the map image is greater than the preset distance threshold; Determining the second candidate boundary according to the first candidate boundaries retained in the map image.

3. The method according to claim 2, wherein The method further includes: Performing a second detection step: Detecting whether there are intersections between each of the first candidate boundaries; If there are no intersections between each of the first candidate boundaries, then determining each of the first candidate boundaries as the second candidate boundary; If there are intersections between each of the first candidate boundaries, then retaining the first candidate boundary with the lowest boundary width among the intersecting first candidate boundaries; Returning to perform the second detection step until there are no intersections between all the retained first candidate boundaries.

4. The method according to claim 1, characterized in that, The step of performing room area segmentation on the map image according to the second candidate boundary includes: Segmenting a plurality of initial room areas in the map image according to the second candidate boundary, and detecting the area of each of the initial room areas in the map image; Merging the initial room areas with an area smaller than a first preset area threshold with adjacent initial room areas in the map image.

5. The method according to claim 4, characterized in that, After segmenting a plurality of initial room areas in the map image according to the second candidate boundary, the method further includes: Detecting the proportion of the boundary length of the unknown boundary of each of the initial room areas in the map image, where the unknown boundary is the boundary between the initial room area and the unknown area; Merging the initial room areas with a boundary length proportion less than a preset proportion threshold with adjacent initial room areas.

6. The method according to claim 4, wherein After segmenting a plurality of initial room areas in the map image according to the second candidate boundary, the method further includes: Obtaining the area cleaning type of each of the initial room areas; Merging each of the initial room areas in the map image according to each of the area cleaning types.

7. The method according to claim 1, characterized in that Merging each of the initial room areas in the map image according to the area cleaning type includes: If the area cleaning types of adjacent initial room areas are the same, determining the cumulative total area of the adjacent initial room areas; If the cumulative total area is less than a second preset area threshold, merging the adjacent initial room areas in the map image.

8. The method according to claim 1, wherein Locating each first candidate boundary in the map image 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 the number of first pixels in the first pixel sequence and the number of second pixels in the second pixel sequence; 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, determining the area between the first pixel sequence and the second pixel sequence as a first candidate boundary.

9. The method according to claim 1, wherein Locating each first candidate boundary in the map image includes: Determining a first grid sequence and a second grid sequence in a preset direction in the map image, where the first grid sequence and the second grid sequence are adjacent; Obtaining the number of first grids in the first grid sequence and the number of second grids in the second grid sequence; If the absolute value of the difference between the number of first grids and the number of second grids is greater than a preset threshold, determining the area between the first grid sequence and the second grid sequence as a first candidate boundary.

10. A cleaning robot, comprising 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, and the memory stores a computer program, characterized in that, When the processor executes the computer program, the steps of the method according to any one of claims 1 to 9 are implemented.