Map main direction detection method and system of robot and application
By extracting the contour from the probability grid image and performing polygon and minimum external rectangle calculations, the problem of inaccurate positioning of the main direction detection of the robot map in complex environments is solved, the accuracy and robustness of direction recognition are improved, and the calculation is optimized Efficiency improves the navigation ability and adaptability of the robot.
Patent Information
- Application Number
- CN202411250568.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-06
- Publication Date
- 2024-12-10
AI Technical Summary
The existing robot map main direction detection methods have inaccurate positioning, high calculation costs, and poor adaptability to environmental changes in complex environments, making it difficult to accurately identify the main direction of the robot.
By obtaining the probability grid image, converting it into a grayscale image, extracting the contour and calculating the area to filter out the contour set, performing polygon approximation and minimum external rectangle calculations, combining the first main direction and the second main direction to obtain the main direction offset angle of the robot .
It improves the accuracy and robustness of direction recognition, optimizes computing efficiency, improves positioning accuracy, and improves the navigation ability and adaptability of the robot in complex environments.
Smart Images

Figure CN119107358A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of robot map detection, and more specifically, to a method, system and application for detecting the main direction of a robot map. Background Art
[0002] With the development of robotics technology, more and more application scenarios require robots to have autonomous navigation capabilities. In complex environments, robots need to be able to accurately identify the position and orientation of surrounding objects in order to make reasonable decisions. Traditional navigation methods usually rely on pre-built maps and fixed landmarks, but this solution is more complicated and often performs poorly in the face of dynamic changes in the environment.
[0003] To overcome this challenge, researchers have developed a variety of real-time map building and localization techniques based on sensor data. Among them, probabilistic grid maps are a commonly used map representation that can effectively fuse information from different sensors and update the understanding of the environment. However, how to accurately identify the main direction of the robot from the probabilistic grid map remains an urgent problem to be solved. Although existing methods can achieve the goal to a certain extent, they still have shortcomings when dealing with complex scenes, such as inaccurate positioning, high computational cost, and poor adaptability to environmental changes. Summary of the invention
[0004] Based on the problems existing in the prior art, this application provides a method, system and application for detecting the main direction of a robot map. The specific solution is as follows:
[0005] In the first part, this application proposes a method for detecting the main direction of a robot map, including the following:
[0006] Obtaining a probability grid corresponding to a certain area, and converting the probability grid into a grayscale image;
[0007] Extracting all contours in the grayscale image, calculating the area of each contour, and filtering contours according to the area to obtain a contour set;
[0008] Performing polygonal approximation on the contours in the contour set, and drawing polygons of each contour; calculating a first main direction based on the length and angle of each side of the polygon, and calculating a second main direction based on the minimum circumscribed rectangle of the polygon;
[0009] The first main direction and the second main direction are combined to obtain the main direction offset angle of the robot.
[0010] In some specific embodiments, the length and angle of each edge of the polygon are traversed to solve the weight array of each polygon, and the first main direction is calculated based on each weight array;
[0011] And / or, a minimum bounding rectangle is drawn for the contours in the contour set, vertices of each minimum bounding rectangle are extracted and included in a point queue, and a principal component analysis is performed on the point queue to obtain a second principal direction.
[0012] In some specific embodiments, the process of acquiring the contour set includes:
[0013] Determine whether the grayscale image is consistent with the initial image. If not, then:
[0014] Calculate the area of each contour based on pixels and sort them by area;
[0015] The contour with the largest area is taken as the first contour, and the contours located in the first contour are screened out according to the range of the first contour to obtain all sub-contours;
[0016] The first contour and the sub-contours with areas greater than a preset value are classified into the same set to obtain the contour set.
[0017] In some specific embodiments, the grayscale image acquisition process specifically includes:
[0018] Initializing a blank image by the size of the probability grid to obtain an initial image, wherein each pixel unit in the initial image corresponds to a probability value in the probability grid;
[0019] If the probability value of the grid is 0, the corresponding pixel unit in the initial image is set to black;
[0020] If the probability value of the grid is greater than the preset probability value, the corresponding pixel unit in the initial unit is set to white;
[0021] If the probability value of the grid is not 0 and is not greater than a preset probability value, the corresponding pixel unit in the initial unit is set to black;
[0022] The probability value of each grid in the probability grid is traversed to obtain a grayscale image.
[0023] In some specific embodiments, after acquiring the grayscale image, a morphological structure element with a preset height and a preset width is created, and a morphological closing operation is performed on the grayscale image through the morphological structure element to obtain a first grayscale image;
[0024] Analyze whether the grayscale values of the first grayscale image are all 0, and if not, extract the contour.
[0025] In some specific embodiments, a standard reference direction is selected for the polygon, and the angle between each side of the polygon and the standard reference direction, as well as the length of each side, is calculated; wherein the angle is less than 180°;
[0026] The side lengths corresponding to the same angle in all polygons are accumulated to obtain the weight value corresponding to the angle, and the weight values of all angles are summarized to obtain a weight array.
[0027] In some specific embodiments, the first main direction and / or the second main direction are normalized;
[0028] Calculate the normalized difference between the first main direction and the second main direction;
[0029] If the difference exceeds a preset threshold, the first main direction and the second main direction are fused to obtain a main direction offset angle;
[0030] If the difference does not exceed the preset threshold, the first main direction and / or the second main direction is selected as the main direction offset angle.
[0031] In the second part, this application proposes a robot map main direction detection system, including the following:
[0032] A preprocessing unit, used to obtain a probability grid corresponding to a certain area and convert the probability grid into a grayscale image;
[0033] A contour unit, used for extracting all contours in the grayscale image, calculating the area of each contour, and filtering contours according to the area to obtain a contour set;
[0034] A direction calculation unit, used for performing polygonal approximation on the contours in the contour set and drawing polygons of each contour; calculating a first main direction based on the length and angle of each side of the polygon, and calculating a second main direction based on the minimum circumscribed rectangle of the polygon;
[0035] The output unit is used to obtain the main direction offset angle of the robot by combining the first main direction and the second main direction.
[0036] In the third part, the present application proposes a computer device, the computer device comprising:
[0037] one or more processors;
[0038] A memory for storing one or more programs;
[0039] When the one or more programs are executed by the one or more processors, the one or more processors implement the robot map main direction detection method as described in any one of the first parts.
[0040] In the fourth part, the present application proposes a computer program product, including executable instructions, which are used to implement the robot map main direction detection method as described in any one of the first parts when executed by a processor.
[0041] Beneficial effects: This application proposes a method, system and application for detecting the main direction of a robot map, which uses a probability grid to predict the main direction of the robot, and integrates the first main direction based on the length and angle of the polygon and the second main direction based on the minimum circumscribed rectangle, which can effectively improve the accuracy and robustness of direction recognition, optimize calculation efficiency, improve positioning accuracy, and thus enhance the navigation ability and adaptability of the robot in complex environments. In addition, the solution is based on general image processing technology and geometric calculation methods, and can be integrated into other robot perception and navigation systems, and is suitable for a variety of different environments and application scenarios.
[0042] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0044] Figure 1 It is a flowchart of the map main direction detection method of the present application;
[0045] Figure 2 It is a schematic diagram of the map main direction detection system module of this application.
[0046] Figure numerals: 1 - preprocessing unit; 2 - contour unit; 3 - direction calculation unit; 4 - output unit. DETAILED DESCRIPTION
[0047] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0048] This application proposes a method for detecting the main direction of a robot map. Based on the probability grid, the main direction of the robot is predicted, which can effectively improve the accuracy and robustness of direction recognition, thereby improving the navigation ability and adaptability of the robot in complex environments. The flowchart of the main direction detection method is shown in the attached figure. Figure 1 The specific plan is as follows:
[0049] A method for detecting the main direction of a map of a robot, comprising the following steps:
[0050] 101. Obtain a probability grid corresponding to a certain area, and convert the probability grid into a grayscale image;
[0051] 102. Extract all contours in the grayscale image, calculate the area of each contour, and filter the contours according to the area to obtain a contour set;
[0052] 103. Perform polygonal approximation on the contours in the contour set, and draw polygons of each contour; calculate a first main direction based on the length and angle of each side of the polygon, and calculate a second main direction based on the minimum circumscribed rectangle of the polygon;
[0053] 104. The first main direction and the second main direction are combined to obtain the main direction offset angle of the robot.
[0054] Among them, step 101 needs to convert the probability grid map into a grayscale image, convert the complex probability information into image information that is easy to process and analyze, and is convenient for image processing techniques in subsequent steps, such as edge detection, contour extraction, etc. The probability grid is a form of map that represents the environment, usually constructed by a robot using sensor data (such as lidar, camera, etc.). This map divides the environment into a series of discrete cells, each of which has a probability value to indicate whether the position is occupied. For example, a probability value close to 1 indicates that the position is likely to be occupied by an obstacle, while a value close to 0 indicates that the position is likely to be idle. Before the conversion, it is necessary to clarify the mapping rules between probability values and grayscale, and map the probability values in the probability grid map to the grayscale in the grayscale image. Generally, the probability value from 0 to 1 can be mapped to the grayscale from 0 to 255, where 0 represents black (darkest) and 255 represents white (brightest). For example, if the probability value is 0, the grayscale is also 0 (black), and if the probability value is 1, the grayscale is 255 (white). Specifically, it can be defined that when the gray value is 0 (black), it represents an unoccupied or uncertain state, and when the gray value is 255 (white), it represents an occupied state.
[0055] In some specific embodiments, the grayscale image acquisition process specifically includes: initializing a blank image by the size of the probability grid to obtain an initial image, each pixel unit in the initial image corresponds to a probability value in the probability grid; if the probability value of the grid is 0, the corresponding pixel unit in the initial image is set to black; if the probability value of the grid is greater than the preset probability value, the corresponding pixel unit in the initial unit is set to white; if the probability value of the grid is not 0 and is not greater than the preset probability value, the corresponding pixel unit in the initial unit is set to black. Traversing the probability value of each grid in the probability grid to obtain a grayscale image. First, create a blank grayscale image according to the size (width and height) of the probability grid. The size of the blank grayscale image is the same as the probability grid, which means that each pixel unit corresponds to a cell in the probability grid. All pixel units in the created initial image are set to black by default, and the grayscale value is 0. For each cell in the probability grid, check its probability value. If the probability value of the cell is 0, it means that the position is likely to be idle, and the corresponding pixel unit in the initial image is set to black (grayscale value is 0). If the probability value of a cell is greater than a preset probability threshold, it means that the position is likely to be occupied, and the corresponding pixel unit in the initial image is set to white (grayscale value is 255). If the probability value of a cell is not 0 and is not greater than the preset probability threshold, it means that the position is in an uncertain state, and the corresponding pixel unit in the initial image is also set to black (grayscale value is 0). The preset probability threshold is a user-defined value, that is, a cell with a probability value greater than 0.5 is considered to be occupied.
[0056] The expression for converting the probability grid to a grayscale image is as follows:
[0057]
[0058] Among them, Probability represents the probability value of the grid point, and Gray Value represents the gray value.
[0059] Step 102 involves the process of extracting contours from the grayscale image and screening these contours, and identifying the boundaries and objects in the image by extracting contours. Edges in the image can be identified using edge detection algorithms (such as Canny edge detection or Sobel operator). Use contour detection algorithms (such as findContours function in Open CV) to find all closed contours. A contour is a set of continuous edge points that form a closed curve and represent the boundary of an object. Once the contours are detected, the next step is to calculate the area of each contour. The area of the contour can be obtained by calculating the number of pixels within the contour.
[0060] After calculating the area of each contour, we filter them according to their area to get a contour set, and remove contours with smaller areas or that do not meet specific conditions to reduce the complexity of subsequent processing.
[0061] In some specific embodiments, the process of acquiring the contour set includes: determining whether the grayscale image is consistent with the initial image, if not, then: calculating the area of each contour according to the pixels and sorting them by area; taking the contour with the largest area as the first contour, filtering the contours located in the first contour according to the range of the first contour, and obtaining all sub-contours; classifying the first contour and the sub-contours with an area greater than a preset value into the same set to obtain the contour set. Select the contour with the largest area as the first contour. Use the bounding box of the first contour to filter out all other contours located inside the first contour. The contour with the largest area often represents the most significant feature or object in the image, and including it in the set can ensure that the main feature is correctly identified and processed. The sub-contour is located inside the first contour and is usually associated with the object represented by the first contour. Contours with large areas are more likely to represent real object boundaries, while contours with small areas may be edge cases or background noise. Retaining larger contours can improve the accuracy and reliability of the analysis. Setting an area threshold can exclude contours with smaller areas and reduce false positives in subsequent processing. By retaining only contours with larger areas, the subsequent processing flow can be simplified and efficiency can be improved.
[0062] In some specific embodiments, after acquiring a grayscale image, a morphological structure element with a preset height and a preset width is created, and a morphological closing operation is performed on the grayscale image through the morphological structure element to obtain a first grayscale image; it is analyzed whether the grayscale values of the first grayscale image are all 0, and if not, the contour is extracted. The structure element is usually a rectangle, and its size can be adjusted as needed. For example, a 5x5 rectangular structure element. The grayscale image is closed using the structure element. The closing operation is a type of morphological operation, which removes small holes in the image and smoothes the contour by first dilating and then corroding, making the edge of the object clearer. Check whether the grayscale image after the closing operation (called the first grayscale image) is all 0 (that is, whether it is a completely black image). If it is a completely black image, it means that there are not enough white pixels (obstacles) in the original grayscale image to form a valid contour. If the first grayscale image is not completely black, the contour can be extracted from it. The contour is the edge of the object in the image, and these edges can be found by the contour detection algorithm. Through the closing operation, small noise points in the grayscale image can be effectively removed, small holes inside the object can be filled, and the boundary of the object can be smoothed, making the outline of the object clearer and more complete, ensuring that high-quality contours are extracted from the grayscale image, and laying the foundation for subsequent polygon approximation and direction calculation.
[0063] By screening and approximating the contours, unnecessary computational load is reduced, thereby reducing the computational cost of the entire system, making this method also applicable to mobile platforms with limited resources, such as cleaning robots.
[0064] In some specific embodiments, the length and angle of each side of the polygon are traversed to solve the weight array of each polygon, and the first principal direction is calculated based on each weight array; and / or, the minimum enclosing rectangle is drawn for the contours in the contour set, the vertices of each minimum enclosing rectangle are extracted and included in the point queue, and the principal component analysis is performed on the point queue to obtain the second principal direction.
[0065] For the first main direction, a weight array is calculated based on the angle and the side length. In some specific embodiments, it specifically includes: selecting a standard reference direction for the polygon, calculating the angle between each side of the polygon and the standard reference direction, and the side length of each side; wherein the angle is less than 180°. The side lengths corresponding to the same angle in all polygons are accumulated to obtain the weight value corresponding to the angle, and the weight values of all angles are summarized to obtain the weight array. The standard reference direction is usually a horizontal direction or a vertical direction, which can be selected according to specific application requirements. By calculating the angle between each side and the standard reference direction, the direction information can be quantified into a numerical value. For each side in all polygons, it is classified according to its angle with the standard reference direction. For the same angle, all corresponding side lengths are accumulated to obtain the weight value of the angle. By calculating the accumulated value of the side length as the weight value, the importance of different directions can be reflected. Longer sides have a greater impact on the direction, so they have a higher weight. Accumulating the side lengths with the same angle can simplify the subsequent direction calculation process and reduce the amount of calculation. In some embodiments, after the weight array is calculated, the direction with the largest weight value may be selected and converted to obtain the first main direction.
[0066] Specifically, the expression for angle calculation is:
[0067]
[0068] Among them, θ represents the angle between the side of the polygon and the standard reference direction, (x1, y1) and (x2, y2) are the two endpoints of one side of the polygon.
[0069] The expression of weight value is:
[0070] weights[θ]+=len
[0071] Among them, weights[θ] represents the weight value of the angle θ, and len represents the side length of the polygon.
[0072] In some embodiments, the first main direction and / or the second main direction are normalized; the difference between the normalized first main direction and the second main direction is calculated; if the difference exceeds a preset threshold, the first main direction and the second main direction are fused to obtain a main direction offset angle; if the difference does not exceed the preset threshold, the first main direction and / or the second main direction are selected as the main direction offset angle. The direction vectors are normalized to ensure that they have unit length for subsequent calculations. To compare the difference between the two direction vectors, the similarity between the two can be evaluated by calculating the angle between the two vectors or directly calculating the Euclidean distance between them. If the two vectors are very close, the angle between them will be small; if the directions are opposite, the angle is 180 degrees. A threshold T is set, and if the difference between the two direction vectors exceeds T, it is considered that there is a significant difference between them. If the difference is less than or equal to T, the two direction vectors are considered to be close enough.
[0073] When there is a significant difference between the two direction vectors, they are fused to obtain a more accurate main direction offset angle. The two direction vectors can be merged into a new direction vector by weighted averaging or other methods. When the two direction vectors are very close, one of them can be selected as the final result, reducing additional calculation steps and simplifying the processing flow.
[0074] The second principal direction can be used as a secondary principal direction, using the minimum enclosing rectangle to show the basic size and orientation of the contour, and analyze the spatial layout of the contour set. By drawing the minimum enclosing rectangle for multiple contours, the size and orientation differences between different contours can be compared. Extract four vertex coordinates from each minimum enclosing rectangle and collect these vertex coordinates into a list or queue. The vertex set provides boundary information of the contour set and can be used to build a geometric model of the contour set. Use principal component analysis to find the direction with the largest variation in the data and find the main directions in the point set. PCA usually involves calculating the covariance matrix of the data and then solving the eigenvalues and eigenvectors.
[0075] In this application, polygonal approximation is used to describe the shape and orientation of each contour. The expression of polygonal approximation is:
[0076]
[0077] Among them, d represents the approximation distance, (x, y) is the point to be approximated, (x1, y1) and (x2, y2) are the two endpoints of an edge of the polygon.
[0078] This application provides a robot map main direction detection system, as shown in the attached Figure 2 As shown, including the following:
[0079] A preprocessing unit 1 is used to obtain a probability grid corresponding to a certain area and convert the probability grid into a grayscale image;
[0080] Contour unit 2, used to extract all contours in the grayscale image, calculate the area of each contour, and filter contours according to the area to obtain a contour set;
[0081] A direction calculation unit 3 is used to perform polygonal approximation on the contours in the contour set and draw the polygons of each contour; a first main direction is calculated based on the length and angle of each side of the polygon, and a second main direction is calculated based on the minimum circumscribed rectangle of the polygon;
[0082] The output unit 4 is used to obtain a main direction offset angle of the robot by combining the first main direction and the second main direction.
[0083] The present application provides a computer program product, which includes computer instructions, which are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes a method for detecting the main direction of a map of a robot. A method for detecting the main direction of a map of a robot is applied to a computer program product for easy execution.
[0084] The present application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of a method for detecting the main direction of a map of a robot as described above.
[0085] The computer storage medium of the present application may adopt any combination of one or more computer-readable media. The computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium may be, for example, but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, device or device. The present application applies a method for detecting the main direction of a map of a robot to a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the steps of the clothing simulation method provided by the present application are implemented, which is simple and fast, easy to store, and not easy to lose.
[0086] This application proposes a method, system and application for detecting the main direction of a robot map. The method uses a probability grid to predict the main direction of the robot, and combines the first main direction based on the length and angle of the polygon and the second main direction based on the minimum circumscribed rectangle. This method can effectively improve the accuracy and robustness of direction recognition, optimize computational efficiency, improve positioning accuracy, and thus enhance the navigation capability and adaptability of the robot in complex environments. The solution is based on general image processing technology and geometric calculation methods, and can be integrated into other robot perception and navigation systems, and is suitable for a variety of different environments and application scenarios.
[0087] Those skilled in the art should understand that the modules of the present application described above can be implemented by a general-purpose computing system, they can be concentrated on a single computing system, or distributed on a network composed of multiple computing systems, and optionally, they can be implemented by program codes executable by a computer system, so that they can be stored in a storage system and executed by the computing system, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.
[0088] Note that the above are only preferred embodiments of the present application and the technical principles used. Those skilled in the art will understand that the present application is not limited to the specific embodiments herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present application. Therefore, although the present application is described in more detail through the above embodiments, the present application is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present application, and the scope of the present application is determined by the scope of the appended claims.
[0089] The above disclosure only discloses several specific implementation scenarios of the present application. However, the present application is not limited thereto, and any changes that can be conceived by technicians in this field should fall within the scope of protection of the present application.
Claims
1. A method for detecting the main direction of a robot map, characterized in that: These include: Obtaining a probability grid corresponding to a certain area, and converting the probability grid into a grayscale image; Extracting all contours in the grayscale image, calculating the area of each contour, and filtering contours according to the area to obtain a contour set; Performing polygonal approximation on the contours in the contour set, and drawing polygons of each contour; calculating a first main direction based on the length and angle of each side of the polygon, and calculating a second main direction based on the minimum circumscribed rectangle of the polygon; The first main direction and the second main direction are combined to obtain the main direction offset angle of the robot.
2. The map main direction detection method according to claim 1, characterized in that: Traverse the length and angle of each edge of the polygon to solve the weight array of each polygon, and calculate the first main direction based on each weight array; And / or, a minimum bounding rectangle is drawn for the contours in the contour set, vertices of each minimum bounding rectangle are extracted and included in a point queue, and a principal component analysis is performed on the point queue to obtain a second principal direction.
3. The map main direction detection method according to claim 1, characterized in that: The process of obtaining the contour set includes: Determine whether the grayscale image is consistent with the initial image. If not, then: Calculate the area of each contour based on pixels and sort them by area; The contour with the largest area is taken as the first contour, and the contours located in the first contour are screened out according to the range of the first contour to obtain all sub-contours; The first contour and the sub-contours with areas greater than a preset value are classified into the same set to obtain the contour set.
4. The map main direction detection method according to claim 1, characterized in that: The grayscale image acquisition process specifically includes: Initializing a blank image by the size of the probability grid to obtain an initial image, wherein each pixel unit in the initial image corresponds to a probability value in the probability grid; If the probability value of the grid is 0, the corresponding pixel unit in the initial image is set to black; If the probability value of the grid is greater than the preset probability value, the corresponding pixel unit in the initial unit is set to white; If the probability value of the grid is not 0 and is not greater than a preset probability value, the corresponding pixel unit in the initial unit is set to black; The probability value of each grid in the probability grid is traversed to obtain a grayscale image.
5. The map main direction detection method according to claim 1, characterized in that: After acquiring the grayscale image, creating a morphological structure element with a preset height and a preset width, and performing a morphological closing operation on the grayscale image through the morphological structure element to obtain a first grayscale image; Analyze whether the grayscale values of the first grayscale image are all 0, and if not, extract the contour.
6. The map main direction detection method according to claim 2, characterized in that: Select a standard reference direction for the polygon, and calculate the angle between each side of the polygon and the standard reference direction, as well as the length of each side; wherein the angle is less than 180°; The side lengths corresponding to the same angle in all polygons are accumulated to obtain the weight value corresponding to the angle, and the weight values of all angles are summarized to obtain a weight array.
7. The map main direction detection method according to claim 1, characterized in that: Normalizing the first main direction and / or the second main direction; Calculate the normalized difference between the first main direction and the second main direction; If the difference exceeds a preset threshold, the first main direction and the second main direction are fused to obtain a main direction offset angle; If the difference does not exceed the preset threshold, the first main direction and / or the second main direction is selected as the main direction offset angle.
8. A robot map main direction detection system, characterized in that: These include: A preprocessing unit, used to obtain a probability grid corresponding to a certain area and convert the probability grid into a grayscale image; A contour unit, used for extracting all contours in the grayscale image, calculating the area of each contour, and filtering contours according to the area to obtain a contour set; A direction calculation unit, used for performing polygonal approximation on the contours in the contour set and drawing polygons of each contour; calculating a first main direction based on the length and angle of each side of the polygon, and calculating a second main direction based on the minimum circumscribed rectangle of the polygon; The output unit is used to obtain the main direction offset angle of the robot by combining the first main direction and the second main direction.
9. A computer device, characterized in that: The computer device comprises: one or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the map main direction detection method for a robot as described in any one of claims 1-7.
10. A computer program product, characterized in that It includes executable instructions, which are used to implement the map main direction detection method of the robot as described in any one of claims 1-7 when executed by a processor.
Citation Information
Cited By
Robot visual direction identification method and system for robot navigation
CN119832340A
A robot vision direction recognition method and system for robot navigation
CN119832340B
