Map inner and outer contour identification method
By preprocessing the grid map of the robotic vacuum cleaner and segmenting the door frame points, the boundary lines are extracted as the map skeleton, solving the problems of high computing resources and insufficient scene semantic understanding in the existing technology, and realizing efficient recognition and visualization experience of real-time map contours.
Patent Information
- Application Number
- CN202411010805.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-26
- Publication Date
- 2026-02-03
AI Technical Summary
Existing robotic vacuum cleaners require high computational resources and time when using two-dimensional maps for navigation and path planning, which cannot meet the need for real-time map outline generation and cannot fully understand scene semantics. Users find it difficult to intuitively understand the passable locations near doors and the boundaries of inaccessible walls in real time.
Image processing techniques are used to preprocess the raster map. The map is scanned using a total room mask and the target room area is segmented by searching for door frame points. After dilation processing, the boundary lines are extracted, the map skeleton is set, and the outer contour, inner contour, and door frame boundary lines are identified. This reduces the computational power of semantic classification and improves the efficiency of map recognition.
It fulfills the requirement of generating map outlines in real time, improves the robot's efficiency in understanding scene semantics, and allows users to intuitively understand the passable locations near doors and the boundaries of impassable walls in real time.
Smart Images

Figure CN121459010A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and specifically to a method for recognizing the inner and outer contours of a map. Background Technology
[0002] Currently, robotic vacuum cleaners are widely used in homes and commercial spaces for automated cleaning. However, existing robotic vacuum cleaners typically use two-dimensional maps for navigation and path planning, allowing users to more intuitively understand the robot's operation and environmental layout through a two-dimensional map on a mobile application.
[0003] Chinese invention patent application number CN202111419022.8 uses deep learning to identify and segment rooms based on the semantic information of rooms in raster images. Specifically, it obtains images of designated regions with door features through a semantic segmentation network, processes the images through several pooling layers of different scales, and performs pixel-level classification on the features of the pooled images. Then, it upsamples the pooled images several times, and after each upsampling, it fuses the features of the same scale corresponding to the number of channels in the pooling process, and then obtains the doors in the topographic map from the fused image.
[0004] The Chinese invention patent with patent application number CN202311809668.6 describes a robot that uses a convolutional neural network to obtain doors from an environmental map in a fused image and connects the doors to obtain room areas divided from the environmental map. The robot performs line fitting on the pixels of each contour edge that makes up the room area to obtain polygons of the room area. The robot also calculates the pixel coordinates of the centroid of the polygon using a summation formula based on the pixel coordinates of the centroid of the triangle and the area, and then sets the center point of the room area by judging the positional relationship between the centroid and the polygon.
[0005] The aforementioned patents often require significant computing resources and time, making it impossible to meet the demands of real-time generation. Furthermore, the robot's understanding of scene semantics is limited to areas divided by doors, failing to comprehensively grasp the contour features of each room area. This results in users being unable to intuitively and in real-time understand the truly passable locations near doors and the boundaries of impassable walls when viewing map images on electronic device screens. Summary of the Invention
[0006] This application discloses a method for recognizing the inner and outer contours of a map, and the specific technical solution is as follows: A method for recognizing the inner and outer contours of a map, wherein the main body executing the method is a robot equipped with a ranging sensor. When the robot walks in an indoor environment, it scans environmental data using the ranging sensor to construct a grid map. The method includes: Step 1, preprocessing a pre-constructed grid map to obtain an initial map; then executing Step 2; Step 2, using the pre-constructed grid map to form a general room mask, then controlling the general room mask to scan the initial map to obtain an effective room map, and marking each target room area within the effective room map with different identifier values as pixel values; then executing Step 3; Step 3, detecting the pixel values of each location point within the effective room map, and searching for door frame points based on the pixel values within the connected components of location points in each target room area whose pixel values are not zero, then using the searched door frame points to form corresponding... The target door frame point set is used to form the boundary line between two adjacent target room areas in the effective room map; then, each target room area is segmented by deleting each target door frame point set in the effective room map; then step 4 is executed; step 4: control each target room area segmented in step 3 to expand simultaneously until all adjacent target room areas in the effective room map have boundary lines that intersect or overlap, then control all target room areas in the effective room map to stop expanding, and obtain the expanded target room areas; then step 5 is executed; step 5: use the boundary lines of the expanded target room areas in step 4 to set the map skeleton, and then step 6 is executed; step 6: set the outermost boundary of the map skeleton as the outer contour, and then control the map skeleton to subtract the outer contour to obtain the inner skeleton; then identify the inner contour and door frame boundary line in each position point of the inner skeleton; where the door frame boundary line is composed of door frame points in the target door frame point set.
[0007] In summary, this application first preprocesses the grid map using image processing techniques and converts the pre-set room sub-information into a total room mask. The total room mask is then applied to the preprocessed grid map to obtain an effective room map. Next, the effective room map is segmented into different target room regions by searching for door frame points. Each target room region is then simultaneously expanded. The map skeleton is then set based on the boundary lines of all expanded target room regions. Based on the outermost boundary and door frame points, the map skeleton is split into outer contours, inner contours, and door frame boundaries, which are identified as the type of boundary lines expanded from multiple room regions simultaneously. This allows for the differentiation of the contours of the front and back sides of a door or the walls extending from the left and right sides of a door, thereby expanding the robot's understanding of scene semantics to different types of contours in all room regions.
[0008] Compared with existing technologies, the internal and external contour recognition method disclosed in this application does not use algorithms such as deep learning algorithms that rely on feature training and learning to process points and lines in map images, nor does it perform straight line fitting. Instead, it applies a total room mask to scan the map and uses door frame points to segment the map. After obtaining multiple room regions, it extracts the boundary lines of the room regions as the map skeleton, and then performs classification processing on the map skeleton. This reduces the computational power required for semantic classification of the boundary information of each room region within the map image, improves map recognition efficiency, enhances the robot's understanding of scene semantics, meets the need for real-time generation of map contour display information, improves the user's visualization experience of various map contours, and allows users to intuitively understand the truly passable locations near doors and the boundaries of impassable walls in real time. Attached Figure Description
[0009] Figure 1 This application discloses a flowchart illustrating a method for recognizing the inner and outer contours of a map, as one embodiment of the present application.
[0010] Figure 2 This is a black-and-white planar schematic diagram of the initial map preprocessed according to one embodiment of this application.
[0011] Figure 3 This is a plan view of the overall room mask disclosed in one embodiment of this application.
[0012] Figure 4 This is a black-and-white plan view of an effective room map disclosed in one embodiment of this application.
[0013] Figure 5 This is a schematic diagram of the map skeleton formed by expanding the various target room areas within an effective room map disclosed in one embodiment of this application.
[0014] Figure 6 This application discloses an embodiment of the method for... Figure 5 A schematic diagram illustrating the classification process of the map skeleton. Detailed Implementation
[0015] The technical solutions of the embodiments of the present invention will be described in detail below with reference to the accompanying drawings. To further illustrate the embodiments, the present invention provides accompanying drawings. These drawings are part of the disclosure of the present invention, mainly used to illustrate the embodiments, and can be used in conjunction with the relevant descriptions in the specification to explain the operating principles of the embodiments. With reference to these drawings, those skilled in the art should be able to understand other possible implementation methods and the advantages of the present invention. The components in the figures are not drawn to scale, and similar component symbols are generally used to represent similar components.
[0016] As one embodiment, this application discloses a method for recognizing the inner and outer contours of a map. The main body executing the method is a robot equipped with a ranging sensor. When the robot walks in an indoor environment, it scans environmental data through the ranging sensor to construct a grid map. For example, the robot scans the indoor working environment through a laser sensor to obtain the contour information of the indoor working environment described by laser points and line segments, including the contour information of the outer and inner walls, and constructs the grid map. It can also divide the indoor working environment into various room areas, which can be understood as dividing each template room area in the grid map. The boundary lines of each template room area will include the outer wall, the door frame line (the dividing line between two room areas), and the inner wall contour. If the marking of obstacles is excluded, the internal area of the template room area is regarded as a passable area.
[0017] like Figure 1 As shown, the inner and outer contour recognition method includes: Step 1: Preprocess the pre-built raster map to obtain the initial map, such as... Figure 2 The black and white effect planar diagram is shown, which is equivalent to a binary map. Specifically, the pixel value of the passable location point in the initial map is configured as pixel value 1, and the pixel value of the location point other than the passable location point in the initial map is configured as pixel value 0; then step 2 is executed.
[0018] The preprocessing of the constructed grid map by the robot involves a series of image processing techniques, including but not limited to denoising, smoothing edges, erosion, dilation and other image morphological transformations on the grid map.
[0019] Step 2: A master room mask is constructed using the pre-built raster map, which has been divided into various template room areas. This master room mask is then used to scan the initial map to obtain a valid room map, limiting the valid room map to the coverage area of the master room mask. Within this valid room map, each target room area is marked with a different identifier value as its pixel value. Specifically, the pixel value of each target room area is represented by the identifier value of the corresponding covered template room area. This ensures map readability. Then, Step 3 is executed. This transforms the room-divided information of the initial map into a master room mask, which is then used to extract the valid room map from the initial map.
[0020] Since the target room area is a unit area simulating the robot's work in an indoor environment, it can be directly configured as a passable area. In some embodiments, different target room areas are filled with different colors because the pixel values of different target room areas are different.
[0021] The division of each template room area can utilize the area dividing lines provided in Chinese invention patent application number CN202010415909.9, combined with... Figure 3 It can be seen that template room areas #ID1, #ID2, #ID3, #ID4, #ID5, #ID6, #ID7, #ID8, #ID9, #ID10, and #ID11 are pre-divided from the grid map using area dividing lines. These 11 template room areas are then stitched together to form... Figure 3 The diagram shows the overall room mask. Different template room areas have different pre-configured identifier values, and apart from the boundary lines, there are no overlapping areas between the template room areas. Therefore, the overall room mask is used in this application to describe the distribution pattern of each template room area. Thus, in comparison... Figure 2 , Figure 3 and Figure 4 It can be seen that, Figure 3 The total room mask shown in this application is used for description Figure 2 The initial map shown includes all passable areas, including connected areas of different template rooms, but excluding isolated areas; based on this... Figure 3 Total room mask scan shown Figure 2 The initial map shown is obtained. Figure 4 The valid room map shown.
[0022] Step 3: Detect the pixel values of each location point within the valid room map, and search for door frame points based on the pixel values within the connected components of location points in each target room region whose pixel values are not zero. Specifically, within a target room region, search for location points with different pixel values (different identifier values, spanning different room regions) within the connected components of at least one location point whose pixel value is not zero. Then, for each target room region, use the searched door frame points to form corresponding target door frame point sets to create the boundary lines between adjacent target room regions in the valid room map. That is, a boundary line is formed between every two adjacent target room regions using the corresponding target door frame point sets. Then, segment each target room region by deleting each target door frame point set from the valid room map, thereby obtaining door frame information and segmenting each target room region; then proceed to Step 4.
[0023] The original target room areas within the effective room map were connected, and the boundary lines between the target room areas corresponded to the locations of door frames. (Illustratively, in...) Figure 4 Within the valid room map shown, proceed to step 3 to... Figure 4The valid room map shown is divided into target room areas #ID1', #ID2', #ID3', #ID4', #ID5', #ID6', #ID7', #ID8', #ID9', #ID10', and #ID11'. Figure 4 In the diagram, adjacent target room areas are separated by white dashed lines to delineate each target room area, making each area independent. The actual pixel values of points within each target room area are different. The value represented by #ID1' is set to the pixel value of each point within target room area #ID1', the value represented by #ID2' is set to the pixel value of each point within target room area #ID2', the value represented by #ID3' is set to the pixel value of each point within target room area #ID3', the value represented by #ID4' is set to the pixel value of each point within target room area #ID4', and the value represented by #ID5' is set to the pixel value of each point within target room area #ID4'. The pixel values of each location point within room area #ID5' are set to the pixel values of each location point within the target room area #ID6', #ID7', #ID8', #ID9', #ID10', and #ID11'.
[0024] In some embodiments, the target room area is determined by the length of the longest side. If the longest side is more than three times the second longest side, i.e., it is a rectangle, it is identified as a corridor; otherwise, it is identified as a room. The identified rooms and corridors are labeled, indicating which rectangular areas are rooms, which are corridors, and which room number they are, etc., generating corresponding segmentation maps or topology maps.
[0025] Step 4: Control the expansion of each target room region segmented in Step 3 simultaneously. This is equivalent to making each target room region compete to expand until all adjacent target room regions in the effective room map have boundary lines that intersect, partially overlap, or completely overlap. At this point, control all target room regions in the effective room map to stop expanding. The target room region in the expansion process is defined as the expanded target room region. The original target room region is then enveloped to obtain the expanded target room region. Each expanded target room region has a boundary line that overlaps or intersects with at least one adjacent expanded target room region. This allows each target room region to compete to expand using its own bounding rectangle as the target bounding polygon. Then, proceed to Step 5.
[0026] Indicatively, in contrast Figure 4 and Figure 5 It can be seen that, Figure 4 The target room area #ID1' becomes the target room area through step 4. Figure 5 The first expansion room area #ID1'', Figure 4 The target room area #ID2' becomes the target room area through step 4. Figure 5 The second expansion room area #ID2'', Figure 4 The target room area #ID3' becomes the target room area through step 4. Figure 5 The third expanded room region #ID3'' (expanded into the outer rectangle of the target room region #ID3'). Figure 4 The target room area #ID4' becomes the target room area through step 4. Figure 5 The fourth expansion room area #ID4'' Figure 4 The target room area #ID5' becomes the target room area through step 4. Figure 5 The fifth expansion room area #ID5'' Figure 4 The target room area #ID6' becomes the target room area through step 4. Figure 5 The sixth expanded room region #ID6'' (expanded into the outer rectangle of the target room region #ID6'). Figure 4 The target room area #ID7' becomes the target room area through step 4. Figure 5 The seventh expansion room area #ID7'' Figure 4 The target room area #ID8' becomes the target room area through step 4. Figure 5 The eighth expanded room region #ID8'' (expanded into the outer rectangle of the target room region #ID8'). Figure 4 The target room area #ID9' becomes the target room area through step 4. Figure 5 The ninth expanded room region #ID9'' (expanded into the outer rectangle of the target room region #ID9'). Figure 4 The target room area #ID10' becomes the target room area through step 4. Figure 5 The tenth expansion room area #ID10'' Figure 4 The target room area #ID11' becomes the target room area through step 4. Figure 5 The eleventh expansion room area #ID11''.
[0027] Within the effective room map, a partially expanded target room area may simultaneously have boundary lines that partially or completely overlap with those of six adjacent expanded target room areas, such as... Figure 5 As shown in the eleventh expanded room region #ID11'' (the expanded target room region #ID11'), the eleventh expanded room region #ID11'' simultaneously overlaps with the corresponding boundary lines of the first expanded room region #ID1'' (i.e., the expanded target room region #ID1'), the third expanded room region #ID3'' (i.e., the expanded target room region #ID3'), the fourth expanded room region #ID4'' (i.e., the expanded target room region #ID4'), the fifth expanded room region #ID5'' (i.e., the expanded target room region #ID5'), the seventh expanded room region #ID7'' (i.e., the expanded target room region #ID7'), and the tenth expanded room region #ID10'' (i.e., the expanded target room region #ID10').
[0028] In addition to overlapping with the boundary lines of adjacent expanded target room areas, some expanded target room areas also overlap with the boundary lines of closed areas (not belonging to expanded target room areas), such as... Figure 5 As shown in the eighth expanded room region #ID8'' (i.e., the expanded target room region #ID8'), the eighth expanded room region #ID8'' has a line segment region that coincides with the corresponding boundary line of region #O2, the corresponding boundary line of the sixth expanded room region #ID6'' (i.e., the expanded target room region #ID6'), and the corresponding boundary line of the ninth expanded room region #ID9'' (i.e., the expanded target room region #ID9').
[0029] The pixel values of each location point within each expanded target room region are represented by the corresponding identifier value of the expanded target room region. The identifier values of the target room regions before and after expansion are the same; the difference lies only in the pixel values within the expanded target room region. Figure 4 and Figure 5 The reference numerals in the attached figures are different.
[0030] Step 5: Use the boundary lines of the expanded target room regions from Step 4 to set the map skeleton, and then proceed to Step 6. Step 5, in order to set the map skeleton, first extracts the overlapping and non-overlapping boundary lines in each expanded target room region. Then, all overlapping and non-overlapping boundary lines are drawn onto an image to obtain the map skeleton. Since each expanded target room region is the result of competitive expansion using its own orthogonal circumscribed rectangle as the target circumscribed polygon, executing Step 5 yields a neat and aesthetically pleasing map image.
[0031] It should be noted that the map skeleton of this application is suitable for 3D mapping and displays the map image in a 3D style on the terminal display interface of the electronic device. Specifically, the application will render the 3D style map image through a plugin.
[0032] Step 6: Set the outermost boundary of the map skeleton as the outer contour, then subtract the outer contour from the map skeleton to obtain the inner skeleton. Next, identify the inner contour and door frame boundaries at various points within the inner skeleton. Specifically, identify the door frame boundaries at points in the inner skeleton where the pixel value is not zero, thus distinguishing the inner contour. When the outer contour, inner contour, and door frame boundaries are displayed on the electronic device's screen, the application will render a 3D-style map outline through system software plugins, enabling the outer contour, inner contour, and door frame boundaries distinguished in the 2D plane to be rendered as outlines in the 3D map.
[0033] By performing step 6, the boundary lines in the map skeleton are divided into three parts: outer contour, inner contour, and door frame dividing line, point by point at each location. The outermost boundary of the map skeleton (i.e., the outer contour) surrounds the inner contour and the door frame dividing line, and the inner contour and the door frame dividing line can be connected.
[0034] In some embodiments, the outer contour, inner contour, and door frame boundary line of each expanded target room area can be displayed sequentially according to the size relationship between the identification values of each expanded target room area.
[0035] In step 6, the door frame boundary line is composed of door frame points within the target door frame point set. When step 4 detects that all two adjacent target room areas in the expansion process within the effective room map have intersecting, partially overlapping, or completely overlapping boundary lines, there is a door frame boundary line in the boundary line between the two adjacent expanded target room areas. This boundary line is connected to the map skeleton in step 5, enabling step 6 to identify the door frame boundary line by searching for door frame points, and then extract the inner contour from the map skeleton.
[0036] It should be noted that this application can set door frame boundaries within the effective room map. These boundaries may or may not include actual walls, thus enriching the area division patterns within the effective room map in conjunction with the distribution of actual walls. Connectivity is reserved for the room areas on both sides of the door frame boundaries (the expanded target room area), allowing for more flexible definition of the robot's actual passage area. The outer contour refers to the outer wall of the effective room map, and the inner contour refers to the inner wall of the effective room map.
[0037] In summary, this application first preprocesses the grid map using image processing techniques and converts the pre-set room sub-information into a total room mask. The total room mask is then applied to the preprocessed grid map to obtain an effective room map. Next, the effective room map is segmented into different target room regions by searching for door frame points. Each target room region is then simultaneously expanded. The map skeleton is then set based on the boundary lines of all expanded target room regions. Based on the outermost boundary and door frame points, the map skeleton is split into outer contours, inner contours, and door frame boundaries, which are identified as the type of boundary lines expanded from multiple room regions simultaneously. This allows for the differentiation of the contours of the front and back sides of a door or the walls extending from the left and right sides of a door, thereby expanding the robot's understanding of scene semantics to different types of contours in all room regions.
[0038] Compared with existing technologies, the internal and external contour recognition method disclosed in this application does not use algorithms such as deep learning algorithms that rely on feature training and learning to process points and lines in map images, nor does it perform straight line fitting. Instead, it applies a total room mask to scan the map and uses door frame points to segment the map. After obtaining multiple room regions, it extracts the boundary lines of the room regions as the map skeleton, and then performs classification processing on the map skeleton. This reduces the computational power required for semantic classification of the boundary information of each room region within the map image, improves map recognition efficiency, enhances the robot's understanding of scene semantics, meets the need for real-time generation of map contour display information, improves the user's visualization experience of various map contours, and allows users to intuitively understand the truly passable locations near doors and the boundaries of impassable walls in real time.
[0039] As one embodiment, in step 4, when the boundary line of a target room area in one expansion process extends into the target room area in any other expansion process within the effective room map, it is determined that the boundary lines of the target room areas in two adjacent expansion processes intersect, partially overlap, or completely overlap. This expansion process is a competitive expansion. In step 4, each target room area expands simultaneously. When the boundary line of a target room area in one expansion process extends into the target room area in any other expansion process, it can also be understood that the boundary spacing between two adjacent expanded target room areas is zero.
[0040] The boundary lines of each expanded target room region are connected to form the bounding polygon of the corresponding target room region segmented in step 3, or each expanded target room region is surrounded by the bounding polygon of the corresponding target room region segmented in step 3. The bounding polygon can be obtained by a pre-configured closure detection function.
[0041] The target bounding polygon that a target room area can be expanded into through step 4 is a bounding rectangle. This bounding rectangle encloses the expanded target room area. However, when it expands into any other target room area in the expansion process, the shape that can be expanded into through step 4 is mostly not a bounding rectangle, but a concave polygon inside the bounding rectangle.
[0042] When the circumscribed polygon of the target room area is a circumscribed rectangle used to enclose a target room area, each circumscribed rectangle is provided with at least one door frame dividing line, so that each expanded target room area is adjacent to at least one expanded target room area to form the two adjacent expanded target room areas.
[0043] Indicatively, such as Figure 5 As shown, the eleventh expanded room region #ID11'' is simultaneously adjacent to the first expanded room region #ID1'', the third expanded room region #ID3'', the fourth expanded room region #ID4'', the fifth expanded room region #ID5'', the seventh expanded room region #ID7'', and the tenth expanded room region #ID10''. The first expanded room region #ID1'', the third expanded room region #ID3'', the fourth expanded room region #ID4'', the fifth expanded room region #ID5'', the seventh expanded room region #ID7'', and the tenth expanded room region #ID10'' each form two adjacent expanded target room regions with the eleventh expanded room region #ID11''.
[0044] The eighth expanded room region #ID8'' is simultaneously adjacent to the sixth expanded room region #ID6'' and the ninth expanded room region #ID9''. The sixth expanded room region #ID6'' and the ninth expanded room region #ID9'' each form two adjacent expanded target room regions with the eighth expanded room region #ID8''.
[0045] The fifth expanded room region #ID5'' and the sixth expanded room region #ID6'' are adjacent to each other, forming two adjacent expanded target room regions.
[0046] The seventh expanded room region #ID7'' and the ninth expanded room region #ID9'' are adjacent to each other, forming two adjacent expanded target room regions.
[0047] The second expanded room region #ID2'' is simultaneously adjacent to both the first expanded room region #ID1'' and the fourth expanded room region #ID4''. The first expanded room region #ID1'' and the fourth expanded room region #ID4'', together with the second expanded room region #ID2'', form two adjacent expanded target room regions.
[0048] The boundary line where the door frame dividing line is located is the dividing line between two adjacent circumscribed rectangles. That is, the two sides of a door frame dividing line are two adjacent expanded target room areas. Step 3 divides the two adjacent expanded target room areas within the same map area by deleting the door frame dividing line. Part of the boundary line of the circumscribed rectangle or the door frame dividing line can allow the robot to pass through, but it will be displayed as a solid line boundary. Figure 5 middle.
[0049] During the expansion of each target room region toward its own orthogonal circumscribed rectangle (target circumscribed polygon), the target room regions in each expansion process compete simultaneously. When a point that has expanded encounters an adjacent target room region, that point will not be expanded. This expansion continues until the boundary line of one of the target room regions in one expansion process extends into any other target room region in another expansion process. At this point, it is determined that the boundary lines of the two adjacent target room regions in the expansion process intersect or coincide. The boundary of the two adjacent target room regions in the expansion process is extended relative to the boundary of the target room region before expansion, and can cover the position covered by the target door frame point set. That is, the boundary of the target room region is extended to the position of the door frame point that was deleted in step 3. Then, the target door frame point set is used as the dividing line between the two adjacent expanded target room regions in the effective room map.
[0050] like Figure 5 As shown, Figure 5 During the simultaneous expansion of target room region #ID1' and target room region #ID2', Figure 4 After expansion, the left and right boundary lines and the bottom boundary line of the target room region #ID1' in the middle are in contact with the expanded area of the target room region #ID2', thus obtaining the first expanded room region #ID1'' and the second expanded room region #ID2'' with partially overlapping boundary lines. Figure 4 The target room area #ID1' becomes the target room area through step 4. Figure 5When the first expanded room region #ID1'' is defined, the first expanded room region #ID1'' is not the orthogonal circumscribed rectangle of the target room region #ID1', but rather a concave polygon surrounded by the orthogonal circumscribed rectangle. The door frame boundary line L8L9 is set on the concave side of the first expanded room region #ID1'', so that the door frame is unrelated to the circumscribed rectangle.
[0051] Each expanded target room region contains door frame points found in step 3 along its partial boundary line, such that some or all of the line segments along the overlapping boundary lines between two adjacent expanded target room regions are door frame dividing lines; schematically, Figure 6 In the boundary line coinciding between the first expanded room region #ID1'' and the second expanded room region #ID2'', boundary line L1L4 is the coinciding boundary line between the first expanded room region #ID1'' and the second expanded room region #ID2''. The dashed line L2L3 within boundary line L1L4 is the door frame boundary line. The door frame points within the door frame boundary line are the points searched from the target door frame point set in step 3. Dashed line L2L3 is the unique door between the first expanded room region #ID1'' and the second expanded room region #ID2'', and dashed line L8L9 is the unique door between the first expanded room region #ID1'' and the eleventh expanded room region #ID11''. Dashed lines L2L3 or L8L9 are door frame boundary lines. Thus, by regularizing multiple door frames existing in the same room region using the circumscribed polygon of the target room region, door frame boundary lines are provided for the map skeleton.
[0052] As one embodiment, in step 5, each boundary line of each expanded target room area is sequentially searched, and then all the searched boundary lines are merged into one frame image to obtain a map skeleton. The map skeleton is a contour image formed by sequentially connecting all the searched boundary lines. Figure 5 As shown, after executing step 4, the robot sequentially obtains the first expanded room region #ID1'', the second expanded room region #ID2'', the third expanded room region #ID3'', the fourth expanded room region #ID4'', the fifth expanded room region #ID5'', the sixth expanded room region #ID6'', the seventh expanded room region #ID7'', the eighth expanded room region #ID8'', the ninth expanded room region #ID9'', the tenth expanded room region #ID10'', and the eleventh expanded room region #ID11''. It then searches for each boundary line of each expanded room region (i.e., the expanded target room region) and defines the corresponding range based on all boundary lines within the same expanded room region. Finally, based on the positional relationship between the expanded room regions, it lays out all the boundary lines (i.e., the region outline, including overlapping and non-overlapping boundary lines) of each expanded room region onto the same frame image, obtaining... Figure 5 The image composed of polygonal regions, i.e., the skeleton map, makes the displayed map image neat and aesthetically pleasing, and displays it with solid line boundaries. Figure 5 middle.
[0053] The skeleton in the map skeleton refers to the boundary lines of each expanded room area connected sequentially, which is used to represent the distribution of the inner and outer contours / boundary lines of all expanded target room areas in step 4.
[0054] As one embodiment, in step 6, the method of setting the outermost boundary of the map skeleton as the outer contour includes: setting the boundary line between two adjacent expanded target room areas that do not overlap and are not completely surrounded by the corresponding expanded target room area as the outer contour; wherein, the outer contour forms a closed area, which is used to surround the inner contour and the door frame dividing line, so as to surround all expanded target room areas, and also to make the outer contour used to describe the overall contour of the periphery of all expanded target room areas.
[0055] Specifically, a portion of the boundary line of any expanded target room region coincides with the corresponding boundary line of an adjacent expanded target room region; except for one expanded target room region that is completely surrounded by multiple adjacent expanded target room regions, other expanded target room regions have non-coincident boundary lines, which are connected sequentially to form the outer contour.
[0056] like Figure 6 As shown, the boundary lines required to form the outer contour are as follows, based on the boundary lines of the expanded room area: In the first expansion room region #ID1'', the outer contour includes boundary line L1P1, boundary line P1P2 and boundary line P2L26.
[0057] In the second expansion room region #ID2'', the outer contour includes boundary line L1P15, boundary line P15P14, and boundary line P14L14.
[0058] In the third expansion room region #ID3'', the outer contour includes boundary line L27P3, boundary line P3P4, and boundary line P4L29.
[0059] In the fourth expansion room region #ID4'', the outer contour includes boundary line L14P13 and boundary line P13L20.
[0060] In the fifth expansion room region #ID5'', the outer contour includes boundary line L30P5 and boundary line P5P6.
[0061] In the sixth expansion room region #ID6'', the outer contour includes the boundary line P6L40.
[0062] In the seventh expansion room region #ID7'', the outer contour includes the boundary lines L47L48.
[0063] In the eighth expansion room region #ID8'', the outer contour includes boundary line L40P7, boundary line P7P8 and boundary line P8L51.
[0064] In the ninth expansion room region #ID9'', the outer contour includes boundary line L51P9 and boundary line P9L48.
[0065] In the tenth expansion room region #ID10'', the outer contour includes boundary line L21P12, boundary line P12P11, and boundary line P11L25.
[0066] In the eleventh expansion room region #ID11'', the outer contour includes boundary lines L25P10, P10L47, L21L20, L26L27, and L29L30.
[0067] As one embodiment, in step 6, the method for identifying the inner contour and door frame boundary line at various locations within the inner skeleton includes: the robot traversing various locations along the inner skeleton, thereby traversing the pixel values of various locations within the area enclosed by the outer contour in a certain clockwise direction or in order of the size of the identifier value (the identifier values of the target room areas before and after expansion are equal); and determining whether the currently traversed location is a door frame point. If it is, the currently traversed location is marked as a door frame point in the map skeleton to form a door frame boundary line in the connected domain between two adjacent expanded target room areas; otherwise, the currently traversed location is marked as an inner contour point to form an inner contour at the wall between two adjacent expanded target room areas. Therefore, in the connected domain between two adjacent expanded target room areas, if multiple door frame points are continuously detected and the multiple door frame points are distributed near a straight line segment, a door frame boundary line can be fitted; if multiple door frame points are continuously detected and the multiple door frame points are located on the same straight line segment, the door frame boundary line can be formed sequentially. Similarly, between two adjacent expanded target room areas, if all positions except the door frame point are continuously traversed in the inner skeleton, the currently continuously traversed positions are connected in sequence to form the inner contour.
[0068] After traversing all the positions in the inner skeleton, door frame points and inner contour points can be identified from each position point in the inner skeleton where the pixel value is not zero. By connecting the corresponding door frame points, door frame boundaries are formed at the connected domain between two adjacent expanded target room areas. And by connecting the corresponding inner contour points, inner contours are formed at the walls between two adjacent expanded target room areas.
[0069] In summary, this application distinguishes between door frame boundaries and inner contours in the map skeleton. The boundary lines connecting the two sides of the door frame boundaries may or may not contain actual walls. The boundary lines connecting the two sides of the door frame boundaries are those where actual walls exist. The inner contour is the boundary line connecting the two sides of the door frame boundaries, but it is not the door frame boundaries. The outer contour is the outer wall of the effective room map, and the inner contour is the inner wall of the effective room map. This, combined with the distribution of actual walls, enriches the area division patterns within the effective room map / map skeleton, reserving connected regions for adjacent room areas on both sides of the door frame boundaries (expanded target room areas), and more flexibly defining the robot's actual passage area and wall environment. This improves the robot's understanding of contour types in the map scene and reduces navigation efficiency caused by the robot using incorrect connected region information.
[0070] In the above embodiments, within the closed area, there exists a sub-closed area enclosed by an inner contour. Both the sub-closed area and the closed area are regions enclosed by closed boundaries. The coverage area of the closed area is larger than that of the sub-closed area, meaning the coverage area enclosed by the outer contour is larger than that of the sub-closed area. Each boundary line of the sub-closed area is a part or all of the boundary line segments of the adjacent expanded target room areas, ensuring that each boundary line of the sub-closed area is completely surrounded by its adjacent expanded target room areas. This provides a gap between two adjacent but non-contact expanded target room areas, forming an impassable area. This improves the robot's understanding of semantic scenes, allowing the ranging information collected by the robot to reflect the truly passable locations and impassable wall boundaries near the door frame in its indoor environment. Furthermore, it enables the display of map images on electronic device screens, allowing users to intuitively understand the truly passable locations and impassable wall boundaries near the door in real time.
[0071] like Figure 6As shown, the sub-closed region #O1 has line segments that overlap with the corresponding boundary lines of the first expanded room region #ID1'', the second expanded room region #ID2'', the eleventh expanded room region #ID11'' (i.e., the expanded target room region #ID1'), and the fourth expanded room region #ID4'' (i.e., the expanded target room region #ID4'). Sub-closed region #O1 also provides a gap between the first expanded room region #ID1'' and the fourth expanded room region #ID4'', forming two adjacent but non-contact expanded target room regions. Sub-closed region #O1 also provides a gap between the second expanded room region #ID2'' and the eleventh expanded room region #ID11'', forming two adjacent but non-contact expanded target room regions.
[0072] The sub-closed region #O1 and the first expanded room region #ID1'' share the boundary line L6L7. When the robot detects the boundary line L6L7 while traversing the sub-closed region #O1 and the first expanded room region #ID1'', it marks the boundary line L6L7 as the inner contour L6L7. Similarly, the boundary lines L11L12, L12L6, and L7L11 are all marked as inner contours in sequence.
[0073] like Figure 6 As shown, the sub-closed region #O2 has a line segment region that coincides with the corresponding boundary line of the eighth expanded room region #ID8'', the corresponding boundary line of the sixth expanded room region #ID6'' (i.e. the expanded target room region #ID6'), and the corresponding boundary line of the ninth expanded room region #ID9'' (i.e. the expanded target room region #ID9').
[0074] Sub-closed region #O2 simultaneously provides a separation region for the seventh expanded room region #ID7'' and the eighth expanded room region #ID8'', forming two adjacent but non-contact expanded target room regions. Sub-closed region #O2 simultaneously provides a separation region for the sixth expanded room region #ID6'' and the ninth expanded room region #ID9'', forming two adjacent but non-contact expanded target room regions. The sub-closed region #O2 and the eighth expanded room region #ID8'' share the boundary line L42L43. When the robot detects the boundary line L42L43 while traversing the sub-closed region #O2 and the eighth expanded room region #ID8'', it marks the boundary line L42L43 as the inner contour L42L43. Similarly, the boundary lines L42L36, L36L35, L35L45, L45L44, and L44L43 are all marked as inner contours.
[0075] Indicatively, such as Figure 6 As shown in the diagram, for the composition of the inner contour and door frame boundary lines in the map skeleton, the i-th expanded room region #IDi'' is the expanded target room region #IDi' with the identifier value represented by #IDi'', and it exists that: Between the first expanded room region #ID1'' and the second expanded room region #ID2'', the door frame boundary line includes dashed lines L2 and L3, and the inner contour includes boundary lines L1 and L2, L3 and L4, L4 and L5, and L5 and L6. Between the first expanded room region #ID1'' and the eleventh expanded room region #ID11'', the door frame boundary line includes dashed lines L8 and L9, and the inner contour includes boundary lines L26 and L10, L10 and L9, and L7 and L8.
[0076] In the sub-closed region #O1, the inner contour includes boundary line L7L6 (partial line segment of the boundary line of the first expanded room region #ID1''), boundary line L11L12 (partial line segment of the boundary line of the fourth expanded room region #ID4''), boundary line L12L6 (partial line segment of the boundary line of the second expanded room region #ID2''), and boundary line L11L7 (partial line segment of the boundary line of the eleventh expanded room region #ID11'').
[0077] Between the fourth expansion room region #ID4'' and the second expansion room region #ID2'', the inner contour includes boundary lines L12L13 and L13L14.
[0078] Between the fourth expansion room region #ID4'' and the eleventh expansion room region #ID11'', the door frame dividing line includes dashed lines L11L15, and the inner contour includes boundary lines L16L17, L17L18, L18L19, and L19L20.
[0079] Between the third expansion room region #ID3'' and the eleventh expansion room region #ID11'', the door frame dividing line includes dashed lines L27 and L28, and the inner contour includes boundary lines L28 and L29.
[0080] Between the fifth expansion room region #ID5'' and the eleventh expansion room region #ID11'', the inner contour includes the boundary line L30L31.
[0081] Between the fifth expanded room region #ID5'' and the sixth expanded room region #ID6'', the inner contour includes the boundary lines L39 and L38, and the door frame dividing line includes the dashed lines L37 and L38.
[0082] Between the fifth expansion room area #ID5'' and the seventh expansion room area #ID7'', the door frame dividing line includes dashed lines L33 and L34, and the inner contour includes boundary lines L34 and L35 as well as boundary lines L32 and L33.
[0083] Between the eleventh expanded room region #ID11'' and the seventh expanded room region #ID7'', the door frame dividing line includes dashed lines L46 and L47, and the inner contour includes boundary lines L31 and L46.
[0084] Between the eleventh expansion room region #ID11'' and the tenth expansion room region #ID10'', the door frame dividing line includes dashed lines L21 and L22, and the inner contour includes boundary lines L22 and L23 as well as boundary lines L24 and L25.
[0085] Between the ninth expanded room region #ID9'' and the seventh expanded room region #ID7'', the door frame dividing line includes dashed lines L48 and L49, and the inner contour includes boundary lines L49 and L44.
[0086] In the sub-closed region #O2, the inner contour includes boundary lines L42L36 (partial line segments of the boundary line of the sixth expanding room region #ID6''), boundary lines L36L35 (partial line segments of the boundary line of the fifth expanding room region #ID5''), boundary lines L35L45 (partial line segments of the boundary line of the seventh expanding room region #ID7''), boundary lines L45L44 (partial line segments of the boundary line of the seventh expanding room region #ID7''), boundary lines L44L43 (partial line segments of the boundary line of the ninth expanding room region #ID9''), and boundary lines L43L42 (partial line segments of the boundary line of the eighth expanding room region #ID8'').
[0087] Between the sixth expanded room region #ID6'' and the eighth expanded room region #ID8'', the inner contour includes the boundary line L40L41, and the door frame dividing line includes the dashed line L41L42.
[0088] Between the eighth expansion room region #ID8'' and the ninth expansion room region #ID9'', the inner contour includes boundary lines L43L52 and L50L51, and the door frame dividing line includes dashed lines L52L50.
[0089] As one embodiment, in step 3, the method of searching for door frame points based on the pixel values within the connected domain of the location points in each target room area that have pixel values that are not zero includes: in the effective room map, taking a location point with a pixel value that is not zero as the search starting point, performing a neighborhood search on the connected domain of the search starting point; the neighborhood search is to search for location points with pixel values that are not zero in the eight neighborhoods of the search starting point.
[0090] If a pixel value that meets the segmentation criteria is found during the current search, then the current search point or the previously searched point is marked as a door frame point; the previously searched point is used to update the search starting point in the neighborhood search. Therefore, within a target room area, each time a pixel value that does not meet the segmentation criteria is found and updated as the current search starting point, the search continues within the eight neighborhoods of the updated current search starting point to find pixel values that meet the segmentation criteria. The search can proceed along the direction pointing to an adjacent target room area, and must at least search within the connected components. If the vertical direction of the boundary between two adjacent target room areas is used as the search direction and it is considered a column-by-column search, then whenever a pixel value that meets the segmentation criteria is found, the search is switched to another column, and the search continues along the vertical direction of the boundary between two adjacent target room areas to find pixel values that meet the segmentation criteria. This column-switching search continues from one endpoint of the boundary between two adjacent target room areas to the other endpoint, until the boundary between any two adjacent target room areas has been searched. In this embodiment, the pixel value of the location point that meets the segmentation condition is neither equal to the pixel value of the search starting point nor equal to the pixel value of zero, so that the location point that meets the segmentation condition is located on the boundary line between two adjacent target room areas.
[0091] Starting from the search origin, the search proceeds along the connected domains in the same direction. If multiple door frame points are found on the boundary line of the same target room area, these points are connected sequentially to form the door frame boundary line. A straight line containing a door frame boundary line divides two adjacent target room areas within the effective room map. Except for the boundary line, the pixel values of each point within the same target room area are equal. The pixel values of points within different target room areas are not equal, and each target room area is marked with a different pixel value within the effective room map to ensure that adjacent target room areas have different pixel values, thus avoiding difficulty in distinguishing between adjacent areas.
[0092] Indicatively, in Figure 4 Within the valid room map shown, proceed to step 3 to... Figure 4 The valid room map shown is divided into target room areas #ID1', #ID2', #ID3', #ID4', #ID5', #ID6', #ID7', #ID8', #ID9', #ID10', and #ID11'. Figure 4 In the diagram, a white dashed line represents the boundary line between two adjacent target room areas (i.e., two adjacent target room areas), in order to separate each target room area and make each target room area independent.
[0093] Optionally, the identifier value includes the numerical values represented by #ID1' to #ID11', and each identifier value corresponds to a pixel value representing a color, so that the colors of adjacent target room areas are different, making them easier to distinguish and improving the readability of the map.
[0094] As one embodiment, during the neighborhood search of the connected domain of the search starting point, if the search starting point is located inside a target room area, and a neighborhood of the search starting point intersects with the boundary line between two adjacent target room areas, then the position point within the neighborhood where the search starting point intersects with the boundary line between the two adjacent target room areas, or the search starting point itself, is set as the door frame point. It is also determined that the boundary line between the two adjacent target room areas is located within the connected domain in the same direction. For example, the boundary line between the two adjacent target room areas is... Figure 4 As shown by the white dashed line in the diagram; at the same time, the width of the door frame represented by the door frame dividing line is set to be equal to the value 1.
[0095] Schematic illustration: Between two adjacent target room regions, such as between the first target room region and the second target room region, a location point with pixel value 'a' is located within the first target room region, and a location point with pixel value 'b' is located within the second target room region. Whenever a location point with pixel value 'a' is found to have pixel value 'b' (b is not equal to a) within its eight-neighborhood, it is considered that the location point with pixel value 'b' and the location point with pixel value 'a' are located on the boundary line between the two adjacent target room regions, which can be regarded as being located in the region where two different pixel values alternate. At this time, the width of the door frame is equal to the value 2, and both the location point with pixel value 'b' and the location point with pixel value 'a' are set as door frame points. That is, the width of the door frame is 2 pixels. For the convenience of subsequent calculations, this embodiment will simplify the width to the value 1, so only the location point with pixel value 'b' or the location point with pixel value 'a' is set as a door frame point. In this way, after searching all the door frame points in the connected domain in the same direction between two adjacent target room regions, a target door frame point set is formed. All the door frame points in a target door frame point set are connected in sequence to form the door frame boundary line.
[0096] Based on the above embodiments, after deleting each target door frame point set in the effective room map by performing step 3, each target room region will not have any connected components in the effective room map, that is, each target room region will be... Figure 4 The white dashed lines shown separate each target room area, making each target room area independent. This allows for the segmentation of each target room area in the effective room map while keeping the pixel values of each location point within the same target room area unchanged.
[0097] By executing step 3, no two target room areas will be reconnected, and two adjacent target room areas correspond to a deleted target door frame point set. One target room area can correspond to multiple deleted target door frame point sets, which has the effect of dividing different target room areas. However, in the subsequent step 4, by controlling each target room area to expand simultaneously, the area covered by the deleted target door frame point set can be filled. Then, the boundary lines of all expanded target room areas in step 4 will cover the target door frame point set, so that door frame points can be searched and door frame boundaries can be identified in the map skeleton set in step 5.
[0098] As one embodiment, in step 1, the method for preprocessing the pre-built raster map includes: After the robot constructs a grid map, it extracts the passable area from the grid map through threshold segmentation; after obtaining the grid map, it performs binarization processing on the grid map by setting a pixel value threshold, converting it into a binary map; and extracts the passable area from the binary map.
[0099] Specifically, the method for extracting passable areas from a raster map using threshold segmentation includes converting all pixels in the raster map to grayscale, comparing the pixel value of each pixel in the resulting binary image with a preset pixel threshold. If the pixel value is greater than the preset pixel threshold, the pixel value is set to pixel value 1 and configured as a passable location point; otherwise, the pixel value is set to pixel value 0. Preferably, the preset pixel threshold is set to pixel value 128. Based on this, the pixel values of pre-marked passable location points can be set to pixel value 1, and the pixel values of other location points can be set to pixel value 0, resulting in a binary map where the pixels only have pixel values of 1 and 0. Then, the passable areas are formed by grouping the location points with pixel values of 1 within the binary map.
[0100] Then, median filtering and edge smoothing are performed on the passable area to obtain the optimized image region; median filtering and edge smoothing are both conventional image processing algorithms, which will not be elaborated here.
[0101] Then, morphological transformations are performed on the optimized image region to remove noise, resulting in the initial map. This completes the preprocessing. Figure 2 This is a black-and-white planar schematic diagram of the initial map preprocessed in step 1 of this application, serving as the preprocessing result of the pre-constructed raster map. Therefore, the pixel value of each location point in the initial map is a pixel value of 1.
[0102] Specifically, the morphological transformation method includes first eroding the optimized image region, and then dilating the eroded optimized image region. The morphological transformation is an image processing operation based on the shape of the optimized image region, generally performing structuring element matching operations on binary images. Its core is the structuring element or kernel that determines the nature of the operation. Basic morphological operators: erosion and dilation; in step 1, erosion is performed first, followed by dilation, and its functions are: smoothing contours, eliminating noise, and breaking narrow discontinuities.
[0103] Based on the above embodiments, in step 2, the method of forming a total room mask using the pre-constructed grid map and the pre-divided template room areas includes: restoring the pre-set template room areas to the same frame template image according to their positional relationship within the area covered by the grid map, and then setting the template image as the total room mask. Since the template room areas in the template image have not undergone binarization processing, each template room area is displayed in the form of a color image. If converted to a grayscale image, the grayscale values of different template room areas are different, but not limited to pixel value 1 and pixel value 0.
[0104] In step 2, a unique identifier is assigned to each template room area. Different template room areas have different identifiers. Within the overall room mask, each template room area uses its identifier to represent the pixel value of each point within it, ensuring that the pixel values of each point within the same template room area are equal, while the pixel values of points in different template room areas are not equal. This process yields the room-specific information.
[0105] Preferably, the total range of each template room area represented in the room sub-information is actually slightly larger than the grid map, so the total room mask can be ANDed with the complete grid map to completely capture all passable areas in the grid map and apply a scan.
[0106] As one embodiment, in step 2, the method for controlling the total room mask scan of the initial map to obtain an effective room map includes: The robot controls the overall room mask to perform an AND logic calculation with the initial map; the robot controls the pixel values of all locations in the initial map to perform an AND logic calculation with the pixel values of the corresponding locations in the overall room mask, or controls the pixel values of all locations in the overall room mask to perform an AND logic calculation with the pixel values of the corresponding locations in the initial map.
[0107] Specifically, when the total room mask scans the initial map, if the pixel value of a location point of the total room mask is equal to the pixel value of the corresponding pixel point covered by the initial map (i.e., pixel value 1), then the result of the logical AND operation between the pixel value of the total room mask and the pixel value of the corresponding pixel point covered by the initial map is the pixel value of the total room mask. This preserves the pixel values of the covered pixels in the initial map and modifies them to the pixel values of the corresponding location point in the total room mask. If the pixel value of a location point of the total room mask is equal to the pixel value of the corresponding pixel point covered by the initial map (i.e., pixel value 0), then the result of the logical AND operation between the pixel value of the total room mask and the pixel value of the corresponding pixel point covered by the initial map is zero, thus modifying the pixel values of the pixels covered by the total room mask within the initial map to 0. In summary, when the coverage area of the initial map is larger than the coverage area of the total room mask, the coverage area of the initial map is restricted to within the total room mask, and the result of the logical AND operation is extracted from the initial map according to its outline shape. Figure 2 The initial black-and-white planar diagram of the map is converted to Figure 4A black and white planar schematic diagram of an effective room map; when the coverage area of the initial map is less than or equal to the coverage area of the total room mask, the pixel values of each location point in the initial map can be assigned according to the pixel values of the corresponding location points in the template room area within the coverage area of the total room mask, thereby modifying the pixel values of each location point in the initial map based on the pixel values within the total room mask.
[0108] Then, the robot sets the results of the logical calculations as the effective room map. Specifically, each location point where the logical calculation is performed and its corresponding logical calculation result together constitute the effective room map. The positional relationships and corresponding identifier values of each template room area within the overall room mask are also configured in the effective room map, transforming each template room area into its corresponding target room area in the effective room map.
[0109] In this embodiment, the initial map is a binary map, where the pixel values of all location points within the corresponding target room area are represented by the identifier values of each template room area within the total room mask. Since the pixel values of each location point in the initial map are all pixel values of 1, after the aforementioned logical calculations, each target room area and the corresponding template room area share the same identifier value. That is, the pixel values of location points within each target room area are configured according to the pixel values of location points within the corresponding template room area, ensuring that each target room area and its internal passable area have corresponding identifier values to constitute the effective room map.
[0110] The above embodiments are only for illustrating the technical concept and features of the present invention, and are intended to enable those skilled in the art to understand the content of the present invention and implement it accordingly. They should not be construed as limiting the scope of protection of the present invention. All equivalent transformations or modifications made in accordance with the spirit and essence of the present invention should be covered within the scope of protection of the present invention.
Claims
1. A method for recognizing the inner and outer contours of a map, wherein the main body executing the method is a robot equipped with a ranging sensor, and the robot scans environmental data through the ranging sensor while walking in an indoor environment to construct a grid map; characterized in that, The inner and outer contour recognition method includes: Step 1: Preprocess the pre-built raster map to obtain the initial map; then proceed to Step 2. Step 2: Use the pre-built raster map to form a master room mask, then control the master room mask to scan the initial map to obtain a valid room map, and mark each target room area in the valid room map with different identifier values as pixel values; then proceed to step 3. Step 3: Detect the pixel values of each location point in the valid room map, and search for door frame points in the connected components of the location points in each target room area whose pixel value is not zero. Then, use the searched door frame points to form a corresponding target door frame point set for each target room area to form the boundary line between two adjacent target room areas in the valid room map. Then, divide each target room area by deleting each target door frame point set in the valid room map. Then, proceed to step 4. Step 4: Control the expansion of each target room area segmented in Step 3 simultaneously until all adjacent target room areas in the effective room map have intersecting or overlapping boundary lines. Then, control all target room areas in the effective room map to stop expanding and obtain the expanded target room areas. Then, execute Step 5. Step 5: Use the boundary lines of the expanded target room area from Step 4 to set the map skeleton, and then proceed to Step 6; Step 6: Set the outermost boundary of the map skeleton as the outer contour, and then control the map skeleton to subtract the outer contour to obtain the inner skeleton; then identify the inner contour and the door frame boundary line at each location point of the inner skeleton. Among them, the door frame boundary line is composed of door frame points within the target door frame point set.
2. The inner and outer contour recognition method according to claim 1, characterized in that, In step 4, within the effective room map, when the boundary line of a target room area in one expansion process extends into a target room area in any other expansion process, it is determined that the boundary lines of the target room areas in the two adjacent expansion processes intersect or overlap. Wherein, the boundary lines of each expanded target room region are connected to form the circumscribed polygon of the corresponding target room region segmented in step 3, or each expanded target room region is surrounded by the circumscribed polygon of the corresponding target room region segmented in step 3. In each of the expanded target room areas, there are door frame points searched in step 3 in a portion of the boundary line, so that some or all of the line segments of the boundary line that overlaps between two adjacent expanded target room areas are the door frame dividing line.
3. The inner and outer contour recognition method according to claim 2, characterized in that, When the circumscribed polygon of the target room area is a circumscribed rectangle used to enclose a target room area, each circumscribed rectangle is provided with at least one door frame dividing line, so that each expanded target room area is adjacent to at least one expanded target room area to form the two adjacent expanded target room areas.
4. The inner and outer contour recognition method according to claim 2, characterized in that, In step 5, each boundary line of each expanded target room area is searched sequentially, and then all the searched boundary lines are merged into one frame image to obtain the map skeleton, which is a contour image formed by sequentially connecting all the searched boundary lines.
5. The inner and outer contour recognition method according to claim 4, characterized in that, In step 6, the method of setting the outermost boundary of the map skeleton as the outer contour includes: The boundary line between two adjacent expanded target room regions that do not overlap and are not completely surrounded by the corresponding expanded target room region is set as the outer contour. The outer contour forms a closed area, which is used to enclose the inner contour and the door frame boundary line, in order to enclose all the expanded target room areas.
6. The inner and outer contour recognition method according to claim 5, characterized in that, In step 6, the method for identifying the inner contour and the door frame boundary line at various locations within the inner skeleton includes: Traverse each location point along the inner skeleton and determine whether the current location point is a door frame point. If it is, mark the current location point as a door frame point in the map skeleton to connect the door frame boundary line at the connected domain between two adjacent expanded target room areas. Otherwise, mark the current location point as an inner contour point to connect the inner contour at the wall between two adjacent expanded target room areas. After traversing all the points in the inner skeleton, the corresponding door frame points are connected to form the door frame boundary line in the connected domain between two adjacent expanded target room areas, and the corresponding inner contour points are connected to form the inner contour at the wall between two adjacent expanded target room areas.
7. The inner and outer contour recognition method according to claim 5, characterized in that, Within the closed area, there exists a sub-closed area enclosed by an inner contour. The boundary line of the sub-closed area is part or all of the boundary line of the adjacent expanded target room area.
8. The method for recognizing inner and outer contours according to claim 6, characterized in that, In step 3, the method for searching door frame points based on the pixel values within the connected components of locations in each target room area where the pixel value is not zero includes: Within the valid room map, a location point whose pixel value is not zero is used as the search starting point. A neighborhood search is performed on the connected components of the search starting point. If a location point whose pixel value meets the segmentation condition is found, the current search location point or the previously searched location point is marked as a door frame point. The previously searched location point is used to update the search starting point in the neighborhood search. The segmentation condition is that the pixel value of the location point is neither equal to the pixel value of the search starting point nor equal to zero, so that the location point that meets the segmentation condition is located on the boundary line between two adjacent target room areas. Starting from the search origin, search along the connected domain in the same direction. If multiple door frame points are found on the boundary line of the same target room area, connect the multiple door frame points in sequence to form the door frame dividing line. Among them, the straight line of a door frame dividing line divides two adjacent target room areas in the effective room map. Except for the boundary lines, the pixel values of each location point within the same target room area are equal; the pixel values of location points within different target room areas are not equal.
9. The method for recognizing inner and outer contours according to claim 8, characterized in that, If the search starting point is located inside a target room area, and a neighborhood of the search starting point intersects with the boundary line between two adjacent target room areas, then the location point in the neighborhood where the search starting point intersects with the boundary line between the two adjacent target room areas, or the search starting point itself, is set as the door frame point. It is also determined that the boundary line between the two adjacent target room areas is within a connected region in the same direction, and the width of the door frame represented by the door frame boundary line is set to be equal to a pixel value of 1.
10. The method for recognizing inner and outer contours according to claim 1, characterized in that, After deleting each target door frame point set in the effective room map by performing step 3, each target room area will not have any connected domains in the effective room map, making each target room area independent, while keeping the pixel values of each location point within the same target room area unchanged.
11. The method for recognizing inner and outer contours according to claim 1, characterized in that, In step 1, the method for preprocessing the pre-constructed raster map includes: After the robot constructs a grid map, it extracts passable areas from the grid map through threshold segmentation; Median filtering and edge smoothing are applied to the passable area to obtain the optimized image region; A morphological transformation is performed on the optimized region of the image to obtain the initial map.
12. The method for recognizing inner and outer contours according to claim 11, characterized in that, In step 2, the method of assembling the overall room mask using the pre-constructed grid map and the various template room areas includes: Each pre-set template room area is restored to the same frame template image according to its positional relationship within the area covered by the raster map. The template image is then set as the total room mask. Each template room area is assigned an identifier value, and different template room areas have different identifier values. Within the total room mask, the identifier value of each position point of the same template room area represents the pixel value of each position point.
13. The inner and outer contour recognition method according to claim 12, characterized in that, In step 2, the method for controlling the total room mask scan of the initial map to obtain a valid room map includes: The overall room mask is controlled to perform an AND logic calculation with the initial map; The result of the logical calculation is then set as the effective room map, and the positional relationship and corresponding identifier value of each template room area within the total room mask are configured in the effective room map, so that each template room area is transformed into the corresponding target room area in the effective room map. The initial map is a binary map, in which the pixel values of all locations within the corresponding target room area are represented by the identifier values of each template room area within the total room mask.
Citation Information
Patent Citations
Segmentation method based on laser grid map
CN111681250A
A room semantic segmentation method
CN116188482B
Method for determining central point of room area by robot and robot
CN117697750A