A region division method and device
Patent Information
- Application Number
- CN202310253519.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-02
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2043-03-02
AI Technical Summary
[0003]本申请的目的在于提供一种区域划分方法及装置,旨在解决现有的问题,即现有技术进行区域划分时划分不准确,划分效率低的问题
[0018]本申请提供的一种区域划分方法及装置,可提高区域划分的准确度及效率。
Smart Images

Figure CN116416346B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular provides a method and apparatus for region division. Background Technology
[0002] As smart homes become increasingly prevalent, cleaning robots are also becoming more common. When using a cleaning robot, users can modify the areas delineated by the robot on a map to create multiple reasonable cleaning zones, allowing the robot to perform cleaning work according to these zones. However, existing technology has the following problems: Due to the display precision limitations of the software interface, the areas delineated by the user on the map may be inaccurate. For example, the connection points drawn manually may not be the actual target connection points, requiring multiple adjustments by the user. Furthermore, because the map on the display interface is often too small, when creating irregular or regular areas, the connection points along the lines of the delineated areas need to be perfectly aligned with the actual boundary lines, impacting the user's delineation efficiency. Summary of the Invention
[0003] The purpose of this application is to provide a method and apparatus for dividing regions, which aims to solve the existing problems, namely, the inaccuracy and low efficiency of the existing technology in dividing regions.
[0004] To achieve the above objectives, the technical solution adopted in this application is as follows:
[0005] In a first aspect, this application provides a method for dividing regions, which includes: acquiring a user's division trajectory in an electronic map; correcting the division trajectory according to a preset correction rule to obtain a division line; and intersecting the division line with the boundary line of the electronic map according to a preset connection rule to obtain an electronic map after dividing the regions.
[0006] In one embodiment, the dividing trajectory includes straight lines, polylines, curves, and any combination of the three; the step of correcting the dividing trajectory according to a preset correction rule to obtain a dividing line includes: determining the enclosed area to be formed between the dividing trajectory and the boundary line of the electronic map; determining the target point of the dividing trajectory to be formed into a dividing line based on the enclosed area to be formed and the orientation of the dividing trajectory in the enclosed area; and correcting the dividing trajectory to a dividing line that passes through the target point and remains in a straight line state.
[0007] In one embodiment, correcting the division trajectory according to a preset correction rule to obtain a division line includes: determining the room area of the division trajectory on the electronic map and the target room area pre-determined by the user on the electronic map; when the room area and the target room area are different, correcting the division trajectory to a division line displayed as a straight line on the electronic map, and then translating the division line to the target room area to obtain a division line in the target room area.
[0008] In one embodiment, the step of intersecting the dividing line with the boundary line of the electronic map according to a preset connection rule to obtain the electronic map after dividing the area includes: intersecting the two endpoints of the dividing line with the boundary line that is closest to the extension line of the dividing line, thereby obtaining the electronic map after dividing the area with the dividing line and the boundary line.
[0009] In one embodiment, the step of intersecting the dividing line with the boundary line of the electronic map according to a preset connection rule to obtain the electronic map after dividing the area includes: determining the room area of the dividing line in the electronic map; determining the vertex on the boundary line in the room area by the convex hull point; when the distance between the intersection of the dividing line and the boundary line and the vertex of the boundary line is less than or equal to a preset distance, determining the vertex to be connected with the connecting line, translating the dividing line so that the dividing line is connected with the vertex to be connected, and obtaining the electronic map after dividing the area with the dividing line and the boundary line.
[0010] In one embodiment, the step of intersecting the dividing line with the boundary line of the electronic map according to a preset connection rule to obtain the electronic map after dividing the area includes: determining the room area of the dividing line in the electronic map; when the size ratio of the enclosed area formed by the dividing line and the boundary line corresponding to the room area to the room area is less than a first preset ratio, translating the dividing line so that the size ratio reaches the first preset ratio, thereby obtaining the electronic map after dividing the area with the dividing line and the boundary line.
[0011] In one embodiment, the dividing line includes a first dividing line and a second dividing line; the step of intersecting the dividing line with the boundary line of the electronic map according to a preset connection rule to obtain the electronic map after dividing the area includes: determining the room area of the first dividing line in the electronic map; when the size ratio of the enclosed area formed by the first dividing line and the boundary line corresponding to the room area to the room area is less than a second preset ratio, obtaining the second dividing line in the electronic map area corresponding to the room area; when the size ratio of the enclosed area formed by the second dividing line and the boundary line corresponding to the room area to the room area is greater than or equal to a third preset ratio, translating the first dividing line so that the first dividing line coincides with the second dividing line, obtaining the electronic map after dividing the area with the dividing line and the boundary line; when the size ratio of the enclosed area formed by the second dividing line and the boundary line corresponding to the room area to the room area is less than the third preset ratio, translating the second dividing line so that the size ratio reaches the third preset ratio, and translating the first dividing line so that the first dividing line coincides with the second dividing line, obtaining the electronic map after dividing the area with the dividing line and the boundary line.
[0012] In one embodiment, the step of intersecting the dividing line with the boundary line of the electronic map according to a preset connection rule to obtain an electronic map after dividing the area includes: when the dividing line passes through the boundary line of a first room in the electronic map and reaches a second room in the electronic map, determining a first length of the line segment of the dividing line located in the second room; when the first length is less than or equal to the length or width of the second room by a preset ratio, deleting the line segment of the dividing line located in the second room, so that the remaining line segment of the dividing line intersects with the boundary of the first room, to obtain an electronic map after dividing the area with the dividing line and the boundary line; when the first length is greater than the length or width of the second room by a preset ratio, extending the dividing line, so that the extended dividing line intersects with the boundary of the second room, to obtain an electronic map after dividing the area with the dividing line and the boundary line.
[0013] In one embodiment, the step of intersecting the dividing line with the boundary line of the electronic map according to a preset connection rule to obtain the electronic map after dividing the area includes: determining the room area of the dividing line in the electronic map; when the size ratio of the enclosed area formed by the dividing line and the boundary line corresponding to the room area to the room area is greater than or equal to a fourth preset ratio, translating the dividing line so that the dividing line connects with the vertex corresponding to the room area to obtain the electronic map after dividing the area with the dividing line and the boundary line.
[0014] Secondly, this application provides a region division device, which includes: an acquisition module for acquiring a user's division trajectory in an electronic map; a correction module for correcting the division trajectory according to a preset correction rule to obtain a division line; and a connection module for intersecting the division line with the boundary line of the electronic map according to a preset connection rule to obtain an electronic map after region division.
[0015] Thirdly, this application also provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor; when the processor executes the computer program, it implements the region partitioning method of the first aspect described above.
[0016] Fourthly, this application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the region partitioning method described in the first aspect.
[0017] The beneficial effects of this application are:
[0018] This application provides a method and apparatus for dividing regions, which can improve the accuracy and efficiency of region division.
[0019] Specifically, after obtaining the user's segmentation trajectory on the electronic map, the segmentation trajectory is corrected according to a preset correction rule to obtain a segmentation line, which improves the connection efficiency between the segmentation line and the boundary line. Then, the segmentation line is intersected with the boundary line of the electronic map according to a preset connection rule to obtain the electronic map after the area is divided. The segmentation line and the boundary line are automatically connected to improve the efficiency of area division, reduce the problem of inaccurate manual division, and improve the user's experience in area division.
[0020] It is understandable that devices that can implement the above methods have the same beneficial effects. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 This is a flowchart of an embodiment of the region division method of this application;
[0023] Figure 2 This is a flowchart of an embodiment of the region division method of this application;
[0024] Figure 3This is a schematic diagram of the dividing line in Embodiment 1 of the region division method of this application;
[0025] Figure 4 This is a schematic diagram of the dividing line in Embodiment 1 of the region division method of this application;
[0026] Figure 5 This is a schematic diagram of the dividing line in Embodiment 1 of the region division method of this application;
[0027] Figure 6 This is a schematic diagram of the dividing line in Embodiment 1 of the region division method of this application;
[0028] Figure 7 This is a schematic diagram of the dividing line in Embodiment 1 of the region division method of this application;
[0029] Figure 8 This is a schematic diagram of the dividing line in Embodiment 1 of the region division method of this application;
[0030] Figure 9 This is a schematic diagram of the dividing line in Embodiment 1 of the region division method of this application;
[0031] Figure 10 This is a schematic diagram of the dividing line in Embodiment 1 of the region division method of this application;
[0032] Figure 11 This is a flowchart of an embodiment of the region division method of this application;
[0033] Figure 12 This is a flowchart of Embodiment 2 of the region division method of this application;
[0034] Figure 13 This is a schematic diagram of the dividing line in Embodiment 2 of the region division method of this application;
[0035] Figure 14 This is a flowchart of Embodiment 2 of the region division method of this application;
[0036] Figure 15 This is a flowchart of Embodiment 2 of the region division method of this application;
[0037] Figure 16 This is a flowchart of Embodiment 2 of the region division method of this application;
[0038] Figure 17 This is a schematic diagram of the dividing line in Embodiment 2 of the region division method of this application;
[0039] Figure 18 This is a flowchart of Embodiment 2 of the region division method of this application;
[0040] Figure 19 This is a structural block diagram of an embodiment of the region division device of this application;
[0041] Figure 20 This is a structural block diagram of the terminal device of this application. Detailed Implementation
[0042] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this application, and should not be construed as limiting this application.
[0043] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this application, "multiple" means two or more, unless otherwise explicitly specified.
[0044] The region division method provided in this application embodiment can be applied to terminal devices such as mobile phones and tablets. This application embodiment does not impose any restrictions on the specific type of terminal device.
[0045] To illustrate the technical solution described in this application, the following embodiments will be used for further explanation.
[0046] Example 1
[0047] Please see Figure 1 The region division method provided in this application includes:
[0048] Step S11: Obtain the user's segmented trajectory on the electronic map.
[0049] The defined trajectory is the path created by a user manually drawing on the map of an app on their device. It represents the approximate shape of the area drawn by the user based on their desired division. In applications, if a user's gesture is only a brief movement and does not connect to the boundary line, it can be considered an accidental touch.
[0050] Step S12: Correct the division trajectory according to the preset correction rule to obtain the division line;
[0051] Please see Figure 2 In one embodiment, the segmented trajectory includes straight lines, polylines, curves, and any combination of the three.
[0052] The step of correcting the division trajectory according to a preset correction rule to obtain the division line includes:
[0053] Step S121: Determine the enclosed area to be formed between the divided trajectory and the boundary line of the electronic map;
[0054] Step S122: Determine the target point of the dividing line to be formed in the dividing trajectory based on the orientation of the enclosed area to be formed and the dividing trajectory in the enclosed area;
[0055] Step S123: Correct the division trajectory according to the target point to a division line that passes through the target point and remains in a straight line.
[0056] The preset correction rules are used to correct the shape and position of the segmented trajectory manually entered by the user.
[0057] The following example illustrates how a user can draw a curve on a map and then correct it into a straight line using preset correction rules.
[0058] The enclosed area to be formed between the defined trajectory and the boundary line of the electronic map can be determined by methods such as extending the defined trajectory in one direction, extending the defined trajectory in two directions, or intersecting the defined trajectory with the boundary line. Figure 3 In this process, the first curve 31 can be extended (the extension line is represented by a dashed line) to intersect with the boundary line, forming a first enclosed area S, thereby determining the enclosed area to be formed between the dividing trajectory and the boundary line of the electronic map. If the dividing trajectory has already intersected with the boundary line, the enclosed area can be directly determined based on the area enclosed by the dividing trajectory and the boundary line.
[0059] Based on the orientation of the first enclosed area to be formed and the dividing trajectory within the enclosed area, the target point of the dividing line to be formed in the dividing trajectory is determined, for example... Figure 4 The direction of the second curve 41 away from the second enclosed area P determines the target point for forming the dividing line. Then, the curve arc point a and the user-selected point b, or a point near the arc point, are extended towards the boundary line to form the first straight line 42 (represented by a dashed line in the figure). Since the user's dividing trajectory, i.e., the second curve 41, is intended to divide a larger area, the area enclosed by the first straight line 42 and the boundary line is larger than the original second enclosed area P, which helps to improve the user experience.
[0060] In another embodiment, the target point to be formed as the dividing line can also be determined as needed by the orientation toward the second enclosed area P, and then a straight line is formed by the two endpoints of the curve.
[0061] like Figure 5 As shown, the target point of the dividing line to be formed is determined by the direction of the third enclosed area T according to the third curve 51, and the second straight line 52 (represented by dashed lines in the figure) is formed by the two endpoints of the curve.
[0062] In another embodiment, the target point to be formed as the dividing line can be determined by the orientation close to the third enclosing region T, and then the curve arc point and the user-selected point located near the arc point can be extended to the boundary line to form a straight line.
[0063] The following example illustrates how a user can draw a broken line on a map and then correct it into a straight line using preset correction rules.
[0064] The enclosed area to be formed between the defined trajectory and the boundary line of the electronic map can be determined by methods such as extending the defined trajectory in one direction, extending the defined trajectory in two directions, or intersecting the defined trajectory with the boundary line. Figure 6 In the process, the first broken line 61 is extended (the extension line is represented by a dashed line) until it intersects with the boundary line, forming the fourth enclosed area Q, thereby determining the enclosed area to be formed between the dividing trajectory and the boundary line of the electronic map. If the dividing trajectory has already intersected with the boundary line, the enclosed area can be directly determined based on the area enclosed by the dividing trajectory and the boundary line.
[0065] like Figure 7 As shown, the corrected straight line can be determined based on the area enclosed by the second broken line 71 and the boundary line, as well as the orientation of the broken line.
[0066] Based on the fifth enclosed region R to be formed and the orientation of the dividing trajectory within the enclosed region, the target point of the dividing line to be formed in the dividing trajectory is determined, for example, Figure 7 The second broken line 71, moving away from the fifth enclosed area R, determines the target point for forming the dividing line. Then, the third straight line 72 is formed by extending from the broken line vertex c and the user-selected point d, or a point near the broken line vertex, towards the boundary line. Since the user's dividing trajectory aims to divide a larger area, the area enclosed by the third straight line and the boundary line is larger than the original fifth enclosed area R, which helps improve the user experience.
[0067] In another embodiment, the target point to be formed as the dividing line can be determined by the orientation toward the fifth enclosing region R, and then a straight line is formed by the two endpoints of the broken line.
[0068] like Figure 8 As shown, the third broken line 81 determines the target point of the dividing line to be formed according to the direction away from the sixth enclosed area U. Then, the two endpoints of the curve are used as target points to form the fourth straight line 82 (represented by dashed lines in the figure).
[0069] In another embodiment, the target point to be formed as the dividing line can be determined by the orientation close to the sixth enclosing region U. Then, the line is extended from the vertex of the polyline and the point selected by the user or located near the vertex of the polyline to the boundary line to form a straight line.
[0070] It should be noted that the number of curves or polylines in the examples above is not limited to one. Users can also freely draw dividing lines that combine straight lines and curves on the map. In this case, the curves can be corrected to straight lines first, and then the corrected straight lines can be connected to the original straight lines to form a single straight line. Users can freely draw dividing trajectories on the map and form standard straight lines. These standard straight lines can be solid black lines of preset pixels, which can be distinguished from boundary lines. For example... Figure 9 As shown, the dividing line includes the fourth curve 91 and the fifth straight line 92. First, the target point to be formed for the dividing line is determined according to the direction of the fourth curve away from the enclosed area W. For example, the curve arc point e and the user-selected point f or a point near the arc point are extended towards the boundary line to form the sixth straight line 93. Then, the distance between the fifth straight line 92 (the oblique straight line) and the sixth straight line 93 and the enclosed area W is determined. Specifically, a point g can be selected in the enclosed area W, and the distance from point g to the fifth straight line 92 and the sixth straight line 93 is used as the distance between the fifth straight line 92 and the sixth straight line 93 and the enclosed area W. Finally, the fifth straight line 92, which is closer to the enclosed area W, is selected and extended to form the final dividing line.
[0071] In another embodiment, such as Figure 10 As shown, the dividing line includes the seventh curve 101 and the eighth straight line 102. First, the target point of the dividing line to be formed is determined according to the direction of the seventh curve 101 away from the enclosed area V. For example, the curve arc point h and the user-selected point i or a point near the arc point are extended towards the boundary line to form the ninth straight line 103. The eighth straight line 102 and the ninth straight line 103 are extended respectively to make the two straight line segments intersect and form a broken line. Finally, the target point of the dividing line to be formed is determined according to the direction of the broken line away from the enclosed area W. For example, the broken line vertex j and the user-selected point k or a point near the broken line vertex are extended towards the boundary line to finally form the tenth straight line 104.
[0072] In addition, the dividing line is a continuous line. If the dividing line drawn by the user is broken, each individual dividing line will be processed according to the preset correction rules.
[0073] Please see Figure 11 In one embodiment, correcting the division trajectory according to a preset correction rule to obtain the division line includes:
[0074] Step S124: Determine the room area of the divided trajectory on the electronic map and the target room area pre-determined by the user on the electronic map;
[0075] Step S125: When the room area is different from the target room area, the dividing trajectory is corrected to a dividing line displayed as a straight line on the electronic map, and then the dividing line is translated to the target room area to obtain the dividing line in the target room area.
[0076] Before drawing dividing lines on the electronic map, a specific room area can be pre-selected as the target room area. Dividing lines are then formed based on the selected target room area. These room areas include, but are not limited to, master bedroom, secondary bedroom, kitchen, living room, and bathroom. These areas can be pre-divided by a robot or manually, and may not be the most accurate or ideal area for the user. The user can continue to divide the area using the dividing lines. After selecting a specific target room area, the dividing lines for all other areas on the electronic map will be shifted to the area corresponding to the selected target room area, with the direction of the dividing lines in other areas serving as the direction of the dividing lines in the selected target room area. In another embodiment, during the shifting process, line segments extending beyond the selected target room area can be deleted.
[0077] It should be noted that the preset correction rules include shape correction rules and position correction rules. These two rules can be used individually or in combination. For example, for a curve outside the target room area, the position correction rule can be used to first translate it into the target room area, and then the shape correction rule can be used to correct the curve into a straight line.
[0078] Step S13: According to the preset connection rules, the dividing line intersects with the boundary line of the electronic map to obtain the electronic map after the area is divided.
[0079] In application, after the dividing line intersects with the boundary line, the dividing line can be changed by moving its body or by moving its endpoints. These changes can affect its shape, size, and position. Furthermore, when zooming in and out of the electronic map, the dividing line can be zoomed in and out proportionally. Simultaneously, changing the dividing line does not affect the zooming in and out of the map. The map and the dividing line can also use the same magnification factor proportionally.
[0080] The embodiments of this application can improve the accuracy and efficiency of region division.
[0081] Specifically, after obtaining the user's segmentation trajectory on the electronic map, the segmentation trajectory is corrected according to a preset correction rule to obtain a segmentation line, which improves the connection efficiency between the segmentation line and the boundary line. Then, the segmentation line is intersected with the boundary line of the electronic map according to a preset connection rule to obtain the electronic map after the area is divided. The segmentation line and the boundary line are automatically connected to improve the efficiency of area division, reduce the problem of inaccurate manual division, and improve the user's experience in area division.
[0082] Example 2
[0083] This application provides a region division method, including steps S11 to S13 in Embodiment 1. This embodiment is a further explanation of Embodiment 1. For details on the same or similar parts as Embodiment 1, please refer to the relevant description in Embodiment 1, which will not be repeated here.
[0084] In one embodiment, the step of intersecting the dividing line with the boundary line of the electronic map according to a preset connection rule to obtain the electronic map after dividing the area includes:
[0085] The two endpoints of the dividing line are respectively intersected by the nearest boundary line in the direction of the extension of the dividing line to obtain an electronic map after the area is divided by the dividing line and the boundary line.
[0086] Users can directly draw one boundary line from another, at which point the endpoint of the dividing line intersects the boundary line. Alternatively, users can draw from one boundary line to the center of a room area; in this case, only one endpoint of the dividing line intersects the boundary line. From the other endpoint, the dividing line can be extended unidirectionally until that endpoint intersects the nearest boundary line in that direction. Users can also quickly draw an enclosed area within a single room area without needing to draw the dividing line from one boundary line to another; they only need to draw a portion of the area and can then connect it to the boundary line by extending the dividing line.
[0087] Please see Figure 12 In one embodiment, the step of intersecting the dividing line with the boundary line of the electronic map according to a preset connection rule to obtain the electronic map after dividing the area includes:
[0088] Step S131: Determine the room area of the dividing line in the electronic map;
[0089] Step S132: In the room area, determine the vertices on the boundary line by using the convex hull point;
[0090] Step S133: When the distance between the intersection of the dividing line and the boundary line and the vertex of the boundary line is less than or equal to a preset distance, determine the vertex to be connected to the connecting line, translate the dividing line so that the dividing line is connected to the vertex to be connected, and obtain an electronic map after the area is divided by the dividing line and the boundary line.
[0091] like Figure 13 As shown, when the intersection point 131 of the dividing line and the boundary line is very close to the vertex 132 of the boundary line, for example, the distance is only 10 pixels or less, and the two endpoints or one endpoint of the dividing line are not connected to the vertex of the boundary line, then the room area can be considered, for example... Figure 13In the master bedroom, the original dividing line is shifted to the direction of vertex 132. Vertex 132 is the vertex of the convex hull. Thus, the dividing line, after being shifted or extended according to direction, is connected to the two convex hull vertices to form the final dividing line (represented by dashed lines in the diagram).
[0092] A vertex refers to a vertex on the room boundary line identified using a convex hull recognition algorithm. After identifying the convex hull vertices using the algorithm, the distance between the dividing line and the convex hull vertex is determined. Specifically, the dividing line is first extended so that its endpoints intersect the boundary line. Then, based on the endpoints of the intersection of the dividing line and the boundary line, a judgment is made. If, when the dividing line is oblique, at least one endpoint of the dividing line is less than a preset distance from a vertex, the dividing line is converted into a vertical line and connected to the nearest vertex, so that the intersection of the dividing line and the boundary line coincides with the convex hull vertex, forming a new dividing line. During the movement, if a connection to a convex hull vertex is needed, the inner and outer convex hull vertices are determined based on the room area. The inner convex hull vertex is the convex hull vertex that is closer to the interior of the room than the outer convex hull vertex.
[0093] In another embodiment, instead of determining the distance between the endpoints and the convex hull vertices, the outer convex hull vertices are directly connected. Specifically, the target room region is first selected on the map. Then, the vertices of the room region are identified using a convex hull algorithm. Points among these vertices that are closest to other connected regions on the map in terms of distance are identified as the outer convex hull vertices. Finally, the aforementioned dividing line is directly connected to the outer convex hull vertices. Figure 13 In the diagram, the vertex of the outer convex hull is vertex 132. For example... Figure 13 In this embodiment, the dividing line is near the vertex of the convex hull of the master bedroom door. It connects to the vertex of the outer convex hull of the master bedroom door (vertex 132) instead of the vertex of the inner convex hull (vertex 133), thus increasing the area of the room. When the dividing line is very close to the outer convex hull vertex, it can be assumed that the user intends to select the entire room area, improving the user experience. In another embodiment, the dividing line may not be limited to connecting to the outer convex hull vertex. If the distance between the endpoint of the dividing line intersecting the boundary line and a vertex of the room area is less than a preset distance, the dividing line is translated so that it intersects that vertex.
[0094] Please see Figure 14 In one embodiment, the step of intersecting the dividing line with the boundary line of the electronic map according to a preset connection rule to obtain the electronic map after dividing the area includes:
[0095] Step S134: Determine the room area of the dividing line in the electronic map;
[0096] Step S135: When the size ratio of the enclosed area formed by the dividing line and the boundary line corresponding to the room area to the room area is less than a first preset ratio, the dividing line is translated so that the size ratio reaches the first preset ratio, thereby obtaining an electronic map after the area is divided by the dividing line and the boundary line.
[0097] In the application, users can select a corresponding first preset ratio for different room areas. After a user draws a dividing line in a room area, the room area on the electronic map and the corresponding first preset ratio, such as 70%, are determined. If the ratio of the enclosed area formed by the dividing line and the boundary line of the corresponding room area to the room area is less than 70%, the dividing line is shifted to make the ratio reach 70%, thereby facilitating users to quickly delineate specific areas and improving the efficiency of area division.
[0098] Specifically, when translating the dividing line, the dividing line itself can be translated or either of the two endpoints of the dividing line can be moved until the area enclosed by the dividing line and the boundary line of the room reaches the first preset ratio.
[0099] Upon receiving a new instruction from the user to adjust the dividing line, such as adjusting the ratio of the enclosed area formed by the dividing line and the corresponding boundary line of the room area to the room area to be greater than the first preset ratio, the size of the enclosed area can be further increased based on the first preset ratio, thereby allowing the customer to increase the range of the enclosed area themselves and improve the user experience.
[0100] Please see Figure 15 In one embodiment, the dividing line includes a first dividing line and a second dividing line;
[0101] The step of intersecting the dividing line with the boundary line of the electronic map according to a preset connection rule to obtain the electronic map after dividing the area includes:
[0102] Step S136: Determine the room area of the first dividing line in the electronic map;
[0103] Step S137: When the size ratio of the enclosed area formed by the first dividing line and the boundary line corresponding to the room area to the room area is less than the second preset ratio, the second dividing line in the electronic map area corresponding to the room area is obtained.
[0104] Step S138: When the size ratio of the enclosed area formed by the second dividing line and the boundary line corresponding to the room area to the room area is greater than or equal to the third preset ratio, the first dividing line is translated so that the first dividing line coincides with the second dividing line, thereby obtaining an electronic map after the area is divided by the dividing line and the boundary line.
[0105] Step S139: When the size ratio of the enclosed area formed by the second dividing line and the boundary line corresponding to the room area to the room area is less than the third preset ratio, the second dividing line is translated so that the size ratio reaches the third preset ratio, and the first dividing line is translated so that the first dividing line coincides with the second dividing line, thereby obtaining an electronic map after the area is divided by the dividing line and the boundary line.
[0106] The second preset ratio and the third preset ratio are not the same value. That is, the first dividing line and the boundary line form an enclosed area, and the second dividing line and the boundary line form another enclosed area. For example, in a rectangular room, the first dividing line and the left boundary line of the rectangular area form an enclosed area, and the second dividing line and the right boundary line of the rectangular area form another enclosed area. The above steps will be explained below with the second preset ratio being 90% and the third preset ratio being 80%.
[0107] Assuming the room area represented by the first and second dividing lines on the electronic map is the master bedroom, when the ratio of the enclosed area formed by the first dividing line and the boundary line corresponding to the master bedroom to the size of the master bedroom is less than 90%, the second dividing line is obtained to represent the room area corresponding to the master bedroom. Then, it is determined whether the ratio of the enclosed area formed by the second dividing line and the boundary line corresponding to the master bedroom to the size of the master bedroom is greater than or equal to 80%. If so, the first dividing line is shifted to coincide with the second dividing line, resulting in an electronic map with the area divided by the second dividing line and the boundary line. If the ratio of the enclosed area formed by the second dividing line and the boundary line corresponding to the master bedroom to the size of the master bedroom is less than 80%, the second dividing line is first shifted to achieve a ratio of 80%, and then the first dividing line is shifted again to coincide with the second dividing line, resulting in an electronic map with the area divided by the second dividing line and the boundary line. Through the above steps, the first dividing line and the second dividing line coincide, and the size ratio of the enclosed area of the first dividing line (or the second dividing line) to the boundary line of the room area is at least greater than the third preset ratio. Thus, the enclosed area is based on the second dividing line, eliminating the trace of the first dividing line and solving the problem of multiple enclosed areas caused by the user repeatedly drawing the dividing line.
[0108] It should be noted that if no room area is selected, and the area enclosed by the dividing line and the boundary line includes multiple room areas, it is not necessary to consider whether the area enclosed by the drawn dividing line and the boundary line is less than the second preset ratio.
[0109] In another embodiment, the second preset ratio and the third preset ratio can be the same value, so that the ratio of the size of the enclosed area of the room area to the room area formed by the multiple dividing lines drawn by the user in a short period of time all conform to the second preset ratio (or the third preset ratio), preventing the user from drawing multiple dividing lines in a short period of time to form multiple enclosed areas whose size ratio to the room area where the dividing lines are located does not conform to the second preset ratio (or the third preset ratio).
[0110] In another embodiment, when the ratio of the size of the enclosed area formed by the first dividing line and the boundary line corresponding to the room area to the size of the room area is less than a second preset ratio, the first dividing line is translated so that the ratio of the size of the enclosed area formed by the first dividing line and the boundary line corresponding to the room area to the size of the room area reaches the second preset ratio. Then, a second dividing line is obtained. When the ratio of the size of the enclosed area formed by the second dividing line and the boundary line corresponding to the room area to the size of the room area is less than a third preset ratio, the second dividing line is translated to coincide with the first dividing line; when the ratio of the size of the enclosed area formed by the second dividing line and the boundary line corresponding to the room area to the size of the room area is greater than the third preset ratio, the second dividing line is not translated.
[0111] Please see Figure 16 In one embodiment, the step of intersecting the dividing line with the boundary line of the electronic map according to a preset connection rule to obtain the electronic map after dividing the area includes:
[0112] Step S1310: When the dividing line passes through the boundary line of the first room in the electronic map and reaches the second room in the electronic map, determine the first length of the line segment of the dividing line located in the second room;
[0113] Step S1311: When the first length and the length or width of the second room are less than or equal to a preset ratio, delete the line segment in the dividing line located in the second room, so that the remaining line segment of the dividing line intersects with the boundary of the first room, and obtain an electronic map after the area is divided by the dividing line and the boundary line.
[0114] Step S1312: When the ratio of the first length to the length or width of the second room is greater than a preset value, the dividing line is extended so that the extended dividing line intersects with the boundary of the second room, thereby obtaining an electronic map after the area is divided by the dividing line and the boundary line.
[0115] like Figure 17As shown, a preset ratio of 50% is set. The dividing line (represented by a dashed line in the diagram) passes through two rooms: the master bedroom and the living room. If the master bedroom is considered the first room and the living room the second room, the length of the portion of the dividing line located in the living room is determined, i.e., the first length. If the first length is less than or equal to 50% of the length or width of the second room, the portion of the dividing line located in the living room is deleted, and the remaining segment of the dividing line in the master bedroom intersects with the boundary line of the master bedroom, resulting in an electronic map after the area is divided by the dividing line and the boundary line. If the first length is greater than 50% of the length or width of the second room, the dividing line is extended so that the extended dividing line intersects with the boundary line of the living room, resulting in an electronic map after the area is divided by the dividing line and the boundary line. Through the above steps, users can easily draw lines to divide enclosed areas within multiple room regions at once, while also eliminating the error of users accidentally drawing dividing lines into different room regions, thus improving the efficiency of enclosed area division.
[0116] Please see Figure 18 In one embodiment, the step of intersecting the dividing line with the boundary line of the electronic map according to a preset connection rule to obtain the electronic map after dividing the area includes:
[0117] Step S1313: Determine the room area of the dividing line in the electronic map;
[0118] Step S1314: When the ratio of the size of the enclosed area formed by the dividing line and the boundary line corresponding to the room area to the size of the room area is greater than or equal to a fourth preset ratio, the dividing line is translated so that the dividing line is connected to the vertex corresponding to the room area, thereby obtaining an electronic map after the area is divided by the dividing line and the boundary line.
[0119] In applications, users sometimes want to divide an entire room into cleaning areas, but only delineating about 90% of the area is insufficient to cover the entire room. In this case, the first preset ratio can be set to a larger ratio, such as 85%. When the ratio of the enclosed area formed by the user-drawn dividing line and the corresponding boundary line of the room area to the size of the room area is greater than 85%, the dividing line is translated so that it connects with the corresponding vertices of the room area, resulting in an electronic map after the area is divided by the dividing line and the boundary line. Specifically, the room vertices connected to the dividing line can be convex hull vertices or any other vertices. Through the above steps, users do not need to draw precise dividing lines; they only need to define a general area to delineate the entire room as the robot's cleaning area, thus improving the efficiency of area division.
[0120] It should be noted that the preset connection rules in Embodiment 2 can coexist. For example, steps S134 and S135 can coexist with steps S1310, S1311 and S1312; steps S131, S132 and S133 can coexist with steps S1310, S1311 and S1312; steps S131, S132 and S133 can coexist with steps S134 and S135; steps S131, S132 and S133, steps S1310, S1311 and S1312, and steps S134 and S135 can coexist.
[0121] The embodiments of this application can improve the accuracy and efficiency of region division.
[0122] Specifically, after obtaining the user's segmentation trajectory on the electronic map, the segmentation trajectory is corrected according to a preset correction rule to obtain a segmentation line, which improves the connection efficiency between the segmentation line and the boundary line. Then, the segmentation line is intersected with the boundary line of the electronic map according to a preset connection rule to obtain the electronic map after the area is divided. The segmentation line and the boundary line are automatically connected to improve the efficiency of area division, reduce the problem of inaccurate manual division, and improve the user's experience in area division.
[0123] Example 3
[0124] Corresponding to the region division method described in the above embodiments, Figure 19 A structural block diagram of a region partitioning device 190 provided in an embodiment of this application is shown. This system can be a virtual appliance in a terminal device, run by the processor of the terminal device, or it can be integrated into the terminal device itself. For ease of explanation, only the parts relevant to the embodiments of this application are shown.
[0125] The region division device 190 in this embodiment includes:
[0126] The acquisition module 191 is used to acquire the user's segmented trajectory in the electronic map;
[0127] Correction module 192 is used to correct the division trajectory according to a preset correction rule to obtain a division line;
[0128] The connection module 193 is used to intersect the dividing line with the boundary line of the electronic map according to the preset connection rules to obtain the electronic map after the area is divided.
[0129] The embodiments of this application can improve the accuracy and efficiency of region division.
[0130] Specifically, after the acquisition module obtains the user's division trajectory on the electronic map, the correction module corrects the division trajectory according to the preset correction rules to obtain the division line, which improves the connection efficiency between the division line and the boundary line. Then, the connection module intersects the division line with the boundary line of the electronic map according to the preset connection rules to obtain the electronic map after the area is divided. The division line and the boundary line are automatically connected to improve the area division efficiency, reduce the problem of inaccurate manual division, and improve the user's experience in area division.
[0131] Example 4
[0132] like Figure 20 As shown, this application also provides a terminal device 200, including a memory 201, a processor 202, and a computer program 203 stored in the memory and executable on the processor. For example, when the processor 202 executes the computer program 203, it implements the steps in the above-described region partitioning method embodiments, such as the method steps in Embodiment 1 and / or Embodiment 2. When the processor 202 executes the computer program 203, it implements the functions of each module in the above-described device embodiments, such as the functions of each module and unit in Embodiment 3.
[0133] For example, the computer program 203 can be divided into one or more modules, which are stored in the memory 201 and executed by the processor 202 to complete Embodiments 1, 2, and / or 3 of this application. The one or more modules can be a series of computer program instruction segments capable of performing specific functions, which describe the execution process of the computer program 203 in the terminal device 200. For example, the computer program 203 can be divided into an acquisition module, a shape correction module, a connection output module, etc. The specific functions of each module have been described in Embodiment 3 above and will not be repeated here.
[0134] The terminal device 200 may be a receiving terminal device. The terminal device may include, but is not limited to, a memory 201 and a processor 202. Those skilled in the art will understand that... Figure 10 This is merely an example of terminal device 200 and does not constitute a limitation on terminal device 200. It may include more or fewer components than shown, or combine certain components, or different components. For example, the terminal device may also include input / output devices, network access devices, buses, etc.
[0135] The memory 201 can be an internal storage unit of the terminal device 200, such as a hard disk or memory of the terminal device 200. The memory 201 can also be an external storage device of the terminal device 200, such as a plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card equipped on the terminal device 200. Furthermore, the memory 201 can include both internal and external storage units of the terminal device 200. The memory 201 is used to store the computer program and other programs and data required by the terminal device. The memory 201 can also be used to temporarily store data that has been output or will be output.
[0136] The processor 202 may be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.
[0137] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to 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 embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0138] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0139] Those skilled in the art will recognize that the units and algorithm steps of the various examples 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 implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0140] In the embodiments provided by this invention, it should be understood that the disclosed apparatus / terminal devices and methods can be implemented in other ways. For example, the apparatus / terminal device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0141] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0142] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0143] If the integrated module is implemented as 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, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electrical carrier signals and telecommunication signals.
[0144] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.
Claims
1. A method for dividing regions, characterized in that, The method includes: Obtain the user's defined trajectory on the electronic map; The dividing trajectory is corrected according to a preset correction rule to obtain the dividing line; The dividing lines are intersected with the boundary lines of the electronic map according to preset connection rules to obtain the electronic map after the area is divided. The step of intersecting the dividing line with the boundary line of the electronic map according to a preset connection rule to obtain the electronic map after dividing the area includes: When the dividing line passes through the boundary line of the first room in the electronic map and reaches the second room in the electronic map, determine the first length of the line segment of the dividing line located in the second room; When the first length and the length or width of the second room are less than or equal to a preset ratio, delete the line segment in the dividing line located in the second room, so that the remaining line segment of the dividing line intersects with the boundary of the first room, and obtain an electronic map after the area is divided by the dividing line and the boundary line. When the first length and the length or width of the second room are greater than a preset ratio, the dividing line is extended so that the extended dividing line intersects with the boundary of the second room, thus obtaining an electronic map after the area is divided by the dividing line and the boundary line.
2. The method according to claim 1, characterized in that, The defined trajectory includes straight lines, broken lines, curves, and any combination of the three. The step of correcting the division trajectory according to a preset correction rule to obtain the division line includes: Determine the enclosed area to be formed between the defined trajectory and the boundary line of the electronic map; The target point of the dividing line to be formed in the dividing trajectory is determined based on the orientation of the enclosed area to be formed and the dividing trajectory in the enclosed area; The dividing trajectory is corrected based on the target point to a dividing line that passes through the target point and remains in a straight line.
3. The method according to claim 1 or 2, characterized in that, The step of correcting the division trajectory according to a preset correction rule to obtain the division line includes: The division trajectory is determined in the room area of the electronic map and the target room area pre-defined by the user in the electronic map; When the room area is different from the target room area, the dividing trajectory is corrected to a dividing line displayed as a straight line on the electronic map, and then the dividing line is translated to the target room area to obtain the dividing line in the target room area.
4. The method according to claim 1, characterized in that, The step of intersecting the dividing line with the boundary line of the electronic map according to a preset connection rule to obtain the electronic map after dividing the area includes: The two endpoints of the dividing line are respectively intersected by the nearest boundary line in the direction of the extension of the dividing line to obtain an electronic map after the area is divided by the dividing line and the boundary line.
5. The method according to claim 1, characterized in that, The step of intersecting the dividing line with the boundary line of the electronic map according to a preset connection rule to obtain the electronic map after dividing the area includes: The dividing line is used to define the room area in the electronic map; In the room region, vertices on the boundary line are determined by convex hull points; When the distance between the intersection of the dividing line and the boundary line and the vertex of the boundary line is less than or equal to a preset distance, the vertex to be connected by the connecting line is determined, the dividing line is translated so that the dividing line is connected to the vertex to be connected, and an electronic map is obtained after the area is divided by the dividing line and the boundary line.
6. The method according to claim 1, characterized in that, The step of intersecting the dividing line with the boundary line of the electronic map according to a preset connection rule to obtain the electronic map after dividing the area includes: The dividing line is used to define the room area in the electronic map; When the ratio of the size of the enclosed area formed by the dividing line and the boundary line corresponding to the room area to the size of the room area is less than a first preset ratio, the dividing line is translated so that the size ratio reaches the first preset ratio, thereby obtaining an electronic map after the area is divided by the dividing line and the boundary line.
7. The method according to claim 1, characterized in that, The dividing line includes a first dividing line and a second dividing line; The step of intersecting the dividing line with the boundary line of the electronic map according to a preset connection rule to obtain the electronic map after dividing the area includes: Determine the room area in the electronic map where the first dividing line is located; When the size ratio of the enclosed area formed by the first dividing line and the boundary line corresponding to the room area to the room area is less than the second preset ratio, the second dividing line in the electronic map area corresponding to the room area is obtained. When the size ratio of the enclosed area formed by the second dividing line and the boundary line corresponding to the room area to the room area is greater than or equal to the third preset ratio, the first dividing line is translated so that the first dividing line coincides with the second dividing line, thereby obtaining an electronic map after the area is divided by the dividing line and the boundary line. When the size ratio of the enclosed area formed by the second dividing line and the boundary line corresponding to the room area to the room area is less than the third preset ratio, the second dividing line is translated so that the size ratio reaches the third preset ratio, and the first dividing line is translated so that the first dividing line coincides with the second dividing line, thus obtaining an electronic map after the area is divided by the dividing line and the boundary line.
8. The method according to claim 1, characterized in that, The step of intersecting the dividing line with the boundary line of the electronic map according to a preset connection rule to obtain the electronic map after dividing the area includes: The dividing line is used to define the room area in the electronic map; When the ratio of the size of the enclosed area formed by the dividing line and the boundary line corresponding to the room area to the size of the room area is greater than or equal to a fourth preset ratio, the dividing line is translated so that the dividing line is connected to the vertex corresponding to the room area, thereby obtaining an electronic map after the area is divided by the dividing line and the boundary line.
9. A region division device, characterized in that, include: The acquisition module is used to acquire the user's defined trajectory on the electronic map; The correction module is used to correct the division trajectory according to a preset correction rule to obtain the division line; A connection module is used to intersect the dividing line with the boundary line of the electronic map according to a preset connection rule to obtain an electronic map after the area is divided. The step of intersecting the dividing line with the boundary line of the electronic map according to a preset connection rule to obtain the electronic map after dividing the area includes: When the dividing line passes through the boundary line of the first room in the electronic map and reaches the second room in the electronic map, determine the first length of the line segment of the dividing line located in the second room; When the first length and the length or width of the second room are less than or equal to a preset ratio, delete the line segment in the dividing line located in the second room, so that the remaining line segment of the dividing line intersects with the boundary of the first room, and obtain an electronic map after the area is divided by the dividing line and the boundary line. When the first length and the length or width of the second room are greater than a preset ratio, the dividing line is extended so that the extended dividing line intersects with the boundary of the second room, thus obtaining an electronic map after the area is divided by the dividing line and the boundary line.
Citation Information
Patent Citations
Robotic virtual boundaries
US20190061157A1
