CN115641436A - Region segmentation method and device and robot device - Google Patents

Region segmentation method and device and robot device Download PDF

Info

Publication number
CN115641436A
CN115641436A CN202211164291.9A CN202211164291A CN115641436A CN 115641436 A CN115641436 A CN 115641436A CN 202211164291 A CN202211164291 A CN 202211164291A CN 115641436 A CN115641436 A CN 115641436A
Authority
CN
China
Prior art keywords
preset
region
point
intersection point
area
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211164291.9A
Other languages
Chinese (zh)
Inventor
胡焕
江斌
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Huacheng Software Technology Co Ltd
Original Assignee
Hangzhou Huacheng Software Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Huacheng Software Technology Co Ltd filed Critical Hangzhou Huacheng Software Technology Co Ltd
Priority to CN202211164291.9A priority Critical patent/CN115641436A/en
Publication of CN115641436A publication Critical patent/CN115641436A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Image Analysis (AREA)

Abstract

A method, a device and a robot device for region segmentation are provided, the method comprises the following steps: the method comprises the steps of obtaining a preset rectangular area corresponding to an area to be divided, determining a first intersection point and a second intersection point on the edge of the preset rectangular area based on a preset position relation, obtaining a preset array corresponding to the area to be divided based on the first intersection point and the second intersection point, determining a target dividing line corresponding to the area to be divided based on the preset array, and dividing the area to be divided based on the target dividing line. By the method, the preset rectangular region corresponding to the region to be segmented is determined, and the first intersection point and the second intersection point on the edge line of the preset rectangular region are determined, so that the target segmentation line corresponding to the region to be segmented can be accurately positioned, the condition that the determined target segmentation line cannot segment the region to be segmented is avoided, and the region segmentation of the region to be segmented is ensured.

Description

Region segmentation method and device and robot device
Technical Field
The application relates to the technical field of computers and household Internet of things, in particular to a region segmentation method and device and a robot device.
Background
With the development of a computer and a household internet of things technology, the computer and the household internet of things technology are also applied to the intelligent home robot, and the intelligent home robot needs to divide a target area on a map when working.
At present, a map editing method of an intelligent home robot is adopted for dividing a target area on a map by the intelligent home robot, and the method includes: the intelligent home robot selects a target area to be segmented in a room map, detects a sliding track on the room map, generates a segmentation line on the target area according to the sliding track, and segments the target area into a first sub-area and a second sub-area according to the segmentation line.
Based on the method, in the process of generating the dividing line on the target area according to the sliding track, a rectangular coordinate system needs to be established in a room map area, the rectangular coordinate system can be a view coordinate system of a map, a linear equation corresponding to the gesture dividing line of the user side in the rectangular coordinate system is determined, points with horizontal coordinates of 0 and horizontal coordinates of x1 are traversed, traversal is performed from the point with horizontal coordinates of xt to the point with horizontal coordinates of x1, the traversal is stopped when the traversed points are consistent with the color value points of the target area, when the number of the traversed points with the color value points of the target area is determined to be 2, the dividing line of the target area is determined, and the process of determining the dividing line is as follows:
specifically, a schematic diagram of a position relationship between a linear equation and a target region is shown in fig. 1, where in fig. 1, points corresponding to the linear equation when abscissa is x1 and xt are recorded, and four kinds of position relationships between the linear equation and the target region are recorded, the target region is a real region of a room, where a rectangular region is exemplified, a coordinate point (minX, minY) and a coordinate point (maxX, maxY) are vertexes of the rectangular region, and only a first intersection point on the target region can be determined based on 1, 2, and 3 in fig. 1, however, a dividing line cannot be determined based on the first intersection point, so that the smart home robot cannot respond to a dividing instruction input from a user side, and thus cannot determine an accurate dividing line for the target region.
Disclosure of Invention
The application provides a region segmentation method, a region segmentation device and electronic equipment, which are used for determining a segmentation line of a region to be segmented.
In a first aspect, the present application provides a method for region segmentation, where the method includes:
obtaining a preset rectangular area corresponding to an area to be segmented;
determining a first intersection point and a second intersection point on the edge of the preset rectangular region based on a preset position relationship, and obtaining a preset array corresponding to the region to be segmented based on the first intersection point and the second intersection point, wherein the preset position relationship is the position relationship between the preset rectangular region and each preset coordinate point;
and determining a target segmentation line corresponding to the region to be segmented based on the preset array, and segmenting the region to be segmented based on the target segmentation line.
According to the method, the preset rectangular area of the area to be divided is determined, the first intersection point and the second intersection point are determined based on the preset position relation between the preset rule area and the preset coordinate point, so that the condition that two intersection points exist between the preset straight line and the preset rectangular area is determined, the target dividing line corresponding to the area to be divided is determined based on the color value point, the area to be divided can be divided, and the area to be divided can be further guaranteed to be divided by the intelligent household robot under various scenes.
In one possible design, obtaining a preset rectangular region corresponding to a region to be segmented includes:
determining the color value identification of the area to be divided and calculating a first extreme point and a second extreme point corresponding to the area to be divided;
and determining a preset rectangular area corresponding to the area to be divided based on the color value identification and the first extreme point and the second extreme point.
By the method, the preset rectangular region corresponding to the region to be segmented is determined, and the irregular region is simulated in the preset rectangular region, so that the method is suitable for more scenes, and is favorable for determining the target segmentation line corresponding to the region to be segmented.
In one possible design, determining a first intersection point and a second intersection point on the edge of the preset rectangular region based on a preset positional relationship includes:
determining a preset first coordinate point and a preset second coordinate point corresponding to the region to be segmented;
determining a linear equation based on the preset first coordinate point and the preset second coordinate point;
calculating a first coordinate point and a second coordinate point of an edge line corresponding to the linear equation and the preset rectangular area based on the linear equation and the preset rectangular area;
and determining a first intersection point and a second intersection point on the edge line of the preset rectangular area based on the first coordinate point and the second coordinate point.
By the method, whether the preset rectangular area is intersected with the first coordinate point and the second coordinate point of the preset rectangular area or not is determined based on the linear equation, the first intersection point and the second intersection point are determined, the preset rectangular area can be segmented based on the first intersection point and the second intersection point, and further segmentation of the area to be segmented is facilitated.
In one possible design, obtaining the preset array corresponding to the region to be partitioned based on the first intersection point and the second intersection point includes:
traversing each color value point on a preset straight line based on the first intersection point and the second intersection point;
and determining color value points consistent with the color value identification of the area to be divided, and adding the color value points consistent with the color value identification to a preset array.
By the method, the determined target segmentation line is ensured to be in the region to be segmented by comparing whether the color value identification of the color value point is consistent with the color value identification of the region to be segmented, and the target segmentation line can accurately segment the region to be segmented.
In a possible design, determining a target partition line corresponding to the to-be-partitioned area based on the preset array includes:
in response to the fact that the array elements in the preset array exceed a preset threshold value, taking a first element in the preset array as a starting point of the area to be partitioned, and taking a last element in the preset array as a terminal point corresponding to the area to be partitioned;
and determining a target segmentation line corresponding to the region to be segmented based on the starting point and the end point.
According to the method, the starting point and the ending point are determined through the array elements recorded in the preset array, and two intersection points exist between the linear equation corresponding to the preset array and the area to be divided, so that the target dividing line corresponding to the area to be divided can be determined based on the starting point and the ending point in the preset array, and the area to be divided is divided.
In a second aspect, the present application provides an apparatus for region segmentation, the apparatus comprising:
the acquisition module is used for acquiring a preset rectangular region corresponding to a region to be segmented;
the determining module is used for determining a first intersection point and a second intersection point on the edge of the preset rectangular region based on a preset position relation and obtaining a preset array corresponding to the region to be divided based on the first intersection point and the second intersection point;
and the target module is used for determining a target parting line corresponding to the region to be parted based on the preset array and parting the region to be parted based on the target parting line.
In a possible design, the obtaining module is specifically configured to determine a color value identifier of the to-be-divided region, calculate a first extreme point and a second extreme point corresponding to the to-be-divided region, and determine a preset rectangular region corresponding to the to-be-divided region based on the color value identifier and the first extreme point and the second extreme point.
In a possible design, the determining module is specifically configured to determine a preset first coordinate point and a preset second coordinate point corresponding to the to-be-divided region, determine a linear equation based on the preset first coordinate point and the preset second coordinate point, calculate the linear equation based on the linear equation and the preset rectangular region and the first coordinate point and the second coordinate point of the edge line corresponding to the preset rectangular region, and determine a first intersection point and a second intersection point on the edge line of the preset rectangular region based on the first coordinate point and the second coordinate point.
In a possible design, the determining module is further configured to determine, based on the first intersection point and the second intersection point traversing each color value point on a preset straight line, a color value point consistent with the color value identifier of the to-be-divided region, and add the color value point consistent with the color value identifier to a preset array.
In a possible design, the determining module is further configured to, in response to that array elements in the preset array exceed a preset threshold, use a first element in the preset array as a starting point of the region to be divided, and use a last element in the preset array as an end point corresponding to the region to be divided, and determine a target dividing line corresponding to the region to be divided based on the starting point and the end point.
In a third aspect, the present application provides a robotic device comprising:
a memory for storing a computer program;
the processor is configured to implement the above-mentioned method steps of region segmentation when executing the computer program stored in the memory.
In a fourth aspect, a computer-readable storage medium has stored therein a computer program which, when executed by a processor, implements one of the above-described method steps of region segmentation.
For each of the first to fourth aspects and possible technical effects of each aspect, please refer to the above description of the possible technical effects for the first aspect or each possible solution in the first aspect, and no repeated description is given here.
Drawings
FIG. 1 is a schematic diagram of a relationship between a linear equation and a target region provided in the present application;
FIG. 2 is a flowchart of the method steps for region segmentation provided herein;
FIG. 3 is a schematic diagram showing that there is only one intersection point between a line segment and a region to be segmented on a linear equation provided in the present application;
fig. 4 is a schematic diagram of a relationship between a linear equation and a preset position corresponding to a preset rectangular region provided in the present application;
FIG. 5 is a schematic diagram illustrating a target segmentation line corresponding to a region to be segmented according to the present application;
FIG. 6 is a schematic structural diagram of a region segmentation apparatus provided in the present application;
fig. 7 is a schematic structural diagram of a robot apparatus provided in the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more clear, the present application will be further described in detail with reference to the accompanying drawings. The particular methods of operation in the method embodiments may also be applied to apparatus embodiments or system embodiments. It should be noted that "a plurality" is understood as "at least two" in the description of the present application. "and/or" describes the association relationship of the associated objects, meaning that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. A is connected with B and can represent: a and B are directly connected and A and B are connected through C. In the description of the present application, the terms "first," "second," and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or order.
In order to determine the partition line of the room region on the map, the intelligent household robot can adopt the following mode: in a rectangular coordinate system corresponding to a target area, a point with an abscissa of 0 and a point with an abscissa of x1 on a linear equation where a gesture dividing line of a user side is located are determined, points between the abscissa of 0 and the abscissa of x1 are traversed on the linear equation, a first intersection point with the target area is determined, traversal is performed from the point with the abscissa of xt to the point with the abscissa of x1, the traversal is stopped when the traversed points are consistent with color value points of the target area, a second intersection point with the target area is determined, and the dividing line of the target area is determined based on the first intersection point and the second intersection point.
The embodiment provides a region segmentation method, which is used for an intelligent household robot to accurately determine a segmentation line and accurately segment a target region based on the segmentation line. The method and the device in the embodiment of the application are based on the same technical concept, and because the principles of the problems solved by the method and the device are similar, the device and the embodiment of the method can be mutually referred, and repeated parts are not repeated.
The present embodiment is described in detail below with reference to the accompanying drawings.
Referring to fig. 2, this embodiment provides a method for region segmentation, which may determine a segmentation line of a target region, and implement segmentation of the target region based on the segmentation line, and the implementation flow of the method is as follows:
step S21: and obtaining a preset rectangular area corresponding to the area to be segmented.
In order to determine the dividing line of the area to be divided, the area to be divided needs to be determined first, the area to be divided can be an irregular polygon, all conditions and scenes of the area to be divided can be accurately covered, an intersection point can be prevented from being determined in the area to be divided, and a preset rectangular area corresponding to the area to be divided needs to be obtained.
Optionally, the process of determining the preset rectangular area is as follows:
the method for converting the to-be-divided area into the two-dimensional array is not specifically described here, and in practical application, the intelligent home robot can convert the scanned one-dimensional array corresponding to the to-be-divided area into the two-dimensional array.
After the area to be divided is converted into the two-dimensional array, a first extreme point and a second extreme point corresponding to the area to be divided are calculated based on the two-dimensional array, a preset rectangular area corresponding to the area to be divided can be simulated through the first extreme point and the second extreme point, the first extreme point is represented by (minX, minY), the first extreme point represents a minimum extreme point corresponding to the area to be divided, the second extreme point is represented by (maxX, maxY), and the second extreme point represents a maximum extreme point corresponding to the area to be divided.
In the above description, the optional method for obtaining the preset rectangular region is described, and when the region to be partitioned is an irregular region, the preset rectangular region corresponding to the region to be partitioned can be obtained by the method described above, but the method for obtaining the preset rectangular region is not limited thereto.
Step S22: and determining a first intersection point and a second intersection point on the edge of the preset rectangular region based on a preset position relation, and obtaining a preset array corresponding to the region to be divided based on the first intersection point and the second intersection point.
After the preset rectangular region corresponding to the region to be divided is determined, the embodiment of the application simulates the dividing line determined by the user terminal in the actual situation through the position relation between the non-overlapping two coordinate points and the preset rectangular region.
Optionally, the position relationship between the two non-overlapping coordinate points and the preset rectangular area is as follows:
the corresponding linear equation can be calculated by presetting the first coordinate point and the second coordinate point, for example, the first coordinate point is preset to be (2, 3), the second coordinate point is preset to be (4, 2), the linear equation calculated based on (2, 3) and (4, 2) is y = -0.5x +4, the first coordinate point is preset to be x1, the second coordinate point is preset to be xt, after the linear equations of the two non-overlapping coordinate points are determined, the preset position relationship between the linear equation and the preset rectangular region can be determined, all the position relationships between the linear equation and the preset rectangular region need to be respectively explained according to the following conditions, and the specific explanation process is as follows: the first condition is as follows: when the linear equation does not have an intersection with the preset rectangular region, because a line segment with x1 and xt as end points exists on the linear equation, and x1 and xt are on the linear equation, when the abscissa of x1 in a rectangular coordinate system is determined, the ordinate corresponding to the abscissa x1 on the linear equation can be calculated, and the position relationship between the line segment and the preset rectangular region can be determined based on the coordinates of the first extreme point, the second extreme point and the two end points, wherein the specific position relationship is as follows:
when the abscissa of the endpoint x1 is larger than or equal to maxX and the abscissa of the endpoint xt is larger than or equal to maxX, the line segment is positioned on the right side of the preset rectangular area;
when the abscissa of the endpoint x1 is less than or equal to minX and the abscissa of the endpoint xt is less than or equal to minX, the line segment is on the left side of the preset rectangular region;
when the ordinate of the endpoint x1 is larger than or equal to maxY and the ordinate of the endpoint xt is larger than or equal to maxY, the line segment is arranged below the preset rectangular area;
when the ordinate of the end point x1 is less than or equal to minY and the ordinate of the end point xt is less than or equal to minY, the line segment is positioned on the upper side of the preset rectangular area;
in the above-described four positional relationships between the line segment and the preset rectangular region, the linear equation and the preset rectangular region do not have an intersection.
And a second condition: when the linear equation and the preset rectangular region have intersection points, there are two coincident intersection points and two non-coincident intersection points, which is specifically described as follows:
when the linear equation and the preset rectangular area have a first intersection point, the linear equation is only coincided with one coordinate point in the coordinates of the four vertexes of the preset rectangular area.
When the linear equation and the preset rectangular region have a first intersection point and a second intersection point, the linear equation and the region to be segmented have two intersection points, or the linear equation and the region to be segmented have one intersection point, or the linear equation and the region to be segmented have no intersection point.
It should be noted that, in order to determine the intersection between the line segment on the linear equation and the preset rectangular area, the following method may be used to determine:
in practical application, in order to determine the position relationship between the line segment on the linear equation and the preset rectangular region, y1 corresponding to the ordinate when the abscissa in the linear equation is minX needs to be calculated; and calculating y2 corresponding to the ordinate when the abscissa in the linear equation is maxX; and calculating a1 corresponding to the abscissa when the ordinate of the linear equation is minY; and calculating a2 corresponding to the abscissa when the ordinate of the linear equation is maxY.
After the y1, the y2, the a1 and the a2 are determined, if the y1 is more than or equal to minY and the y1 is less than or equal to maxY, representing that the linear equations are intersected at the left side of the preset rectangular area;
if a1 is more than or equal to minX and a1 is less than or equal to maxX, representing that the linear equations are intersected at the upper side of the preset rectangular area;
if y2 is more than or equal to minY and y1 is less than or equal to maxY, representing that the linear equations are intersected at the right side of the preset rectangular area;
if a2 is larger than or equal to minX and a2 is smaller than or equal to maxX, the linear equations are intersected at the lower side of the preset rectangular area.
Based on the method, the intersection condition of the line segment and the preset rectangular region can be determined, and when an intersection point exists between the linear equation and the region to be segmented, the specific description is as follows:
a schematic diagram of a linear equation where a line segment and a to-be-segmented region have only one intersection point is shown in fig. 3, in fig. three, for the schematic diagram 1 in fig. 3, when x1> x2 and start x < end x, there are two intersection points, if end x > x1, it represents that xt is within a preset rectangular region, or if start x < x2, it represents that x1 is within a preset rectangular region;
for the schematic diagram 2 in fig. 3, there are two intersections when x1> x2 and start x > end x, if start x > x1, it represents xt as within the preset rectangular region, or if end x < x2, it represents x1 as within the preset rectangular region;
for the diagram 3 in fig. 3, there are two intersections when x1< x2 and start x < end x, if start x < x1, it means that xt is within the preset rectangular area, or if end x > x2, it means that x1 is within the preset rectangular area;
for the diagram 4 in fig. 3, there are two intersections when x1< x2 and start x > end x, which means that xt is within the predetermined rectangular area if end x < x1 or x1 is within the predetermined rectangular area if start x > x 2.
When the line segment with x1 and xt as endpoints meets any one of the four conditions, a certain endpoint representing the target segmentation line is in the room, and the judgment result is that the target segmentation line and the region to be segmented have only one intersection.
After it is determined that there is only one intersection point between the target segmentation line and the region to be segmented, the intersection point may be a coincident intersection point, and after it is determined that there are a first intersection point and a second intersection point between the linear equation and the preset rectangular region, in order to ensure that the two intersection points of the linear equation and the region to be segmented are on the edge of the region to be segmented, all points between the first intersection point and the second intersection point on the linear equation may be traversed, and when a point that is consistent with the color value identifier of the region to be segmented is not traversed, it represents that there is no intersection point between the linear equation and the region to be segmented; when traversing out the point consistent with the color value identification of the area to be divided, determining whether the point is two coincident intersection points, if not, determining the two intersection points intersected with the area to be divided on the linear equation.
Based on the above description, when two intersection points exist between the linear equation and the region to be segmented, the region to be segmented can be ensured to be segmented smoothly, so the preset position relationship in the embodiment of the present application represents a case where two intersection points exist between the linear equation and the region to be segmented, in some embodiments, a schematic diagram of the preset position relationship between the linear equation and the preset rectangular region is shown in fig. 4, the region to be segmented is a diamond in the preset rectangular region, a line segment on the linear equation is a dotted line in fig. 4, x1 and xt are end points of the line segment, x1 is also a preset first coordinate point, xt is also a preset second coordinate point, x1 and xt are used for simulating end points of the segmentation line determined by the user end, in fig. 4, a case where the line segment and the preset rectangular region are at different positions is recorded, and intersection points of the line segment and the preset rectangular region are respectively a first intersection point and a second intersection point.
Based on the above description, after the linear equation is calculated based on the preset first coordinate point and the preset second coordinate point, the first coordinate point and the second coordinate point can be calculated through the first extreme point and the second extreme point of the preset rectangular region and the linear equation, and when it is determined that two intersection points exist outside the preset rectangular region, the first intersection point and the second intersection point on the edge line of the preset rectangular region can also be determined, and for any case in fig. 4, the first intersection point and the second intersection point where the line segment on the linear equation intersects with the preset rectangular region can be determined according to the above described method.
Based on the method, the condition that the linear equation and the to-be-segmented region have no two intersection points is eliminated, all the conditions that the linear equation, the preset rectangular region and the to-be-segmented region have two intersection points are determined, the condition that the to-be-segmented region cannot be segmented based on the determined segmentation line is avoided, and the to-be-segmented region can be smoothly segmented. After the first intersection point and the second intersection point of the linear equation and the preset rectangular area are determined, the preset straight line is the linear equation because the first intersection point and the second intersection point are on the preset straight line, and therefore all pixel points between the first intersection point and the second intersection point on the linear equation can be traversed, and color value points consistent with color value identifications of the areas to be partitioned are added into the preset array.
Based on the method, a first intersection point and a second intersection point corresponding to the preset rectangular region are determined, the first intersection point and the second intersection point are on a linear equation, and pixel points outside the region to be segmented and pixel points inside the region to be segmented are respectively determined by traversing pixel points consistent with color value identifications of the region to be segmented.
Step S23: and determining a target segmentation line corresponding to the region to be segmented based on the preset array, and segmenting the region to be segmented based on the target segmentation line.
The pixel points between the first intersection point and the second intersection point in the linear equation and consistent with the color value identification of the area to be partitioned are recorded in the preset array, so that the partition lines of the area to be partitioned can be determined by reading the pixel points recorded in the preset array.
After the starting point and the ending point are determined, the dividing line corresponding to the area to be divided can be determined based on the starting point and the ending point, the dividing line is used as a target dividing line, and after the target dividing line is determined, the intelligent home sweeping robot can divide the area to be divided based on the target dividing line, so that the area to be divided is successfully divided based on the target dividing line.
It should be noted that, a schematic diagram for determining a target dividing line corresponding to a region to be divided provided in the embodiment of the present application is shown in fig. 5, and after a first intersection point and a second intersection point are determined in a preset rectangular region, the target dividing line corresponding to the region to be divided can be determined based on the method described above, which is only exemplified by the case 7 in fig. 4 in fig. 5, and a process for determining a target dividing line corresponding to a region to be divided based on other preset dividing lines is referred to as an example in fig. 5, and since the process for determining the target dividing line is consistent, it is not described herein too much.
Based on the method, the preset rectangular area is determined through the color value identification of the area to be divided, the first intersection point and the second intersection point of the preset rectangular area are determined, the target dividing line corresponding to the area to be divided is determined through traversing the color value points between the first intersection point and the second intersection point, two intersection points of the target dividing line and the area to be divided are ensured, various scenes can be covered, and the intelligent home robot can accurately determine the target dividing line of the area to be divided.
Based on the same inventive concept, an embodiment of the present application further provides a region segmentation apparatus, where the region segmentation apparatus is configured to implement a function of a region segmentation method, and with reference to fig. 6, the apparatus includes:
an obtaining module 601, configured to obtain a preset rectangular region corresponding to a region to be segmented;
a determining module 602, configured to determine a first intersection point and a second intersection point on an edge of the preset rectangular region based on a preset position relationship, and obtain a preset array corresponding to the region to be partitioned based on the first intersection point and the second intersection point;
a target module 603, configured to determine a target segmentation line corresponding to the region to be segmented based on the preset array, and segment the region to be segmented based on the target segmentation line.
In a possible design, the obtaining module 601 is specifically configured to determine a color value identifier of the to-be-divided region, calculate a first extreme point and a second extreme point corresponding to the to-be-divided region, and determine a preset rectangular region corresponding to the to-be-divided region based on the color value identifier and the first extreme point and the second extreme point.
In a possible design, the determining module 602 is specifically configured to determine a preset first coordinate point and a preset second coordinate point corresponding to the to-be-segmented area, determine a linear equation based on the preset first coordinate point and the preset second coordinate point, calculate a first coordinate point and a second coordinate point of an edge line corresponding to the linear equation and the preset rectangular area based on the linear equation and the preset rectangular area, and determine a first intersection point and a second intersection point on the edge line of the preset rectangular area based on the first coordinate point and the second coordinate point.
In a possible design, the determining module 602 is further configured to determine, based on that the first intersection point and the second intersection point traverse each color value point on a preset straight line, a color value point consistent with the color value identifier of the area to be partitioned, and add the color value point consistent with the color value identifier to a preset array.
In a possible design, the determining module 602 is further configured to, in response to that array elements in the preset array exceed a preset threshold, use a first element in the preset array as a starting point of the region to be divided, and use a last element in the preset array as an end point corresponding to the region to be divided, and determine a target dividing line corresponding to the region to be divided based on the starting point and the end point.
Based on the same inventive concept, the embodiment of the present application further provides a robot apparatus, which can implement the function of the foregoing region segmentation apparatus, and with reference to fig. 7, the robot apparatus includes:
at least one processor 701 and a memory 702 connected to the at least one processor 701, in this embodiment, a specific connection medium between the processor 701 and the memory 702 is not limited in this embodiment, and fig. 7 illustrates an example in which the processor 701 and the memory 702 are connected by a bus 700. The bus 700 is shown in fig. 7 by a thick line, and the connection between other components is merely illustrative and not limited thereto. The bus 700 may be divided into an address bus, a data bus, a control bus, etc., and is shown in fig. 7 with only one thick line for ease of illustration, but does not represent only one bus or type of bus. Alternatively, the processor 701 may also be referred to as a controller, without limitation to name a few.
In the embodiment of the present application, the memory 702 stores instructions executable by the at least one processor 701, and the at least one processor 701 may execute the method of region segmentation discussed above by executing the instructions stored in the memory 702. The processor 701 may implement the functions of the various modules in the apparatus shown in fig. 6.
The processor 701 is a control center of the apparatus, and may connect various parts of the entire control device by using various interfaces and lines, and perform various functions and process data of the apparatus by operating or executing instructions stored in the memory 702 and calling data stored in the memory 702, thereby performing overall monitoring of the apparatus.
In one possible design, processor 701 may include one or more processing units and processor 701 may integrate an application processor, which handles primarily the operating system, user interfaces, application programs, etc., and a modem processor, which handles primarily wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 701. In some embodiments, processor 701 and memory 702 may be implemented on the same chip, or in some embodiments they may be implemented separately on separate chips.
The processor 701 may be a general-purpose processor, such as a Central Processing Unit (CPU), digital signal processor, application specific integrated circuit, field programmable gate array or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or the like, that may implement or perform the methods, steps, and logic blocks disclosed in embodiments of the present application. The general purpose processor may be a microprocessor or any conventional processor or the like. The steps of a method for partitioning a region disclosed in the embodiments of the present application may be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules in the processor.
Memory 702, which is a non-volatile computer-readable storage medium, may be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. The Memory 702 may include at least one type of storage medium, and may include, for example, a flash Memory, a hard disk, a multimedia card, a card-type Memory, a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Programmable Read Only Memory (PROM), a Read Only Memory (ROM), a charge Erasable Programmable Read Only Memory (EEPROM), a magnetic Memory, a magnetic disk, an optical disk, and so on. The memory 702 is any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited to such. The memory 702 in the embodiments of the present application may also be circuitry or any other device capable of performing a storage function for storing program instructions and/or data.
The processor 701 is programmed to solidify the code corresponding to the region segmentation method described in the foregoing embodiment into a chip, so that the chip can perform the region segmentation step of the embodiment shown in fig. 1 when running. How to program the processor 701 is a technique well known to those skilled in the art and will not be described in detail here.
Based on the same inventive concept, the present application further provides a storage medium storing computer instructions, which when executed on a computer, cause the computer to perform a region segmentation method as discussed above.
In some possible embodiments, the present application provides that the various aspects of a method of region segmentation may also be implemented in the form of a program product comprising program code means for causing a control device to carry out the steps of a method of region segmentation according to various exemplary embodiments of the present application described above in this specification, when the program product is run on an apparatus. As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.

Claims (10)

1. A method of region segmentation, comprising:
obtaining a preset rectangular area corresponding to an area to be divided;
determining a first intersection point and a second intersection point on the edge of the preset rectangular region based on a preset position relationship, and obtaining a preset array corresponding to the region to be segmented based on the first intersection point and the second intersection point, wherein the preset position relationship is the position relationship between the preset rectangular region and each preset coordinate point;
and determining a target parting line corresponding to the region to be divided based on the preset array, and dividing the region to be divided based on the target parting line.
2. The method of claim 1, wherein obtaining the preset rectangular region corresponding to the region to be segmented comprises:
determining the color value identification of the area to be divided and calculating a first extreme point and a second extreme point corresponding to the area to be divided;
and determining a preset rectangular area corresponding to the area to be divided based on the color value identification and the first extreme point and the second extreme point.
3. The method of claim 1, wherein determining the first intersection point and the second intersection point on the edge of the preset rectangular region based on a preset positional relationship comprises:
determining a preset first coordinate point and a preset second coordinate point corresponding to the region to be segmented;
determining a linear equation based on the preset first coordinate point and the preset second coordinate point;
calculating a first coordinate point and a second coordinate point of an edge line corresponding to the linear equation and the preset rectangular area based on the linear equation and the preset rectangular area;
and determining a first intersection point and a second intersection point on the edge line of the preset rectangular area based on the first coordinate point and the second coordinate point.
4. The method of claim 1, wherein obtaining the preset array corresponding to the region to be partitioned based on the first intersection point and the second intersection point comprises:
traversing each color value point on a preset straight line based on the first intersection point and the second intersection point;
and determining color value points consistent with the color value identification of the area to be divided, and adding the color value points consistent with the color value identification to the preset array.
5. The method of claim 1, wherein determining a target segmentation line corresponding to the region to be segmented based on the preset array comprises:
in response to the fact that array elements in the preset array exceed a preset threshold, taking a first element in the preset array as a starting point of the area to be divided, and taking a last element in the preset array as a termination point corresponding to the area to be divided;
and determining a target segmentation line corresponding to the region to be segmented based on the starting point and the end point.
6. An apparatus for region segmentation, comprising:
the acquisition module is used for acquiring a preset rectangular region corresponding to a region to be segmented;
the determining module is used for determining a first intersection point and a second intersection point on the edge of the preset rectangular region based on a preset position relation and obtaining a preset array corresponding to the region to be divided based on the first intersection point and the second intersection point;
and the target module is used for determining a target parting line corresponding to the region to be parted based on the preset array and parting the region to be parted based on the target parting line.
7. The apparatus according to claim 6, wherein the obtaining module is specifically configured to determine a color value identifier of the region to be partitioned, calculate a first extreme point and a second extreme point corresponding to the region to be partitioned, and determine a preset rectangular region corresponding to the region to be partitioned based on the color value identifier and the first extreme point and the second extreme point.
8. The apparatus according to claim 6, wherein the determining module is specifically configured to determine a preset first coordinate point and a preset second coordinate point corresponding to the region to be segmented, determine a linear equation based on the preset first coordinate point and the preset second coordinate point, calculate a first coordinate point and a second coordinate point of an edge line of the linear equation corresponding to the preset rectangular region based on the linear equation and the preset rectangular region, and determine a first intersection point and a second intersection point on the edge line of the preset rectangular region based on the first coordinate point and the second coordinate point.
9. A robotic device, comprising:
a memory for storing a computer program;
a processor for implementing the method steps of any one of claims 1-5 when executing the computer program stored on the memory.
10. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of claims 1-5.
CN202211164291.9A 2022-09-23 2022-09-23 Region segmentation method and device and robot device Pending CN115641436A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211164291.9A CN115641436A (en) 2022-09-23 2022-09-23 Region segmentation method and device and robot device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211164291.9A CN115641436A (en) 2022-09-23 2022-09-23 Region segmentation method and device and robot device

Publications (1)

Publication Number Publication Date
CN115641436A true CN115641436A (en) 2023-01-24

Family

ID=84941391

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211164291.9A Pending CN115641436A (en) 2022-09-23 2022-09-23 Region segmentation method and device and robot device

Country Status (1)

Country Link
CN (1) CN115641436A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117824665A (en) * 2024-03-05 2024-04-05 安徽领云物联科技有限公司 Routing inspection robot route planning system based on GIS

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117824665A (en) * 2024-03-05 2024-04-05 安徽领云物联科技有限公司 Routing inspection robot route planning system based on GIS
CN117824665B (en) * 2024-03-05 2024-05-14 安徽领云物联科技有限公司 Routing inspection robot route planning system based on GIS

Similar Documents

Publication Publication Date Title
CN113010937B (en) Parametric modeling method of member section steel bar and related device
CN107633208B (en) Electronic device, the method for face tracking and storage medium
CN107765694A (en) A kind of method for relocating, device and computer read/write memory medium
CN110796016A (en) Engineering drawing identification method, electronic equipment and related product
CN112336342A (en) Hand key point detection method and device and terminal equipment
CN115641436A (en) Region segmentation method and device and robot device
CN109767479A (en) A kind of glyph filling method and system based on dynamic boundary group sequence
CN108564645A (en) Rendering intent, terminal device and the medium of building model
CN110930520B (en) Semantic segmentation labeling method, device and equipment
CN109388131B (en) Robot attitude control method and system based on angular point feature recognition and robot
CN116327060A (en) Method and device for judging regional overlapping, electronic equipment and medium
CN111783180B (en) Drawing splitting method and related device
CN114565505B (en) Clothing deformation method, device, equipment and storage medium based on virtual replacement
CN112529984B (en) Method, device, electronic equipment and storage medium for drawing polygon
CN108629219A (en) A kind of method and device of identification one-dimension code
CN114444185A (en) In-situ labeling identification method and device and electronic equipment
CN114297751A (en) BIM rendering method and device, electronic equipment and storage medium
CN113867371A (en) Path planning method and electronic equipment
CN113448667B (en) Method and device for generating display relationship diagram
CN113810626A (en) Video fusion method, device and equipment based on three-dimensional map and storage medium
CN115661485B (en) Image feature extraction method, device, equipment and storage medium
CN112101369B (en) Image segmentation method and device
CN115168112B (en) Method, device, equipment and medium for restoring section data under dynamic section change
CN117633973A (en) CAD file identification method, device, electronic equipment and storage medium
CN116091365B (en) Triangular surface-based three-dimensional model notch repairing method, triangular surface-based three-dimensional model notch repairing device, triangular surface-based three-dimensional model notch repairing equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination