Region segmentation method and device, storage medium and electronic device

By dynamically adjusting the segmentation line and combining the shape and direction changes of the target area, the problem of unreasonable area segmentation in the prior art is solved, more adaptable area division is achieved, and robot cleaning efficiency is improved.

CN120070463APending Publication Date: 2025-05-30DREAM INNOVATION TECH (SUZHOU) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311558401.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-21
Publication Date
2025-05-30

AI Technical Summary

Technical Problem

In the prior art, the area segmentation scheme adopts a fixed segmentation method, which makes the block size difficult to control and poor adaptability, especially in irregular rooms, which are unreasonable.

Method used

By obtaining the outline of the target area, determining the normal vector and angle range of the position point, filtering out matching points to form candidate segmentation lines, combining the screening and optimization process, dynamically adjusting the segmentation lines to adapt to the area shape.

Benefits of technology

It realizes reasonable division based on the actual shape of the area, improves the robot cleaning efficiency, and avoids the problem of difficult block size.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120070463A_ABST
    Figure CN120070463A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a region segmentation method and device, a storage medium and an electronic device, and the method comprises the steps: obtaining a target contour of a target region in a target map; for each position point included on the target contour, executing the following operations to determine a first candidate segmentation line group of the target area: determining a normal vector of the position point; determining a target angle range based on the normal vector; determining a matching point which is located on the target contour and is closest to the position point within the target angle range to form a plurality of position point pairs; screening out target position point pairs which are matched with each other from the plurality of position point pairs; determining a connecting line of the target position point pair as a first candidate segmentation line; screening the first candidate segmentation line group based on the position of each first candidate segmentation line included in the first candidate segmentation line group in the target area to obtain a first target segmentation line group; and segmenting the target region based on the first target segmentation line group.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the field of map segmentation, and more particularly, to a method, apparatus, storage medium, and electronic device for region segmentation.

Background Art

[0002] Robots bring great convenience to daily life. For example, during the sweeping and mopping process, a sweeping and mopping integrated robot usually divides a relatively large area (such as a room area, and hereinafter, the division of the room area will be taken as an example for illustration) into multiple areas for local cleaning, and adopts different cleaning schemes according to the dirtiness of different areas.

[0003] In related technologies, when dividing a room area, generally multiple horizontal and vertical lines are used to divide the room into multiple blocks, and then room cleaning is carried out separately in each block. Figure 1 is a schematic diagram of region segmentation in related technologies Figure 1 , Figure 2 is a schematic diagram of region segmentation in related technologies Figure 2 , such as Figure 1 , Figure 2 shown, the size of the blocks divided by such a room division scheme is difficult to control, and such a room division method is only applicable to rooms that are relatively regular (for example, close to a rectangle). For other irregular rooms, the above division method will result in unreasonable division. In particular, the area of the blocks generated at the edges of the room and the edges of obstacles will be very small, which will cause it difficult for the robot to define the dirtiness of the area.

[0004] Regarding the problem that the region segmentation scheme in related technologies divides the region according to a fixed segmentation method, resulting in the size of the divided blocks being difficult to control and thus the region segmentation being unreasonable, no effective solution has been proposed yet.

Summary of the Invention

[0005] Embodiments of the present invention provide a method, apparatus, storage medium, and electronic device for region segmentation, so as to at least solve the problem that the region segmentation scheme in related technologies divides the region according to a fixed segmentation method, resulting in the size of the divided blocks being difficult to control and thus the region segmentation being unreasonable.

[0006] According to an embodiment of the present invention, a region segmentation method is provided, including: obtaining a target contour of a target region included in a target map; for each position point included in the above target contour, performing the following operations to determine a first candidate segmentation line group of the above target region: determining a normal vector of the above position point; determining a target angle range based on the above normal vector; determining, within the above target angle range, matching points that are located on the above target contour and closest to the above position point to form a plurality of position point pairs; screening out target position point pairs that are mutual matching points from the plurality of above position point pairs; determining the connection line of the above target position point pairs as the above first candidate segmentation line; screening the above first candidate segmentation line group based on the positions of each of the above first candidate segmentation lines included in the above first candidate segmentation line group in the above target region to obtain a first target segmentation line group; segmenting the above target region based on the above first target segmentation line group.

[0007] In an exemplary embodiment, screening the above first candidate segmentation line group based on the positions of each of the above first candidate segmentation lines included in the above first candidate segmentation line group in the above target region includes: determining the lengths of a plurality of first parallel lines that are parallel to the above first candidate segmentation line and within a first predetermined length on both sides of the above first candidate segmentation line, where both endpoints of the above first parallel lines are located on the above target contour; extracting the parallel line with the maximum length and the parallel line with the minimum length among the plurality of above first parallel lines; using the length difference between the parallel line with the maximum length and the parallel line with the minimum length as the score of the above first candidate segmentation line; screening the above first candidate segmentation line group based on the score of the above first candidate segmentation line.

[0008] In an exemplary embodiment, segmenting the above target region based on the above first target segmentation line group includes: in the case where it is determined that there are two parallel lines with a distance less than a first distance threshold in the above first target segmentation line group, deleting the parallel line with a lower score among the two parallel lines; segmenting the above target region based on the remaining segmentation lines in the above first target segmentation line group.

[0009] In an exemplary embodiment, before dividing the target region based on the above-mentioned first target dividing line group, the method further includes: for each position point included in the target contour, the following operations are performed to determine a second candidate dividing line group of the target region: starting from the position point, a ray is made in the positive direction of the axis of the image coordinate system, and when it is determined that the ray intersects the target contour, the intersection point is determined as the corresponding point of the position point; the connection line between the position point and the corresponding point of the position point is determined as the second candidate dividing line; the second candidate dividing line group is screened based on the type and / or position in the target region of each of the second candidate dividing lines included in the second candidate dividing line group to obtain a second target dividing line group; dividing the target region based on the first target dividing line group includes: dividing the target region based on the first target dividing line group and the second target dividing line group.

[0010] In an exemplary embodiment, screening the second candidate dividing line group based on the type of each of the second candidate dividing lines included in the second candidate dividing line group includes: screening the second candidate dividing line group based on the length of each of the second candidate dividing lines and / or the areas of the two regions separated by the second candidate dividing line.

[0011] In an exemplary embodiment, the method includes at least one of the following: screening the second candidate dividing line group based on the length of each of the second candidate dividing lines includes: deleting the second candidate dividing lines in the second candidate dividing line group whose lengths are not within a predetermined length range; screening the second candidate dividing line group based on the areas of the two regions separated by each of the second candidate dividing lines includes: deleting the second candidate dividing lines whose sum of the areas of the two separated regions is less than a first area threshold.

[0012] In an exemplary embodiment, screening the second candidate dividing line group based on the position of each of the second candidate dividing lines included in the second candidate dividing line group in the target region includes: screening the second candidate dividing line group based on the lengths of a plurality of second parallel lines parallel to the second candidate dividing line within a second predetermined length on both sides of each of the second candidate dividing lines, wherein both endpoints of the second parallel lines are located on the target contour.

[0013] In an exemplary embodiment, screening the second candidate dividing line group based on the lengths of a plurality of second parallel lines parallel to the second candidate dividing line within a second predetermined length on both sides of each of the above-mentioned second candidate dividing lines includes: respectively determining the lengths of the plurality of second parallel lines parallel to the second candidate dividing line within the second predetermined length on both sides of the second candidate dividing line; respectively determining the length differences between the longest and shortest second parallel lines among the plurality of second parallel lines on one side of the second candidate dividing line; deleting the second candidate dividing line when it is determined that the length difference on one side is less than a first length threshold, or the sum of the length differences on both sides is less than a second length threshold; retaining the second candidate dividing line when it is determined that the length difference on one side is greater than or equal to the first length threshold and the sum of the length differences on both sides is greater than or equal to the second length threshold.

[0014] In an exemplary embodiment, dividing the target region based on the first target dividing line group and the second target dividing line group includes: combining the first target dividing line group and the second target dividing line group to obtain a third target dividing line group; when it is determined that the third target dividing line group includes dividing lines, performing at least one of the following operations on the third target dividing line group to obtain a fourth target dividing line group: deleting one of two parallel third target dividing lines in the third target dividing line group with a distance less than a second distance threshold; deleting a dividing line in the third target dividing line group with a divided area less than a second area threshold; for two third target dividing lines with intersections in the third target dividing line group, starting from the intersection, dividing each of the two third target dividing lines into two dividing lines; dividing the target region based on the fourth target dividing line group.

[0015] In an exemplary embodiment, dividing the target region based on the fourth target dividing line group includes: performing at least one of the following operations to obtain a fifth target dividing line group: when it is determined that the fourth target dividing line group includes a dividing line with a divided first area less than a third area threshold, merging the first area into an adjacent area separated by the longest dividing line used to divide the first area and deleting the longest dividing line; when it is determined that the fourth target dividing line group includes a fourth target dividing line passing through an obstacle in the target region, removing the partial dividing line passing through the obstacle included in the fourth target dividing line and determining the remaining part as a plurality of new dividing lines; dividing the target region based on the fifth target dividing line group.

[0016] In an exemplary embodiment, after obtaining the above-mentioned third target dividing line group, the method further includes: when it is determined that the third target dividing line group does not include a dividing line, determining a first circumscribed rectangle of the target area; determining a connection line of the midpoints of the long sides of the first circumscribed rectangle as the target dividing line of the target area; and dividing the target area based on the target dividing line.

[0017] In an exemplary embodiment, dividing the target area based on the target dividing line includes: when it is determined that there is an area in the divided area of the target area that is larger than a fourth area threshold, repeatedly performing the following operations until there is no area in the divided area of the target area that is larger than the fourth area threshold: determining a second circumscribed rectangle of the area larger than the fourth area threshold; determining a connection line of the midpoints of the long sides of the second circumscribed rectangle as the dividing line of the area larger than the fourth area threshold; and dividing the target area based on the finally determined respective dividing lines.

[0018] In an exemplary embodiment, dividing the target area based on the target dividing line includes: when it is determined that the target dividing line passes through an obstacle in the target area, removing the partial dividing line of the target dividing line that passes through the obstacle and determining the remaining part as a plurality of new dividing lines; and dividing the target area based on the plurality of new dividing lines.

[0019] According to another embodiment of the present invention, there is provided an area dividing device, including: a first obtaining module, configured to obtain a target contour of a target area included in a target map; a first determining module, configured to perform the following operations for each position point included on the target contour to determine a first candidate dividing line group of the target area: determining a normal vector of the position point; determining a target angle range based on the normal vector; determining, within the target angle range, matching points located on the target contour and closest to the position point to form a plurality of position point pairs; screening out target position point pairs that are matching points from the plurality of position point pairs; and determining a connection line of the target position point pairs as the first candidate dividing line; a first screening module, configured to screen the first candidate dividing line group based on the position of each first candidate dividing line included in the first candidate dividing line group in the target area to obtain a first target dividing line group; and a first dividing module, configured to divide the target area based on the first target dividing line group.

[0020] According to still another embodiment of the present invention, there is further provided a storage medium, in which a computer program is stored, and when the program is run by a terminal device or a computer, it executes the above-mentioned area dividing method in any one of the above-mentioned embodiments.

[0021] According to another embodiment of the present invention, an electronic device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the region segmentation method in any one of the above embodiments.

[0022] Through the present invention, the dividing line is determined based on the normal vector and the angle range of each position point on the target contour of the target area to be divided. Based on this method, it is possible to adjust the position and angle of the dividing line according to the shape and direction change of the target contour, so as to divide the dividing line adapted to different target contours, effectively solving the problem that in the related art, the region segmentation scheme divides the region according to a fixed segmentation method, resulting in difficulty in controlling the size of the divided blocks and thus unreasonable region segmentation. It achieves the effect of reasonably dividing the region based on the actual shape of the region, thereby improving the cleaning efficiency of the robot.

BRIEF DESCRIPTION OF THE DRAWINGS

[0023] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The illustrative embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation to the present invention. In the drawings:

[0024] Figure 1 is a schematic diagram of region segmentation in the related art Figure 1 ;

[0025] Figure 2 is a schematic diagram of region segmentation in the related art Figure 2 ;

[0026] Figure 3 is a hardware structure block diagram of a mobile terminal of the region segmentation method according to an embodiment of the present invention;

[0027] Figure 4 is a flowchart of the region segmentation method according to an embodiment of the present invention;

[0028] Figure 5 is a schematic diagram of region segmentation according to an embodiment of the present invention;

[0029] Figure 6 is an overall flowchart of the region segmentation method according to an embodiment of the present invention;

[0030] Figure 7 is a structure block diagram of the region segmentation device according to an embodiment of the present invention.

DETAILED DESCRIPTION

[0031] The present invention will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments. It should be noted that, without conflict, the embodiments in the present application and the features in the embodiments may be combined with each other.

[0032] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily need to describe a specific order or sequence.

[0033] First, the application scenarios of the present invention will be described:

[0034] When a robot is operating, it may perform block operations on an area. For example, a robot that combines sweeping and mopping needs to perform block cleaning on the area to be cleaned. For a relatively large area (for example, a room area, the following takes the division of a room area as an example for illustration), certain block processing needs to be carried out before cleaning, so as to perform targeted cleaning on each divided area. Regarding how to divide the area to be cleaned, specific implementation methods are given in the embodiments of the present invention. The area division method in the present invention will be described below in conjunction with the embodiments:

[0035] The method embodiments provided in the embodiments of the present application can be executed on a mobile robot or a similar computing device. Taking the operation on a mobile robot as an example, Figure 3 is a hardware structure block diagram of an area division method according to an embodiment of the present invention. As Figure 3 shown, the mobile robot may include one or more ( Figure 3 only one is shown in Figure 3 the processor 302 (the processor 302 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 304 for storing data. In an exemplary embodiment, the above-mentioned mobile robot may further include a transmission device 306 for communication functions and an input / output device 308. Those of ordinary skill in the art can understand that Figure 3 the structure shown in Figure 3 is only schematic, and it does not limit the structure of the above-mentioned mobile robot. For example, the mobile robot may further include more or fewer components than Figure 3 shown in

[0036] The memory 304 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the region segmentation method in the embodiments of the present invention. The processor 302 executes various functional applications and data processing by running the computer programs stored in the memory 304, that is, the above-mentioned method is implemented. The memory 304 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories. In some instances, the memory 304 may further include a memory remotely disposed relative to the processor 302, and these remote memories can be connected to the mobile robot through a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0037] The transmission device 306 is used to receive or send data via a network. Specific examples of the above-mentioned network may include a wireless network provided by a communication provider of the mobile robot. In one instance, the transmission device 306 includes a network adapter (abbreviated as NIC for Network Interface Controller), which can be connected to other network devices through a base station and thus communicate with the Internet. In one instance, the transmission device 306 can be a radio frequency (RF for short) module, which is used to communicate with the Internet wirelessly.

[0038] In this embodiment, a region segmentation method is also provided. Figure 4 is a flowchart of the region segmentation method of the embodiments of the present invention, as Figure 4 shown, the process includes the following steps:

[0039] Step 402, obtain the target contour of the target region included in the target map;

[0040] Step 404, for each position point included in the target contour, perform the following operations: determine the first candidate segmentation line group of the target region: determine the normal vector of the position point; determine the target angle range based on the normal vector; determine the matching points on the target contour that are closest to the position point within the target angle range, and form multiple pairs of position points; screen out the target pairs of position points that are mutual matching points from the multiple pairs of position points; determine the connection line of the target pairs of position points as the first candidate segmentation line;

[0041] Step 406, screen the first candidate segmentation line group based on the positions of each first candidate segmentation line included in the first candidate segmentation line group in the target region to obtain the first target segmentation line group;

[0042] Step 408, segment the target region based on the first target segmentation line group.

[0043] In the above embodiments, the target area can be the area to be segmented. For example, it can be the floor area of the living room at home, the floor area in a playground, the floor area in an outdoor activity venue, or even a specific water area. Any area that requires the robot to perform block operations is acceptable. The normal vector of a position point is the normal vector of the coordinates of two adjacent position points, and generally, this normal vector points towards the interior of the target area. The target angle range includes, but is not limited to: plus or minus 15 degrees, plus or minus 20 degrees, plus or minus 25 degrees, plus or minus 30 degrees. In addition, the above angle range can be flexibly adjusted based on the accuracy requirements of area segmentation. It should also be noted that at different position points in the target area, the angle range used can be unified. Of course, it can also be not completely the same. For example, at the position points in the relatively empty area included in the target area, the angle range used can be relatively large, and at the position points in the relatively crowded area (for example, the area with more obstacles) included in the target area, the angle range used can be relatively small.

[0044] Among them, the position of the first candidate segmentation line in the target area can include the type of the position of the first candidate segmentation line in the target area. For example, the trend or type of the areas on both sides of this position, or the arrangement of other segmentation lines around this position, or some pre-configured attributes of this position (such as priority, importance, etc.). The methods for screening the first candidate segmentation line group include, but are not limited to: deleting the first candidate segmentation line whose segmented block does not match the contour of the target area, deleting the first candidate segmentation line whose distance from the adjacent first candidate segmentation lines on both sides is less than a certain threshold, deleting the first candidate segmentation line with a relatively low priority (for example, the priority can be configured based on the direction of the segmentation line, or based on the length of the segmentation line, etc.), etc., deleting the first candidate segmentation line whose area of any one of the two segmented blocks on both sides is less than a certain area threshold, and deleting the first candidate segmentation line whose sum of the areas of the two segmented blocks on both sides is less than a certain area threshold.

[0045] Among them, the execution entity for performing the above operations can be a cleaning device (such as a mopping and sweeping robot, or other devices with cleaning ability and automatic driving ability), or a processor set in the cleaning device, or other devices with similar processing capabilities. In addition, the execution entity of the above operations can also be a device or system that has a certain association with the cleaning device. For example, a processor, a processing system, or other devices with similar processing capabilities for configuring the cleaning device, or other machines that at least integrate data processing devices. Among them, the data processing devices can include terminals such as computers and mobile phones, but are not limited thereto.

[0046] Through the above steps, the dividing line is determined based on the normal vectors and angular ranges of each position point on the target contour of the target area to be divided. Based on this method, it is possible to adjust the position and angle of the dividing line according to the shape and direction changes of the target contour, so as to divide the dividing line adapted to different target contours, effectively solving the problem in the related art that the area segmentation scheme divides the area according to a fixed segmentation method, resulting in the difficulty of controlling the size of the divided blocks and thus unreasonable area segmentation. It achieves the effect of reasonably dividing the area based on the actual shape of the area, thereby improving the cleaning efficiency of the robot.

[0047] As an optional implementation manner, screening the first candidate dividing line group based on the positions of each first candidate dividing line included in the first candidate dividing line group in the target area includes: determining the lengths of a plurality of first parallel lines parallel to the first candidate dividing line within a first predetermined length on both sides of the first candidate dividing line, where both endpoints of the first parallel line are located on the target contour; extracting the parallel line with the maximum length and the parallel line with the minimum length among the plurality of first parallel lines; using the difference between the length of the parallel line with the maximum length and the length of the parallel line with the minimum length as the score of the first candidate dividing line; and screening the first candidate dividing line group based on the score of the first candidate dividing line.

[0048] In the above embodiment, the score of each first candidate dividing line is used to indicate whether the division of the area by the candidate dividing line is reasonable. The higher the score, the more reasonable the division. When screening the first candidate dividing lines according to the scores, the dividing lines with relatively high scores can be retained (for example, the dividing lines with scores exceeding a predetermined score value can be retained, or the first candidate dividing lines can be sorted in descending order of scores, and the top-ranked dividing lines can be retained). Through the above screening method, it is possible to filter out the dividing lines with unreasonable area segmentation, making the segmentation result more reasonable.

[0049] In the above embodiment, the first predetermined length includes but is not limited to 9 pixels, 10 pixels, 11 pixels, etc. The plurality of first parallel lines are distributed on both sides of the first candidate dividing line, and the distance from the dividing line is an integer multiple of 1 pixel. The first parallel line has two intersections with the target contour, and the length of the first parallel line is the length of the line segment between the two intersections of the first parallel line and the target contour. It should be noted that the above first parallel lines can be parallel lines within the same length range on both sides of the first candidate dividing line, or parallel lines within different length ranges on both sides of the first candidate dividing line. For example, the parallel lines within 9 pixels on the left side of the first candidate dividing line and the parallel lines within 10 pixels on the right side of the first candidate dividing line.

[0050] In the above embodiments, if the length difference between the longest parallel line and the shortest parallel line within a first predetermined range on both sides of a certain first candidate dividing line is small, the score of this first candidate dividing line will be low, indicating that the region divided by this first candidate is a relatively regular rectangle. By calculating the scores of each first candidate dividing line, the type of the region divided by each first candidate dividing line can be determined.

[0051] In an alternative embodiment, dividing the target region based on the first target dividing line group includes: in the case where it is determined that there are two parallel lines in the first target dividing line group with a distance less than a first distance threshold, deleting the parallel line with a lower score among the two parallel lines; dividing the target region based on the remaining dividing lines in the first target dividing line group.

[0052] The first distance threshold includes, but is not limited to, 9 pixels, 10 pixels, 11 pixels, and so on.

[0053] In the above embodiments, by setting the first distance threshold to screen the dividing lines, if the distance between the dividing lines is less than the first distance threshold, it means that the two dividing lines are close, and deleting one of them can avoid the area of the divided block being small and improve the quality of region division.

[0054] As an alternative implementation manner, before dividing the target region based on the first target dividing line group, the method further includes: for each position point included in the target contour, performing the following operations to determine a second candidate dividing line group of the target region: making a ray in the positive direction of the axis of the image coordinate system starting from the position point, and in the case where it is determined that the ray intersects the target contour, determining the intersection point as the corresponding point of the position point; determining the connection line between the position point and its corresponding point as the second candidate dividing line; screening the second candidate dividing line group based on the type and / or position in the target region of each second candidate dividing line included in the second candidate dividing line group to obtain a second target dividing line group; dividing the target region based on the first target dividing line group includes: dividing the target region based on the first target dividing line group and the second target dividing line group.

[0055] In the above embodiments, the image coordinate system is constructed using a plane rectangular coordinate system. The axes of the image coordinate system are the coordinate axes of the plane rectangular coordinate system, and the axis extension direction and the positive axis direction can be set as needed and are not limited here; for example, the axis extension direction and the positive axis direction of the image coordinate system can be set according to the layout of the room; or the axis extension direction and the positive axis direction of the image coordinate system can be set in combination with the world coordinate system of the sweeping robot.

[0056] In the above embodiments, the second candidate dividing line group is determined by the position points on the target contour. Since the direction of the dividing line is along the axis of the image coordinate system, the positional relationship between the dividing lines is parallel or perpendicular to each other. When dividing the target area, the second target dividing line group and the first target dividing line group jointly complete the division of the target area, making up for the deficiencies of a single division scheme and achieving a reasonable division of the target area.

[0057] As an optional implementation manner, screening the second candidate dividing line group based on the type of each second candidate dividing line included in the second candidate dividing line group includes: screening the second candidate dividing line group based on the length of each second candidate dividing line and / or the areas of the two regions separated by the second candidate dividing line.

[0058] In the above embodiments, when screening the second candidate dividing lines according to the length of the second candidate dividing lines, the second candidate dividing lines can be sorted in descending order of the length values, and at least several dividing lines in the middle of the ranking can be retained; when screening the second candidate dividing lines according to the areas of the regions separated, the dividing lines with a higher sum of the area values on both sides of the dividing line can be retained (for example, the dividing lines with a sum of the area values on both sides exceeding a predetermined area value can be retained, or the second candidate dividing lines can be sorted in descending order of the sum of the area values on both sides, and multiple dividing lines at the front of the ranking can be retained). By screening the second candidate dividing line group based on the length of the dividing line and the sum of the areas of the two separated regions, some unreasonable dividing lines can be eliminated.

[0059] As an optional implementation manner, screening the second candidate dividing line group based on the length of each second candidate dividing line includes: deleting the second candidate dividing lines whose lengths are not within a predetermined length range among the dividing lines included in the second candidate dividing line group; optionally, screening the second candidate dividing line group based on the areas of the two regions separated by each second candidate dividing line includes: deleting the second candidate dividing lines whose sum of the areas of the two separated regions is less than a first area threshold.

[0060] In the above embodiments, the predetermined length range includes but is not limited to 10 pixels, 20 pixels, 40 pixels, etc.; among them, the first area threshold includes but is not limited to 4 square meters, 9 square meters, 16 square meters, etc. It should be noted that the area threshold here is a threshold set based on the actual area of the region and needs to be converted according to the relationship between the unit length in the displayed map and the unit length of the actual room.

[0061] In the above embodiments, by limiting the specific length range of the dividing line and the area of the divided region, the range can be delimited more accurately, thereby avoiding dividing some regions with smaller areas.

[0062] As an alternative embodiment, screening the second candidate dividing line group based on the position of each second candidate dividing line included in the second candidate dividing line group in the target area includes: screening the second candidate dividing line group based on the lengths of a plurality of second parallel lines parallel to the second candidate dividing line within a second predetermined length on both sides of each second candidate dividing line, wherein both endpoints of the second parallel line are located on the target contour.

[0063] In the above embodiment, the appropriate candidate dividing line can be selected as the final second target dividing line group according to the position of the second candidate dividing line in the target area and the lengths of the second parallel lines on both sides thereof, thereby improving the accuracy of segmentation.

[0064] As an alternative embodiment, screening the second candidate dividing line group based on the lengths of a plurality of second parallel lines parallel to the second candidate dividing line within a second predetermined length on both sides of each second candidate dividing line includes: respectively determining the lengths of a plurality of second parallel lines parallel to the second candidate dividing line within a second predetermined length on both sides of the second candidate dividing line, wherein both endpoints of the second parallel line are located on the target contour; respectively determining the length differences between the longest and shortest second parallel lines among the plurality of second parallel lines on one side of the second candidate dividing line; deleting the second candidate dividing line when it is determined that the length difference on one side is less than the first length threshold, or the sum of the length differences on both sides is less than the second length threshold; retaining the second candidate dividing line when it is determined that the length difference on one side is greater than or equal to the first length threshold, and the sum of the length differences on both sides is greater than or equal to the second length threshold.

[0065] In the above embodiment, the second predetermined length includes but is not limited to 9 pixels, 10 pixels, 11 pixels, etc. The plurality of second parallel lines are distributed on both sides of the second candidate dividing line, and the distance from the dividing line is an integer multiple of 1 pixel. The second parallel line has two intersections with the target contour, and the length of the second parallel line is the length of the line segment between the two intersections of the second parallel line and the target contour. The first length threshold includes but is not limited to 2 pixels, 4 pixels, 6 pixels, etc., and the second length threshold includes but is not limited to 4 pixels, 6 pixels, 10 pixels, etc. It should be noted that the above second parallel lines can be parallel lines within the same length range on both sides of the second candidate dividing line, or parallel lines within different length ranges on both sides of the second candidate dividing line. For example, the parallel lines within 9 pixels on the left side of the second candidate dividing line and the parallel lines within 10 pixels on the right side of the second candidate dividing line.

[0066] In the above embodiment, if the length difference of the parallel lines on one side or the sum of the length differences of the parallel lines on both sides is lower than the threshold length, it indicates that the block shapes in the areas on both sides of the dividing line are relatively regular.

[0067] As an alternative embodiment, segmenting the target area based on the first target segmentation line group and the second target segmentation line group includes: combining the first target segmentation line group and the second target segmentation line group to obtain a third target segmentation line group; when it is determined that the third target segmentation line group includes segmentation lines, performing at least one of the following operations on the third target segmentation line group to obtain a fourth target segmentation line group: deleting one of two parallel third target segmentation lines in the third target segmentation line group whose distance is less than the second distance threshold; deleting the segmentation lines in the third target segmentation line group whose segmented area is less than the second area threshold; for two third target segmentation lines with intersections in the third target segmentation line group, starting from the intersection, splitting each of the two third target segmentation lines into two segmentation lines; segmenting the target area based on the fourth target segmentation line group.

[0068] In the above embodiments, the second distance includes but is not limited to 9 pixels, 11 pixels, etc., and the second area threshold includes but is not limited to 4 square meters, 6 square meters, 9 square meters, etc.

[0069] In the above embodiments, combining the first target segmentation line group and the second target segmentation line group can make the segmentation lines better adapt to the shape of the target contour. By setting the second distance threshold and the second area threshold to screen the segmentation lines, the problem of too small segmented area that may be caused by the too close distance between the segmentation lines is avoided. Splitting the two third target segmentation lines with intersections into two new segmentation lines ensures that the segmented blocks are not disconnected. This can improve the accuracy and precision of the segmentation, making the segmentation result of the target area more in line with the actual situation.

[0070] As an alternative embodiment, segmenting the target area based on the fourth target segmentation line group includes: performing at least one of the following operations to obtain a fifth target segmentation line group: when it is determined that the fourth target segmentation line group includes a segmentation line whose segmented first area is less than the third area threshold, merging the first area into the adjacent area separated by the longest segmentation line used to segment the first area, and deleting the longest segmentation line; when it is determined that the fourth target segmentation line group includes a fourth target segmentation line passing through an obstacle in the target area, removing the part of the fourth target segmentation line passing through the obstacle, and determining the remaining part as multiple new segmentation lines; segmenting the target area based on the fifth target segmentation line group.

[0071] In the above embodiments, the third area threshold includes but is not limited to 2 square meters, 4 square meters, etc.

[0072] In the above embodiments, by setting the third area threshold and the block merging scheme, the problem of too small divided area is avoided. At the same time, the partial dividing lines passing through the obstacles are removed, making the sub-blocks more conform to the distribution of the obstacles, and improving the accuracy and feasibility of the dividing lines.

[0073] As an alternative embodiment, after obtaining the third target dividing line group, the method further includes: when it is determined that the third target dividing line group does not include dividing lines, determining the first circumscribed rectangle of the target area; determining the connection line of the midpoints of the long sides of the first circumscribed rectangle as the target dividing line of the target area; and dividing the target area based on the target dividing line.

[0074] In the above embodiments, the first circumscribed rectangle is the smallest positive rectangle covering the target area. In the above embodiments, a regional division scheme is provided for the case where the target area is a relatively regular figure.

[0075] As an alternative embodiment, dividing the target area based on the target dividing line includes: when it is determined that there is an area in the areas divided from the target area that is larger than the fourth area threshold, repeatedly performing the following operations until there is no area in the areas divided from the target area that is larger than the fourth area threshold: determining the second circumscribed rectangle of the area larger than the fourth area threshold; determining the connection line of the midpoints of the long sides of the second circumscribed rectangle as the dividing line of the area larger than the fourth area threshold; and dividing the target area based on the finally determined respective dividing lines.

[0076] In the above embodiments, the fourth area threshold includes but is not limited to 9 square meters, 12 square meters, and the like.

[0077] In this embodiment, by re-dividing the divided area larger than the fourth area threshold, the problem of too large divided area is avoided.

[0078] As an alternative embodiment, dividing the target area based on the target dividing line includes: when it is determined that the target dividing line passes through an obstacle in the target area, removing the partial dividing line of the target dividing line that passes through the obstacle, and determining the remaining part as a plurality of new dividing lines; and dividing the target area based on the plurality of new dividing lines.

[0079] In the above embodiments, by deleting the partial dividing line passing through the obstacle and only retaining the remaining dividing lines, the regional division becomes more reasonable.

[0080] As an optional implementation, after the target area is segmented based on multiple new dividing lines, the method further includes: drawing the finally retained dividing lines in the target area included in the target map; assigning the colors of the adjacent areas to each dividing line; if the area of the area is less than the fifth area threshold, assigning the color of the area to the color of the area adjacent to the block with an area greater than the threshold and the smallest area, where the fifth area threshold includes but is not limited to 2 square meters, 4 square meters, etc.; drawing the result of the area segmentation on the final target map.

[0081] Taking the segmentation of a room as an example, the present invention will be described as a whole below.

[0082] According to a specific embodiment of the present invention, a method for segmenting a room area is provided, and the method includes:

[0083] Step 1, count the rooms with larger areas in a house map, and divide each room with a larger area into blocks in turn. Among them, the dividing lines can be extracted separately using Step 2, or the dividing lines can be extracted separately using Step 3, or the two methods in Step 2 combined with Step 3 can be used to comprehensively extract the dividing lines.

[0084] Step 2, for the room block to be divided, extracting the dividing line according to the shape of the block includes:

[0085] Step 2.1, extract the outermost contour of the block, and traverse and calculate the normal vector of each point P on the contour;

[0086] Among them, the normal vector of each point can be the normal vector of the vector from the point to the adjacent point pointing to the inside of the block;

[0087] Step 2.2, set the angle range according to the normal vector, and find the point with the closest Euclidean distance to point P on the contour within this range to form a candidate point match, and find a closest point for all points on the contour. Among them, the closest point also needs to be a point on the contour;

[0088] Step 2.3, traverse the candidate points and their closest points. Only when the two points are the closest points to each other, retain the match of the two points and form a candidate dividing line (corresponding to the aforementioned first candidate dividing line), otherwise delete the candidate point match;

[0089] Step 2.4, traverse the candidate dividing lines, and delete one of the candidate dividing lines with duplicate matches and the candidate dividing lines that do not conform to the room shape;

[0090] Step 2.5, calculate the score of each candidate dividing line: On the left and right sides of the candidate dividing line, calculate the lengths of the line segments parallel to the candidate dividing line in the step range (corresponding to the aforementioned first predetermined length) in the image. The step range includes, but is not limited to, 9 pixels, 10 pixels, 11 pixels, etc. The length of the line segment is the length of the line segment between the intersections of the straight line parallel to the candidate dividing line and the contour within the step range. The candidate dividing line score = the maximum value of the line segments on both sides - the minimum value of the line segments on both sides. The candidate dividing line score is the length difference between the maximum value and the minimum value of the line segments on both sides. At the same time, if the candidate dividing line score is less than the threshold, delete this dividing line; where the threshold includes, but is not limited to, 2 to 3 pixels, etc. The distance between the length of the line segment within the step range and the candidate dividing line is an integer multiple of 1 pixel;

[0091] Step 2.6, delete adjacent parallel dividing lines: If the distance between two dividing lines is less than the threshold (corresponding to the aforementioned first distance threshold), where the threshold includes, but is not limited to, 9 to 11 pixels, etc.;

[0092] Step 2.7, save the remaining candidate dividing lines.

[0093] Step 3, extract the dividing lines from the room block to be divided again, including:

[0094] Step 3.1, extract the outermost contour of the block, traverse each point P on the contour, and find the intersection points horizontally to the right and vertically downwards on the contour as the corresponding points of point P to form candidate dividing lines. If it goes outside the room horizontally to the right and vertically downwards, point P has no corresponding point;

[0095] Step 3.2, traverse the candidate dividing lines. If the length of the candidate dividing line is not within the length range (corresponding to the aforementioned predetermined length range), and the sum of the areas of the two blocks divided by the dividing line is less than the threshold (corresponding to the aforementioned first area threshold), then delete this candidate dividing line, where the length range includes, but is not limited to, 10 pixels, 20 pixels, 40 pixels, etc., and the threshold includes, but is not limited to, 4 square meters, 9 square meters, 16 square meters, etc.;

[0096] Step 3.3, calculate the length of each candidate dividing line, and the maximum and minimum values of the line segments between the intersections of the parallel lines parallel to this dividing line on each side within the step range (corresponding to the aforementioned second predetermined length) on the left and right sides of the dividing line. The step range includes, but is not limited to, 11 pixels, 10 pixels, 9 pixels, etc.;

[0097] Step 3.4, if the difference between the longest value and the shortest value on each side of the dividing line is less than threshold 1 (corresponding to the aforementioned first length threshold) or the sum of the differences on both sides is less than threshold 2 (corresponding to the aforementioned second length threshold), then delete the dividing line, where threshold 1 includes but is not limited to 2 to 4 pixels, etc., and threshold 2 includes but is not limited to 4 to 6 pixels, etc.; if the candidate dividing line is not the shortest in length among the parallel line segments within the step range, then delete the dividing line;

[0098] Step 3.5, the remaining candidate dividing lines are the dividing lines of the narrow channel and are saved.

[0099] Step 4, merge the dividing lines extracted in Step 2 and Step 3 and put them into an array. If there are dividing lines at this time, go to Step 5, otherwise go to Step 6.

[0100] Step 5, optimize the dividing lines in Step 4, including:

[0101] Step 5.1, delete one of the duplicate candidate dividing lines, and delete the candidate dividing lines that are parallel and the distance between them is less than the threshold (corresponding to the aforementioned second distance threshold), where the threshold includes but is not limited to 9 to 11 pixels, etc.;

[0102] Step 5.2, traverse and take out the candidate dividing lines, draw all the lines on the block diagram to divide the block into two parts. If the areas of the two divided parts are less than the threshold (corresponding to the aforementioned second area threshold), then delete the candidate dividing line, where the threshold includes but is not limited to 4 to 6 square meters, etc.;

[0103] Step 5.3, process the intersecting candidate dividing lines. Find the intersection point of the two candidate dividing lines, divide each candidate dividing line into two new lines from this intersection point, delete the old dividing lines, and save the new dividing lines;

[0104] Step 5.4, merge small areas: all the dividing lines divide the block into multiple small parts, number each part, save the dividing lines of each part and the corresponding adjacent parts, sort them according to the area size. If the area of a certain part is less than the threshold (corresponding to the aforementioned third area threshold), then merge this part into the adjacent block corresponding to its longest dividing line, delete this dividing line, construct a new part, and store the information of the merged part until there are no parts with an area less than the threshold, where the threshold includes but is not limited to 3 to 5 square meters, etc.; through this step, small areas are eliminated.

[0105] Step 5.5, if the dividing line passes through an obstacle, then divide the dividing line into multiple dividing lines at the obstacle;

[0106] Step 5.6, if there are no remaining dividing lines, go to Step 6, otherwise go to Step 7.

[0107] Step 6, since the dividing line is not retained, it indicates that this block is a relatively regular block diagram, so the middle line division method is used for division. This method includes:

[0108] Step 6.1, find the smallest positive rectangle that encloses this block, and this rectangle can be the circumscribed rectangle of this block;

[0109] Step 6.2, determine the midpoint connection of the longest side of the rectangle as the candidate dividing line;

[0110] Step 6.3, if there are obstacles within the block, divide it into multiple lines;

[0111] Through this step, the rationality of room partitioning is improved, making the partitioning conform to the distribution of the actual house type and obstacles.

[0112] Step 7, use the generated dividing line to divide this room, and determine whether there are still blocks in the divided room with an area greater than the threshold (corresponding to the aforementioned fourth area threshold). If so, take out the blocks with an area greater than the threshold and transfer them to Step 2; otherwise, transfer to Step 8. Among them, the threshold includes but is not limited to 5 to 7 square meters, etc.

[0113] Step 8, draw the blocks after dividing each room on the final map, including:

[0114] Step 8.1, draw the final dividing line on each room to divide the room to be divided into multiple blocks

[0115] Step 8.2, draw different colors for each block

[0116] Step 8.3, assign the color of the adjacent room to each dividing line;

[0117] Step 8.4, merge small - area blocks again. If the area of a block is less than the threshold (corresponding to the aforementioned fifth area threshold), then assign the color of the block to the color of the smallest block with an area greater than the threshold and adjacent to this block. Among them, the threshold includes but is not limited to 1 to 3 square meters, etc.;

[0118] Step 8.5, draw the final division result of this room on the final map.

[0119] Step 9, output the division result of the final room map, where, Figure 5 is the schematic diagram of area division in an embodiment of the present invention. The division map of this room can be referred to in the appendix Figure 5 .

[0120] This embodiment can achieve the rationality of room partitioning, making the partitioning more in line with the distribution of real house types and obstacles. In addition, the block merging scheme proposed in the above embodiment can eliminate blocks with very small areas and ensure that the divided blocks are not disconnected, which can help the robot accurately locate dirty areas and improve the turbidity cleaning efficiency of the robot.

[0121] According to another specific embodiment of the present invention, an overall flowchart of a region segmentation method is further provided. Figure 6 It is the overall flowchart of the region segmentation method of the embodiment of the present invention, as Figure 6 shown, and this process includes the following steps:

[0122] Step S601, input a room partition map.

[0123] Step S602, determine whether the map is valid.

[0124] If the map is valid, execute step S603, and put the rooms with an area greater than 20 square meters in the initial map area into the set rooms; if the map is invalid, end the program.

[0125] Execute step S604, and determine whether there are still rooms in the set rooms that have not been completely partitioned.

[0126] If there are rooms that have not been completely partitioned, execute step S605, take out a room from the set rooms and put it into the set of rooms to be processed candidate_rooms; if there are no rooms that have not been completely partitioned, jump to step S619 to number each block of the entire map; after executing step S619, execute step S620, input the turbidity partition map after segmentation, and then the task ends.

[0127] Execute step S606, and determine whether the set candidate_rooms is an empty set.

[0128] If the set candidate_rooms is an empty set, jump to step S618, draw the dividing line of this room on the final map; then jump to step 604.

[0129] If the set candidate_rooms is not an empty set, continue to execute step S607, take out a block to be segmented from the set candidate_rooms and put it into the set of rooms to be processed candidate_block.

[0130] Execute step S608, based on the room shape and the distribution of obstacles in the room, find the narrow places in the room area to form a set of candidate dividing lines; the specific implementation manner of step S608 includes but is not limited to the methods of steps 2 and 3 in the above embodiment.

[0131] Execute step S609 to determine whether a candidate set of dividing lines is obtained;

[0132] If a candidate set of dividing lines is not obtained, jump to step S617. This region is a relatively regular region. Use halving division on the region to obtain the optimal dividing line; The specific implementation of step S617 includes but is not limited to the method of step 6 in the above embodiments; Then jump to step S612;

[0133] If a candidate set of dividing lines is obtained, execute step S610 to optimize the dividing lines, delete unreasonable dividing lines, and find the optimal dividing line;

[0134] Execute step S611 to determine whether there is an optimal set of dividing lines;

[0135] If there is no optimal set of dividing lines, jump to step S617;

[0136] If there is an optimal set of dividing lines, execute step S612 to determine whether there is ultimately an optimal set of dividing lines;

[0137] If there is ultimately an optimal set of dividing lines, execute step S613 to place the newly added dividing lines in the dividing line variable of this room;

[0138] If there is ultimately no optimal set of dividing lines, jump to step S606;

[0139] Execute step S614. After this room is divided, look for blocks with an area greater than 20 square meters;

[0140] Execute step S615 to determine whether there are still blocks with an area greater than 20 square meters;

[0141] If there are blocks with an area greater than 20 square meters, execute step S616 to place the new blocks with an area greater than 10 square meters into the set candidate_rooms to achieve secondary division;

[0142] If there are no blocks with an area greater than 20 square meters, jump to step S606;

[0143] After executing step S616, jump to step S606.

[0144] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases, the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to enable a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of the present invention.

[0145] In this embodiment, a region segmentation device is further provided. This device is used to implement the above embodiments and preferred implementation manners, and those that have been described will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that can achieve a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware is also possible and contemplated.

[0146] Figure 7 is the structural block diagram of the region segmentation device of the embodiment of the present invention. As Figure 7 shown, this device includes:

[0147] A first acquisition module 72, configured to acquire the target contour of the target region included in the target map;

[0148] A first determination module 74, configured to perform the following operations for each position point included in the target contour to determine a first candidate segmentation line group of the target region: determine the normal vector of the position point; determine the target angle range based on the normal vector; determine the matching points on the target contour that are closest to the position point within the target angle range to form multiple position point pairs; screen out the target position point pairs that are mutual matching points from the multiple position point pairs; determine the connection line of the target position point pairs as the first candidate segmentation line;

[0149] A first screening module 76, configured to screen the first candidate segmentation line group based on the position of each first candidate segmentation line included in the first candidate segmentation line group in the target region to obtain a first target segmentation line group;

[0150] A first segmentation module 78, configured to segment the target region based on the first target segmentation line group.

[0151] In an optional embodiment, the first screening module 76 includes:

[0152] A first determination unit, configured to determine the lengths of a plurality of first parallel lines that are parallel to a first candidate dividing line and within a first predetermined length on both sides of the first candidate dividing line, where both endpoints of the first parallel lines are located on the target contour; an extraction unit, configured to extract the parallel line with the maximum length and the parallel line with the minimum length among the plurality of first parallel lines; a first processing unit, configured to use the length difference between the parallel line with the maximum length and the parallel line with the minimum length as the score of the first candidate dividing line; a first screening unit, configured to screen the first candidate dividing line group based on the score of the first candidate dividing line.

[0153] In an optional embodiment, the first dividing module 78 includes: a first deletion unit, configured to delete the parallel line with a lower score among two parallel lines when it is determined that there are two parallel lines with a distance less than a first distance threshold in the first target dividing line group; a first dividing unit, configured to divide the target area based on the remaining dividing lines in the first target dividing line group.

[0154] In an optional embodiment, the apparatus further includes: a second determination module, configured to, before dividing the target area based on the first target dividing line group, perform the following operations for each position point included in the target contour to determine a second candidate dividing line group of the target area: draw a ray in the positive direction of the axis of the image coordinate system starting from the position point, and when it is determined that the ray intersects the target contour, determine the intersection point as the corresponding point of the position point; determine the connection line between the position point and the corresponding point of the position point as the second candidate dividing line; a second screening module, configured to screen the second candidate dividing line group based on the type of each second candidate dividing line included in the second candidate dividing line group and / or the position in the target area to obtain a second target dividing line group; the first dividing module 78 includes: a second dividing unit, configured to divide the target area based on the first target dividing line group and the second target dividing line group.

[0155] In an optional embodiment, the second screening module includes: a second screening unit, configured to screen the second candidate dividing line group based on the length of each second candidate dividing line and / or the areas of the two regions separated by the second candidate dividing line.

[0156] In an optional embodiment, the second screening unit includes: a first screening subunit, configured to delete the second candidate dividing lines in the second candidate dividing line group whose lengths of the dividing lines are not within a predetermined length range. In an optional embodiment, the second screening unit includes: a second screening subunit, configured to delete the second candidate dividing lines whose sum of the areas of the two divided regions is less than a first area threshold.

[0157] In an alternative embodiment, the second screening module further includes: a third screening unit configured to screen the second candidate dividing line group based on the lengths of a plurality of second parallel lines parallel to the second candidate dividing line within a second predetermined length on both sides of each second candidate dividing line, wherein both endpoints of the second parallel lines are located on the target contour.

[0158] In an alternative embodiment, the third screening unit includes: a first determination subunit configured to respectively determine the lengths of a plurality of second parallel lines parallel to the second candidate dividing line within a second predetermined length on both sides of the second candidate dividing line; a second determination subunit configured to respectively determine the length differences between the longest and shortest second parallel lines among the plurality of second parallel lines on one side of the second candidate dividing line; a first deletion subunit configured to delete the second candidate dividing line when it is determined that the length difference on one side is less than a first length threshold, or the sum of the length differences on both sides is less than a second length threshold; and a first retention subunit configured to retain the second candidate dividing line when it is determined that the length difference on one side is greater than or equal to the first length threshold and the sum of the length differences on both sides is greater than or equal to the second length threshold.

[0159] In an alternative embodiment, the second dividing unit includes: a first merging subunit configured to merge the first target dividing line group and the second target dividing line group to obtain a third target dividing line group; a first obtaining subunit configured to, when it is determined that the third target dividing line group includes dividing lines, perform at least one of the following operations on the third target dividing line group to obtain a fourth target dividing line group: deleting one of two parallel third target dividing lines in the third target dividing line group with a distance less than a second distance threshold; deleting a dividing line in the third target dividing line group with a divided area less than a second area threshold; for two third target dividing lines with intersections in the third target dividing line group, starting from the intersection, dividing each of the two third target dividing lines into two dividing lines; and a first dividing subunit configured to divide the target area based on the fourth target dividing line group.

[0160] In an alternative embodiment, the first dividing subunit includes: an obtaining sub-subunit configured to perform at least one of the following operations to obtain a fifth target dividing line group: when it is determined that the fourth target dividing line group includes a dividing line with a divided first area less than a third area threshold, merging the first area into an adjacent area separated by the longest dividing line for dividing the first area and deleting the longest dividing line; when it is determined that the fourth target dividing line group includes a fourth target dividing line passing through an obstacle in the target area, removing the part of the fourth target dividing line passing through the obstacle and determining the remaining part as a plurality of new dividing lines; and a dividing sub-subunit configured to divide the target area based on the fifth target dividing line group.

[0161] In an alternative embodiment, the apparatus further includes: a third determination module, configured to determine a first circumscribed rectangle of the target area after the first merging unit obtains a third target dividing line group and when it is determined that the third target dividing line group does not include a dividing line; a fourth determination module, configured to determine a connecting line of the midpoints of the long sides of the first circumscribed rectangle as the target dividing line of the target area; and a second dividing module, configured to divide the target area based on the target dividing line.

[0162] In an alternative embodiment, the second dividing module includes: a second processing unit, configured to, when it is determined that there is an area in the area divided from the target area that is larger than a fourth area threshold, repeatedly perform the following operations until there is no area in the area divided from the target area that is larger than the fourth area threshold: determine a second circumscribed rectangle of the area larger than the fourth area threshold; determine a connecting line of the midpoints of the long sides of the second circumscribed rectangle as the dividing line of the area larger than the fourth area threshold; and a third dividing unit, configured to divide the target area based on the finally determined respective dividing lines.

[0163] In an alternative embodiment, the second dividing module includes: a second determination unit, configured to, when it is determined that the target dividing line passes through an obstacle in the target area, remove the part of the dividing line passing through the obstacle included in the target dividing line and determine the remaining part as a plurality of new dividing lines; and a fourth dividing unit, configured to divide the target area based on the plurality of new dividing lines.

[0164] An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, and the computer program is configured to execute the steps in any one of the above method embodiments when running.

[0165] In an exemplary embodiment, the above computer-readable storage medium may include, but is not limited to: various media such as a USB flash drive, a read-only memory (ROM for short), a random access memory (RAM for short), a mobile hard disk, a magnetic disk, or an optical disc that can store a computer program.

[0166] An embodiment of the present invention further provides an electronic device, including a memory and a processor, where a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0167] Specific examples in this embodiment may refer to the examples described in the above embodiments and exemplary embodiments, and details are not described herein again.

[0168] Obviously, those skilled in the art should understand that the above-mentioned modules or steps of the present invention can be implemented by a general-purpose computing device. They can be concentrated on a single computing device or distributed on a network composed of multiple computing devices. They can be implemented by program codes executable by the computing device. Thus, they can be stored in a storage device and executed by the computing device. And in some cases, the steps shown or described can be executed in a sequence different from that here, or they can be separately fabricated into individual integrated circuit modules, or multiple modules or steps among them can be fabricated into a single integrated circuit module for implementation. In this way, the present invention is not limited to any specific combination of hardware and software.

[0169] The above are only the preferred embodiments of the present invention and are not used to limit the present invention. For those skilled in the art, the present invention can have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the principle of the present invention shall be included within the protection scope of the present invention.

Claims

1. A method for region segmentation, characterized in that, it includes: Obtaining the target contour of the target region included in the target map; For each position point included in the target contour, perform the following operations to determine the first candidate segmentation line group of the target region: Determine the normal vector of the position point; Determine the target angle range based on the normal vector; Determine the matching points on the target contour that are closest to the position point within the target angle range, forming multiple position point pairs; Screen out the target position point pairs that are mutual matching points from the multiple position point pairs; Determine the connection line of the target position point pair as the first candidate segmentation line; Screen the first candidate segmentation line group based on the position of each first candidate segmentation line included in the first candidate segmentation line group in the target region to obtain the first target segmentation line group; Segment the target region based on the first target segmentation line group.

2. The method according to claim 1, characterized in that, Screening the first candidate segmentation line group based on the position of each first candidate segmentation line included in the first candidate segmentation line group in the target region includes: Determining the lengths of multiple first parallel lines parallel to the first candidate segmentation line within a first predetermined length on both sides of the first candidate segmentation line, wherein both endpoints of the first parallel line are located on the target contour; Extracting the parallel line with the maximum length and the parallel line with the minimum length among the multiple first parallel lines; Taking the length difference between the parallel line with the maximum length and the parallel line with the minimum length as the score of the first candidate segmentation line; Screening the first candidate segmentation line group based on the score of the first candidate segmentation line.

3. The method according to claim 2, characterized in that, Segmenting the target region based on the first target segmentation line group includes: In the case of determining that there are two parallel lines with a distance less than the first distance threshold in the first target segmentation line group, deleting the parallel line with a lower score among the two parallel lines; Segmenting the target region based on the remaining segmentation lines in the first target segmentation line group.

4. The method according to claim 1, characterized in that: Before segmenting the target region based on the first target segmentation line group, the method further includes: For each position point included in the target contour, perform the following operations to determine the second candidate segmentation line group of the target region: Make a ray from the position point in the positive direction of the axis of the image coordinate system, and in the case of determining that the ray intersects the target contour, determine the intersection point as the corresponding point of the position point; Determine the connection line between the position point and the corresponding point of the position point as the second candidate segmentation line; Screen the second candidate segmentation line group based on the type and / or position of each second candidate segmentation line included in the second candidate segmentation line group in the target region to obtain the second target segmentation line group; Dividing the target area based on the first target dividing line group includes: dividing the target area based on the first target dividing line group and the second target dividing line group.

5. The method according to claim 4, wherein, screening the second candidate dividing line group based on the type of each second candidate dividing line included in the second candidate dividing line group includes: screening the second candidate dividing line group based on the length of each second candidate dividing line and / or the areas of the two areas separated by the second candidate dividing line.

6. The method according to claim 5, wherein, including at least one of the following: Screening the second candidate dividing line group based on the length of each second candidate dividing line includes: deleting the second candidate dividing lines in the second candidate dividing line group whose lengths of the dividing lines are not within a predetermined length range; Screening the second candidate dividing line group based on the areas of the two areas separated by each second candidate dividing line includes: deleting the second candidate dividing lines whose sum of the areas of the two separated areas is less than a first area threshold.

7. The method according to claim 4, wherein, screening the second candidate dividing line group based on the position of each second candidate dividing line included in the second candidate dividing line group in the target area includes: screening the second candidate dividing line group based on the lengths of a plurality of second parallel lines parallel to the second candidate dividing line within a second predetermined length on both sides of each second candidate dividing line, wherein both endpoints of the second parallel line are located on the target contour.

8. The method according to claim 7, wherein, screening the second candidate dividing line group based on the lengths of a plurality of second parallel lines parallel to the second candidate dividing line within a second predetermined length on both sides of each second candidate dividing line includes: respectively determining the lengths of a plurality of second parallel lines parallel to the second candidate dividing line within a second predetermined length on both sides of the second candidate dividing line; respectively determining the length differences between the longest and shortest second parallel lines among the plurality of second parallel lines on one side of the second candidate dividing line; deleting the second candidate dividing line when it is determined that the length difference on one side is less than a first length threshold, or the sum of the length differences on both sides is less than a second length threshold; retaining the second candidate dividing line when it is determined that the length difference on one side is greater than or equal to the first length threshold, and the sum of the length differences on both sides is greater than or equal to the second length threshold.

9. The method according to claim 4, wherein, dividing the target area based on the first target dividing line group and the second target dividing line group includes: combining the first target dividing line group and the second target dividing line group to obtain a third target dividing line group; When it is determined that there are dividing lines in the third target dividing line group, perform at least one of the following operations on the third target dividing line group to obtain a fourth target dividing line group: delete one of two parallel third target dividing lines in the third target dividing line group whose distance is less than the second distance threshold; delete the dividing line in the third target dividing line group whose divided area is less than the second area threshold; for two third target dividing lines with intersections in the third target dividing line group, starting from the intersection, divide each of the two third target dividing lines into two dividing lines; Divide the target area based on the fourth target dividing line group.

10. The method according to claim 9, wherein, dividing the target area based on the fourth target dividing line group includes: perform at least one of the following operations to obtain a fifth target dividing line group: when it is determined that there is a dividing line in the fourth target dividing line group whose divided first area is less than the third area threshold, merge the first area into the adjacent area separated by the longest dividing line used to divide the first area, and delete the longest dividing line; when it is determined that there is a fourth target dividing line passing through an obstacle in the target area in the fourth target dividing line group, remove the part of the fourth target dividing line passing through the obstacle, and determine the remaining part as multiple new dividing lines; Divide the target area based on the fifth target dividing line group.

11. The method according to claim 9, wherein, after obtaining the third target dividing line group, the method further includes: when it is determined that there are no dividing lines in the third target dividing line group, determine the first circumscribed rectangle of the target area; determine the connection line of the midpoints of the long sides of the first circumscribed rectangle as the target dividing line of the target area; Divide the target area based on the target dividing line.

12. The method according to claim 11, wherein, dividing the target area based on the target dividing line includes: when it is determined that there is an area in the target area whose divided area is greater than the fourth area threshold, repeatedly perform the following operations until there is no area in the target area whose divided area is greater than the fourth area threshold: determine the second circumscribed rectangle of the area greater than the fourth area threshold; determine the connection line of the midpoints of the long sides of the second circumscribed rectangle as the dividing line of the area greater than the fourth area threshold; Divide the target area based on the finally determined dividing lines.

13. The method according to claim 11, wherein, dividing the target area based on the target dividing line includes: when it is determined that the target dividing line passes through an obstacle in the target area, remove the part of the target dividing line passing through the obstacle, and determine the remaining part as multiple new dividing lines; Segment the target area based on the multiple new dividing lines.

14. An area segmentation device, characterized in that, it includes: A first acquisition module, configured to acquire the target contour of the target area included in the target map; A first determination module, configured to perform the following operations for each position point included in the target contour to determine a first candidate dividing line group of the target area: determine the normal vector of the position point; determine the target angle range based on the normal vector; determine the matching points on the target contour that are closest to the position point within the target angle range, and form multiple position point pairs; screen out the target position point pairs that are mutual matching points from the multiple position point pairs; Determine the connection line of the target position point pair as the first candidate dividing line; A first screening module, configured to screen the first candidate dividing line group based on the position of each first candidate dividing line included in the first candidate dividing line group in the target area to obtain a first target dividing line group; A first segmentation module, configured to segment the target area based on the first target dividing line group.

15. A storage medium, characterized in that, a computer program is stored in the storage medium, wherein the program can be executed by a terminal device or a computer to execute the area segmentation method described in any one of claims 1 to 13.

16. An electronic device, including a memory and a processor, characterized in that, a computer program is stored in the memory, and the processor is configured to run the computer program to execute the area segmentation method described in any one of claims 1 to 13.