Map image beautifying method and cleaning robot

By detecting and adjusting the number of obstacle boundaries and unknown boundaries in the binarized image of the cleaning robot, and identifying and deleting irregular contour areas, the problem of discontinuity of the outer contour affecting the beautification effect is solved, and the aesthetics and cleanliness of the map image are improved.

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

Patent Information

Application Number
CN202311872082.4
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, the map images generated by the cleaning robot are difficult to accurately search for irregular contour areas due to discontinuity of the outer contours, which affects the beautification effect of the map images.

Method used

By obtaining the binarized image of the cleaning robot, detecting the number of obstacle boundaries and unknown boundaries in the idle connected areas, identifying irregular contour areas, and performing corresponding deletion and adjustments in the image, including area screening, obstacle thickness processing, contour completion and other operations to ensure the continuity and aesthetics of the outer contour.

Benefits of technology

It realizes accurate identification and deletion of irregular contour areas, improves the neatness and aesthetics of map images, and ensures that the map images are more beautiful on the terminal.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120235903A_ABST
    Figure CN120235903A_ABST
Patent Text Reader

Abstract

The invention relates to a map image beautifying method and a cleaning robot. The method comprises the steps that a binary image corresponding to a working map of the cleaning robot is acquired, the foreground part of the binary image comprises an idle connected area and an obstacle area, and the background part of the binary image comprises an unknown area; detecting a first boundary number of obstacle boundaries of each idle connected region and a second boundary number of unknown boundaries of each idle connected region in the binary image; according to the number of the first boundaries and the number of the second boundaries of each idle connected region, detecting whether an irregular contour region exists in each idle connected region; and if the irregular contour region exists in each idle connected region, deleting the irregular contour region in the binarized image. By adopting the method, the map image beautifying effect of the robot can be cleaned.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] With the development of image processing technology, map image beautification technology has emerged. Using map image beautification technology, certain adjustments can be made to the originally generated map images of cleaning robots, enabling the map images to be more beautifully displayed on terminals while ensuring the authenticity of the maps.

[0003] In traditional technologies, usually the originally collected map images are first binarized to obtain binary images, and then an image traversal algorithm is used to search for the irregular contour regions formed by the outer contour pixels in the binary images. After the irregular contour regions are searched, corresponding beautification processing can be performed to make the map images more beautiful in appearance.

[0004] However, the image traversal algorithm usually performs a diffusion search in the neighborhood of the outer contour pixels to find the irregular contour regions, which requires a relatively high continuity of the outer contours in the map images. However, for the map images originally collected by cleaning robots, the outer contours in the map images are often discontinuous. Therefore, the sampling image traversal algorithm cannot accurately search for the irregular contour regions, thus affecting the beautification effect of the map images. Summary of the Invention

[0005] Based on this, it is necessary to provide a map image beautification method and a cleaning robot that can improve the beautification effect of the map images of cleaning robots for the above technical problems.

[0006] In a first aspect, this application provides a method for beautifying map images. The method includes:

[0007] Obtain a binary image corresponding to the working map of a cleaning robot, where the foreground part of the binary image includes passable free connected regions and impassable obstacle regions, and the background part of the binary image includes unknown regions;

[0008] Detect the first boundary quantity of the obstacle boundaries of each free connected region and the second boundary quantity of the unknown boundaries of each free connected region in the binary image, where the obstacle boundary is the boundary between the free connected region and the obstacle region, and the unknown boundary is the boundary between the free connected region and the unknown region;

[0009] Detect whether there are irregular contour regions in each free connected region according to the first boundary quantity and the second boundary quantity of each free connected region;

[0010] If there are irregular contour regions in each of the idle connected regions, then delete the irregular contour regions in the binary image.

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

[0012] Find a target idle connected domain in the binary image whose area is smaller than a first preset area; according to the trajectory information of the cleaning robot, detect whether the cleaning robot has reached the target idle connected domain; if the cleaning robot has not reached the target idle connected domain, then delete the target idle connected domain in the binary image.

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

[0014] Detect the area thickness of all obstacle regions in the binary image; if the area thickness of the obstacle region is within a first preset range, then divide the obstacle region into a first intermediate region and a first edge region, wherein the area thickness of the first edge region is smaller than a first preset thickness threshold; replace the first intermediate region with an idle connected region in the binary image, and keep the first edge region unchanged.

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

[0016] If the area thickness of the obstacle region is within a second preset range, then divide the obstacle region into a second intermediate region and a second edge region, wherein the area thickness of the second intermediate region is smaller than a second preset thickness threshold; replace the second edge region with the neighborhood region of the second edge region in the binary image, and keep the second intermediate region unchanged, wherein the upper limit value of the second preset range is less than or equal to the lower limit value of the first preset range.

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

[0018] If there is a target region surrounded by obstacles in the binary image, then detect whether there are both an idle connected region and an unknown region in the target region; if so, determine that the target region is an incomplete mapping region, and detect the first area of the idle connected region and the second area of the unknown region in the incomplete mapping region; if the first area is greater than or equal to the second area, then replace the incomplete mapping region with an idle connected region; if the first area is less than the second area, then replace the incomplete mapping region with an unknown region.

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

[0020] Locate the unknown boundary between the free connected regions and the unknown regions in the binary image, and complete the contour at all the unknown boundaries.

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

[0022] Identify the contour lines of all the free connected regions in the binary image, and adjust the connection of adjacent contour lines; locate the contour adjacent regions corresponding to the adjusted contour lines in the binary image, and fill the contour adjacent regions according to the neighborhood region types of the contour adjacent regions.

[0023] In one embodiment, the detecting whether there is an irregular contour region in each of the free connected regions according to the first boundary number and the second boundary number of each of the free connected regions includes:

[0024] Calculate the boundary number ratio between the first boundary number and the second boundary number of the free connected region; if the boundary number ratio is less than a preset ratio threshold, determine that the free connected region is an irregular contour region; if the boundary number ratio is equal to or greater than the preset ratio threshold, determine that the free connected region is not an irregular contour region.

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

[0026] Determine the local image center position of the foreground part in the binary image and the global image center position of the binary image; if the interval distance between the local image center position and the global image center position is greater than a preset distance threshold, adjust the position of the foreground part in the binary image until the interval distance is less than or equal to the preset distance threshold.

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

[0028] An acquisition module, configured to acquire a binary image corresponding to a working map of a cleaning robot, wherein the foreground part of the binary image includes passable free connected regions and impassable obstacle regions, and the background part of the binary image includes unknown regions;

[0029] A first detection module, configured to detect a first boundary number of an obstacle boundary of each free connected region and a second boundary number of an unknown boundary of each free connected region in the binary image, wherein the obstacle boundary is the boundary between the free connected region and the obstacle region, and the unknown boundary is the boundary between the free connected region and the unknown region;

[0030] A second detection module, configured to detect whether there is an irregular contour region in each of the free connected regions according to the first boundary quantity and the second boundary quantity of each of the free connected regions;

[0031] A deletion module, configured to delete the irregular contour region in the binary image if there is an irregular contour region in each of the free connected regions.

[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 walk on a working surface. The cleaning component is configured to clean the working surface. The memory stores a computer program. When the processor executes the computer program, the following steps are implemented:

[0033] Obtain a binary image corresponding to a working map of the cleaning robot. The foreground part of the binary image includes passable free connected regions and impassable obstacle regions, and the background part of the binary image includes unknown regions; detect the first boundary quantity of the obstacle boundary of each of the free connected regions and the second boundary quantity of the unknown boundary of each of the free connected regions in the binary image, where the obstacle boundary is the boundary between the free connected region and the obstacle region, and the unknown boundary is the boundary between the free connected region and the unknown region; detect whether there is an irregular contour region in each of the free connected regions according to the first boundary quantity and the second boundary quantity of each of the free connected regions; if there is an irregular contour region in each of the free connected regions, delete the irregular contour region in the binary image.

[0034] In a fourth aspect, the present application further 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:

[0035] Obtain a binary image corresponding to the working map of the cleaning robot, where the foreground part of the binary image includes a passable free connected area and an impassable obstacle area, and the background part of the binary image includes an unknown area; Detect the first boundary quantity of the obstacle boundary of each free connected area and the second boundary quantity of the unknown boundary of each free connected area in the binary image, where the obstacle boundary is the boundary between the free connected area and the obstacle area, and the unknown boundary is the boundary between the free connected area and the unknown area; According to the first boundary quantity and the second boundary quantity of each free connected area, detect whether there is an irregular contour area in each free connected area; If there is an irregular contour area in each free connected area, delete the irregular contour area in the binary image.

[0036] The above map image beautification method and cleaning robot first obtain a binary image corresponding to the working map of the cleaning robot. Among them, the foreground part of the binary image includes a passable free connected area and an impassable obstacle area, and the background part of the binary image includes an unknown area; Furthermore, in the binary image, detect the first boundary quantity of the obstacle boundary of each free connected area and the second boundary quantity of the unknown boundary of each free connected area. Among them, the obstacle boundary is the boundary between the free connected area and the obstacle area, and the unknown boundary is the boundary between the free connected area and the unknown area; According to the first boundary quantity and the second boundary quantity of each free connected area, detect whether there is an irregular contour area in each free connected area. In this way, even if the outer contour in the map image is discontinuous, the irregular contour area can be accurately searched in the binary image. Based on this, all the irregular contour areas can be accurately searched and deleted from the binary image. The irregular contour areas will not be missed and not deleted in the beautified map image, making the overall binary image cleaner and more beautiful. Therefore, the beautification effect of the map image can be improved. Description of the Drawings

[0037] Figure 1 Schematic diagram of a map image with an irregular contour area in an embodiment;

[0038] Figure 2 Schematic flowchart of a map image beautification method in an embodiment;

[0039] Figure 3 Schematic diagram of a binary image in an embodiment;

[0040] Figure 4 Schematic diagram of a small free connected area in a binary image where the cleaning robot cannot reach in an embodiment;

[0041] Figure 5 Schematic diagram of a binary image after cleaning small idle connected areas inaccessible to the cleaning robot in one embodiment;

[0042] Figure 6 Schematic diagram of obstacles with a regional thickness within a first preset range and obstacles with a regional thickness within a first preset range in a binary image in one embodiment;

[0043] Figure 7 Schematic diagram of a binary image after processing obstacles with a regional thickness within a first preset range and obstacles with a regional thickness within a first preset range in one embodiment;

[0044] Figure 8 Schematic diagram of an incomplete mapping area in a binary image in one embodiment;

[0045] Figure 9 Structural block diagram of a map image beautification device in one embodiment;

[0046] Figure 10 Internal structure diagram of a cleaning robot in one embodiment. Detailed implementation manners

[0047] 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.

[0048] First of all, it should be noted that a cleaning robot usually detects the surrounding environment by emitting signal rays through a detection sensor (such as a lidar or a structured light sensor), so as to establish a working map. However, when the signal rays of the detection sensor are emitted towards the open area outside the room, an irregular contour area will be displayed on the map image. Among them, the irregular contour area presents an irregular shape in the overall visual effect, such as radial, multi-angular spiky, etc. from the inside of the room to the outside, while regular shapes are usually square, rectangular, circular, etc. This irregular contour area greatly affects the beauty of the map image.

[0049] As an example, as Figure 1 shown, the black contour is the contour of the room. Obviously, there is a radial irregular contour area outside the room contour, which greatly affects the beauty of the map image.

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

[0051] Step 202: Obtain a binary image corresponding to the working map of the cleaning robot. The foreground part of the binary image includes a passable free connected area and an impassable obstacle area, and the background part of the binary image includes an unknown area.

[0052] Among them, the working map generated by the cleaning robot Figure 1 At the beginning, it can be a grayscale image. By binarizing the working image, a binary map can be generated. The foreground part of the binary image is the area that the cleaning robot has explored, that is, the known area. This known area includes a passable free connected area that the cleaning robot deems passable and an obstacle area that the cleaning robot deems impassable. The background part of the binary image is the area that the cleaning robot has not explored, that is, the unknown area, and the cleaning robot does not know whether this unknown area is passable.

[0053] As an example, in this embodiment, the working map of the cleaning robot can be a map image that has undergone map image segmentation (room division). The specific process of map image segmentation is as follows:

[0054] First, obtain the original map image of the cleaning robot; determine the pre-segmentation line in the original map image, and then determine the true segmentation line according to the pre-segmentation line; use the true segmentation line as the segmentation boundary to perform room area segmentation in the map image.

[0055] As an example, the pre-segmentation line can be determined according to the line drawn by the user on the display interface of the terminal device; it can also be obtained by the cleaning robot searching for the position area in the map image where the change range of the passable width of the cleaning robot is greater than the preset range.

[0056] As an example, determining the true segmentation line according to the pre-segmentation line includes: determining the target pixels that intersect with the pre-segmentation line in the foreground part of the map image; selecting the connection line formed by the target pixel sides of the target pixels as the pixel boundary line, and using this pixel boundary line as the true segmentation line.

[0057] As an example, the pre-segmentation line can also be directly used as the true segmentation line.

[0058] As an example, as Figure 3 shown, the free connected area can be represented by the first type of pixel points, presented as a white area in the binary image, the obstacle area can be represented by the second type of pixel points, presented as a black area in the binary image, and the unknown area can be represented by the third type of pixel points, presented as a gray area in the binary image.

[0059] As an example, the working map of the cleaning robot can be a map obtained by adding the marker information of the camera and other sensors on the basis of the slam image.

[0060] Step 204, detect the first boundary quantity of the obstacle boundaries of each free connected region and the second boundary quantity of the unknown boundaries of each free connected region in the binary image, where the obstacle boundary is the boundary between the free connected region and the obstacle region, and the unknown boundary is the boundary between the free connected region and the unknown region.

[0061] Wherein, the obstacle boundary is the boundary formed by the junction of the free connected region and the obstacle region, and this obstacle boundary can also be called the edge contour; the unknown boundary is the boundary formed by the junction of the free connected region and the unknown region; for an irregular contour region that is radially outward from the room, there are usually only fewer edge contours, that is, fewer obstacle boundaries, but there are more junction regions with the unknown region, so there are more unknown boundaries; for the free connected region of a normal room, there are walls around the room, so there are more obstacle boundaries and fewer unknown boundaries in the free connected region of a normal room.

[0062] As an example, step 204 includes: extract the region boundary of each free connected region in the binary image; divide all the region boundaries into obstacle boundaries and unknown boundaries according to the pixel types of the pixel points in the region boundary; count the first boundary quantity of the obstacle boundaries of each free connected region and the second boundary quantity of the position boundaries of each free connected region.

[0063] Step 206, detect whether there is an irregular contour region in each free connected region according to the first boundary quantity and the second boundary quantity of each free connected region.

[0064] As an example, step 206 includes: for each free connected region, if the first boundary quantity of the free connected region is greater than the second boundary quantity, determine that the free connected region is an irregular contour region; if the second boundary quantity of the free connected region is not greater than the second boundary quantity, determine that the free connected region is not an irregular contour region.

[0065] In one embodiment, detecting whether there is an irregular contour region in each free connected region according to the first boundary quantity and the second boundary quantity of each free connected region includes:

[0066] Calculate the boundary quantity ratio between the first boundary quantity and the second boundary quantity of the free connected region; if the boundary quantity ratio is less than the preset ratio threshold, determine that the free connected region is an irregular contour region; if the boundary quantity ratio is equal to or greater than the preset ratio threshold, determine that the free connected region is not an irregular contour region.

[0067] Specifically, for each idle connected region, calculate the ratio between the first boundary quantity and the second boundary quantity of the idle connected region to obtain a boundary quantity ratio. If the boundary quantity ratio is less than a preset ratio threshold, determine that the idle connected region is an irregular contour region. If the boundary quantity ratio is greater than or equal to the preset ratio threshold, determine that the idle connected region is not an irregular contour region. For example, it can be set that if the first boundary quantity is more than twice the second boundary quantity, determine that the idle connected region is an irregular contour region. If the first boundary quantity is twice or less than twice the second boundary quantity, determine that the idle connected region is not an irregular contour region.

[0068] Step 208, if there is an irregular contour region among the idle connected regions, delete the irregular contour region in the binary image.

[0069] As an example, if there is an irregular contour region among the idle connected regions, delete the irregular contour region in the binary image by replacing the pixel points in the irregular contour region with the pixel points in the unknown region. Thus, the binary map is beautified.

[0070] As an example, the edge contour of the irregular contour region can also be considered as part of the irregular contour region. When deleting the irregular contour region, the edge contour of the irregular contour region can also be deleted together.

[0071] In the above map image beautification method, first obtain the binary image corresponding to the working map of the cleaning robot. Among them, the foreground part of the binary image includes passable idle connected regions and impassable obstacle regions, and the background part of the binary image includes unknown regions. Further, detect the first boundary quantity of the obstacle boundary of each idle connected region and the second boundary quantity of the unknown boundary of each idle connected region in the binary image. Among them, the obstacle boundary is the boundary between the idle connected region and the obstacle region, and the unknown boundary is the boundary between the idle connected region and the unknown region. According to the first boundary quantity and the second boundary quantity of each idle connected region, detect whether there is an irregular contour region in each idle connected region. In this way, even if the outer contour in the map image is discontinuous, the irregular contour region can be accurately searched in the binary image. Based on this, all the irregular contour regions can be accurately searched and deleted from the binary image. The irregular contour regions will not be missed and not deleted in the beautified map image, making the overall binary image cleaner and more beautiful. Therefore, the beautification effect of the map image can be improved.

[0072] In one embodiment, the map image beautification method further includes:

[0073] Find a target free connected region in the binary image whose region area is smaller than the first preset region area; according to the trajectory information of the cleaning robot, detect whether the cleaning robot has reached the target free connected region; if the cleaning robot has not reached the target free connected region, delete the target free connected region in the binary image.

[0074] Among them, when the cleaning robot constructs or updates the map using the detection sensor, some small free connected regions may appear on the working map. These free connected regions are surrounded by obstacles, such as surrounded by walls. The cleaning robot usually does not navigate to these small free connected regions. Therefore, although these small free connected regions do not affect the accuracy of the map, they will affect the aesthetics of the map image.

[0075] Specifically, detect the region area of all free connected regions in the binary image. If the region area of the free connected region is smaller than the first preset region area, determine the free connected region as the target free connected region; according to the trajectory information of the cleaning robot, detect whether there is an intersection between the movement trajectory of the cleaning robot and the target free connected region. If there is an intersection, it means that the cleaning robot has reached the target free connected region, so keep the target free connected region; if there is no intersection, it means that the cleaning robot has not reached the target free connected region, so delete the target free connected region and the edge contour of the target free connected region in the binary image.

[0076] As an example, the region area of the free connected region can also be represented by the number of pixel points in the free connected region. The more the number of pixel points, the larger the region area of the free connected region is considered; the fewer the number of pixel points, the smaller the region area of the free connected region is considered.

[0077] As an example, the map image can be a grid map image, and the region area of the free connected region can be represented by the number of map grids in the free connected region. The more the number of map grids, the larger the region area of the free connected region is considered; the fewer the number of map grids, the smaller the region area of the free connected region is considered.

[0078] As an example, as Figure 4 shown, there are obviously some small free connected regions in the binary image, then the cleaning robot cannot reach these small free connected regions. These free connected regions cannot be used for the work of the cleaning robot, but these small free connected regions will affect the aesthetics of the map image. Further, as Figure 5 shown, compared with the binary image in Figure 4 , after deleting some small free connected regions (the regions pointed by the arrows) that the cleaning robot cannot reach in the binary image, the binary image is obviously much neater and more beautiful.

[0079] In this embodiment, target free connected regions with an area smaller than a first preset area are searched for in the binary image; according to the trajectory information of the cleaning robot, it is detected whether the cleaning robot has reached the target free connected region. In this way, small free connected regions in the binary image that the cleaning robot cannot reach can be accurately identified. Thus, if the cleaning robot has not reached the target free connected region, the target free connected region is deleted in the binary image. In this way, some small free connected regions can be deleted in the binary map without affecting the accuracy of the map, which helps to improve the beauty and neatness of the map image.

[0080] In one embodiment, the map image beautification method further includes:

[0081] Detect the region thickness of all obstacle regions in the binary image; if the region thickness of the obstacle region is within a first preset range, the obstacle region is divided into a first intermediate region and a first edge region, where the region thickness of the first edge region is less than a first preset thickness threshold; in the binary image, the first intermediate region is replaced with a free connected region, and the first edge region remains unchanged.

[0082] Among them, for some obstacle regions in the free connected region, if the obstacle region is too thick, it will cause a large black pixel region to exist in the free connected region of the binary image, affecting the beauty of the map image.

[0083] Specifically, the region thickness of all obstacle regions is detected in the binary image. The region thickness of the obstacle region can be the region thickness of the obstacle region, and this region thickness can be the shortest distance between the central position of the obstacle region and the free connected region, or the shortest distance between the unknown region; if the region thickness of the obstacle region is within a first preset range, it means that the obstacle region is too thick, and this obstacle region is used to represent a large obstacle in the free connected region. Therefore, the obstacle region is divided into a first intermediate region and a first edge region, where the region thickness of the first edge region is less than a first preset thickness threshold; in the binary image, the first intermediate region is replaced with a free connected region, and the first edge region remains unchanged.

[0084] As an example, the first intermediate region can be replaced with a free connected region by replacing the pixel points in the first intermediate region with the pixel points of the free connected region in the binary image.

[0085] As an example, the map of the cleaning robot can be a grid map, and the first intermediate region can be replaced with a free connected region by replacing the map grids in the first intermediate region with the map grids of the free connected region in the binary image.

[0086] In the above embodiments, the middle area of the obstacle area with an overly thick area thickness in the idle connected area is hollowed out, and after hollowing out, the pixel points of the idle connected area are filled, leaving only the obstacle edges with a lower area thickness to represent large obstacles. In this way, there will be no large black pixel areas displayed in the binary image, which helps to improve the aesthetics of the map image.

[0087] In one embodiment, the method for beautifying the map image further includes:

[0088] If the area thickness of the obstacle area is within a second preset range, the obstacle area is divided into a second middle area and a second edge area, where the area thickness of the second middle area is less than a second preset thickness threshold; in the binary image, the second edge area is replaced with the neighborhood area of the second edge area, and the second middle area remains unchanged, where the upper limit value of the second preset range is less than or equal to the lower limit value of the first preset range.

[0089] Specifically, if the area thickness of the obstacle area is within a second preset range, where the lower limit value of the first preset range is greater than the upper limit value of the second preset range, it indicates that the obstacle area is used to represent small obstacles or walls in the idle connected area; therefore, the obstacle area is divided into a second middle area and a second edge area, where the area thickness of the second middle area is less than a second preset thickness threshold; in the binary image, the second edge area is replaced with the neighborhood area of the second edge area, and the second middle area remains unchanged.

[0090] As an example, replacing the second edge area with the neighborhood area of the second edge area in the binary image includes:

[0091] If the neighborhood area of the second edge area is an idle connected area, the pixel points in the second edge area are replaced with the pixel points in the idle connected area in the binary image; if the neighborhood area of the second edge area is an unknown area, the pixel points in the second edge area are replaced with the pixel points in the unknown area in the binary image.

[0092] As an example, the working map of the cleaning robot is a grid map; replacing the second edge area with the neighborhood area of the second edge area in the binary image includes:

[0093] If the neighborhood area of the second edge area is an idle connected area, the map grids in the second edge area are replaced with the map grids in the idle connected area in the binary image; if the neighborhood area of the second edge area is an unknown area, the map grids in the second edge area are replaced with the map grids in the unknown area in the binary image.

[0094] As an example, the upper limit value of the second preset range is less than or equal to the lower limit value of the first preset range.

[0095] In the above embodiment, by trimming the edge regions of the small obstacles and the walls, the thickness of the small obstacles and the walls is reduced, and only the middle region of the edge regions of the small obstacles and the walls is retained to represent the small obstacles and the walls in the binary image. In this way, the small obstacles and the walls displayed in the binary image will not be too thick, reducing the display ratio of the black pixels in the free connected regions in the binary image. The binary image as a whole looks cleaner, which helps to improve the beauty of the binary image.

[0096] As an example, as Figure 6 shown, there are obstacle regions A1 and A2 in the binary image. The regional thickness of the obstacle region A1 is within the first preset range, and the regional thickness of the obstacle region A2 is within the second preset range. Further, as Figure 7 shown, for the obstacle region A1, obviously the middle region is replaced with a free connected region, and the edge region is retained. For the obstacle region A2, obviously the edge region is replaced with a free connected region, and the middle region is retained.

[0097] In one embodiment, the method for beautifying the map image further includes:

[0098] If there is a target region surrounded by obstacles in the binary image, it is detected whether there are both a free connected region and an unknown region in the target region; if so, the target region is determined as an incompletely mapped region, and the first region area of the free connected region and the second region area of the unknown region in the incompletely mapped region are detected; if the first region area is greater than or equal to the second region area, the incompletely mapped region is replaced with a free connected region; if the first region area is less than the second region area, the incompletely mapped region is replaced with an unknown region.

[0099] Among them, for special obstacles such as tables or beds, the signal rays emitted by the detection sensor usually cannot hit all the areas above the special obstacles, and only the surroundings of the special obstacles can be detected as obstacles. This will display a special obstacle region in the binary image. This special obstacle region is the region surrounded by obstacles, and there will be both a free connected region and an unknown region in this special obstacle region, which will cause the mixing of pixels of different colors in the special obstacle region, affecting the beauty of the map image. For example, as Figure 8 shown, there is a special obstacle region (the region pointed by the arrow) in the binary image, and there will be both a free connected region and an unknown region in the special obstacle region, which results in the mixing of the unknown region in the blank connected region and affects the beauty of the map image.

[0100] Specifically, if there is a target area surrounded by obstacles in the binary image, it is detected whether there are both a free connected area and an unknown area in the target area; if there are both a free connected area and an unknown area in the target area, the target area is determined as an incomplete mapping area, and the first area of the free connected area and the second area of the unknown area in the incomplete mapping area are detected; if the first area is greater than or equal to the second area, the incomplete mapping area is replaced with the free connected area; if the first area is less than the second area, the incomplete mapping area is replaced with the unknown area.

[0101] As an example, the first area can be determined according to the number of pixel points or the number of grids in the free connected area in the incomplete mapping area; the first area can be determined according to the number of pixel points or the number of grids in the unknown area in the incomplete mapping area.

[0102] As an example, detecting whether there are both a free connected area and an unknown area in the target area includes:

[0103] Detect the pixel types of all pixel points in the target area, and according to the pixel types of all pixel points, detect whether there are both a free connected area and an unknown area in the target area. For example, if the pixel types of all pixel points are white pixels and gray pixels, it is determined that there are both a free connected area and an unknown area in the target area.

[0104] As an example, detecting whether there are both a free connected area and an unknown area in the target area includes:

[0105] Detect the grid types of all map grids in the target area, and according to the grid types of all map grids, detect whether there are both a free connected area and an unknown area in the target area. For example, if the grid types of all map grids are white grids and gray grids, it is determined that there are both a free connected area and an unknown area in the target area.

[0106] In the above embodiment, by detecting whether there are both a free area and an unknown area in the target area surrounded by obstacles, the incomplete mapping area in the binary image can be accurately identified, and then the incomplete mapping area can be replaced with a free connected area or an unknown area, which can eliminate the adverse display effect on the map aesthetics caused by the incomplete mapping area, so the aesthetics of the map image can be improved.

[0107] In one embodiment, the map image beautification method further includes:

[0108] Locate the unknown boundary between the free connected area and the unknown area in the binary image, and complete the contour at all unknown boundaries.

[0109] Among them, there may be some missing contours in the free connected regions in the binary image, which affects the aesthetics of the map image. There are two reasons for this kind of contour missing. On the one hand, there will be some contour missing in the binary image itself after the mapping is completed. On the other hand, since the target free connected domain and the irregular contour region are deleted in the binary image, there is a certain contour missing in the remaining free connected regions.

[0110] Specifically, locate all the unknown boundaries between the free connected regions and the unknown regions in the binary image; perform contour completion on all the unknown boundaries. This can ensure that the contours of all the free connected regions in the binary image are complete, so the aesthetics of the map image can be improved.

[0111] After performing contour completion at all the unknown boundaries, the method further includes:

[0112] Identify the contour lines of all the free connected regions in the binary image, and perform connection adjustment on the adjacent contour lines; locate the contour adjacent regions corresponding to the contour lines after connection adjustment in the binary image, and fill the contour adjacent regions according to the neighborhood region types of the contour adjacent regions.

[0113] Specifically, for each free connected region, identify the contour line of the free connected region in the binary image, and straighten the contour line of the free connected region by performing connection adjustment on the adjacent contour lines; locate the contour adjacent region corresponding to the contour line after connection adjustment in the binary image, where the contour adjacent region can be the region within a preset region centered on the contour line, for example, the region within 2 pixels from the contour line, or the region within 2 map grids from the contour line; fill the contour adjacent region according to the neighborhood region types of the contour adjacent regions.

[0114] As an example, the contour adjacent region includes the first side region of the contour line and the second side region of the contour line; filling the contour adjacent region according to the neighborhood region types of the contour adjacent region includes:

[0115] Determine the neighborhood region type of the neighborhood of the first side region. If the neighborhood region type of the neighborhood of the first side region is a blank connected region, then the first side region is filled as a blank connected region; if the neighborhood region type of the neighborhood of the first side region is an unknown region, then the first side region is filled as an unknown region; determine the neighborhood region type of the neighborhood of the first side region. If the neighborhood region type of the neighborhood of the second side region is a blank connected region, then the second side region is filled as a blank connected region; if the neighborhood region type of the neighborhood of the second side region is an unknown region, then the second side region is filled as an unknown region.

[0116] As an example, the neighborhood region type of the neighborhood of the first side region can be determined according to the map grid type or pixel type of the neighborhood of the first side region; and the neighborhood region type of the neighborhood of the second side region can be determined according to the map grid type or pixel type of the neighborhood of the second side region.

[0117] In the above embodiment, by identifying the contour lines of all free connected regions in the binary image and adjusting the connection of adjacent contour lines; locating the contour adjacent regions corresponding to the adjusted contour lines in the binary image, and filling the contour adjacent regions according to the neighborhood region type of the contour adjacent regions. In this way, the originally uneven contour lines in the binary image can be straightened, and by filling the contour adjacent regions, it is possible to prevent pixels or grids in the blank connected regions and unknown regions from crossing the contour lines, ensuring that the edge contours of all free connected regions in the binary image are flat and tidy enough, so the beauty of the map image can be improved.

[0118] In one embodiment, the map image beautification method further includes:

[0119] Determining the local image center position of the foreground part in the binary image and the global image center position of the binary image; if the distance between the local image center position and the global image center position is greater than a preset distance threshold, then adjusting the position of the foreground part in the binary image until the distance is less than or equal to the preset distance threshold.

[0120] Specifically, locate the center position of the foreground part in the binary image to obtain the first position coordinate of the local image center position; locate the center position of the entire image in the binary image to obtain the second position coordinate of the global image center position; calculate the distance between the local image center position and the global image center position according to the first position coordinate of the local image center position and the second position coordinate of the global image center position; if the distance is greater than the preset distance threshold, it means that the foreground part of the binary image is not centered in the binary image, so adjust the position of the foreground part in the binary image according to the first position coordinate and the second position coordinate until the distance is less than or equal to the preset distance threshold.

[0121] In the above embodiment, after performing a series of processes in the above embodiment on the binary image, by adjusting the position of the foreground part in the entire binary image, the foreground part can be adjusted to the centered position in the binary image, so the beauty of the map image can be further improved.

[0122] In one embodiment, first, a binary image corresponding to the working map of the cleaning robot is obtained. The foreground part of the binary image includes passable free connected areas and impassable obstacle areas, and the background part of the binary image includes unknown areas. The regional boundaries of each free connected area are extracted from the binary image. According to the pixel types of the pixel points in the regional boundaries, all the regional boundaries are divided into obstacle boundaries and unknown boundaries. The first boundary quantity of the obstacle boundaries of each free connected area and the second boundary quantity of the position boundaries of each free connected area are counted. For each free connected area, if the first boundary quantity of the free connected area is greater than the second boundary quantity, it is determined that the free connected area is an irregular contour area. If the second boundary quantity of the free connected area is not greater than the second boundary quantity, it is determined that the free connected area is not an irregular contour area. If there are irregular contour areas among the free connected areas, the irregular contour areas are deleted in the binary image by replacing the pixel points in the irregular contour areas with the pixel points in the unknown areas. In this way, all the irregular contour areas can be accurately searched and deleted from the binary image, and there will be no omission of the irregular contour areas not deleted in the beautified map image, making the whole binary image cleaner and more beautiful. Therefore, the beautification effect of the map image can be improved.

[0123] Further, after deleting the irregular connected domains in the binary image, the regional areas of all the free connected areas in the binary image are detected. If the regional area of a free connected area is less than the first preset regional area, it is determined that the free connected area is a target free connected domain. According to the trajectory information of the cleaning robot, it is detected whether there is an intersection between the movement trajectory of the cleaning robot and the target free connected domain. If there is an intersection, it means that the cleaning robot has reached the target free connected domain, so the target free connected domain is retained. If there is no intersection, it means that the cleaning robot has not reached the target free connected domain, so the target free connected domain and the edge contour of the target free connected domain are deleted in the binary image. In this way, some small free connected areas can be deleted in the binary map without affecting the accuracy of the map, which helps to improve the beauty and neatness of the map image.

[0124] Further, after some small unvisited free connected regions in the binary image, locate the unknown boundaries between the free connected regions and the unknown regions in the binary image, and complete the contours at all unknown boundaries; for each free connected region, identify the contour line of the free connected region in the binary image, and straighten the contour line of the free connected region by adjusting the connection of adjacent contour lines; locate the contour adjacent region corresponding to the adjusted contour line in the binary image, where the contour adjacent region can be the region within a preset region centered on the contour line, for example, the region within 2 pixels from the contour line, or the region within 2 map grids from the contour line; fill the contour adjacent region according to the neighborhood region type of the contour adjacent region. This can straighten the originally uneven contour line in the binary image, and by filling the contour adjacent region, it can prevent the pixels or grids in the blank connected region and the unknown region from crossing the contour line, ensuring that the edge contours of all free connected regions in the binary image are smooth and tidy enough, thus improving the aesthetic degree of the map image.

[0125] After straightening the contour line and filling the contour adjacent region in the binary image, detect the region thickness of all obstacle regions in the binary image, where the region thickness of the obstacle region can be the region thickness of the obstacle region, and this region thickness can be the shortest distance between the central position of the obstacle region and the free connected region, or the shortest distance between the unknown region; if the region thickness of the obstacle region is within the first preset range, it means that the obstacle region is too thick, and this obstacle region is used to represent a large obstacle in the free connected region, so the obstacle region is divided into a first intermediate region and a first edge region, where the region thickness of the first edge region is less than the first preset thickness threshold; replace the first intermediate region with the free connected region in the binary image and keep the first edge region unchanged. This realizes the hollowing out of the intermediate region of the obstacle region with too thick region thickness in the free connected region, and filling the pixel points of the free connected region after hollowing out, leaving only the obstacle edge with a lower region thickness to represent the large obstacle, so that there will be no large black pixel regions shown in the binary image, which helps to improve the aesthetic degree of the map image.

[0126] Further, if the regional thickness of the obstacle area is within the second preset range, where the lower limit of the first preset range is greater than the upper limit of the second preset range, it indicates that the obstacle area is used to represent small obstacles or walls in the free connected area; therefore, the obstacle area is divided into a second intermediate area and a second edge area, where the regional thickness of the second intermediate area is less than the second preset thickness threshold; in the binary image, the second edge area is replaced with the neighborhood area of the second edge area, and the pixel points of the second intermediate area remain unchanged, where the upper limit of the second preset range is less than or equal to the lower limit of the first preset range. In this way, by trimming the edge areas of small obstacles and walls, the thickness of small obstacles and walls is reduced, and only the intermediate area of the edge areas of small obstacles and walls is retained to represent small obstacles and walls in the binary image. In this way, the small obstacles and walls displayed in the binary image will not be too thick, reducing the display ratio of black pixels in the free connected area of the binary image, and making the binary image look tidier overall, which helps to improve the aesthetics of the binary image.

[0127] Further, if there is a target area surrounded by obstacles in the binary image, it is detected whether there are both free connected areas and unknown areas in the target area; if there are both free connected areas and unknown areas in the target area, the target area is determined as an incompletely mapped area, and the first area of the free connected area and the second area of the unknown area in the incompletely mapped area are detected; if the first area is greater than or equal to the second area, the incompletely mapped area is replaced with the free connected area; if the first area is less than the second area, the incompletely mapped area is replaced with the unknown area. This can eliminate the adverse display effect on the map aesthetics caused by the incompletely mapped area, and thus improve the aesthetics of the map image.

[0128] After the above processing of the complemented boundary and obstacles in the binary image, some irregular contour areas and some small free connected areas that the cleaning robot has not reached may be regenerated in the binary image. Therefore, the process of clearing irregular contour areas and some small free connected areas that the cleaning robot has not reached in the binary image can be executed again. This can further ensure the aesthetics of the map image.

[0129] Finally, locate the center position of the foreground part in the binary image to obtain the first position coordinate of the center position of the local image; locate the center position of the entire image in the binary image to obtain the second position coordinate of the center position of the global image; calculate the distance between the center position of the local image and the center position of the global image according to the first position coordinate of the center position of the local image and the second position coordinate of the center position of the global image; if the distance is greater than the preset distance threshold, it means that the foreground part of the binary image is centered in the binary image, so adjust the position of the foreground part in the binary image according to the first position coordinate and the second position coordinate until the distance is less than or equal to the preset distance threshold. This can adjust the foreground part of the binary image to be centered, which helps to improve the beautification degree of the map image.

[0130] It should be noted that the beautified binary image in this application can be directly displayed on the control terminal of the cleaning robot, or can be converted into a grayscale image or an RGB image and then displayed on the control terminal, where the control terminal can be a mobile terminal, and the image can be specifically displayed on an application installed on the mobile terminal.

[0131] It should be understood that although the steps in the flowcharts involved in the above-described embodiments are displayed in sequence according to the arrows, these steps do not necessarily need to be 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-described embodiments may include multiple steps or multiple stages. These steps or stages do not necessarily need to be executed at the same time, but can be executed at different times. The execution order of these steps or stages does not necessarily need to be sequential, but can be executed alternately or alternately with at least a part of other steps or steps or stages in other steps.

[0132] Based on the same inventive concept, the embodiments of this application also provide a map image beautification device for implementing the map image beautification 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 beautification device provided below can refer to the limitations on the map image beautification method in the above text, and will not be repeated here.

[0133] In one embodiment, as Figure 9 shown, a map image beautification device is provided, including an acquisition module 302, a first detection module 304, a second detection module 306, and a deletion module 308, where:

[0134] An acquisition module, configured to acquire a binary image corresponding to a working map of a cleaning robot, where a foreground part of the binary image includes a passable free connected area and an impassable obstacle area, and a background part of the binary image includes an unknown area;

[0135] A first detection module, configured to detect a first boundary quantity of an obstacle boundary of each of the free connected areas and a second boundary quantity of an unknown boundary of each of the free connected areas in the binary image, where the obstacle boundary is a boundary between the free connected area and the obstacle area, and the unknown boundary is a boundary between the free connected area and the unknown area;

[0136] A second detection module, configured to detect whether there is an irregular contour area in each of the free connected areas according to the first boundary quantity and the second boundary quantity of each of the free connected areas;

[0137] A deletion module, configured to delete the irregular contour area in the binary image if there is an irregular contour area in each of the free connected areas.

[0138] In one embodiment, the map image beautification device further includes:

[0139] A connected domain cleaning module, configured to find a target free connected domain with an area smaller than a first preset area in the binary image; detect whether the cleaning robot has reached the target free connected domain according to the trajectory information of the cleaning robot; and delete the target free connected domain in the binary image if the cleaning robot has not reached the target free connected domain.

[0140] In one embodiment, the map image beautification device further includes:

[0141] An obstacle area processing module, configured to detect a regional thickness of all obstacle areas in the binary image; if the regional thickness of the obstacle area is within a first preset range, divide the obstacle area into a first intermediate area and a first edge area, where the regional thickness of the first edge area is less than a first preset thickness threshold; and replace the first intermediate area with a free connected area in the binary image and keep the first edge area unchanged.

[0142] In one embodiment, the obstacle area processing module is further configured to:

[0143] If the regional thickness of the obstacle area is within a second preset range, the obstacle area is divided into a second intermediate area and a second edge area, where the regional thickness of the second intermediate area is less than a second preset thickness threshold; in the binary image, the second edge area is replaced with the neighborhood area of the second edge area, and the second intermediate area remains unchanged, where the upper limit value of the second preset range is less than or equal to the lower limit value of the first preset range.

[0144] In one embodiment, the obstacle area processing module is further configured to:

[0145] If there is a target area surrounded by obstacles in the binary image, it is detected whether there are both free connected areas and unknown areas in the target area; if so, the target area is determined to be an incomplete mapping area, and the first area of the free connected area and the second area of the unknown area in the incomplete mapping area are detected; if the first area is greater than or equal to the second area, the incomplete mapping area is replaced with the free connected area; if the first area is less than the second area, the incomplete mapping area is replaced with the unknown area.

[0146] In one embodiment, the map image beautification device further includes:

[0147] A contour completion module, configured to locate an unknown boundary between the free connected area and the unknown area in the binary image, and perform contour completion at all the unknown boundaries.

[0148] In one embodiment, the contour completion module is further configured to:

[0149] Identify the contour lines of all free connected areas in the binary image, and perform connection adjustment on adjacent contour lines; locate the contour adjacent areas corresponding to the contour lines after connection adjustment in the binary image, and fill the contour adjacent areas according to the neighborhood area types of the contour adjacent areas.

[0150] In one embodiment, the second detection module is further configured to:

[0151] Calculate the boundary number ratio between the first boundary number and the second boundary number of the free connected area; if the boundary number ratio is less than a preset ratio threshold, determine that the free connected area is an irregular contour area; if the boundary number ratio is equal to or greater than the preset ratio threshold, determine that the free connected area is not an irregular contour area.

[0152] In one embodiment, the map image beautification device further includes:

[0153] A centering adjustment module is used to determine the local image center position of the foreground part in the binary image and the global image center position of the binary image; if the interval distance between the local image center position and the global image center position is greater than a preset distance threshold, the position of the foreground part in the binary image is adjusted until the interval distance is less than or equal to the preset distance threshold.

[0154] Each module in the above map image beautification device can be implemented in whole or in part by software, hardware, and their combination. Each of 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 each of the above modules.

[0155] In one embodiment, a cleaning robot is provided, and its internal structure diagram can be as Figure 10 shown. The cleaning robot includes a fuselage, a processor, a memory, a communication interface, an input device, a driving component, a cleaning component, and a detection sensor connected by a system bus. The driving component, the cleaning component, and the detection sensor are all installed on the fuselage. The driving component is used to drive the fuselage to walk 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, and 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 map image beautification method.

[0156] Those skilled in the art can understand that Figure 10 the structure shown in

[0157] 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 a working surface, and the cleaning component is used to clean the working surface. A computer program is stored in the memory, and when the processor executes the computer program, the steps in the above method embodiments are implemented.

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

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

[0160] 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 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 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 logic devices, data processing logics based on quantum computing, etc., without limitation.

[0161] 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 as the scope described in this specification.

[0162] The above-described embodiments only represent several implementation manners of the present application. The description 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 beautifying map images, characterized in that, The method includes: Obtaining a binary image corresponding to the working map of the cleaning robot, where the foreground part of the binary image includes a passable free connected area and an impassable obstacle area, and the background part of the binary image includes an unknown area; Detecting, in the binary image, a first boundary number of the obstacle boundary of each of the free connected areas and a second boundary number of the unknown boundary of each of the free connected areas, where the obstacle boundary is the boundary between the free connected area and the obstacle area, and the unknown boundary is the boundary between the free connected area and the unknown area; Detecting, according to the first boundary number and the second boundary number of each of the free connected areas, whether there is an irregular contour area in each of the free connected areas; If there is an irregular contour area in each of the free connected areas, deleting the irregular contour area in the binary image.

2. The method according to claim 1, characterized in that, The method further includes: Searching, in the binary image, for a target free connected area with an area smaller than a first preset area; Detecting, according to the trajectory information of the cleaning robot, whether the cleaning robot has reached the target free connected area; If the cleaning robot has not reached the target free connected area, deleting the target free connected area in the binary image.

3. The method according to claim 1, wherein The method further includes: Detecting the area thickness of all the obstacle areas in the binary image; If the area thickness of the obstacle area is within a first preset range, dividing the obstacle area into a first intermediate area and a first edge area, where the area thickness of the first edge area is less than a first preset thickness threshold; Replacing the first intermediate area with a free connected area in the binary image and keeping the first edge area unchanged.

4. The method according to claim 3, characterized in that, The method further includes: If the area thickness of the obstacle area is within a second preset range, dividing the obstacle area into a second intermediate area and a second edge area, where the area thickness of the second intermediate area is less than a second preset thickness threshold; Replacing the second edge area with the neighborhood area of the second edge area in the binary image and keeping the second intermediate area unchanged; Wherein, the upper limit value of the second preset range is less than or equal to the lower limit value of the first preset range.

5. The method according to claim 1, wherein The method further includes: If there is a target area surrounded by obstacles in the binary image, detecting whether there are both a free connected area and an unknown area in the target area; If so, determining that the target area is an incompletely mapped area, and detecting a first area of the free connected area and a second area of the unknown area in the incompletely mapped area; If the first area is greater than or equal to the second area, replacing the incompletely mapped area with a free connected area; If the first area is less than the second area, replacing the incompletely mapped area with an unknown area.

6. The method according to claim 1, wherein The method further includes: Locating the unknown boundary between the free connected area and the unknown area in the binary image and performing contour completion at all the unknown boundaries.

7. The method according to claim 6, characterized in that, After contour completion at all the unknown boundaries, the method further includes: Identifying the contour lines of all the free connected regions in the binary image and adjusting the connection of adjacent contour lines; Locating the contour adjacent regions corresponding to the contour lines after connection adjustment in the binary image and filling the contour adjacent regions according to the neighborhood region types of the contour adjacent regions.

8. The method according to claim 1, wherein The detecting whether there are irregular contour regions in each of the free connected regions according to the first boundary number and the second boundary number of each of the free connected regions includes: Calculating the boundary number ratio between the first boundary number and the second boundary number of the free connected region; If the boundary number ratio is less than a preset ratio threshold, determining that the free connected region is an irregular contour region; If the boundary number ratio is equal to or greater than the preset ratio threshold, determining that the free connected region is not an irregular contour region.

9. The method according to any one of claims 1 to 8, characterized in that, The method further includes: Determining the local image center position of the foreground part in the binary image and the global image center position of the binary image; If the interval distance between the local image center position and the global image center position is greater than a preset distance threshold, adjusting the position of the foreground part in the binary image until the interval distance is less than or equal to the preset distance threshold.

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 installed 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. The memory stores a computer program, 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.