Map partitioning method, device, sweeper and computer-readable storage medium
By performing operation processing and segmentation image analysis on the sweeper map, the target area is accurately partitioned, solving the problem of inaccurate partitioning during the sweeper cleaning process, and improving cleaning efficiency and user experience.
Patent Information
- Application Number
- CN202111595069.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-23
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2041-12-23
AI Technical Summary
It is difficult for existing sweepers to accurately partition the target area during cleaning, which affects the cleaning efficiency.
By obtaining the original binary map of the target area, using the preset matrix to perform operation processing, segmenting image analysis, determining and merging partitions, and achieving accurate partitioning of the target area.
It improves the cleaning efficiency and user experience of the sweeper, and ensures the accurate division and cleaning effect of the map.
Smart Images

Figure CN114429477B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of robotics technology, and in particular, relates to a map partitioning method, device, sweeper, and computer-readable storage medium. Background Art
[0002] At present, during the cleaning process, a sweeper can use lasers or visual sensors to create a map corresponding to the target area, and then clean the target area based on the established map. In order to better perform the cleaning work and improve cleaning efficiency, the sweeper needs to partition the created map for cleaning, such as partitioning by room. Therefore, how to accurately partition the created map has become a problem that needs to be solved by technicians in this field. Summary of the invention
[0003] The embodiments of the present application provide a map partitioning method, device, sweeper and computer-readable storage medium, which can accurately partition the map to improve the cleaning efficiency of the sweeper.
[0004] In a first aspect, an embodiment of the present application provides a map partitioning method, which is applied to a sweeping robot. The method may include:
[0005] Get the original binary map corresponding to the target area;
[0006] Performing an opening operation on the original binary map using a first preset matrix to obtain a first segmented image corresponding to the original binary map, wherein the first segmented image includes a plurality of first partitions, and the first partitions are partial areas in the target area;
[0007] Acquire a second partition corresponding to the original binary map according to the first segmented image;
[0008] A first target partition corresponding to the second partition is determined, and the second partition is merged into the first target partition to obtain a partition result corresponding to the original binary map, where the first target partition is one of the multiple first partitions.
[0009] In the above-mentioned map partitioning method, the sweeper can obtain the original binary map corresponding to the target area, and use the first preset matrix to perform an opening operation on the original binary map to obtain a first segmented image corresponding to the original binary map. The first segmented image may include multiple first partitions, and a first partition may be a partial area in the target area. Subsequently, the sweeper can obtain the second partition corresponding to the original binary map according to the first segmented image, and can determine the first target partition corresponding to the second partition to merge the second partition into the first target partition to obtain the partition result corresponding to the original binary map, so that the original binary map corresponding to the target area can be accurately divided into multiple partitions, which is convenient for the sweeper to clean the target area according to each partition, improve the cleaning efficiency of the sweeper, and improve the user experience.
[0010] In a possible implementation manner, acquiring the second partition corresponding to the original binary map according to the first segmented image may include:
[0011] Performing an XOR operation on the original binary map and the first segmented image to obtain a first intermediate image;
[0012] Performing an AND operation on the original binary map and the first intermediate image to obtain a second intermediate image;
[0013] Performing an opening operation on the second intermediate image using a second preset matrix to obtain a third intermediate image;
[0014] Perform a connected domain analysis on the third intermediate image to obtain a second partition corresponding to the original binary map.
[0015] Exemplarily, determining the first target partition corresponding to the second partition may include:
[0016] Obtaining each contour pixel point corresponding to the second partition;
[0017] Determine a first candidate partition corresponding to each of the contour pixels;
[0018] The second candidate partition having the most contour pixels in the first candidate partitions is determined as the first target partition corresponding to the second partition.
[0019] It should be understood that the determination of the first candidate partition corresponding to each of the contour pixel points may include: for each of the contour pixel points, using the four-neighborhood method to determine the third candidate partitions where the four neighborhoods of the contour pixel point are respectively located, and determining each of the third candidate partitions as the first candidate partition corresponding to the contour pixel point.
[0020] In a possible implementation, merging the second partition into the first target partition to obtain a partition result corresponding to the original binary map may include:
[0021] Merging the second partition into the first target partition to obtain a second segmented image;
[0022] Determine the remaining pixel points corresponding to the original binary map according to the original binary map and the second segmented image;
[0023] Determine a second target partition corresponding to the legacy pixel point, and merge the legacy pixel point into the second target partition to obtain a partition result corresponding to the original binary map, where the second target partition is one of the multiple first partitions.
[0024] Exemplarily, determining the second target partition corresponding to the legacy pixel point may include:
[0025] A four-neighborhood method is used to determine a second target partition corresponding to the remaining pixel point.
[0026] In a second aspect, an embodiment of the present application provides a map partitioning device, which is applied to a sweeping machine. The device may include:
[0027] A binary map acquisition module, used to obtain the original binary map corresponding to the target area;
[0028] A map segmentation module, configured to perform an opening operation on the original binary map using a first preset matrix to obtain a first segmented image corresponding to the original binary map, wherein the first segmented image includes a plurality of first partitions, and the first partitions are partial areas in the target area;
[0029] A second partition acquisition module, used for acquiring a second partition corresponding to the original binary map according to the first segmented image;
[0030] A partition merging module is used to determine the first target partition corresponding to the second partition, and merge the second partition into the first target partition to obtain a partition result corresponding to the original binary map, wherein the first target partition is one of the multiple first partitions.
[0031] In a third aspect, an embodiment of the present application provides a sweeping machine, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the sweeping machine implements the map partitioning method described in any one of the first aspects above.
[0032] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a computer, the computer implements the map partitioning method described in any one of the first aspects above.
[0033] In a fifth aspect, an embodiment of the present application provides a computer program product. When the computer program product is run on a sweeping machine, the sweeping machine executes the map partitioning method described in any one of the first aspects above.
[0034] It can be understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 is a schematic flow chart of a map partitioning method provided in an embodiment of the present application;
[0036] Figure 2 is a schematic diagram of an original binary map provided in an embodiment of the present application;
[0037] Figure 3 Yes Figure 2 A schematic diagram of a first segmented image obtained by segmenting the original binary map in;
[0038] Figure 4 is a schematic diagram of a first intermediate image provided in an embodiment of the present application;
[0039] Figure 5 is a schematic diagram of a second intermediate image provided in an embodiment of the present application;
[0040] Figure 6 is a schematic diagram of a third intermediate image provided in an embodiment of the present application;
[0041] Figure 7 is a schematic diagram of a second partition provided in an embodiment of the present application;
[0042] Figure 8 is a schematic diagram of a second partition and a first partition provided in an embodiment of the present application after being merged;
[0043] Fig. 9 is a schematic diagram of the four neighborhoods of the contour pixel point provided in the embodiment of the present application;
[0044] Fig.10 is a schematic diagram of the partitioning result provided in the embodiment of the present application;
[0045] Fig.11 is a schematic diagram of the structure of a map partitioning device provided in an embodiment of the present application;
[0046] Fig.12It is a structural schematic diagram of the sweeping machine provided in an embodiment of the present application. DETAILED DESCRIPTION
[0047] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0048] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0049] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0050] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0051] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0052] In addition, the “plurality” mentioned in the embodiments of the present application should be interpreted as two or more.
[0053] The steps involved in the map partitioning method provided in the embodiments of the present application are only examples. Not all steps are mandatory, or not all information or messages are mandatory. They can be added or reduced as needed during use. The same step or steps or messages with the same function in different embodiments of the present application can be referenced and learned from each other.
[0054] The business scenarios described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. A person of ordinary skill in the art will appreciate that, with the evolution of network architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0055] During the cleaning process, the sweeper can use laser radar or visual sensors to create a map corresponding to the target area, and then clean the target area based on the established map. In order to better perform the cleaning work and improve cleaning efficiency, the sweeper needs to partition the created map, such as room-based partitioning. Therefore, how to accurately partition the created map has become a problem that technicians in this field need to solve.
[0056] To solve the above problems, the embodiments of the present application provide a map partitioning method, device, sweeper and computer-readable storage medium. The method can be applied to a sweeper, in which the sweeper can obtain the original binary map corresponding to the target area, and can use the first preset matrix to perform an open operation on the original binary map to obtain a first segmented image corresponding to the original binary map. The first segmented image may include multiple first partitions, and a first partition may be a partial area in the target area. Subsequently, the sweeper can obtain the second partition corresponding to the original binary map according to the first segmented image, and can determine the first target partition corresponding to the second partition, so as to merge the second partition into the first target partition and obtain the partition result corresponding to the original binary map, so that the original binary map corresponding to the target area can be accurately divided into multiple partitions, which is convenient for the sweeper to clean the target area according to each partition, improve the cleaning efficiency of the sweeper, improve the user experience, and have strong ease of use and practicality.
[0057] See also Figure 1 , Figure 1 FIG. 1 shows a schematic flow chart of a map partitioning method provided in an embodiment of the present application. The method can be applied to a sweeping machine. Figure 1 As shown, the method may include:
[0058] S101, obtaining an original binary map corresponding to a target area.
[0059] In the embodiment of the present application, the target area may be an area such as a house, a ward, or an office space. For example, the target area may include all rooms of the entire house, or may include part of the rooms of the entire house, and the embodiment of the present application does not specifically limit this. Similarly, for areas such as wards or offices, the target area may also be all wards or all office areas on a layer, or may be part of the wards or part of the office areas on a layer. The following will take the target area as an example of a house to exemplify the map partitioning method provided in the embodiment of the present application.
[0060] See also Figure 2 , Figure 2 FIG. 1 shows a schematic diagram of an original binary map provided by an embodiment of the present application. Figure 2 As shown, the original binary map refers to a map represented only by white and black. White can represent an open area (i.e., an area where the sweeper can walk), and black can represent an obstacle area (i.e., an area where obstacles exist) or an unknown area. It should be understood that a pixel point in the original binary map can be used to represent an actual area of a preset size, for example, a pixel point can be used to represent an actual (5cm×5cm) area.
[0061] In an embodiment of the present application, the original binary map corresponding to the target area can be a map independently constructed by the sweeper, or a map constructed by other terminal devices and sent to the sweeper. For example, when the sweeper receives an autonomous mapping instruction, the sweeper can turn on the automatic mapping mode and move within the target area. During the movement, the sweeper can obtain laser data collected by the laser radar in the sweeper, and can construct an original binary map based on the laser data.
[0062] It can be understood that the autonomous map-building instruction can be generated based on the user clicking or touching a specific button in the display interface of the sweeping machine, or based on the user's voice input of keywords such as "map-building", or can be sent to the sweeping machine by other terminal devices, and so on.
[0063] S102, using a first preset matrix to perform an opening operation on the original binary map to obtain a first segmented image corresponding to the original binary map, wherein the first segmented image includes a plurality of first partitions, and the first partition is a partial area in the target area.
[0064] In an embodiment of the present application, the sweeping robot can use traditional morphological opening operation processing to segment the target area, that is, the original binary map can be opened using the first preset matrix to obtain the first segmented image corresponding to the original binary map, that is, MAT_A1=MORPH_OPEN(MAT_RAW, MAT_AOPEN), wherein MAT_A1 is the first segmented image, MORPH_OPEN() is the opening operation processing, MAT_RAW is the original binary map, and MAT_AOPEN is the first preset matrix.
[0065] It should be understood that the purpose of performing the opening operation on the original binary map is to segment out the main rooms in the original binary map, that is, to roughly segment out the rooms in the target area. Therefore, according to the actual environment, the width of the room door generally does not exceed 1 meter (that is, does not exceed 20 pixels), the first preset matrix can be set to a 20×20 matrix, and all values in the matrix are set to 1.
[0066] It should be understood that the opening operation processing refers to first using the first preset matrix to corrode the original binary map, and then using the first preset matrix to dilate the corroded map. The specific content of the opening operation processing of the original binary map using the first preset matrix can refer to the specific content of the existing opening operation processing, and the embodiment of the present application does not specifically limit this.
[0067] See also Figure 3 , Figure 3 Shows the Figure 2 Schematic diagram of the first segmented image obtained by segmenting the original binary map in . When the original binary map is opened using the first preset matrix, the sweeping robot can obtain the first segmented image corresponding to the original binary map. Figure 3 As shown, the first segmented image may include multiple first partitions, and each first partition may be a room in the target area. Exemplarily, the sweeper may determine each first partition in the first segmented image by performing image morphological connected domain analysis on the first segmented image. It should be understood that the connected domain analysis may specifically refer to the content of the connected domain analysis in the existing image processing, and the embodiments of the present application do not impose specific limitations on this.
[0068] S103. Obtain a second partition corresponding to the original binary map according to the first segmented image.
[0069] Among them, the second partition can be one or more undivided small areas in the original binary map, that is, the second partition can be one or more areas in the original binary map that are not divided into any first partition, and the area of the second partition is generally smaller than the area of the first partition.
[0070] Please also read Figures 4 to 7 , Figure 4 A schematic diagram of a first intermediate image provided by an embodiment of the present application is shown. Figure 5 A schematic diagram of a second intermediate image provided by an embodiment of the present application is shown. Figure 6 A schematic diagram of a third intermediate image provided by an embodiment of the present application is shown. Figure 7 A schematic diagram of a second partition provided in an embodiment of the present application is shown.
[0071] In the embodiment of the present application, the sweeping robot can process the original binary map (for example Figure 2 The original binary map shown) and the first segmented image (e.g. Figure 3 The first segmented image shown in FIG. 1 is subjected to an XOR operation to obtain Figure 4 The first intermediate image shown, namely, MAT_B1=BIT_XOR(MAT_RAW, MAT_A1), MAT_B1 is the first intermediate image, and BIT_XOR() is an exclusive OR operation.
[0072] Then, the sweeper can perform AND operation on the original binary map and the first intermediate image to obtain Figure 5 The second intermediate image shown, namely, MAT_B2=BIT_AND(MAT_RAW, MAT_B1), MAT_B2 is the second intermediate image, and BIT_AND() is an AND operation process.
[0073] Then, the sweeping robot can use the second preset matrix to perform an opening operation on the second intermediate image to obtain Figure 6 The third intermediate image shown, namely MAT_B3=MORPH_OPEN(MAT_B2, MAT_BOPEN), MAT_B3 is the third intermediate image, and MAT_BOPEN is the second preset matrix.
[0074] Finally, the sweeper can perform connected domain analysis on the third intermediate image to obtain the second partition corresponding to the original binary map, for example Figure 7 The second partitions shown, namely, MAT_B4=CONNECT_COMPONENT(MAT_B3), MAT_B4 is the second partition.
[0075] In an example, the second preset matrix MAT_BOPEN may be a 2×2 matrix, and all values in the matrix are 1.
[0076] It should be noted that the XOR operation processing, AND operation processing, open operation processing and connected domain analysis can refer to the existing relevant content respectively, and the embodiments of the present application do not impose specific limitations on this.
[0077] S104, determining a first target partition corresponding to the second partition, and merging the second partition into the first target partition to obtain a partition result corresponding to the original binary map, where the first target partition is one of the multiple first partitions.
[0078] In the embodiment of the present application, the small area (ie, the second partition) needs to be reasonably merged into the large area (ie, the second partition) to finally form a valid partition. Exemplarily, the sweeper can perform contour analysis on the small area to merge the small area into the corresponding large area.
[0079] See also Figure 8 , Figure 8 A schematic diagram showing the second partition and the first partition provided in an embodiment of the present application after being merged is shown. Figure 8 So Figures 2 to 7 The schematic diagram shown in the figure is used as an example for explanation. Figure 8 In the example, each partition is marked with a different color to distinguish the partitions. The color marking is only to identify the partitions and should not be understood as a limitation on the embodiments of the present application. Fig.10 It is similar in Chinese.
[0080] In one example, for each second partition, the sweeping machine can obtain each contour pixel point corresponding to the second partition, and determine the first candidate partition corresponding to each contour pixel point; then, the sweeping machine can determine the second candidate partition with the most contour pixels in the first candidate partition as the first target partition corresponding to the second partition, and can merge the second partition into the first target partition to obtain Figure 8 The merged partition map is shown. Among them, the acquisition of the contour pixels can be obtained by any existing acquisition method, and the specific acquisition method can be set by technicians according to the actual scene, and the embodiment of the present application does not limit this.
[0081] Exemplarily, for each contour pixel point of the second partition, the sweeping robot can use the four-neighborhood method to determine the second candidate partitions where the four neighborhoods of the contour pixel point are respectively located, and can respectively determine each second candidate partition as the first candidate partition corresponding to the contour pixel point.
[0082] See also Fig. 9 , Fig. 9 FIG. 4 is a schematic diagram showing the four neighborhoods of the contour pixel point provided by the embodiment of the present application. Fig. 9 As shown, for each contour pixel ( Fig. 9 POINT in the figure), the contour pixel point can have Fig. 9The first neighborhood 1, the second neighborhood 2, the third neighborhood 3 and the fourth neighborhood 4 are shown. Here, the sweeper can determine whether the first neighborhood 1 is inside a certain first partition. When the first neighborhood is inside a certain first partition, the sweeper can increase the count value corresponding to the first partition by one unit. Similarly, similar processing can be performed on the second neighborhood 2, the third neighborhood 3 and the fourth neighborhood 4. For example, when the first neighborhood 1 and the second neighborhood 2 of a certain contour pixel point are both located inside the first partition A, and the third neighborhood 3 and the fourth neighborhood 4 are both located inside the first partition B, the count value corresponding to the first partition A can be increased by 2 units, and the count value corresponding to the first partition B can be increased by 2 units.
[0083] After counting all contour pixel points in the second partition, the sweeping robot can obtain the first partition corresponding to the maximum count value, and can determine the first partition corresponding to the maximum count value as the first target partition corresponding to the second partition to merge the second partition into the first target partition.
[0084] It should be understood that when there is no maximum value among the count values corresponding to the first partitions, or when all count values are 0, the sweeper may temporarily not process the second partition, that is, temporarily not merge the second partition. No maximum value may mean that all count values corresponding to the first partitions are the same.
[0085] It should be noted that whether the neighborhood corresponding to the contour pixel point is located inside a first partition can be determined based on the coordinate information corresponding to the neighborhood and the coordinate information corresponding to the first partition. The specific determination method can be set by technical personnel according to the actual scene, and the embodiments of the present application do not impose any restrictions on this.
[0086] In a possible implementation, after the aforementioned second partition is merged with the first partition, there may still be some white pixels (hereinafter referred to as legacy pixels) in the original binary map that have not been divided into any partition. Exemplarily, after merging each second partition into the corresponding first target partition, a second segmented image can be obtained, and the sweeper can determine these legacy pixels based on the original binary map and the second segmented image. For these legacy pixels, the sweeper can use the four-neighborhood method for processing, that is, the four-neighborhood method can be used to divide these legacy pixels into corresponding partitions to accurately complete the partitioning process of the original binary map.
[0087] It should be noted that the specific method for determining the remaining pixels based on the original binary map and the second segmented image can be any existing determination method, which can be set by technicians according to the actual scenario, and the embodiments of the present application do not impose specific restrictions on this.
[0088] See also Fig.10 , Fig.10A schematic diagram of the partitioning result provided by an embodiment of the present application is shown. Fig.10 by Figure 2 The original binary map shown is used as an example for explanation.
[0089] Exemplarily, for each legacy pixel, the sweeper can determine whether the first neighborhood 1 of the legacy pixel is inside a first partition. When the first neighborhood is inside a first partition, the sweeper can increase the count value corresponding to the first partition by one unit. Similar processing can be performed on the second neighborhood 2, third neighborhood 3, and fourth neighborhood 4 of the legacy pixel, respectively. Subsequently, the sweeper can obtain the first partition corresponding to the maximum count value, and can determine the first partition corresponding to the maximum count value as the second target partition corresponding to the legacy pixel, so as to merge the legacy pixel into the second target partition, and obtain the partition result corresponding to the original binary map, that is, Fig.10 It should be understood that the first partition here refers to the first partition merged with the second partition.
[0090] It should be noted that, when there are multiple first partitions corresponding to the maximum count value, the sweeping robot can determine any one of the multiple first partitions as the second target partition corresponding to the left-over pixel point.
[0091] In an embodiment of the present application, the sweeping machine can obtain the original binary map corresponding to the target area, and can use the first preset matrix to perform an opening operation on the original binary map to obtain a first segmented image corresponding to the original binary map, and the first segmented image may include multiple first partitions, and a first partition may be a partial area in the target area. Subsequently, the sweeping machine can obtain the second partition corresponding to the original binary map according to the first segmented image, and can determine the first target partition corresponding to the second partition, so as to merge the second partition into the first target partition and obtain the partition result corresponding to the original binary map, so that the original binary map corresponding to the target area can be accurately divided into multiple partitions, which is convenient for the sweeping machine to clean the target area according to each partition, improve the cleaning efficiency of the sweeping machine, and improve the user experience.
[0092] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0093] Corresponding to the map partitioning method described in the above embodiment, Fig.11 A structural block diagram of a map partitioning device provided in an embodiment of the present application is shown. For ease of explanation, only the parts related to the embodiment of the present application are shown.
[0094] See also Fig.11, the device can be applied to a sweeping machine, and the device may include:
[0095] A binary map acquisition module 1101 is used to acquire an original binary map corresponding to a target area;
[0096] A map segmentation module 1102 is used to perform an opening operation on the original binary map using a first preset matrix to obtain a first segmented image corresponding to the original binary map, wherein the first segmented image includes a plurality of first partitions, and the first partitions are partial areas in the target area;
[0097] A second partition acquisition module 1103 is used to acquire a second partition corresponding to the original binary map according to the first segmented image;
[0098] The partition merging module 1104 is used to determine the first target partition corresponding to the second partition, and merge the second partition into the first target partition to obtain a partition result corresponding to the original binary map, where the first target partition is one of the multiple first partitions.
[0099] In a possible implementation, the second partition obtaining module 1103 may include:
[0100] An XOR operation unit, used for performing an XOR operation on the original binary map and the first segmented image to obtain a first intermediate image;
[0101] An AND operation unit, used for performing an AND operation on the original binary map and the first intermediate image to obtain a second intermediate image;
[0102] an opening operation unit, configured to perform an opening operation on the second intermediate image using a second preset matrix to obtain a third intermediate image;
[0103] A connected domain analysis unit is used to perform a connected domain analysis on the third intermediate image to obtain a second partition corresponding to the original binary map.
[0104] Exemplarily, the partition merging module 1104 may include:
[0105] A contour pixel point acquisition unit, used to acquire each contour pixel point corresponding to the second partition;
[0106] A candidate partition determination unit, used to determine a first candidate partition corresponding to each of the contour pixels;
[0107] The target partition determining unit is used to determine the second candidate partition having the most contour pixels in the first candidate partitions as the first target partition corresponding to the second partition.
[0108] It should be understood that the candidate partition determination unit can be specifically used to determine, for each of the contour pixel points, the third candidate partitions where the four neighborhoods of the contour pixel point are respectively located using the four-neighborhood method, and determine each of the third candidate partitions as the first candidate partition corresponding to the contour pixel point.
[0109] In a possible implementation, the partition merging module 1104 may further include:
[0110] A first partition merging unit, configured to merge the second partition into the first target partition to obtain a second segmented image;
[0111] A leftover pixel point determining unit, used to determine leftover pixel points corresponding to the original binary map according to the original binary map and the second segmented image;
[0112] The second partition merging unit is used to determine the second target partition corresponding to the legacy pixel point, and merge the legacy pixel point into the second target partition to obtain the partition result corresponding to the original binary map, and the second target partition is one of the multiple first partitions.
[0113] Exemplarily, the legacy pixel determination unit may be specifically configured to determine the second target partition corresponding to the legacy pixel by using a four-neighborhood method.
[0114] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0115] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0116] See also Fig.12 , Fig.12The schematic diagram of the structure of the sweeping machine provided by the embodiment of the present application is shown. Fig.12 As shown, the sweeping machine 12 of this embodiment may include: at least one processor 1200 ( Fig.12 Only one is shown), a memory 1201 and a computer program 1202 stored in the memory 1201 and executable on the at least one processor 1200, wherein the processor 1200 implements the steps of any of the above-mentioned map partitioning method embodiments when executing the computer program 1202.
[0117] The sweeping machine 12 may include, but is not limited to, a processor 1200 and a memory 1201. Those skilled in the art will appreciate that Fig.12 This is only an example of the sweeping machine 12 and does not constitute a limitation on the sweeping machine 12. The sweeping machine 12 may include more or fewer components than shown in the figure, or a combination of certain components, or different components, for example, it may also include input and output devices, network access devices, etc.
[0118] The processor 1200 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.
[0119] The memory 1201 may be an internal storage unit of the sweeping machine 12 in some embodiments, such as a hard disk or memory of the sweeping machine 12. The memory 1201 may also be an external storage device of the sweeping machine 12 in other embodiments, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the sweeping machine 12. Furthermore, the memory 1201 may also include both an internal storage unit and an external storage device of the sweeping machine 12. The memory 1201 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of the computer program. The memory 1201 may also be used to temporarily store data that has been output or is to be output.
[0120] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program. When the computer program is executed by a computer, the computer implements the steps in any of the above method embodiments.
[0121] An embodiment of the present application provides a computer program product. When the computer program product is run on a sweeping machine, the sweeping machine implements the steps in any of the above method embodiments.
[0122] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the process in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable storage medium may at least include: any entity or device that can carry the computer program code to the device / sweeper, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electric carrier signal, a telecommunication signal, and a software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, a computer-readable storage medium cannot be an electric carrier signal and a telecommunication signal.
[0123] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0124] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0125] In the embodiments provided in the present application, it should be understood that the disclosed device / sweeper and method can be implemented in other ways. For example, the device / sweeper embodiments described above are merely schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0126] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0127] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A map partitioning method, characterized in that: Applied to a sweeping machine, the method comprises: Get the original binary map corresponding to the target area; Performing an opening operation on the original binary map using a first preset matrix to obtain a first segmented image corresponding to the original binary map, wherein the first segmented image includes a plurality of first partitions, and the first partitions are partial areas in the target area; Acquiring a second partition corresponding to the original binary map according to the first segmented image, including: performing an XOR operation on the original binary map and the first segmented image to obtain a first intermediate image; performing an AND operation on the original binary map and the first intermediate image to obtain a second intermediate image; performing an open operation on the second intermediate image using a second preset matrix to obtain a third intermediate image; performing a connected domain analysis on the third intermediate image to obtain a second partition corresponding to the original binary map; Obtaining each contour pixel point corresponding to the second partition; Determine a first candidate partition corresponding to each of the contour pixels; Determine the second candidate partition having the most contour pixels in the first candidate partition as the first target partition corresponding to the second partition; The second partition is merged into the first target partition to obtain a partition result corresponding to the original binary map, where the first target partition is one of the multiple first partitions.
2. The method according to claim 1, characterized in that The determining of the first candidate partition corresponding to each of the contour pixels includes: For each of the contour pixel points, a four-neighborhood method is used to determine the third candidate partitions where the four neighborhoods of the contour pixel point are respectively located, and each of the third candidate partitions is respectively determined as the first candidate partition corresponding to the contour pixel point.
3. The method according to any one of claims 1 to 2, characterized in that The step of merging the second partition into the first target partition to obtain a partition result corresponding to the original binary map includes: Merging the second partition into the first target partition to obtain a second segmented image; Determine the remaining pixel points corresponding to the original binary map according to the original binary map and the second segmented image; Determine a second target partition corresponding to the legacy pixel point, and merge the legacy pixel point into the second target partition to obtain a partition result corresponding to the original binary map, where the second target partition is one of the multiple first partitions.
4. The method according to claim 3, characterized in that The determining the second target partition corresponding to the legacy pixel point includes: A four-neighborhood method is used to determine a second target partition corresponding to the remaining pixel point.
5. A map partitioning device, characterized in that: Applied to a sweeping machine, the device comprises: A binary map acquisition module, used to obtain the original binary map corresponding to the target area; A map segmentation module, configured to perform an opening operation on the original binary map using a first preset matrix to obtain a first segmented image corresponding to the original binary map, wherein the first segmented image includes a plurality of first partitions, and the first partitions are partial areas in the target area; A second partition acquisition module, used for acquiring a second partition corresponding to the original binary map according to the first segmented image; A partition merging module is used to obtain each contour pixel point corresponding to the second partition; determine the first candidate partition corresponding to each contour pixel point; determine the second candidate partition with the most contour pixels in the first candidate partition as the first target partition corresponding to the second partition, and merge the second partition into the first target partition to obtain a partition result corresponding to the original binary map, wherein the first target partition is one of the multiple first partitions; Wherein, the second partition acquisition module includes: An XOR operation unit, used for performing an XOR operation on the original binary map and the first segmented image to obtain a first intermediate image; An AND operation unit, used for performing an AND operation on the original binary map and the first intermediate image to obtain a second intermediate image; an opening operation unit, configured to perform an opening operation on the second intermediate image using a second preset matrix to obtain a third intermediate image; A connected domain analysis unit is used to perform a connected domain analysis on the third intermediate image to obtain a second partition corresponding to the original binary map.
6. A sweeping machine, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the sweeping robot implements the map partitioning method according to any one of claims 1 to 4.
7. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a computer, the computer is enabled to implement the map partitioning method according to any one of claims 1 to 4.
