CN114943659A - Map area segmentation method and related device - Google Patents
Map area segmentation method and related device Download PDFInfo
- Publication number
- CN114943659A CN114943659A CN202210704098.3A CN202210704098A CN114943659A CN 114943659 A CN114943659 A CN 114943659A CN 202210704098 A CN202210704098 A CN 202210704098A CN 114943659 A CN114943659 A CN 114943659A
- Authority
- CN
- China
- Prior art keywords
- grid map
- initial
- contour region
- map
- pixel point
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 62
- 230000011218 segmentation Effects 0.000 title claims abstract description 44
- 230000004888 barrier function Effects 0.000 claims description 19
- 230000006870 function Effects 0.000 claims description 17
- 230000007797 corrosion Effects 0.000 claims description 12
- 238000005260 corrosion Methods 0.000 claims description 12
- 238000007781 pre-processing Methods 0.000 claims description 10
- 241000760358 Enodes Species 0.000 claims description 7
- 230000002085 persistent effect Effects 0.000 claims description 3
- 230000001052 transient effect Effects 0.000 claims description 2
- 230000008569 process Effects 0.000 description 21
- 238000004043 dyeing Methods 0.000 description 9
- 239000011159 matrix material Substances 0.000 description 7
- 238000004364 calculation method Methods 0.000 description 6
- 238000010586 diagram Methods 0.000 description 6
- 230000003628 erosive effect Effects 0.000 description 5
- 238000005192 partition Methods 0.000 description 5
- 238000010408 sweeping Methods 0.000 description 5
- 238000004891 communication Methods 0.000 description 4
- 238000004422 calculation algorithm Methods 0.000 description 3
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 238000000605 extraction Methods 0.000 description 3
- 238000005303 weighing Methods 0.000 description 3
- 238000004140 cleaning Methods 0.000 description 2
- 239000003086 colorant Substances 0.000 description 2
- 238000004590 computer program Methods 0.000 description 2
- 230000007613 environmental effect Effects 0.000 description 2
- 241000255789 Bombyx mori Species 0.000 description 1
- 101100134058 Caenorhabditis elegans nth-1 gene Proteins 0.000 description 1
- 241001417527 Pempheridae Species 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005530 etching Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
- 238000010186 staining Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/70—Denoising; Smoothing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/20—Image enhancement or restoration using local operators
- G06T5/30—Erosion or dilatation, e.g. thinning
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/11—Region-based segmentation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/13—Edge detection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/60—Analysis of geometric attributes
- G06T7/62—Analysis of geometric attributes of area, perimeter, diameter or volume
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/30—Subject of image; Context of image processing
- G06T2207/30204—Marker
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Geometry (AREA)
- Image Analysis (AREA)
Abstract
The embodiment of the application discloses a map region segmentation method and related equipment, which are used for improving the region segmentation efficiency and accuracy of a map. The method in the embodiment of the application comprises the following steps: determining the minimum distance value between each pixel point in the target grid map and the corresponding nearest obstacle point, and taking the minimum distance value corresponding to each pixel point as the gray value of each pixel point; respectively taking each minimum distance value as a binarization threshold value, and performing binarization processing on the gray value of each pixel point to determine at least one initial contour region; expanding each of the at least one initial contour region to obtain at least one target contour region of the target grid map.
Description
Technical Field
The embodiment of the application relates to the field of sweeper, in particular to a map area segmentation method and related equipment.
Background
With the continuous upgrade and improvement of the sweeping robot, more and more consumers select the sweeping robot as a household cleaning tool.
At present, before a sweeping robot works, a raster map of a whole house needs to be obtained through laser radar scanning, and then binarization processing, erosion processing and contour extraction processing are performed on the raster map so as to divide at least one contour area in an initial raster map. Based on the at least one divided contour region, the user can respectively give cleaning instructions aiming at different contour regions to the robot. In the process of dividing at least one contour region, generally, each number of 255 to 0 is used as a threshold value in sequence to perform binarization processing on each pixel point in the grid map, so as to determine at least one contour region determined after binarization processing is performed under 256 threshold values.
However, in the contour region determination process, binarization is performed by using each value of 255 to 0 as a threshold value in sequence, and then the contour region determination is performed, which results in a large amount of calculation and an increase in hardware cost.
Disclosure of Invention
The embodiment of the application provides a map area segmentation method and related equipment, which are used for improving the map area segmentation accuracy.
A first aspect of the embodiments of the present application provides a map region segmentation method, including:
preprocessing the initial grid map to obtain a target grid map;
determining the minimum distance value between each pixel point in the target grid map and the corresponding nearest obstacle point, and taking the minimum distance value corresponding to each pixel point as the gray value of each pixel point;
respectively taking each minimum distance value as a binarization threshold value, and performing binarization processing on the gray value of each pixel point to determine at least one initial contour region;
expanding each of the at least one initial contour region to obtain at least one target contour region of the target grid map.
In a specific implementation manner, the binarizing the gray value of each pixel point by using each minimum distance value as a binarization threshold respectively to determine at least one initial contour region includes:
respectively taking each minimum distance value as a binarization threshold value, and performing binarization processing on the gray value of each pixel point to determine multiple groups of regions to be defined;
and determining each contour region to be determined in a group of contour regions to be determined, which has the most contour regions and each contour region in the group is larger than or equal to a preset minimum contour region, as at least one initial contour region.
In a specific implementation, the expanding each of the at least one initial contour region to obtain at least one target contour region of the target grid map includes:
simultaneously expanding each of the initial contour regions;
if the boundary coordinates of each initial contour region at the current moment meet a preset expansion ending condition, stopping expanding each initial contour region;
and if the expansion of each initial contour region is stopped, determining at least one target contour region.
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 coordinates of obstacle pixels corresponding to the obstacle points in the target grid map, wherein the other contour regions are contour regions of the at least one initial contour region except for the initial contour regions.
In a specific implementation manner, the preprocessing the initial grid map to obtain the target grid map includes:
acquiring the initial grid map, and removing other obstacle points which are not communicated with the boundary obstacle points in the initial grid map to obtain a de-noised grid map, wherein the other obstacle points are obstacle points except the boundary obstacle points in the initial grid map;
and carrying out binarization processing and corrosion processing on the de-noised grid map to obtain the target grid map.
In a specific implementation, the method further includes:
marking the other barrier points which are not communicated with the boundary barrier points and the at least one target outline area in the target grid map to obtain a target subarea map.
In a specific implementation manner, the preprocessing the initial grid map to obtain the target grid map includes:
and carrying out binarization processing on the gray value of each pixel point in the initial grid map based on a threshold function, and carrying out corrosion processing on the initial grid map after binarization processing based on an enode function so as to obtain a target grid map.
A second aspect of the embodiments of the present application provides a map area dividing device, including:
the processing unit is used for preprocessing the initial grid map to obtain a target grid map;
the determining unit is used for determining the minimum distance value between each pixel point in the target grid map and the corresponding nearest obstacle point, and taking the minimum distance value corresponding to each pixel point as the gray value of each pixel point;
the determining unit is further configured to perform binarization processing on the gray value of each pixel point by using each minimum distance value as a binarization threshold, so as to determine at least one initial contour region;
an expanding unit, configured to expand each of the at least one initial contour region to obtain at least one target contour region of the target grid map.
In a specific implementation manner, the determining unit is specifically configured to perform binarization processing on the gray value of each pixel point by using each minimum distance value as a binarization threshold, so as to determine multiple groups of regions to be determined;
and determining each contour region to be determined in a group of contour regions to be determined, which has the most contour regions and each contour region in the group is larger than or equal to a preset minimum contour region, as at least one initial contour region.
In a specific implementation, the expanding unit is specifically configured to expand each of the initial contour regions simultaneously;
if the boundary coordinates of each initial contour region at the current moment meet a preset expansion ending condition, stopping expanding each initial contour region;
and if the expansion of each initial contour region is stopped, determining at least one target contour region.
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 coordinates of obstacle pixels corresponding to the obstacle points in the target grid map, wherein the other contour regions are contour regions of the at least one initial contour region except for the initial contour regions.
In a specific implementation manner, the processing unit is specifically configured to obtain the initial grid map, and remove other obstacle points that are not communicated with a boundary obstacle point in the initial grid map to obtain a de-noised grid map, where the other obstacle points are obstacle points other than the boundary obstacle point in the initial grid map;
and carrying out binarization processing and corrosion processing on the de-noised grid map to obtain the target grid map.
In a specific implementation manner, the apparatus further includes: a marking unit;
the marking unit is specifically configured to mark the other obstacle points that are not communicated with the boundary obstacle point and the at least one target contour area in the target grid map to obtain a target partition map.
In a specific implementation manner, the processing unit is specifically configured to perform binarization processing on a gray value of each pixel point in the initial grid map based on a threshold function, and perform erosion processing on the initial grid map after the binarization processing based on an enode function, so as to obtain the target grid map.
A third aspect of the embodiments of the present application provides a map area dividing device, including:
the system comprises a central processing unit, a memory and an input/output interface;
the memory is a transient memory or a persistent memory;
the central processor is configured to communicate with the memory and execute the operations of the instructions in the memory to perform the method of the first aspect.
A fourth aspect of embodiments of the present application provides a computer program product comprising instructions which, when run on a computer, cause the computer to perform the method according to the first aspect.
A fifth aspect of embodiments of the present application provides a computer storage medium having instructions stored therein, which when executed on a computer, cause the computer to perform the method according to the first aspect.
According to the technical scheme, the embodiment of the application has the following advantages: considering the indoor environment, the partition of different areas is realized by walls, and usually the boundary walls for realizing the area partition are communicated with each other, and other obstacles (such as weighing columns or sofas which are not communicated with the boundary walls) which are not communicated with the boundary walls are not used for the indoor area partition. The method aims to reduce the interference and segmentation errors brought by other obstacles which are not communicated with the boundary wall body in the map area segmentation process. After the initial grid map is obtained, denoising is achieved by removing other obstacle points which are not communicated with the boundary obstacle points in the initial grid map, so that a denoising grid map corresponding to the initial grid map is obtained, and then region segmentation is carried out on the denoising grid map. The error in the area segmentation process is greatly reduced, and the accuracy of map area segmentation is further improved.
Drawings
Fig. 1 is a schematic flowchart of a map area segmentation method disclosed in an embodiment of the present application;
FIG. 2 is a diagram illustrating an example of contour region extraction disclosed in an embodiment of the present application;
FIG. 3 is an exemplary illustration of expansion of the outlined area disclosed in an embodiment of the present application;
fig. 4 is another schematic flow chart of a map area segmentation method disclosed in the embodiment of the present application;
fig. 5 is a diagram illustrating an example of a map area segmentation method disclosed in an embodiment of the present application;
fig. 6 is a diagram illustrating another example of a map area segmentation method disclosed in an embodiment of the present application;
fig. 7 is a schematic structural diagram of a map area dividing apparatus disclosed in an embodiment of the present application;
fig. 8 is another schematic structural diagram of a map area dividing apparatus according to an embodiment of the present disclosure.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present application without making any creative effort belong to the protection scope of the present application.
The existing robot map area segmentation algorithm based on the form is as follows: firstly, a given map is binarized (the gray value of the pixel points in the feasible region is 255, and the gray values of the pixel points in other regions except the feasible region are 0). And then, carrying out corrosion treatment on each pixel point, and converting the gray value of each pixel point into the gray value corresponding to the pixel point with the minimum gray value in the 3x3 matrix taking the pixel point as the center. And then, determining the distance value from each pixel point to the nearest zero pixel point as the gray value of the pixel point. And then, sequentially taking each number of 255 to 0 as a threshold value to perform binarization processing on each pixel point to determine 256 groups of to-be-determined contour regions which are determined after binarization processing is performed under 256 threshold values, and determining the to-be-determined contour region in a group of to-be-determined contour regions which have the largest contour region among the 256 groups of to-be-determined contour regions and each contour region in the group is larger than or equal to a preset minimum contour area as an initial contour region. And finally, dyeing corresponding colors on each initial contour area, traversing each undyed pixel point in a given map, dyeing the pixel point into the color of the first dyed pixel point which is traversed clockwise from the pixel point at the upper left corner as a starting point in the surrounding eight pixel points of the 3x3 matrix taking the pixel point as the center until no undyed pixel point exists in the given map, and thus realizing map area segmentation.
The existing map area segmentation algorithm has the following three problems: firstly, a plurality of obstacles exist in a real environment, so that a given map has a plurality of environmental noises, which generate larger interference to map area segmentation and influence the accuracy of the map area segmentation; secondly, in the process of determining the contour region, each numerical value from 255 to 0 is used as a threshold value for binaryzation in sequence, then the contour region is determined, and the calculated amount is large; thirdly, in the process of dyeing the given map, each pixel point in the map needs to be traversed, and the calculated amount is large.
In order to overcome the defects of the existing map area segmentation algorithm, the embodiment of the application provides a map area segmentation method based on connectivity and related equipment, and the map area segmentation method and the related equipment are used for improving the efficiency and the accuracy of map area segmentation.
Referring to fig. 1, the present application provides a map area dividing method, which can be applied to a map area dividing device, and the embodiment of the present application includes the following steps:
101. and preprocessing the initial grid map to obtain a target grid map.
If the map area division is to be performed, a grid map (i.e., an initial grid map) needs to be obtained first, and the initial grid map is preprocessed to obtain a target grid map which can be used for subsequent processing.
Specifically, the pretreatment may include, but is not limited to, a binarization process and/or an etching process.
102. And determining the minimum distance value between each pixel point in the target grid map and the corresponding nearest obstacle point, and taking the minimum distance value corresponding to each pixel point as the gray value of each pixel point.
Specifically, the distance value between each pixel point in the target grid map and the closest obstacle point to the pixel point is determined as the minimum distance value, that is, the distance value between each pixel point in the target grid map and the closest wall is determined as the minimum distance value corresponding to the pixel point, and the minimum distance value corresponding to each pixel point is determined as the gray value of the pixel point.
In practical applications, the minimum distance value may be an euclidean distance or a mahalanobis distance, which is not limited herein.
103. And respectively taking each minimum distance value as a binarization threshold value, and performing binarization processing on the gray value of each pixel point to determine at least one initial contour region.
And respectively taking each minimum distance value as a binarization threshold value, performing binarization processing on the gray value of each pixel point in the target grid map, and then determining at least one initial contour region from the target grid map by using a contour extraction function, wherein the threshold value of the binarization processing can be any value of 256 integers from 0 to 255 theoretically.
104. Each of the at least one initial contour region is expanded to obtain at least one target contour region of the target grid map.
First, the regions in each initial contour region are dyed, specifically, each initial contour region has its corresponding color, as long as any two adjacent initial contour regions (i.e., the boundary coordinates are directly adjacent, wherein any adjacent coordinate of the boundary coordinates of the directly adjacent contour region a is the boundary coordinate of the contour region B) correspond to different colors, respectively.
And then, expanding each initial contour region, specifically, traversing undyed pixel points in the target grid map, and modifying the color of the pixel point into the color of a first dyed pixel point which is traversed clockwise from a pixel point at the upper left corner as a starting point in eight surrounding pixel points of a 3x3 matrix taking the pixel point as the center until no undyed pixel point exists in the target grid map, so as to obtain at least one target contour region and realize map region segmentation.
In the embodiment of the application, in consideration of hardware cost and calculation amount, in the process of determining the contour region, binarization is sequentially performed by using only a plurality of minimum distance values as threshold values, and then the contour region is determined without traversing 256 values of 0-255. The hardware cost is reduced while the calculation amount is reduced.
Further, the foregoing step 101 can be implemented in two ways: the method comprises the steps of obtaining an initial grid map, and removing other obstacle points which are not communicated with boundary obstacle points in the initial grid map to obtain a de-noised grid map, wherein the other obstacle points are obstacle points except the boundary obstacle points in the initial grid map; and carrying out binarization processing and corrosion processing on the de-noised grid map to obtain a target grid map. And secondly, performing binarization processing on the gray value of each pixel point in the initial grid map based on a threshold function, and performing corrosion processing on the initial grid map after binarization processing based on an enode function to obtain a target grid map.
Specifically, with respect to the first method, it is considered that in a real indoor environment, other obstacles (i.e., other obstacle points) that are not communicated with the boundary wall (i.e., boundary obstacle points) generally do not play a role in dividing an indoor area. In order to reduce interference and segmentation errors caused by other obstacles which are not communicated with the boundary wall in the process of segmenting the map region, other obstacle points which are not communicated with the boundary obstacle points in the initial grid map need to be removed to obtain the de-noised grid map. The boundary obstacle points include an outermost obstacle point (which may be considered as a wall in an indoor environment) in the initial grid map and an obstacle point communicating with the outermost obstacle point (i.e., a wall communicating with the outermost wall), and the other obstacle points are other obstacle points (including but not limited to a weighing column or furniture not communicating with the boundary wall) in the initial grid map except for the boundary obstacle point.
And carrying out binarization processing and then carrying out corrosion processing on the de-noised grid map to obtain the target grid map. The binarization processing identifies the de-noised grid map only by using black (the gray value is 0) and white (the gray value is 255) through binarization, so that the outline of an obstacle point in the map can be highlighted, and the de-noised grid map is divided into a feasible region (a white region) and other regions (black regions); the corrosion treatment is for a white area, the corrosion is that a white part of the denoised grid map after the binarization treatment is corroded or the field is eaten by silkworm, and the obtained target grid map has a feasible area (namely, an area except for an obstacle point in the map range) smaller than that of the denoised grid map. The threshold value of the binarization processing may be set according to needs and experience, and may be any one of 256 integers of 0 to 255 in theory.
In practical application, the second method may adopt a threshold function to perform binarization processing and/or use an enode function to perform erosion processing.
In this embodiment, considering that in an indoor environment, different areas are divided by walls, and boundary walls for generally realizing the area division are communicated with each other, and other obstacles (such as a weighing column or a sofa not communicated with the boundary walls) not communicated with the boundary walls are not used for the indoor area division. The method aims to reduce the interference and segmentation errors brought by other obstacles which are not communicated with the boundary wall body in the map area segmentation process. After the initial grid map is obtained, denoising is achieved by removing other obstacle points which are not communicated with the boundary obstacle points in the initial grid map, so that a denoised grid map corresponding to the initial grid map is obtained, and then region segmentation is carried out on the denoised grid map. The error in the area segmentation process is greatly reduced, and the accuracy of map area segmentation is further improved.
In some embodiments, the foregoing step 103 may be specifically implemented by: respectively taking each minimum distance value as a binarization threshold, and performing binarization processing on the gray value of each pixel point to determine multiple groups of to-be-determined contour areas; and determining each contour region to be determined in a group of contour regions to be determined, which has the most contour regions among the plurality of groups of contour regions to be determined and has each contour region in the group being larger than or equal to a preset minimum contour region, as at least one initial contour region.
Specifically, according to the sequence from large to small (or from small to large), starting from the largest minimum distance value (or the smallest minimum distance value) in the plurality of minimum distance values, the largest minimum distance value (or the smallest minimum distance value) is used as a binarization threshold, and the gray value of each pixel point is subjected to binarization processing to determine at least one initial contour region meeting the condition. And (after the determination according to the corresponding minimum distance), performing binarization processing on each pixel point (namely, performing binarization processing on the gray value of each pixel point) to determine a group of to-be-determined contour regions corresponding to the maximum minimum distance value (or the minimum distance value). According to the method, according to the sequence from large to small (or from small to large), a group of to-be-determined contour regions corresponding to each minimum distance value are sequentially determined from the largest minimum distance value (or the smallest minimum distance value) in the minimum distance values until a group of to-be-determined contour regions are determined, the number of contour regions in the group of to-be-determined contour regions is the largest, each contour region in the group is larger than or equal to the preset minimum contour area, and the calculation of a group of to-be-determined contour regions corresponding to each remaining minimum distance value (namely the minimum distance value calculated by the corresponding group of to-be-determined contour regions is not performed) can be stopped. Finally, each contour region to be determined in a group of contour regions to be determined, which has the most contour regions among the plurality of groups of contour regions to be determined and each contour region in the group is larger than or equal to the preset minimum contour region, can be determined as at least one initial contour region. The group of undetermined contour areas comprises at least one undetermined contour area.
It can be understood that, because the minimum distance value is used as the threshold value in the binarization processing process, the larger the threshold value for binarization (i.e. the larger the minimum distance value for performing binarization processing), the smaller the divided to-be-determined contour region and the smaller the number of to-be-determined contour regions in each group of to-be-determined contour regions, and vice versa. In order to more intuitively explain that the larger the binarization threshold value is, the smaller the determined initial contour region is, the following is exemplified. Now, there exists a target grid map (9 × 9 pixels, where the black area is a boundary obstacle point of the target grid map) shown on the left side of fig. 2 (the black dashed line in fig. 2 is only for convenience of explaining the location of each pixel point in the target grid map, and does not indicate that the target grid map in practical application has a black dashed line shown in the drawing), if 2 is used as a binarization threshold, an initial contour area shown on the upper right side of fig. 2 is determined (where a gray area is a boundary of the initial contour area, a white area plus a black area is an intra-group area of the initial contour area, a black area is a boundary obstacle point of the target grid map, a shadow area is a pixel point which is not an obstacle point in the target grid map and is also drawn into the contour area in the binarization process of this time), if 1 is used as a binarization threshold, an initial contour area shown on the lower right side of fig. 2 is determined (where, the gray area is the boundary of the initial contour area, the white area and the black area are the grouped areas of the initial contour area, the black area is the boundary barrier point of the target grid map, and the shadow area is the pixel point which is not the barrier point in the target grid map and is also drawn into the contour area in the binarization process).
In the embodiment of the application, a specific implementation mode for determining at least one initial contour region is provided, and the realizability of the scheme is improved.
Further, considering that in the process of dyeing a given map in the prior art, each pixel point in the map needs to be traversed, the calculation amount is large, and the foregoing step 104 may be implemented in a manner of: simultaneously expanding each initial contour region; if the boundary coordinates of each initial contour area at the current moment meet the preset expansion ending condition, stopping expanding each initial contour area; and if each initial contour region stops expanding, determining at least one target contour region.
First, the region within each initial contour region is dyed in a similar manner to the dyeing manner of the region within the group in the previous step, and the detailed description thereof is omitted here.
Then, each initial contour region is expanded from the boundary at the same time until the expansion is finished when the expansion finishing condition is satisfied. Specifically, the expansion may be performed at a speed that the boundary of each contour region is expanded outward one pixel point at a time until the boundary coordinates of each initial contour region satisfy a preset expansion end condition. And when a certain initial contour region meets the expansion ending condition after the Nth expansion, determining that the target contour region corresponding to the initial contour region is the contour region of the initial contour region after the Nth-1 st expansion. And determining that the expansion is finished and determining that the map area segmentation is finished until each initial contour area determines that a corresponding target contour area exists.
Furthermore, after a certain expansion, the boundary coordinates of a certain initial contour region coincide with the boundary coordinates of other initial contour regions, or the boundary coordinates of a certain initial contour region coincide with the obstacle pixel coordinates of the boundary obstacle point (i.e., the boundary) of the target grid map, that is, the expansion ending condition is considered to be satisfied, and the expansion ending condition is not specifically limited in this embodiment.
To better explain the map expansion process of the embodiment of the present application, the following is exemplified. An existing target grid map as shown in fig. 3 (the black dotted line in fig. 3 is only for convenience of explaining the location of each pixel point in the target grid map, and does not indicate that the target grid map has the illustrated black dotted line in practical application), where a gray area is a boundary of an initial contour area, a white area plus the gray area is an intra-group area of the initial contour area, a black area is a boundary obstacle point of the target grid map, and a shadow area is a pixel point of an intra-group area that is not an obstacle point nor is in any initial contour area in the target grid map. The expansion is performed once from left to right, specifically, the initial contour area corresponding to the gray area in the left image is expanded to the gray area plus the white area in the right image, and it can be obviously known from the figure that after the next expansion is performed, the boundary coordinates of the initial contour area corresponding to the gray area in the left image are convenient for the coordinates of the obstacle points (black) of the target grid map to coincide, so that the target contour area corresponding to the initial contour area corresponding to the gray area in the left image is the gray area plus the white area in the right image.
In addition, the gray areas in fig. 2 and 3 are only used to illustrate the boundaries of the initial contour area, and do not represent the identification of the initial contour area or the definition of the boundaries of the initial contour area by the gray frames in practical applications.
It can be known that the expansion speed can also be two pixel points or three pixel points expanded outwards at a time until the expansion speed is reduced to 1 pixel point when the boundary coordinate of a certain initial contour region coincides with the pixel coordinate of any pixel point of the intra-group region of other initial contour regions (satisfying the expansion ending condition), that is, if the initial contour region is expanded at the speed of 3 pixels and the expansion end condition is satisfied at the Mth expansion, reducing the expansion speed to 1 pixel point, and reducing the boundary coordinate of the corresponding initial contour region after the Mth expansion at the speed of 1 pixel point, wherein the intra-group region of the initial contour region is defined by the boundary coordinate of the initial contour region, that is, the boundary of the initial contour region determines the size and shape of the initial contour region, and since the boundary is closed, all regions within the boundary of one initial contour region are the regions within the group of the initial contour region.
Further, after at least one target contour region is determined, each target contour region and other obstacle points which are removed in the noise reduction in step 101 and are not communicated with the boundary obstacle points can be marked in the target grid map, so that normal operation of the robot is guaranteed.
In the embodiment, in the process of expanding (i.e. dyeing) the target grid map, each pixel point in the map does not need to be traversed, and only each target contour region needs to be expanded outwards at the same expansion speed, so that the room A is prevented from being dyed into the color of the room B, the accuracy of region segmentation is ensured, the calculated amount is reduced, and the hardware cost is reduced.
To better explain the map area segmentation method in the embodiment of the present application, please refer to fig. 4, which will be described below to describe a specific process of the map area segmentation method in the embodiment of the present application, which is applied to a sweeping robot.
First, an initial grid map is obtained through laser radar scanning, because the environment of the sweeping robot is an indoor environment, the outermost obstacle point can be considered as a wall (i.e., a boundary obstacle point). Considering that the wall is usually connected, the noise of the initial grid map can be reduced, and the points which are not connected with the boundary obstacle points are removed, so that the influence of other objects is reduced. Specifically, it is possible to search for an obstacle point that is not directly or indirectly connected to an arbitrary boundary obstacle point in a given map (i.e., an initial grid map), and then remove the obstacle point that is not directly or indirectly connected to the arbitrary boundary obstacle point from the given map to obtain a de-noised grid map. The direct communication means is adjacent to the boundary barrier point, and the indirect communication means is directly or indirectly connected to the boundary barrier point through the adjacent barrier point which does not belong to the boundary barrier point. Referring to fig. 5, the black area 1 in the figure is directly connected to the boundary barrier point (the black area in the outermost circle), and the black area 2 in the figure is indirectly connected to the boundary barrier point (the black area in the outermost circle). Further, if it can be determined that some obstacle points connected to the boundary obstacle points (e.g., obstacle points corresponding to furniture placed close to the wall) do not belong to the boundary obstacle points, these obstacle points connected to the boundary obstacle points but not belonging to the boundary obstacle points can be removed at the same time during denoising, and when other obstacle points not connected to the boundary obstacle points and at least one target contour region are marked in the target grid map, the obstacle points connected to the boundary obstacle points but not belonging to the boundary obstacle points removed during denoising are also marked, so as to reduce the influence of the environmental noise on the map region segmentation.
Secondly, the picture is binarized based on the threshold function. Specifically, the binarization threshold may be set to 250, and after binarization is completed, except that the gray value of the pixel point corresponding to the feasible region is 255, the gray values of the pixel points corresponding to other regions are all 0. And thirdly, corroding each pixel point after binarization processing by using an enode function, and converting the gray value of each pixel point into the minimum gray value in the gray values of all the pixel points in a 3-by-3 matrix taking the pixel point as the center so as to obtain the target grid map.
Then, a distance matrix of Euclidean distance from each pixel point in the target grid map to the corresponding nearest 0 pixel point (because other barrier points except the boundary barrier point do not exist after denoising, the barrier point corresponding to the 0 pixel point is the boundary barrier point) is calculated by using a distancetransform function, and the Euclidean distance matrix is converted into a shape so as to facilitate subsequent calculation. The distance from each pixel point to the corresponding nearest 0 pixel point can be calculated according to a formula, and it can be known that the farther the pixel point is from the boundary obstacle point, the larger the euclidean distance corresponding to the pixel point is. Meanwhile, the Euclidean distance value corresponding to each pixel point is taken as the gray value of the pixel point.
Then, traversing the real existing value in the L2 distance matrix, setting the value as a threshold value using a threshold function, carrying out binarization processing to change the gray value of the pixel point into 255 when the gray value is larger than the threshold value, otherwise, changing the gray value into 0, and carrying out black and white processing on the picture again to obtain the contour area to be determined. The closer the pixel point is to the center of the area (i.e. away from the boundary obstacle point), the larger the current gray value (i.e. the Euclidean distance value corresponding to the pixel point) of the pixel point is, so that the larger the binarization threshold value is, the smaller the determined area to be determined, and vice versa. And then determining a group of target contour regions from the plurality of groups of determined regions to be defined, wherein each contour region in the group of target contour regions is a target contour region. The specific determination method is similar to the foregoing embodiment, and is not described herein again.
And finally, dyeing the area in each contour, then dyeing outwards from the boundary of each target contour area, and dyeing the outward pixel point coordinate of each target contour area into the color of the corresponding target contour area when the outward pixel point coordinate of the boundary coordinate of each target contour area corresponds to the feasible area until the expansion ending condition is met, wherein the corresponding boundary coordinate does not expand outwards any more. And when the boundary coordinates of each target contour region are expanded to be not changed any more, namely each pixel point is dyed, finishing the region segmentation of the given map.
Specific region segmentation effect referring to fig. 6, the five images in fig. 6 sequentially include, in the order indicated by arrows, an initial grid map, a map from which obstacle points that are not connected to boundary obstacle points are removed, a map from which obstacle points that are connected to boundary obstacle points but not boundary obstacle points (e.g., furniture placed against a wall) are removed, a target grid map obtained through binarization processing and erosion processing, and a target partition map from which region segmentation (i.e., staining) is completed.
Referring to fig. 7, an embodiment of the present application provides a map area dividing apparatus, including:
a processing unit 701, configured to perform preprocessing on the initial grid map to obtain a target grid map;
a determining unit 702, configured to determine a minimum distance value between each pixel point in the target grid map and the corresponding closest obstacle point, and use the minimum distance value corresponding to each pixel point as a gray value of each pixel point;
the determining unit 702 is further configured to perform binarization processing on the gray value of each pixel point by using each minimum distance value as a binarization threshold, so as to determine at least one initial contour region;
an expanding unit 703, configured to expand each of the at least one initial contour region to obtain at least one target contour region of the target grid map.
In a specific implementation manner, the determining unit 702 is specifically configured to perform binarization processing on the gray value of each pixel point by using each minimum distance value as a binarization threshold, so as to determine multiple groups of regions to be determined;
and determining each contour region to be determined in a group of contour regions to be determined, which has the most contour regions among the plurality of groups of contour regions to be determined and has each contour region in the group being larger than or equal to a preset minimum contour region, as at least one initial contour region.
In a specific implementation, the expanding unit 703 is specifically configured to simultaneously expand each of the initial contour regions;
if the boundary coordinates of each initial contour region at the current moment meet a preset expansion ending condition, stopping expanding each initial contour region;
and if each initial contour region stops expanding, determining at least one target contour region.
In one specific implementation, the expansion end condition includes: and 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 coordinates of barrier pixels corresponding to barrier points in the target grid map, wherein the other contour regions are contour regions except each initial contour region in at least one initial contour region.
In a specific implementation manner, the processing unit 701 is specifically configured to obtain an initial grid map, and remove other obstacle points that are not communicated with the boundary obstacle points in the initial grid map to obtain a de-noised grid map, where the other obstacle points are obstacle points other than the boundary obstacle points in the initial grid map;
and carrying out binarization processing and corrosion processing on the de-noised grid map to obtain a target grid map.
In a specific implementation, the apparatus further includes: a marking unit;
and the marking unit is specifically used for marking other obstacle points which are not communicated with the boundary obstacle points and at least one target outline area in the target grid map so as to obtain a target subarea map.
In a specific implementation manner, the processing unit 701 is specifically configured to perform binarization processing on a gray value of each pixel point in the initial grid map based on a threshold function, and perform erosion processing on the initial grid map after the binarization processing based on an enode function to obtain the target grid map.
Fig. 8 is a schematic structural diagram of a map area dividing apparatus 800 according to an embodiment of the present disclosure, where the map area dividing apparatus 800 may include one or more Central Processing Units (CPUs) 801 and a memory 805, and one or more applications or data are stored in the memory 805.
The map area segmentation apparatus 800 may also 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 Server, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
The central processing unit 801 may perform the operations performed by the map area dividing apparatus in the embodiments shown in fig. 1 to fig. 6, and details thereof are not repeated herein.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit may be implemented in the form of hardware, or may also be implemented in the form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and the like.
Embodiments of the present application also provide a computer program product containing instructions, which when run on a computer, causes the computer to execute the map region segmentation method as described above.
Claims (10)
1. A map region segmentation method, the method comprising:
preprocessing the initial grid map to obtain a target grid map;
determining the minimum distance value between each pixel point in the target grid map and the corresponding nearest obstacle point, and taking the minimum distance value corresponding to each pixel point as the gray value of each pixel point;
respectively taking each minimum distance value as a binarization threshold value, and performing binarization processing on the gray value of each pixel point to determine at least one initial contour region;
expanding each of the at least one initial contour region to obtain at least one target contour region of the target grid map.
2. The method according to claim 1, wherein the binarizing the gray value of each pixel point by using each minimum distance value as a binarization threshold to determine at least one initial contour region comprises:
respectively taking each minimum distance value as a binarization threshold value, and performing binarization processing on the gray value of each pixel point to determine multiple groups of regions to be defined;
and determining each undetermined contour region in a group of undetermined contour regions with the most contour regions and each contour region in the group being larger than or equal to a preset minimum contour area as at least one initial contour region.
3. The method of claim 1, wherein said expanding each of the at least one initial contour region to obtain at least one target contour region of the target grid map comprises:
simultaneously expanding each of the initial contour regions;
if the boundary coordinates of each initial contour region at the current moment meet a preset expansion ending condition, stopping expanding each initial contour region;
and if the expansion of each initial contour region is stopped, determining at least one target contour region.
4. The method of claim 3, wherein the end-of-dilation condition comprises: 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 coordinates of obstacle pixels corresponding to the obstacle points in the target grid map, wherein the other contour regions are contour regions of the at least one initial contour region except for the initial contour regions.
5. The method of claim 1, wherein preprocessing the initial grid map to obtain the target grid map comprises:
acquiring the initial grid map, and removing other obstacle points which are not communicated with the boundary obstacle points in the initial grid map to obtain a de-noised grid map, wherein the other obstacle points are obstacle points except the boundary obstacle points in the initial grid map;
and carrying out binarization processing and corrosion processing on the de-noised grid map to obtain the target grid map.
6. The method of claim 5, further comprising:
marking the other barrier points which are not communicated with the boundary barrier points and the at least one target outline area in the target grid map to obtain a target subarea map.
7. The method of claim 1, wherein preprocessing the initial grid map to obtain the target grid map comprises:
and carrying out binarization processing on the gray value of each pixel point in the initial grid map based on a threshold function, and carrying out corrosion processing on the initial grid map after binarization processing based on an enode function so as to obtain a target grid map.
8. A map area division apparatus, comprising:
the processing unit is used for preprocessing the initial grid map to obtain a target grid map;
the determining unit is used for determining the minimum distance value between each pixel point in the target grid map and the corresponding nearest barrier point, and taking the minimum distance value corresponding to each pixel point as the gray value of each pixel point;
the determining unit is further configured to perform binarization processing on the gray value of each pixel point by using each minimum distance value as a binarization threshold value, so as to determine at least one initial contour region;
an expanding unit, configured to expand each of the at least one initial contour region to obtain at least one target contour region of the target grid map.
9. A map area division apparatus, comprising:
the system comprises a central processing unit, a memory and an input/output interface;
the memory is a transient memory or a persistent memory;
the central processor is configured to communicate with the memory and execute the instructions in the memory to perform the method of any of claims 1-7.
10. A computer storage medium having stored therein instructions that, when executed on a computer, cause the computer to perform the method of any one of claims 1 to 7.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210704098.3A CN114943659A (en) | 2022-06-21 | 2022-06-21 | Map area segmentation method and related device |
CN202211109954.7A CN115311172A (en) | 2022-06-21 | 2022-09-13 | Map area segmentation method and related device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210704098.3A CN114943659A (en) | 2022-06-21 | 2022-06-21 | Map area segmentation method and related device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114943659A true CN114943659A (en) | 2022-08-26 |
Family
ID=82910844
Family Applications (2)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210704098.3A Pending CN114943659A (en) | 2022-06-21 | 2022-06-21 | Map area segmentation method and related device |
CN202211109954.7A Pending CN115311172A (en) | 2022-06-21 | 2022-09-13 | Map area segmentation method and related device |
Family Applications After (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211109954.7A Pending CN115311172A (en) | 2022-06-21 | 2022-09-13 | Map area segmentation method and related device |
Country Status (1)
Country | Link |
---|---|
CN (2) | CN114943659A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116245894A (en) * | 2023-03-14 | 2023-06-09 | 麦岩智能科技(北京)有限公司 | Map segmentation method and device, electronic equipment and medium |
CN117237596A (en) * | 2023-11-15 | 2023-12-15 | 广州市易鸿智能装备股份有限公司 | Image recognition method, device, computer equipment and storage medium |
-
2022
- 2022-06-21 CN CN202210704098.3A patent/CN114943659A/en active Pending
- 2022-09-13 CN CN202211109954.7A patent/CN115311172A/en active Pending
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116245894A (en) * | 2023-03-14 | 2023-06-09 | 麦岩智能科技(北京)有限公司 | Map segmentation method and device, electronic equipment and medium |
CN116245894B (en) * | 2023-03-14 | 2023-09-22 | 麦岩智能科技(北京)有限公司 | Map segmentation method and device, electronic equipment and medium |
CN117237596A (en) * | 2023-11-15 | 2023-12-15 | 广州市易鸿智能装备股份有限公司 | Image recognition method, device, computer equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN115311172A (en) | 2022-11-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN115311172A (en) | Map area segmentation method and related device | |
Farag et al. | Edge linking by sequential search | |
CN111008597A (en) | Space identification method and device for CAD drawing, electronic equipment and storage medium | |
CN113012210B (en) | Method and device for generating depth map, electronic equipment and storage medium | |
CN111539238B (en) | Two-dimensional code image restoration method and device, computer equipment and storage medium | |
CN109993753B (en) | Method and device for segmenting urban functional area in remote sensing image | |
CN112634301A (en) | Equipment area image extraction method and device | |
CN112150371A (en) | Image noise reduction method, device, equipment and storage medium | |
CN112785492A (en) | Image processing method, image processing device, electronic equipment and storage medium | |
Zeng et al. | Nearest neighbor based digital restoration of damaged ancient Chinese paintings | |
CN110163894B (en) | Sub-pixel level target tracking method based on feature matching | |
CN114862897A (en) | Image background processing method and device and electronic equipment | |
CN112598687B (en) | Image segmentation method and device, storage medium and electronic equipment | |
CN112734837B (en) | Image matching method and device, electronic equipment and vehicle | |
CN112561919A (en) | Image segmentation method, device and computer readable storage medium | |
CN116739943A (en) | Image smoothing method and target contour extraction method | |
CN111242140B (en) | Method for rapidly extracting contour line under non-uniform illumination | |
CN111382834B (en) | Confidence degree comparison method and device | |
CN114025089A (en) | Video image acquisition jitter processing method and system | |
CN111626966A (en) | Sonar image denoising model training method and device and readable storage medium thereof | |
CN117994277B (en) | Target segmentation method, device, medium and system for non-uniform illumination image | |
CN112652004B (en) | Image processing method, device, equipment and medium | |
CN110264488A (en) | A kind of bianry image edge extraction device | |
CN113139975B (en) | Road feature-based pavement segmentation method and device | |
CN117152622B (en) | Boundary optimization model training, boundary optimization method, device, equipment and medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
WD01 | Invention patent application deemed withdrawn after publication | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20220826 |