A non-transitory computer-readable storage medium storing a computer program including instructions, which when executed by a processor, cause the processor to perform a map optimization method comprising:
- obtaining an original map of a work zone generated by an autonomous mobile device while the autonomous mobile device moves in the work zone, the original map including an explore zone, a covered zone, an obstacle zone;
- separating a wall zone from the obstacle zone;
- and
- determining and deleting an error zone from the explore zone in view of the covered zone and the obstacle zone,
- wherein determining and deleting the error zone from the explore zone in view of the covered zone and the obstacle zone, includes:
- extracting an outer profile of the explore zone, to obtain an explore zone profile line;
- extracting an outer profile of the covered zone, to obtain a covered zone profile line;
- with regard to a plurality of key points on the covered zone profile line, expanding the covered zone outwardly based on the plurality of key points on the covered zone profile line until the covered zone touches the obstacle zone and/or the explore zone profile line, to obtain an expanded covered zone;
- with regard to a plurality of key points on the explore zone profile line, searching toward an inside of the explore zone based on the plurality of key points on the explore zone profile line, to determine a first error zone, wherein the first error zone is located between the explore zone profile line and the obstacle zone, and has no overlap with the expanded covered zone;
- and
- deleting the first error zone from the explore zone, to obtain a first optimized map,
- wherein the method further comprises:
- deleting a zone corresponding to the obstacle zone from an explore zone in the first optimized map, to obtain a partitioned map, the partitioned map including a plurality of explore zone blocks;
- determining a second error zone from the plurality of explore zone blocks, wherein the second error zone has no overlap with the covered zone, and has at least one edge that is not adjacent to the obstacle zone;
- and
- deleting the second error zone from the explore zone in the first optimized map, to obtain a second optimized map,
- wherein, the obstacle zone includes an ordinary obstacle zone;
- wherein the method further includes optimizing the wall zone after the wall zone is separated from the obstacle zone, and
- wherein optimizing the wall zone includes:
- performing a dilation operation or a profile filling operation on a location corresponding to the ordinary obstacle zone in the second optimized map, to fill a cavity in the second optimized map, and performing a smooth operation on an edge of an explore zone in the second optimized map, to obtain a third optimized map;
- extracting an outer profile of an explore zone in the third optimized map, to obtain a new explore zone profile line;
- with regard to the new explore zone profile line, performing a straightening operation on an edge of the new explore zone profile line within a margin of error, to obtain a new outer wall zone profile line;
- and
- with regard to a plurality of key points on the new outer wall zone profile line, searching toward an inside of the third optimized map based on the plurality of key points on the new outer wall zone profile line, to obtain a new wall zone profile line.