Map area segmentation method and related devices
By pre-processing and binarizing the sweeping robot map, combined with the expansion method of the contour area, the problems of large computing volume and high hardware cost in the prior art are solved, and the accuracy and efficiency of map area segmentation are improved.
Patent Information
- Application Number
- CN202211109954.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2022-06-21
- Filing Date
- 2022-09-13
- Publication Date
- 2025-06-03
- Estimated Expiration
- 2042-09-13
AI Technical Summary
During the process of determining the contour area of the existing sweeping robot, the calculation amount is large and the hardware cost increases. Other obstacles that do not communicate with boundary obstacle points are greatly disturbed, affecting the accuracy of segmentation.
By pre-processing the initial raster map, other obstacle points that are not connected to the boundary obstacle points are removed, and a denoised raster map is obtained. Then, the minimum distance value between each pixel point and the nearest obstacle point is determined as the grayscale value, and the minimum distance value is used as the threshold is used for binary processing, the initial contour area is determined, and the target contour area is expanded.
It reduces errors in the region segmentation process, improves the accuracy of map region segmentation, and reduces the calculation amount and hardware cost.
Smart Images

Figure CN115311172B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present application relate to the field of floor sweepers, and in particular to a method for segmenting map areas and related devices. Background Art
[0002] With the continuous upgrading and improvement of floor sweeping robots, more and more consumers choose floor sweeping robots as household cleaning tools.
[0003] Currently, before a floor sweeping robot works, it needs to obtain a grid map of the whole house by laser radar scanning, and then perform binarization processing, erosion processing, and contour extraction processing on the grid map to divide at least one contour area in the initial grid map. Based on the at least one divided contour area, the user can respectively issue cleaning instructions for different contour areas to the robot. During the process of dividing at least one contour area, usually, each number from 255 to 0 is used as a threshold in sequence to perform binarization processing on each pixel point in the grid map to determine at least one contour area determined after binarization under 256 thresholds.
[0004] However, during the process of determining the contour area, each value from 255 to 0 is used as a threshold in sequence for binarization, and then the contour area is determined, which results in a large amount of calculation and an increase in hardware costs. Summary of the Invention
[0005] Embodiments of the present application provide a method for segmenting map areas and related devices, which are used to improve the accuracy of map area segmentation.
[0006] A first aspect of an embodiment of the present application provides a method for segmenting map areas, including:
[0007] Preprocess the initial grid map to obtain a target grid map;
[0008] Determine the minimum distance value between each pixel point in the target grid map and the corresponding nearest obstacle point, and use the minimum distance value corresponding to each pixel point as the gray value of each pixel point;
[0009] Respectively use each minimum distance value as a binarization threshold to perform binarization processing on the gray value of each pixel point to determine at least one initial contour area;
[0010] Expand each initial contour area in the at least one initial contour area to obtain at least one target contour area of the target grid map.
[0011] In a specific implementation manner, the step of respectively using each minimum distance value as a binarization threshold to perform binarization processing on the gray value of each pixel point to determine at least one initial contour area includes:
[0012] Taking each of the minimum distance values as a binarization threshold, perform binarization processing on the grayscale value of each pixel point to determine multiple groups of pending contour regions;
[0013] Determine each pending contour region in a group of pending contour regions with the largest number of contour regions and each contour region within the group being greater than or equal to a preset minimum contour area as at least one initial contour region.
[0014] In a specific implementation manner, the expanding each initial contour region in the at least one initial contour region to obtain at least one target contour region of the target grid map includes:
[0015] Expand each initial contour region simultaneously;
[0016] If the boundary coordinates of each initial contour region at the current moment satisfy a preset expansion end condition, stop expanding each initial contour region;
[0017] If each initial contour region stops expanding, determine at least one target contour region.
[0018] In a specific implementation manner, the expansion end condition includes: the boundary coordinates of each initial contour region coincide with the boundary coordinates of other contour regions, or the boundary coordinates of each initial contour region coincide with the obstacle pixel coordinates corresponding to the obstacle points in the target grid map, where the other contour regions are the contour regions in the at least one initial contour region except each initial contour region.
[0019] In a specific implementation manner, the preprocessing the initial grid map to obtain the target grid map includes:
[0020] Obtain the initial grid map, and remove other obstacle points in the initial grid map that are not connected to the boundary obstacle points to obtain a denoised grid map, where the other obstacle points are the obstacle points in the initial grid map except the boundary obstacle points;
[0021] Perform binarization processing and erosion processing on the denoised grid map to obtain the target grid map.
[0022] In a specific implementation manner, the method further includes:
[0023] Mark the other obstacle points that are not connected to the boundary obstacle points and the at least one target contour region in the target grid map to obtain a target partition map.
[0024] In a specific implementation manner, the preprocessing of the initial grid map to obtain the target grid map includes:
[0025] Performing binary processing on the gray value of each pixel point in the initial grid map based on the threshold function, and performing erosion processing on the binary-processed initial grid map based on the erode function to obtain the target grid map.
[0026] The second aspect of the embodiments of the present application provides a map area segmentation device, including:
[0027] A processing unit for preprocessing the initial grid map to obtain the target grid map;
[0028] A determination unit for determining the minimum distance value between each pixel point in the target grid map and the corresponding nearest obstacle point, and using the minimum distance value corresponding to each pixel point as the gray value of each pixel point;
[0029] The determination unit is further configured to perform binary processing on the gray value of each pixel point with each minimum distance value as the binary threshold to determine at least one initial contour area;
[0030] An expansion unit for expanding each initial contour area in the at least one initial contour area to obtain at least one target contour area of the target grid map.
[0031] In a specific implementation manner, the determination unit is specifically configured to perform binary processing on the gray value of each pixel point with each minimum distance value as the binary threshold to determine multiple groups of pending contour areas;
[0032] Determine each pending contour area in a group of pending contour areas with the most contour areas and each contour area in the group being greater than or equal to the preset minimum contour area as at least one initial contour area.
[0033] In a specific implementation manner, the expansion unit is specifically configured to expand each initial contour area simultaneously;
[0034] If the boundary coordinates of each initial contour area at the current moment satisfy the preset expansion end condition, stop expanding each initial contour area;
[0035] If the expansion of each initial contour area stops, determine at least one target contour area.
[0036] In a specific implementation manner, the expansion end condition includes: the boundary coordinates of each initial contour region coincide with the boundary coordinates of other contour regions, or the boundary coordinates of each initial contour region coincide with the obstacle pixel coordinates corresponding to the obstacle points in the target grid map, where the other contour regions are the contour regions other than each initial contour region among the at least one initial contour region.
[0037] In a specific implementation manner, the processing unit is specifically configured to obtain the initial grid map and remove other obstacle points in the initial grid map that are not connected to the boundary obstacle points to obtain a denoised grid map, where the other obstacle points are the obstacle points other than the boundary obstacle points in the initial grid map;
[0038] Perform binarization processing and erosion processing on the denoised grid map to obtain the target grid map.
[0039] In a specific implementation manner, the device further includes: a marking unit;
[0040] The marking unit is specifically configured to mark other obstacle points that are not connected to the boundary obstacle points and the at least one target contour region in the target grid map to obtain a target partition map.
[0041] In a specific implementation manner, the processing unit is specifically configured to perform binarization processing on the gray value of each pixel point in the initial grid map based on the threshold function, and perform erosion processing on the binarized initial grid map based on the erode function to obtain the target grid map.
[0042] A third aspect of the embodiments of the present application provides a map area segmentation device, including:
[0043] A central processing unit, a memory, and an input / output interface;
[0044] The memory is a transient storage memory or a persistent storage memory;
[0045] The central processing unit is configured to communicate with the memory and execute the instruction operations in the memory to execute the method described in the first aspect.
[0046] A fourth aspect of the embodiments of the present application provides a computer program product containing instructions, which when the computer program product runs on a computer, causes the computer to execute the method described in the first aspect.
[0047] A fifth aspect of the embodiments of the present application provides a computer storage medium, in which instructions are stored, and when the instructions are executed on a computer, the computer is caused to execute the method described in the first aspect.
[0048] As can be seen from the above technical solutions, the embodiments of the present application have the following advantages: Considering that in an indoor environment, different areas are divided by walls, and the boundary walls that usually divide the areas are interconnected, while other obstacles that are not connected to the boundary walls (such as weighing columns or sofas that are not connected to the boundary walls) are not used for indoor area division. In order to reduce the interference and segmentation errors brought by other obstacles that are not connected to the boundary walls during the map area segmentation process. After obtaining the initial grid map, noise reduction is achieved by removing other obstacle points in the initial grid map that are not connected to the boundary obstacle points, so as to obtain a denoised grid map corresponding to the initial grid map, and then the denoised grid map is subjected to area segmentation. This greatly reduces the error during the area segmentation process, thereby improving the accuracy of the map area segmentation. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 FIG. is a schematic flowchart of a method for map area segmentation disclosed in an embodiment of the present application;
[0050] Figure 2 FIG. is an example diagram of contour area extraction disclosed in an embodiment of the present application;
[0051] Figure 3 FIG. is an example diagram of contour area expansion disclosed in an embodiment of the present application;
[0052] Figure 4 FIG. is another schematic flowchart of a method for map area segmentation disclosed in an embodiment of the present application;
[0053] Figure 5 FIG. is an example diagram of a method for map area segmentation disclosed in an embodiment of the present application;
[0054] Figure 6 FIG. is another example diagram of a method for map area segmentation disclosed in an embodiment of the present application;
[0055] Figure 7 FIG. is a schematic structural diagram of a map area segmentation device disclosed in an embodiment of the present application;
[0056] Figure 8 FIG. is another schematic structural diagram of a map area segmentation device disclosed in an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0057] The following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments of the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
[0058] The existing robot's morphology-based map region segmentation algorithm is as follows: First, binarize the given map (set the gray value of the pixels in the feasible region to 255, and the gray value of the pixels in other regions except the feasible region to 0). Then, perform erosion processing on each pixel, and convert the gray value of each pixel to the gray value corresponding to the pixel with the smallest gray value in the 3*3 matrix centered on this pixel. Next, determine the distance value from each pixel to the nearest zero pixel as the gray value of this pixel. Then, perform binarization processing on each pixel in turn with each number from 255 to 0 as the threshold to determine 256 groups of pending contour regions after binarization processing under 256 thresholds, and determine the pending contour regions in the group of pending contour regions with the most contour regions and each contour region in the group being greater than or equal to the preset minimum contour area as the initial contour regions. Finally, first dye each initial contour region with the corresponding color, and then traverse each undyed pixel in the given map, and dye this pixel with the color of the first dyed pixel in the eight pixels around the 3x3 matrix centered on this pixel starting from the upper left pixel and traversing clockwise until there are no undyed pixels in the given map to achieve map region segmentation.
[0059] In the existing map region segmentation algorithm, there are the following three problems: First, there are many obstacles in the real environment, so there is a lot of environmental noise in the given map, which causes great interference to map region segmentation and affects the accuracy of map region segmentation; Second, in the process of determining the contour region, binarization is performed in turn with each value from 255 to 0 as the threshold, and then the contour region is determined, and the calculation amount is large; Third, in the process of dyeing the given map, it is necessary to traverse each pixel in the map, and the calculation amount is large.
[0060] To solve the above defects of the existing map region segmentation algorithm, the embodiments of the present application provide a connectivity-based map region segmentation method and related devices to improve the efficiency and accuracy of map region segmentation.
[0061] Please refer to Figure 1 , the present application provides a map region segmentation method, which can be applied to a map region segmentation device. The embodiments of the present application include the following steps:
[0062] 101. Preprocess the initial grid map to obtain a target grid map.
[0063] If map region division is to be performed, first, a grid map (i.e., the initial grid map) needs to be obtained, and the initial grid map is preprocessed to obtain a target grid map that can be used for subsequent processing.
[0064] Specifically, the preprocessing may include, but is not limited to, binarization processing and / or erosion processing.
[0065] 102. Determine the minimum distance value between each pixel point in the target grid map and the corresponding nearest obstacle point, and use the minimum distance value corresponding to each pixel point as the gray value of each pixel point.
[0066] Specifically, first determine the distance value between each pixel point in the target grid map and the nearest obstacle point to this pixel point as the minimum distance value, that is, determine the distance value between each pixel point in the target grid map and the nearest wall as the minimum distance value corresponding to this pixel point, and determine the minimum distance value corresponding to each pixel point as the gray value of this pixel point.
[0067] In practical applications, the minimum distance value can be the Euclidean distance or the Mahalanobis distance, which is not limited here.
[0068] 103. Use each minimum distance value as the binarization threshold respectively to perform binarization processing on the gray value of each pixel point to determine at least one initial contour region.
[0069] Use each minimum distance value as the binarization threshold respectively to perform binarization processing on the gray value of each pixel point in the target grid map, and then use the contour extraction function to determine at least one initial contour region from the target grid map, where the threshold of the binarization processing can theoretically be any one of the 256 integers from 0 to 255.
[0070] 104. Expand each initial contour region in at least one initial contour region to obtain at least one target contour region of the target grid map.
[0071] First, dye the intra-group region of each initial contour region. Specifically, each initial contour region has its corresponding color, as long as any two adjacent (that is, the boundary coordinates are directly adjacent, where directly adjacent means that any adjacent coordinate of the boundary coordinates of contour region A is the boundary coordinate of contour region B) initial contour regions correspond to different colors.
[0072] Then, expand each initial contour region. Specifically, the undyed pixel points in the target grid map can be traversed, and the color of this pixel point can be modified to the color of the first dyed pixel point in the eight surrounding pixel points of the 3x3 matrix centered on this pixel point when traversing clockwise from the upper left pixel point until there are no undyed pixel points in the target grid map, then at least one target contour region is obtained, realizing map region segmentation.
[0073] In the embodiments of the present application, considering the hardware cost and the amount of calculation, during the process of determining the contour area, binarization is sequentially performed only using multiple minimum distance values as thresholds, and then the contour area is determined, without traversing the 256 values from 0 to 255. While reducing the amount of calculation, the hardware cost is also reduced.
[0074] Further, the foregoing step 101 can be implemented in the following two ways: Method 1: Obtain an initial grid map, and remove other obstacle points in the initial grid map that are not connected to the boundary obstacle points to obtain a denoised grid map, where the other obstacle points are the obstacle points in the initial grid map except the boundary obstacle points; perform binarization processing and erosion processing on the denoised grid map to obtain a target grid map. Method 2: Perform binarization processing on the gray value of each pixel point in the initial grid map based on the threshold function, and perform erosion processing on the binarized initial grid map based on the erode function to obtain a target grid map.
[0075] Specifically, for Method 1, considering that in a real indoor environment, other obstacles (i.e., other obstacle points) that are not connected to the boundary wall (i.e., boundary obstacle points) usually do not play a role in dividing the indoor area. In order to reduce the interference and segmentation error brought by other obstacles that are not connected to the boundary wall during the map area segmentation process, it is necessary to remove other obstacle points in the initial grid map that are not connected to the boundary obstacle points to obtain a denoised grid map. Among them, the boundary obstacle points include the outermost obstacle points in the initial grid map (which can be considered as walls in the indoor environment) and the obstacle points connected to the outermost obstacle points (i.e., the walls connected to the outermost walls), and the other obstacle points are the other obstacle points in the initial grid map except the boundary obstacle points (including but not limited to weighing columns or furniture that are not connected to the boundary wall).
[0076] Perform binarization processing on the denoised grid map first, and then perform erosion processing to obtain a target grid map. Among them, the binarization processing uses only black (gray value is 0) and white (gray value is 255) to identify the denoised grid map, which can highlight the contour of the obstacle points in the map, and divide the denoised grid Figure 2 map into a feasible area (white area) and other areas (black area); the erosion processing is for the white area. Erosion means that the white part of the denoised grid map after binarization is "eroded" or "the domain is nibbled away", and the obtained target grid map has a smaller feasible area than the denoised grid map (that is, the area in the map range except the obstacle points). Among them, the threshold of the binarization processing can be set according to requirements and experience, and theoretically it can be any one of the 256 integers from 0 to 255.
[0077] For Method 2, in practical applications, the threshold function can be used for binarization processing and / or the erode function can be used for erosion processing.
[0078] In this embodiment, considering that in the indoor environment, different areas are divided by walls, and the boundary walls for area division are usually interconnected, while other obstacles that are not connected to the boundary walls (such as weighing columns or sofas that are not connected to the boundary walls) are not used for indoor area division. In order to reduce the interference and segmentation error caused by other obstacles that are not connected to the boundary walls during the map area segmentation process. After obtaining the initial grid map, denoising is achieved by removing other obstacle points in the initial grid map that are not connected to the boundary obstacle points, so as to obtain the denoised grid map corresponding to the initial grid map, and then the denoised grid map is subjected to area segmentation. This greatly reduces the error in the area segmentation process, thereby improving the accuracy of the map area segmentation.
[0079] In some specific embodiments, step 103 can be specifically implemented in the following manner: taking each minimum distance value as the binarization threshold respectively, performing binarization processing on the gray value of each pixel point to determine multiple groups of pending contour areas; determining each pending contour area in a group of pending contour areas with the most contour areas and each contour area in the group being greater than or equal to the preset minimum contour area as at least one initial contour area.
[0080] Specifically, in the order from largest to smallest (or from smallest to largest), starting from the largest minimum distance value (or the smallest minimum distance value) among multiple minimum distance values, the largest minimum distance value (or the smallest minimum distance value) is used as the binarization threshold to perform binarization processing on the grayscale value of each pixel point, so as to determine at least one initial contour region that meets the conditions. (Perform binarization processing on each pixel point (that is, perform binarization processing on the grayscale value of each pixel point) after determining according to the corresponding minimum distance) to determine a set of to-be-determined contour regions corresponding to the largest minimum distance value (or the smallest minimum distance value). According to the above method, in the order from largest to smallest (or from smallest to largest), starting from the largest minimum distance value (or the smallest minimum distance value) among multiple minimum distance values, a set of to-be-determined contour regions corresponding to each minimum distance value is determined in turn until a set of to-be-determined contour regions is determined. The number of contour regions in this set of to-be-determined contour regions is the largest and each contour region in the group is greater than or equal to the preset minimum contour area, and the calculation of a set of to-be-determined contour regions corresponding to each remaining minimum distance value (that is, the minimum distance value for which the corresponding set of to-be-determined contour regions has not been calculated) can be stopped. Finally, each to-be-determined contour region in a set of to-be-determined contour regions with the largest number of contour regions and each contour region in the group being greater than or equal to the preset minimum contour area among multiple sets of to-be-determined contour regions can be determined as at least one initial contour region. Among them, a set of to-be-determined contour regions contains at least one to-be-determined contour region.
[0081] It can be understood that since the minimum distance value is used as the threshold in the binarization process, the larger the binarization threshold (that is, the larger the minimum distance value used to perform the binarization process), the smaller the divided to-be-determined contour regions and the fewer the number of to-be-determined contour regions in each set of to-be-determined contour regions, and vice versa. To more intuitively illustrate that the larger the binarization threshold, the smaller the determined initial contour region, the following is an example. There is currently a target grid map as shown on the left ( Figure 2 ( Figure 2 The black dotted line in it is only for conveniently explaining the position of each pixel point in the target grid map and does not mean that there is a black dotted line shown in the target grid map in actual application). The size of the target grid map is 9*9 pixel points, where the black area is the boundary obstacle points of the target grid map shown). If the binarization threshold is 2, the initial contour region as shown in Figure 2 the upper right figure is determined (where the gray area is the boundary of the initial contour region, the white area plus the black area is the intra-group area of the initial contour region, the black area is the boundary obstacle points of the target grid map, and the shaded area is the pixel points in the target grid map that are not obstacle points and are also included in the contour region during this binarization process). If the binarization threshold is 1, the one as shown in Figure 2The initial contour area shown in the lower right figure (where the gray area is the boundary of the initial contour area, the white area plus the black area is the intra-group area of the initial contour area, the black area is the boundary obstacle point of the target grid map, and the shaded area is the pixel point in the target grid map that is not an obstacle point and is also included in the contour area during this binarization process).
[0082] In the embodiments of the present application, a specific implementation manner for determining at least one initial contour area is provided, which improves the feasibility of the solution.
[0083] Furthermore, considering that in the process of dyeing a given map in the prior art, it is necessary to traverse each pixel point in the map, and the calculation amount is relatively large. The foregoing step 104 can be implemented in the following way: expand each initial contour area simultaneously; if the boundary coordinates of each initial contour area at the current moment satisfy the preset expansion end condition, then stop expanding each initial contour area; if each initial contour area stops expanding, then determine at least one target contour area.
[0084] First, dye the intra-group area of each initial contour area. Similar to the foregoing dyeing method for the intra-group area in this step, it will not be elaborated here.
[0085] Next, make each initial contour area start expanding from the boundary simultaneously until the expansion ends when the expansion end condition is satisfied. Specifically, it can expand at a speed of expanding one pixel point outward from the boundary of each contour area at a time until the boundary coordinates of each initial contour area satisfy the preset expansion end condition. When a certain initial contour area satisfies the expansion end condition after the Nth expansion, determine the target contour area corresponding to this initial contour area as the contour area of this initial contour area after the (N - 1)th expansion. Until each initial contour area has a corresponding target contour area determined, it is determined that the expansion ends and the map area segmentation ends.
[0086] Furthermore, if after a certain expansion, the boundary coordinates of a certain initial contour area coincide with the boundary coordinates of other initial contour areas, or the boundary coordinates of a certain initial contour area coincide with the obstacle pixel coordinates of the boundary obstacle point (i.e., the boundary) of the target grid map, it is considered that the expansion end condition is satisfied. In this embodiment, the expansion end condition is not specifically limited.
[0087] To better explain the map expansion process of the embodiments of the present application, the following is an example. Existing as Figure 3 shown in the target grid map ( Figure 3The black dashed line is only for conveniently explaining the positions of each pixel point in the target grid map, and does not represent that there is such a black dashed line shown in the target grid map in actual application. Among them, the gray area is the boundary of the initial contour area, the white area plus the gray area is the intra-group area of the initial contour area, the black area is the boundary obstacle points of the target grid map, and the shaded area is the pixel points in the target grid map that are not obstacle points and are not in the intra-group area of any initial contour area. From left to right is one expansion. Specifically, the initial contour area corresponding to the gray area in the left figure expands to the gray area plus the white area in the right figure. It can be clearly seen from the figure that after the next expansion, the boundary coordinates of the initial contour area corresponding to the gray area in the left figure coincide with the obstacle point (black) coordinates of the target grid map. Therefore, the target contour area corresponding to the initial contour area corresponding to the gray area in the left figure is the gray area plus the white area in the right figure.
[0088] In addition, Figure 2 and Figure 3 the gray area is only for explaining the boundary of the initial contour area, and does not represent that in actual application, the initial contour area is identified or the boundary of the initial contour area is defined through a gray border.
[0089] It can be known that the expansion speed can also be expanding outwards by two pixel points or three pixel points at a time. Until the boundary coordinates of an initial contour area coincide with the pixel coordinates of any pixel point in the intra-group area of other initial contour areas (meeting the expansion end condition), the expansion speed is reduced to 1 pixel point. That is, if the initial contour area expands at a speed of three pixel points and meets the expansion end condition at the Mth expansion, the expansion speed is reduced to 1 pixel point, and the boundary coordinates of the corresponding initial contour area after the Mth expansion are reduced at a speed of 1 pixel point. The intra-group area of the initial contour area is delimited by the boundary coordinates of this initial contour area. That is, the boundary of the initial contour area determines the size and shape of the initial contour area. Because the boundary is closed, all areas within the boundary of an initial contour area are the intra-group area of this initial contour area.
[0090] Furthermore, after determining at least one target contour area, other obstacle points that are not connected to the boundary obstacle points and are removed during noise reduction in step 101 can also be marked in the target grid map to ensure the normal operation of the robot.
[0091] In this embodiment, during the process of expanding (i.e., dyeing) the target grid map, it is not necessary to traverse each pixel point in the map. Only each target contour area needs to expand outwards at the same expansion speed, which avoids dyeing room A with the color of room B, ensures the accuracy of area segmentation, reduces the amount of calculation, and lowers the hardware cost.
[0092] To better illustrate the map area segmentation method of the embodiments of the present application, please refer to Figure 4 , and the following describes the specific process of the map area segmentation method of the embodiments of the present application applied to a floor cleaning robot.
[0093] First, an initial grid map is obtained by lidar scanning. Since the environment where the floor cleaning robot is located is an indoor environment, the outermost obstacle points can be considered as walls (i.e., boundary obstacle points). Considering that walls are usually connected, noise reduction can be performed on the initial grid map to remove points that are not connected to the boundary obstacle points, thereby reducing the influence of other objects. Specifically, starting from any boundary obstacle point in the given map (i.e., the initial grid map), find the obstacle points that are not directly or indirectly connected to the arbitrary boundary obstacle point, and then remove the obstacle points that are not directly or indirectly connected to the arbitrary boundary obstacle point from the given map to obtain a denoised grid map. Among them, direct connection means adjacent to the boundary obstacle point, and indirect connection means that through adjacent obstacle points that do not belong to the boundary obstacle point, it can be directly or indirectly connected to the boundary obstacle point. Please refer to Figure 5 . In the figure, the outermost black area is the boundary obstacle point. The black area 1 in the figure is directly connected to the boundary obstacle point (the outermost black area), and the black area 2 in the figure is indirectly connected to the boundary obstacle point (the outermost black area). Further, if it can be determined that some obstacle points connected to the boundary obstacle point (such as the obstacle points corresponding to the furniture placed against the wall) do not belong to the boundary obstacle point, then these obstacle points that are connected to the boundary obstacle point but do not belong to the boundary obstacle point can be removed simultaneously during denoising, and when marking other obstacle points that are not connected to the boundary obstacle point and at least one target contour area in the target grid map, the obstacle points that are connected to the boundary obstacle point but do not belong to the boundary obstacle point removed during denoising are also marked to reduce the influence of environmental noise on map area segmentation.
[0094] Secondly, the image is binarized based on the threshold function. Specifically, the binarization threshold can be set to 250. After binarization, except for the pixel points corresponding to the feasible area with a gray value of 255, the gray values of the pixel points in other areas are all 0. Thirdly, the erode function is used to perform erosion processing on each pixel point after binarization, and the gray value of each pixel point is converted into the minimum gray value among the gray values of the pixel points in the 3*3 matrix centered on this pixel point to obtain the target grid map.
[0095] Then, use the distancetransform function to calculate the Euclidean distance matrix from each pixel point in the target grid map to the corresponding nearest 0 pixel point (since there are no other obstacle points except the boundary obstacle points after denoising, the obstacle point corresponding to the 0 pixel point is the boundary obstacle point), and convert this Euclidean distance matrix to an integer type for subsequent calculations. Among them, the distance from each pixel point to the corresponding nearest 0 pixel point can be calculated according to the formula. It can be known that the farther the pixel point is from the boundary obstacle point, the greater the Euclidean distance corresponding to the pixel point. At the same time, use the Euclidean distance value corresponding to each pixel point as its gray value.
[0096] Then, traverse the actually existing values in the L2 distance matrix and set them as the thresholds for using the threshold function. For binarization processing, when the gray value of a pixel point is greater than the threshold, change its gray value to 255, otherwise change its gray value to 0. Black and white the picture again to obtain the to-be-determined contour area. Since the closer the pixel point is to the center of the area (i.e., farther from the boundary obstacle point), the greater its current gray value (i.e., the Euclidean distance value corresponding to the pixel point), the larger the binarization threshold, the smaller the determined to-be-determined contour area, and vice versa. Then, determine a set of target contour areas from the determined multiple sets of to-be-determined contour areas, and each contour area in this set of target contour areas is a target contour area. The specific determination method is similar to the foregoing embodiments and will not be elaborated here.
[0097] Finally, stain the area within each contour, and then start staining outward from the boundary of each target contour area. When the pixel point coordinates outward from the boundary coordinates of each target contour area correspond to a feasible area, stain it (i.e., the outward pixel point coordinates) with the color of the corresponding target contour area until the expansion end condition is met and the corresponding boundary coordinates no longer expand outward. When the expansion reaches that the boundary coordinates of each target contour area no longer change, that is, each pixel point is stained, end the area segmentation of the given map.
[0098] For the specific area segmentation effect, reference can be made to Figure 6 In the order indicated by the arrow, Figure 6 Among the five images in, they are, in sequence, the initial grid map, the map after removing the obstacle points that are not connected to the boundary obstacle points, the map after removing the obstacle points that are connected to the boundary obstacle points but are not boundary obstacle points (such as furniture placed against the wall), the target grid map obtained through binarization processing and erosion processing, and the target partition map after completing the area segmentation (i.e., completing the staining).
[0099] Please refer to Figure 7 This application embodiment provides a map area segmentation device, including:
[0100] A processing unit 701, configured to preprocess the initial grid map to obtain a target grid map;
[0101] A determination unit 702, configured to determine the minimum distance value between each pixel point in the target grid map and the corresponding nearest obstacle point, and use the minimum distance value corresponding to each pixel point as the gray value of each pixel point;
[0102] The determination unit 702 is further configured to perform binarization processing on the gray value of each pixel point by using each minimum distance value as the binarization threshold respectively, so as to determine at least one initial contour region;
[0103] An expansion unit 703, configured to expand each initial contour region in at least one initial contour region, so as to obtain at least one target contour region of the target grid map.
[0104] In a specific implementation manner, the determination unit 702 is specifically configured to perform binarization processing on the gray value of each pixel point by using each minimum distance value as the binarization threshold respectively, so as to determine multiple groups of pending contour regions;
[0105] Determine each pending contour region in a group of pending contour regions with the largest number of contour regions and each contour region in the group being greater than or equal to a preset minimum contour area as at least one initial contour region.
[0106] In a specific implementation manner, the expansion unit 703 is specifically configured to expand each initial contour region simultaneously;
[0107] If the boundary coordinates of each initial contour region at the current moment satisfy a preset expansion end condition, stop expanding each initial contour region;
[0108] If the expansion of each initial contour region stops, determine at least one target contour region.
[0109] In a specific implementation manner, the expansion end condition includes: the boundary coordinates of each initial contour region coincide with the boundary coordinates of other contour regions, or the boundary coordinates of each initial contour region coincide with the obstacle pixel coordinates corresponding to the obstacle points in the target grid map, where the other contour regions are the contour regions other than each initial contour region in at least one initial contour region.
[0110] In a specific implementation manner, the processing unit 701 is specifically configured to obtain an initial grid map, and remove other obstacle points in the initial grid map that are not connected to the boundary obstacle points to obtain a denoised grid map, where the other obstacle points are the obstacle points in the initial grid map other than the boundary obstacle points;
[0111] Perform binarization processing and erosion processing on the denoised grid map to obtain the target grid map.
[0112] In a specific implementation, the apparatus further includes: a marking unit;
[0113] The marking unit is specifically configured to mark other obstacle points and at least one target contour area that are not connected to the boundary obstacle points in the target grid map, so as to obtain a target partition map.
[0114] In a specific implementation, the processing unit 701 is specifically configured to perform binarization processing on the gray value of each pixel point in the initial grid map based on the threshold function, and perform erosion processing on the binarized initial grid map based on the erode function, so as to obtain the target grid map.
[0115] Figure 8 FIG. 800 is a schematic structural diagram of a map area segmentation apparatus provided by an embodiment of the present application. The map area segmentation apparatus 800 may include one or more central processing units (CPUs) 801 and a memory 805. One or more application programs or data are stored in the memory 805.
[0116] Among them, the memory 805 may be volatile storage or persistent storage. The program stored in the memory 805 may include one or more modules, and each module may include a series of instruction operations on the map area segmentation apparatus. Further, the central processing unit 801 may be configured to communicate with the memory 805 and execute a series of instruction operations in the memory 805 on the map area segmentation apparatus 800.
[0117] The map area segmentation apparatus 800 may further include one or more power supplies 802, one or more wired or wireless network interfaces 803, one or more input / output interfaces 804, and / or one or more operating systems, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
[0118] The central processing unit 801 may perform the operations performed by the map area segmentation apparatus in the foregoing Figures 1 to 6 illustrated embodiment, and details are not described herein again.
[0119] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the above-described systems, apparatuses, and units can refer to the corresponding processes in the foregoing method embodiments, and details are not described herein again.
[0120] In several embodiments provided in the present application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections between each other can be through some interfaces, and the indirect couplings or communication connections of devices or units can be in electrical, mechanical, or other forms.
[0121] The units described as separate components may or may not be physically separated. The components displayed as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0122] In addition, in each embodiment of the present application, the functional units can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.
[0123] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM, read-only memory), random access memories (RAM, random access memory), magnetic disks, or optical discs that can store program codes.
[0124] The embodiments of the present application also provide a computer program product containing instructions. When the computer program product runs on a computer, it causes the computer to execute the map area segmentation method as described above.
Claims
1. A method for dividing a map area, characterized in that, the method includes: Preprocessing the initial grid map to obtain a target grid map; Determine the minimum distance value between each pixel point in the target grid map and the corresponding nearest obstacle point, and use the minimum distance value corresponding to each pixel point as the gray value of each pixel point; Respectively use each of the minimum distance values as a binarization threshold to perform binarization processing on the gray value of each pixel point to determine at least one initial contour area; Expand each initial contour area in the at least one initial contour area to obtain at least one target contour area of the target grid map.
2. The method according to claim 1, characterized in that, the step of respectively using each of the minimum distance values as a binarization threshold to perform binarization processing on the gray value of each pixel point to determine at least one initial contour area includes: Respectively use each of the minimum distance values as a binarization threshold to perform binarization processing on the gray value of each pixel point to determine multiple groups of pending contour areas; Determine each pending contour area in a group of pending contour areas with the most contour areas and each contour area in the group being greater than or equal to a preset minimum contour area as at least one initial contour area.
3. The method according to claim 1, characterized in that, the step of expanding each initial contour area in the at least one initial contour area to obtain at least one target contour area of the target grid map includes: Simultaneously expand each initial contour area; If the boundary coordinates of each initial contour area at the current moment satisfy a preset expansion end condition, stop expanding each initial contour area; If each initial contour area stops expanding, determine at least one target contour area.
4. The method according to claim 3, characterized in that, the expansion end condition includes: the boundary coordinates of each initial contour area coincide with the boundary coordinates of other contour areas, or the boundary coordinates of each initial contour area coincide with the obstacle pixel coordinates corresponding to the obstacle points in the target grid map, where the other contour areas are the contour areas in the at least one initial contour area except each initial contour area.
5. The method according to claim 1, characterized in that, the step of preprocessing the initial grid map to obtain a target grid map includes: Obtain the initial grid map, and remove other obstacle points in the initial grid map that are not connected to the boundary obstacle points to obtain a denoised grid map, where the other obstacle points are the obstacle points in the initial grid map except the boundary obstacle points; Perform binarization processing and erosion processing on the denoised grid map to obtain the target grid map.
6. The method according to claim 5, characterized in that, the method further includes: Mark the other obstacle points that are not connected to the boundary obstacle points and the at least one target contour area in the target grid map to obtain a target partition map.
7. The method according to claim 1, It is characterized in that the preprocessing of the initial grid map to obtain a target grid map includes: performing binarization processing on the gray value of each pixel point in the initial grid map based on the threshold function, and performing erosion processing on the binarized initial grid map based on the erode function to obtain a target grid map.
8. A map area segmentation device It is characterized in that it includes: a processing unit for preprocessing an initial grid map to obtain a target grid map; a determination unit for determining the minimum distance value between each pixel point in the target grid map and the corresponding nearest obstacle point, and using the minimum distance value corresponding to each pixel point as the gray value of each pixel point; the determination unit is further configured to perform binarization processing on the gray value of each pixel point with each minimum distance value as a binarization threshold to determine at least one initial contour area; an expansion unit for expanding each initial contour area in the at least one initial contour area to obtain at least one target contour area of the target grid map.
9. A map area segmentation device It is characterized in that it includes: a central processing unit, a memory and an input / output interface; the memory is a transient storage memory or a persistent storage memory; the central processing unit is configured to communicate with the memory and execute the instruction operations in the memory to execute the method according to any one of claims 1 to 7.
10. A computer storage medium It is characterized in that the computer storage medium stores instructions, and when the instructions are executed on a computer, the computer is caused to execute the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Multi-type hybrid silkworm cocoon-oriented counting method
CN108596891A
Agaricus bisporus grading judgment method
CN110766702A