Relocation method and device based on machine vision
By downsampling the global map and sub-maps during the relocation process, selecting points with high matching degree, and calculating the target point of the device in the global map, the problem of low positioning efficiency in the existing technology is solved, and efficient positioning process.
Patent Information
- Application Number
- CN202410646701.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-22
- Publication Date
- 2024-09-06
AI Technical Summary
In the existing technology, in order to maintain positioning accuracy, a high-resolution global map needs to be constructed during the relocation process, resulting in a large amount of calculation and difficulty in improving positioning efficiency.
By obtaining the sub-area map of the movable device to be located in the target scene, perform down-sampling processing, select points whose matching degree meets the preset conditions, and calculate the target point of the device in the global map, reducing the amount of traversed data and calculations. .
It improves the efficiency of relocation, reduces the amount of calculation, reduces the amount of data processed, and enhances the efficiency of positioning.
Smart Images

Figure CN118603095A
Abstract
Description
[0001] Technology Neighborhood
[0002] The present application relates to the fields of artificial intelligence and robotics, and in particular to a method and device for repositioning based on machine vision. Background Art
[0003] Accurate positioning is the basis for mobile robots to realize many functions. In related technologies, in order to realize the positioning of mobile robots, a global map of the mobile robot's workplace can be constructed in advance. When the mobile robot works in the workplace, a sub-map of the area where it is located can be scanned and obtained. The position of the mobile robot in the workplace is determined by matching the global map with the sub-map. Since this method requires entering the workplace in advance to build a global map and positioning can only be performed after re-entering the workplace, it is often called relocalization.
[0004] In the relocalization process, in order to improve the accuracy of the positioning results, the resolution of the constructed global map needs to be high enough. The higher the resolution of the global map, the more calculations are required to match the global map with the submap. Therefore, in the related art, it is difficult for the relocalization solution to improve the positioning efficiency while maintaining accuracy. Summary of the invention
[0005] The purpose of the embodiment of the present application is to provide a method and device for repositioning based on machine vision, which is used to improve the positioning efficiency while maintaining accuracy. The specific technical solution is as follows:
[0006] In a first aspect of the present application, a method for relocalization based on machine vision is provided, the method comprising:
[0007] Acquire a map of a sub-region where the movable device to be located is located in the target scene as an original sub-map, wherein the original sub-map is a TSDF map established by scanning the ceiling of the sub-region;
[0008] According to the same sampling method, the original global map and the original sub-map are downsampled respectively to obtain a downsampled global map and a downsampled sub-map, wherein the original global map is a TSDF map established in advance by scanning the ceiling of the target scene;
[0009] In the downsampled global map, a point whose matching degree with the downsampled submap satisfies a preset first matching condition is selected as a first candidate point, wherein the matching degree is used to indicate the matching degree between the submap and the submap at the point in the global map;
[0010] In the original global map, determining a point located in the neighborhood of the projection point of the first candidate point as a second candidate point;
[0011] Among the second candidate points, a point whose matching degree with the original submap satisfies a preset second matching condition is selected as the matching point of the original submap in the original global submap;
[0012] The target point position of the movable device in the original global map is calculated based on the matching point position and the point position of the movable device in the original sub-map.
[0013] In a possible implementation, the step of obtaining a map of a sub-region where the movable device to be located is located in the target scene as an original sub-map includes:
[0014] Acquire a submap established by the mobile device based on machine vision technology as a first submap;
[0015] Controlling the movable device to move in the target scene, and acquiring a map established based on machine vision technology during the movement of the movable device as a second sub-map;
[0016] Expanding the first submap according to the second submap, and returning to execute the step of controlling the movable device to move in the target scene and obtaining a map established based on machine vision technology during the movement of the movable device as a second submap, until the expanded first submap meets a preset minimum submap condition;
[0017] The first submap obtained by expansion is determined as the original submap.
[0018] In a possible implementation, downsampling the original global map and the original sub-map respectively according to the same sampling method to obtain the downsampled global map and the downsampled sub-map includes:
[0019] According to the same sampling method, the original global map and the original sub-map are downsampled respectively to obtain n downsampled global maps and downsampled sub-maps with different resolutions, where n is any positive integer greater than 1;
[0020] The step of selecting, in the downsampled global map, a point whose matching degree with the downsampled submap satisfies a preset first matching condition as a first candidate point includes:
[0021] In the level 1 down-sampled global map, a point whose matching degree with the level 1 down-sampled sub-map satisfies a preset first matching condition is selected as the third candidate point, wherein the level 1 down-sampled global map is a down-sampled global map with the lowest resolution, and the level 1 down-sampled sub-map is a down-sampled sub-map with the lowest resolution;
[0022] In the i-th level downsampled global map, a point in the neighborhood of the projection point of the third candidate point is determined as the fourth candidate point, wherein the i-th level downsampled global map is a downsampled global map with the i-th lowest resolution, and i is initially 2;
[0023] Among the fourth candidate points, a point whose matching degree with the i-th level downsampling submap satisfies a preset first matching condition is selected as the third candidate point, wherein the i-th level downsampling submap is a downsampling submap with the i-th lowest resolution;
[0024] Taking i+1 as the new i, returning to the step of determining, in the i-level downsampled global map, a point in the neighborhood of the projection point of the third candidate point as the fourth candidate point;
[0025] Until i is greater than n, the latest third candidate point is used as the first candidate point.
[0026] In a possible implementation, in the sampling method, the value of the point in the j-level downsampled global map or the j-level downsampled submap is calculated by the following method, including:
[0027] Determine each point in the neighborhood of the projection point of the point in the map to be sampled as the point to be sampled; wherein, when j is greater than 1, the map to be sampled is a j-1 level downsampled global map or downsampled submap, and when j=1, the map to be sampled is an original global map or original submap;
[0028] Determine the maximum value of the values of the points to be sampled;
[0029] The difference between the maximum value and a preset threshold value for j is determined as the value of the point.
[0030] In a possible implementation, the neighborhood of the projection point is an area formed by expanding in a circular shape around the projection point;
[0031] The step of selecting, in the level 1 downsampled global map, a point whose matching degree with the level 1 downsampled submap satisfies a preset first matching condition as the third candidate point includes:
[0032] Calculate the matching degree between the current point in the 1-level downsampled global map and the 1-level downsampled submap, wherein the current point is initially a preset starting point;
[0033] If the calculated matching degree meets the preset first matching condition, the current point is determined as the third candidate point;
[0034] Calculate the traversal step length according to the calculated matching degree, wherein the traversal step length is negatively correlated with the calculated matching degree;
[0035] The traversal step-th point after the current point is taken as the new current point, and the step of calculating the matching degree between the current point in the level 1 down-sampled global map and the level 1 down-sampled sub-map is returned to execute until the preset traversal end condition is met.
[0036] In a possible implementation, the matching degree between the point in the global map and the sub-map is calculated by the following method, including:
[0037] Determine the difference between the value of each point in the submap at the point and the value of the corresponding point in the submap;
[0038] In the sub-graph, the number of points whose difference is greater than a preset upper threshold is counted as the number of matching points; and the number of points whose difference is less than a preset lower threshold is counted in the sub-graph as the number of unmatched points;
[0039] The matching degree between the point and the submap is calculated according to the number of matching points and the number of unmatched points, wherein the calculated matching degree is positively correlated with the number of matching points and negatively correlated with the unmatched points.
[0040] In a possible implementation, the original global map and the original sub-map are truncated distance function maps;
[0041] The step of respectively determining the difference between the value of each point in the submap and the value of the corresponding point in the submap includes:
[0042] Determine the difference between the value of each valid point in the submap and the value of the corresponding point in the submap, wherein the valid point is a point in the submap whose value is not 1;
[0043] The calculating, according to the number of matching points and the number of unmatched points, the matching degree between the submaps at the points in the global map and the submaps includes:
[0044] The matching degree between the submap and the submap at the point in the global map is calculated based on the number of matching points, the number of unmatched points and the number of valid points, wherein the calculated matching degree is negatively correlated with the number of valid points.
[0045] In a possible implementation, the second matching condition is a maximum matching degree, and the method further includes:
[0046] Calculating the degree of difference between the first matching degree and the second matching degree, wherein the first matching degree is the matching degree between the matching point and the original sub-map, the second matching degree is the matching degree between the secondary matching point and the original sub-map, and the secondary matching point is the point with the highest matching degree with the original sub-map among the second candidate points except the matching point;
[0047] If the difference is less than a preset difference threshold, controlling the movable device to move in the target scene, and obtaining a map established based on machine vision technology during the movement of the movable device as a third sub-map;
[0048] Expanding the original submap according to the third submap to obtain a new original submap;
[0049] The new original sub-map is used to return to the step of downsampling the original global map and the original sub-map in the same sampling manner to obtain a downsampled global map and a downsampled sub-map;
[0050] The step of calculating the target point position of the movable device in the original global map according to the matching point position and the point position of the movable device in the original sub-map includes:
[0051] If the difference degree is not less than a preset difference threshold, the target point position of the movable device in the original global map is calculated based on the matching point position and the point position of the movable device in the original sub-map.
[0052] In a second aspect of the present application, a machine vision-based repositioning device is provided, the device comprising:
[0053] A submap acquisition module, used to acquire a map of a sub-area where the movable device to be located is located in the target scene as an original sub-map, wherein the original sub-map is a TSDF map established by scanning the ceiling of the sub-area;
[0054] A downsampling module, used to downsample the original global map and the original sub-map respectively according to the same sampling method to obtain a downsampled global map and a downsampled sub-map, wherein the original global map is a TSDF map established in advance by scanning the ceiling of the target scene;
[0055] A first candidate point matching module is used to select, in the downsampled global map, a point whose matching degree with the downsampled submap satisfies a preset first matching condition as a first candidate point, wherein the matching degree is used to indicate the matching degree between the submap and the submap at the point in the global map;
[0056] A determination module, configured to determine, in the original global map, a point located in a neighborhood of a projection point of the first candidate point as a second candidate point;
[0057] A submap point matching module, configured to select, from the second candidate points, points whose matching degree with the original submap satisfies a preset second matching condition as matching points of the original submap in the original global submap;
[0058] The calculation module is used to calculate the target point position of the movable device in the original global map according to the matching point position and the point position of the movable device in the original sub-map.
[0059] In a third aspect of the present application, an electronic device is provided, including:
[0060] Memory, used to store computer programs;
[0061] The processor is used to implement any method described in the first aspect when executing a program stored in the memory.
[0062] In a fourth aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, any method described in the first aspect is implemented.
[0063] Beneficial effects of the embodiments of the present application:
[0064] A machine vision-based relocalization method and device provided in an embodiment of the present application can obtain a map of a sub-area where a movable device to be located is located in a target scene as an original sub-map, and downsample the original global map and the original sub-map in the same sampling manner to obtain a downsampled global map and a downsampled sub-map. In the downsampled global map, a point whose matching degree with the downsampled sub-map satisfies a preset first matching condition is selected as a first candidate point. In the original global map, a point located in the neighborhood of a projection point of the first candidate point is determined as a second candidate point. Among the second candidate points, a point whose matching degree with the original sub-map satisfies a preset second matching condition is selected as a matching point of the original sub-map in the original global sub-map. According to the matching points and the point of the movable device in the original sub-map, the target point of the movable device in the original global map is calculated. In the embodiment of the present application, the original global map and the original sub-map are downsampled, and then the first candidate point is determined in the downsampled global map. Since the number of pixels in the downsampled global map is much smaller than the number of pixels in the original global map, the amount of data required to be traversed when determining the first candidate point is greatly reduced. In addition, when positioning in the original global map later, since the first candidate point has been determined, although the number of pixels in the downsampled global map is much smaller than the number of pixels in the original global map, when determining the point in the original global map, that is, during the upsampling process, the second candidate point is located near the first candidate point. Therefore, the second candidate point is determined within the field of the projection point of the first candidate point, which is much less than the number of pixels required to traverse the original global map to determine the second candidate point. Therefore, the amount of data required to be processed in the present application is greatly reduced, and the amount of calculation is also greatly reduced, thereby improving the efficiency of repositioning.
[0065] Of course, implementing any product or method of the present application does not necessarily require achieving all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other embodiments can also be obtained based on these drawings.
[0067] Figure 1a A schematic diagram of a process flow of a machine vision-based relocation method provided in an embodiment of the present application;
[0068] Figure 1b A schematic diagram of a TSDF map provided in an embodiment of the present application;
[0069] Figure 1c A schematic diagram of target point relocation provided in an embodiment of the present application;
[0070] Figure 1d A schematic diagram of a generation direction of n downsampled global maps or downsampled submaps with different resolutions provided in an embodiment of the present application;
[0071] Figure 1e A schematic diagram of matching directions of n downsampled global maps or downsampled submaps with different resolutions provided in an embodiment of the present application;
[0072] Figure 1f A neighborhood of a projection point provided in an embodiment of the present application is a schematic diagram of a region formed by a circular expansion around the projection point;
[0073] Figure 1g A schematic diagram showing a neighborhood of a projection point provided in an embodiment of the present application, which is formed by expanding in a circular shape around the projection point;
[0074] Figure 1h A schematic diagram of determining a third candidate point provided in an embodiment of the present application;
[0075] Figure 2 A machine vision-based relocation flow chart provided in an embodiment of the present application;
[0076] Figure 3 A schematic diagram of a machine vision-based repositioning device provided in an embodiment of the present application;
[0077] Figure 4 A schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0078] 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 the field based on the present application belong to the scope of protection of the present application.
[0079] In order to more clearly explain the relocation method based on machine vision provided by the present application, the principle of relocation in the related art will be briefly explained below:
[0080] The machine vision features scanned at different locations in the same scene are theoretically different, so the location can be determined based on the scanned machine vision features. Specifically, the mobile robot first enters the scene for the first time and scans the machine vision features at each point in each scene, thereby establishing a global map of the scene.
[0081] When the mobile robot enters the scene again to perform relevant business processing, it can scan the machine vision features of each point in the area where it is located, thereby establishing a sub-map of the area where it is located. Next, the mobile robot needs to find a point in the global map that meets the following conditions: when the sub-map is placed at this point, the machine vision features represented by the sub-map can match the machine vision features represented by the global map, that is, the sub-map at this point in the global map matches the sub-map. This point is called the target point in this article.
[0082] After determining the target point, the coordinate conversion relationship between the sub-map and the global map can be obtained, so that the position of the mobile robot in the sub-map can be converted to the global map to obtain the position of the mobile robot in the global map, thus realizing the positioning of the mobile robot.
[0083] However, due to the limitations of scanning technology and map construction technology, the sub-map at the target point does not completely match the sub-map. On the other hand, since machine vision features are often complex, there are often some points in the global map besides the target point, where the sub-map and sub-map have a certain degree of matching. These points are called interference points in this paper.
[0084] Due to the aforementioned reasons, the matching degree between the sub-map and the sub-graph at the target point and the interference point may be relatively close, resulting in the inability to accurately determine the target point based only on the matching degree between the sub-map and the sub-graph at some points in the global map. However, even if the sub-map and the sub-map at the target point do not completely match, the matching degree at the target point is still higher than that at the interference point. Therefore, the matching degree between the sub-map and the sub-map at all points in the global map can be calculated separately, and the point with the highest matching degree can be determined as the target point.
[0085] It can be seen that in the related art, in order to improve the positioning accuracy during the repositioning process, a large amount of calculation is required to determine the target point, which leads to low repositioning efficiency.
[0086] Based on this, in an embodiment of the present application, a method for repositioning based on machine vision is provided, such as Figure 1a As shown, the method includes:
[0087] S101: Obtain a map of a sub-region where a movable device to be located in a target scene is located, as an original sub-map.
[0088] The original sub-map is a TSDF (Truncated Signed Distance Function) map established by scanning the ceiling of the sub-area. The value of each point in the TSDF map (i.e., TSDF value) is used to represent the distance between the point and the surface. For the TSDF map established by scanning the ceiling, the value of the point is used to represent the distance between the point and the ceiling feature line. The ceiling feature line refers to the objects set above the scanning device (i.e., toward the ceiling), such as chandeliers, ceilings, furniture, electrical appliances, sockets, etc., which form a line that can be clearly distinguished from the surrounding environment.
[0089] In addition, the value of the point in the TSDF map needs to satisfy the truncation function. For the convenience of description, assuming that the distance between a point and the ceiling is recorded as sdf, the value of the point can be calculated according to formula (1):
[0090] TSDF=max{-1,min{1,sdf / t}}…(1)
[0091] Among them, TSDF represents the value of the point, and t is the preset threshold. From formula (1), it can be seen that when -t<sdf<t, TSDF=sdf / t, and when sdf<-t, TSDF=-1, and when sdf>t, TSDF=1, that is, the value of each point in the TSDF map is truncated within the value range of [-1,1].
[0092] For example, see Figure 1b , Figure 1b The figure shows a schematic diagram of a TSDF map formed by scanning the indoor ceiling of a building. The grayscale of each point in the figure is used to represent the value of each point, that is, to represent the distance of each point from the ceiling feature line. The higher the grayscale, the closer the point is to the ceiling feature line, that is, the closer the point is to the black, the closer it is to the ceiling feature line, and the closer the point is to the white, the farther it is from the ceiling feature line. It can be understood that Figure 1b This is just a schematic diagram of a TSDF map, and does not mean that the real TSDF map only exists Figure 1b Several different shades of gray are shown.
[0093] S102 . Downsample the original global map and the original sub-map respectively according to the same sampling method to obtain a downsampled global map and a downsampled sub-map.
[0094] The original global map is a TSDF map that is pre-established by scanning the ceiling of the target scene.
[0095] S103: In the downsampled global map, select a point whose matching degree with the downsampled sub-map satisfies a preset first matching condition as a first candidate point.
[0096] S104: In the original global map, determine a point located in the neighborhood of the projection point of the first candidate point as a second candidate point.
[0097] S105 . Select, from the second candidate points, points whose matching degree with the original submap satisfies a preset second matching condition as matching points of the original submap in the original global submap.
[0098] S106: Calculate the target point of the movable device in the original global map based on the matching point and the point of the movable device in the original sub-map.
[0099] In this embodiment, the original global map and the original sub-map are downsampled, and then the first candidate point is determined in the downsampled global map. Since the number of pixels in the downsampled global map is much smaller than the number of pixels in the original global map, the amount of data that needs to be traversed when determining the first candidate point is greatly reduced. In addition, when positioning in the original global map later, since the first candidate point has been determined, although the number of pixels in the downsampled global map is much smaller than the number of pixels in the original global map, when determining the point in the original global map, that is, during the upsampling process, the second candidate point is located near the first candidate point. Therefore, the second candidate point is determined within the field of the projection point of the first candidate point, which is much less than the number of pixels that need to be traversed when traversing the original global map to determine the second candidate point. Therefore, the amount of data that needs to be processed is greatly reduced, and the amount of calculation is also greatly reduced, thereby improving the efficiency of repositioning.
[0100] The above S101 - S106 will be described in detail below.
[0101] In S101, in order to reduce the interference point pairs, how to construct the original sub-map will be exemplified below and will not be repeated here.
[0102] The movable device can be any device that requires autonomous positioning, such as a robot, an automatic guided vehicle (AGV), etc.
[0103] In S102, downsampling is also called decimation. In image processing, downsampling is the process of reducing the resolution of an image, which is usually achieved by discarding some points in the map. Therefore, the resolution of the downsampled global map is lower than the resolution of the original global map, that is, the number of points in the downsampled global map is lower than the number of points in the original global map. Similarly, the resolution of the downsampled sub-map is lower than the resolution of the original sub-map. The present application does not impose any limitation on the downsampling method, and the downsampling method will be exemplarily described below, which will not be repeated here.
[0104] In S103, the matching degree is used to indicate the matching degree between the sub-map at the point in the global map.
[0105] The preset first matching condition may be that the similarity is greater than a preset similarity threshold, or may be to sort the similarities from large to small and then select the first N. The preset similarity threshold is set by those skilled in the art according to actual application scenarios.
[0106] Selecting the points whose matching degree with the downsampled submap satisfies the preset first matching condition can be regarded as: finding the points that may be located in the downsampled submap on the downsampled global map.
[0107] In S104, it can be understood that the value of any point in the downsampled global map is calculated by calculating the value of the point in an area in the original global map. The point in the area in this article is the projection point of the point in the downsampled global map. Depending on the embodiment, different points in the area can be used as projection points. For example, in one possible embodiment, the vertex in the upper left corner of the area can be used as the projection point. In another possible embodiment, the vertex in the lower right corner of the area can also be used as the projection point. In another possible embodiment, the midpoint of the area can also be used as the projection point.
[0108] The neighborhood of the projection point refers to the area centered on the projection point. For example, in a possible embodiment, a 5*5 area centered on the projection point may be used as the neighborhood of the projection point. That is, if the coordinates of the projection point are (x, y), the area includes the following points {(x-2, y+2); (x-1, y+2); (x, y+2); (x+1, y+2); (x+2, y+2); (x-2, y+1); (x-1, y+1); (x, y+1); (x+1, y+1); (x+2, y+1); (x-2, y); (x-1, y); (x, y); (x+1, y); (x+2, y); (x-2, y-1); (x-1, y-1); (x, y-1; (x+1, y-1); (x+2, y-1); (x-2, y-2); (x-1, y-2); (x, y In another possible embodiment, the region may be formed by a circular expansion with the projection point as the starting point, that is, if the coordinates of the projection point are (x, y), the region includes the following points {(x, y); (x+1, y); (x+1, y-1); (x, y-1); (x-1, y-1); (x-1, y+1); (x, y+1); (x+1, y+1); (x+2, y+1); (x+2, y); (x+2, y-1); ...}, the ellipsis in this example does not mean that the region in this example includes countless points, and the number of points included in the region formed by a circular expansion with the projection point as the starting point may be different according to different specific embodiments, and illustratively, it may refer to following the rule in this example until (x-1, y-2).
[0109] It is understandable that the first candidate point can be regarded as: the point in the downsampled global map that matches the downsampled submap. Therefore, in theory, the projection point of the first candidate point in the original global submap can be regarded as: the point in the original global map that matches the original submap, that is, the target point that needs to be found to achieve relocation. However, machine vision features are often more complex, and some machine vision features will be lost during the downsampling process. Therefore, in fact, the point in the original global map that matches the original submap may not be the projection point of the first candidate point in the original global submap, but is located within the field of the projection point. Therefore, in this application, it is necessary to further search for the target point in the neighborhood of the projection point.
[0110] In S105, the second matching condition is used to determine the most accurate point as the matching point of the original submap in the original global submap. For example, it can be the point with the highest matching degree with the original submap among the second candidate points, or the matching degrees can be arranged in ascending order and then the first N points are selected, and the matching point can be any one of the first N points. The second matching condition is set by those skilled in the art according to the actual application scenario.
[0111] In S106, if Figure 1c As shown, the origin of the original global map coordinate system, the origin of the original sub-map coordinate system, and the position of the movable device are as follows Figure 1c As shown, the matching point is taken as the best matching position in the original sub-map and the original global map, and the matching position can be used to calculate the coordinate transformation T between the original sub-map and the original main map. ws , through the position p of the movable device in the original submap s The position p of the movable device on the original global map can be obtained w =T ws p s , thereby achieving the relocation of removable devices.
[0112] The specific process of obtaining the original sub-map is described in detail below.
[0113] Specifically, the above S101 includes:
[0114] S1011. Obtain a map created by the mobile device based on machine vision technology in response to a relocation instruction as a first sub-map.
[0115] In this step, the mobile device is equipped with a machine vision component capable of scanning the machine vision features of the area in which it is located, such as a camera or a radar. When the mobile device is repositioning, when it needs to be repositioned, the processor in the mobile device for implementing the repositioning will receive a repositioning instruction. The repositioning instruction may be issued by an upper-layer application, such as a management platform, a server, etc., or may be input by a user. In response to the repositioning instruction, the camera on the mobile device will capture a picture of the surrounding environment, and the machine vision front end, such as a camera, an image acquisition card, etc., will generate an initial submap based on the machine vision features of the captured picture. This initial submap is the first submap.
[0116] S1012: Control the movable device to move in the target scene, and obtain a map created based on machine vision technology during the movement of the movable device as a second sub-map.
[0117] In this step, as the mobile device moves in the target scene, more and more pictures are taken, and the area size and features of the map established based on machine vision technology are also increasing.
[0118] S1013, expanding the first submap according to the second submap, and returning to execute the control of the movable device to move in the target scene, and obtaining a map established based on machine vision technology during the movement of the movable device as a step of the second submap, until the expanded first submap meets the preset minimum submap condition.
[0119] In this step, since the second submap is a map established during the movement of the mobile device, and as the mobile device moves, the mobile device can collect machine vision features of the area that could not be collected before, and also collect machine vision features of the area that has been collected before, it can be considered that the area represented by the second submap overlaps with the area represented by the first submap to a certain extent. At the same time, the area represented by the second submap includes some areas outside the area represented by the first submap. Due to the overlap, the relative position relationship between the second submap and the first submap can be accurately determined, so that the relevant information in the second submap is projected to the first submap. Since there is an area outside the area, the relevant information in the second submap can supplement the first submap, thereby expanding the area represented by the first submap. As the moving distance increases, the first submap will be continuously expanded. In order to avoid the first submap being too small to affect relocation, in the embodiment of the present application, the first submap is constrained by the minimum submap condition.
[0120] Specifically, the minimum subgraph condition is:
[0121] (1) The number of inserted frames is ≥ the preset minimum number threshold. The limit on the number of inserted frames can ensure that the sub-graph is fully updated.
[0122] It can be understood that the mobile device collects machine vision features in frames and establishes a map based on the machine vision features in several frames. The number of inserted frames in this article refers to the number of frames of machine vision features on which the latest first sub-map is based.
[0123] (2) The size of the sub-image area ≥ the preset minimum area threshold. The area of the sub-image reflects the area of the ceiling in the environment. The minimum area needs to ensure that similar scenes can be distinguished. Sub-image area S submap The calculation method is shown in formula (2):
[0124] S submap =N grid *S grid … (2)
[0125] Among them, S grid Represents a grid area, N grid Indicates the number of valid grids. S submap Used to select the minimum subgraph area that meets the entry matching conditions. grid The calculation method is shown in formula (3):
[0126] S grid =res*scale… (3)
[0127] Among them, res represents the resolution and scale represents the scale of the map.
[0128] S1014: Determine the first sub-map obtained by expansion as the original sub-map.
[0129] In this embodiment, the first submap is expanded through the second submap obtained when the movable device moves in the target scene. As the movable device moves, more and more features are obtained. Since each expansion is constrained by the minimum submap condition, the features of the expanded first submap meet the relocation requirements, thereby improving the accuracy of relocation based on the original submap.
[0130] The above has explained how to obtain the original submap. The following will continue to describe how to downsample the original global map and the original submap to obtain the downsampled global map and the downsampled submap:
[0131] There are two cases for downsampling:
[0132] Case 1: The original global map is downsampled to obtain a downsampled global map, and the original submap is downsampled to obtain a downsampled submap.
[0133] Case 2: The original global map is downsampled to obtain multiple downsampled global maps, and the original submap is downsampled to obtain multiple downsampled submaps.
[0134] For case 1, the sampling magnification of the downsampled global map is the same as the sampling magnification of the downsampled sub-map. The sampling magnification in this article refers to: the ratio of the resolution of the downsampled map to the resolution of the original map. For example, assuming that the resolution of the original global map is 10000*10000, and the resolution of the downsampled global map is 5000*5000, the sampling magnification is 1 / 4.
[0135] For case 2, the number of downsampled global maps and downsampled submaps should be the same and correspond one to one. The corresponding downsampled global maps and downsampled submaps have the same sampling ratio, while different downsampled global maps or different downsampled submaps or non-corresponding downsampled global maps and downsampled submaps have different sampling ratios.
[0136] For example, it is assumed that the original global map is downsampled to obtain two downsampled global maps, which are respectively recorded as downsampled global map 1 and downsampled global map 2. Figure 2 , and downsample the original submap to obtain two downsampled submaps, which are recorded as downsampled submap 1 and downsampled submap Figure 2 . Then the sampling ratios between the downsampled maps are the same: downsampled global map 1 and downsampled submap 1, downsampled global map Figure 2 and downsampling sub-area Figure 2 . And the sampling ratios between the downsampled maps are different: downsampled global map 1 and downsampled sub-map Figure 2 , downsampled global map 1 and downsampled global map Figure 2 , downsampling submap 1 and downsampling submap Figure 2 .
[0137] Since the principle of case 1 is the same as that of case 2, and case 1 is relatively simpler than case 2, the following description will only take case 2, which is a relatively heavy load, as an example, and will not elaborate on case 1.
[0138] For the second case, the above S102 includes:
[0139] S1021. Downsample the original global map and the original sub-map respectively according to the same sampling method to obtain n downsampled global maps and downsampled sub-maps with different resolutions.
[0140] In this step, n is any positive integer greater than 1. Since the sampling methods for obtaining the downsampled global map and the downsampled submap are exactly the same, the downsampled global map and the downsampled submap are no longer distinguished in the following description of the sampling method, but are collectively referred to as downsampled maps. Similarly, the original global map and the original submap are collectively referred to as original maps.
[0141] As described above, different downsampling maps have different sampling magnifications. Therefore, for the convenience of description below, different downsampling maps are distinguished according to different sampling magnifications, and the downsampling maps are respectively recorded as level 1 downsampling maps, level 2 downsampling maps, ..., and level n downsampling maps. Among them, the level 1 downsampling map is the downsampling map with the lowest sampling magnification, the level 2 downsampling map is the downsampling map with the second lowest sampling magnification, ..., and the level n downsampling map is the downsampling map with the highest sampling magnification. From the definition of the above sampling magnification, it can be seen that the higher the sampling magnification, the greater the resolution of the downsampling map, so the level 1 downsampling map is the downsampling map with the smallest resolution, the level 2 downsampling map is the downsampling map with the second smallest resolution, ..., and the level n downsampling map is the downsampling map with the highest resolution.
[0142] In order to maintain generality, the sampling method in this application will be described below by taking how to downsample to obtain a j-level downsampled map as an example. Figure 1d A schematic diagram of the generation direction of a downsampled global map or downsampled submap with n different resolutions provided in an embodiment of the present application, the generation direction of the downsampled map is shown in the figure, where j is any integer from 1 to n. For the convenience of description below, the map obtained by sampling the j-level downsampled map is called the map to be sampled.
[0143] In the case of j=n, the map to be sampled is the original map, that is, the n-level downsampled map is obtained by downsampling the original map. In the case where j is a positive integer less than n, the map to be sampled is the original map or the k-level downsampled map, where k is a positive integer greater than j and less than or equal to n. Exemplarily, assuming that n is 3 and j=1, the map to be sampled can be a 2-level downsampled map or a 3-level downsampled map or the original map. For the convenience of description below, the case where the map to be sampled is a j+1-level downsampled map is used as an example for explanation. The principles are the same for other cases and will not be repeated here.
[0144] In this case, a sliding window of a preset size can be pre-established, all pixels of the map to be sampled can be traversed in turn, and the values of the corresponding points in the j-level downsampled map can be determined based on the values of each point in the sliding window. The sliding window of the preset size is set by technicians in this field according to the actual application scenario. It can be 2×2, 4×4, etc.; when it is 2×2, the resolution of the j-level downsampled map is reduced to 0.25 times that of the map to be sampled, and when it is 4×4, the resolution of the j-level downsampled map is reduced to 0.0625 times that of the map to be sampled.
[0145] The method of determining the value of the corresponding point in the j-level downsampling map may vary depending on the application scenario, including but not limited to: calculating the average value of the values of each point in the sliding window as the value of the corresponding point in the j-level downsampling map, determining the maximum value of the values of each point in the sliding window as the value of the corresponding point in the j-level downsampling map, determining the minimum value of the values of each point in the sliding window as the value of the corresponding point in the j-level downsampling map, etc.
[0146] For the case where the maximum value of each point in the sliding window is determined as the value of the corresponding point in the j-level downsampled map, in the above sampling method, the value of the point in the j-level downsampled global map or the j-level downsampled submap is calculated by the following method, including:
[0147] a) Determine each point in the neighborhood of the projection point of the point to be sampled in the map to be sampled as the point to be sampled.
[0148] b) Determine the maximum value of each sampling point.
[0149] c) Determine the difference between the maximum value and the preset threshold value for j as the value of the point.
[0150] Taking j = n-1 and the sliding window size of 2×2 as an example, a sliding window of size 2*2 is established in the n-level downsampling map, and all the points of the n-level downsampling map are crossed in turn, with a step length of 2 points. The value T of the n-1-level downsampling map is obtained by formula (4): n-1 Th is an empirical parameter threshold related to the level. By the above method, in the n-level down-sampling global map, every four points are merged into one point in the n-1-level down-sampling global map.
[0151]
[0152] Among them, Th n is the preset threshold for downsampling the global map at level n, is the maximum value of the values of each sampling point in the 2×2 sliding window. is the value of the point with coordinates (i / 2, j / 2) in the n-1 level downsampled global map, is the value of the point with coordinates (i, j) in the n-level downsampled global map, is the value of the point with coordinates (i+1, j) in the n-level downsampled global map, is the value of the point with coordinates (i, j+1) in the n-level downsampled global map, It is the value of the point with coordinates (i+1, j+1) in the n-level downsampled global map.
[0153] The above describes downsampling. The following describes how to search and match based on the downsampled global map and the downsampled submap. Figure 1e The figure is a schematic diagram of the search and matching direction of n downsampled global maps or downsampled submaps with different resolutions, and the layer-by-layer matching direction is shown in the figure;
[0154] Specifically, the above S103 includes:
[0155] S1031. In the level 1 down-sampled global map, select a point whose matching degree with the level 1 down-sampled sub-map satisfies a preset first matching condition as a third candidate point.
[0156] The preset first matching condition may be greater than or equal to a preset feature threshold. The matching degree is the similarity between the feature of the downsampled submap and the feature of the downsampled global map. The point whose matching degree satisfies the preset first matching condition is the point on the downsampled submap whose similarity with the point on the downsampled global map is greater than the preset similarity threshold. That is, the possible matching position of the downsampled submap on the downsampled global map.
[0157] S1032. In the i-th level down-sampled global map, determine a point in the neighborhood of the projection point of the third candidate point as a fourth candidate point.
[0158] In this step, i is initially 2.
[0159] The projection point of the third candidate point is the point where the third candidate point is projected onto the i-level downsampled global map. The point located in the neighborhood of the projection point of the third candidate point is the point where the projection point of the third candidate point is within the preset area.
[0160] S1033: Select, from the fourth candidate points, points whose matching degree with the level i down-sampling submap satisfies a preset first matching condition as new third candidate points.
[0161] In this step, the level i down-sampling submap is the down-sampling submap with the i-th lowest resolution.
[0162] S1034. Use i+1 as the new i, return to execute the above S1032, until i is greater than n, and use the latest third candidate point as the first candidate point.
[0163] In this embodiment, the third candidate point matching the level 1 downsampled submap is determined by the level 1 downsampled global map with the lowest resolution. Since the level 1 downsampled global map is the downsampled global map with the lowest resolution, and the level 1 downsampled submap is the downsampled map with the lowest resolution, the amount of data calculated during matching is minimal. The candidate points are initially determined by using the minimum amount of data, and then the candidate points are incrementally increased step by step to achieve the determination of the candidate points, which reduces the amount of data and improves the efficiency of determining the candidate points.
[0164] In order to further improve the matching rate, in the embodiment of the present application, the neighborhood of the projection point is an area formed by a circular expansion around the projection point, such as Figure 1f As shown in the figure, assuming that the projection point is point 0, the dotted rectangular area selected around point 0 is the neighborhood of the projection point, and the matching direction is carried out in a circular shape, such as Figure 1g shown.
[0165] Specifically, the above S1031 includes:
[0166] S10311. Calculate the matching degree between the current point in the level 1 down-sampled global map and the level 1 down-sampled sub-map.
[0167] In this step, the current point is initially a preset starting point. The preset starting point is any point in the 1-level downsampled global map. The method of calculating the matching degree will be described in detail later, and will not be described in detail here. The matching degree value can be expressed in the form of a percentage or other numbers, which is set according to the actual application scenario.
[0168] S10312: If the calculated matching degree satisfies a preset first matching condition, the current point is determined as a third candidate point.
[0169] S10313. Calculate the traversal step length according to the calculated matching degree.
[0170] In this step, the traversal step length is negatively correlated with the calculated matching degree. The greater the matching degree, the smaller the traversal step length. For example, if the matching degree is 99%, the traversal step length is 1. If the matching degree is 50%, the traversal step length is 5. Specifically, the relationship between the traversal step length and the matching degree value is preset by those skilled in the art according to the actual application scenario.
[0171] S10314. Take the traversal step-th point after the current point as the new current point, and return to execute step S10311 until the preset traversal end condition is met.
[0172] In this step, the preset traversal end condition is set by those skilled in the art according to the actual application scenario, which may be until all points are traversed or until a preset number of third candidate points are obtained.
[0173] For example, assuming that point 0 is the preset starting point, the preset first matching condition is that the matching degree is greater than 50%, the matching degree of point 0 is calculated to be 80%, the traversal step length is 2 at this time, the traversal obtains point 1, and the matching degree of point 1 is calculated to be 70%, the traversal step length is 3 at this time, the traversal obtains point 2, and the matching degree of point 2 is calculated to be 70%, the traversal step length is 3 at this time, the traversal obtains point 3, and the matching degree of point 3 is calculated to be 80%, and the traversal step length is The step length is 2, and the traversal gets point 4. The matching degree of point 4 is calculated to be 70%. The traversal step length is 3, and the traversal gets point 5. The matching degree of point 5 is calculated to be 70%. The traversal step length is 3, and all points have been traversed. Since the matching degrees of point 1, point 2, point 3, point 4, and point 5 are all greater than 50%, point 1, point 2, point 3, point 4, and point 5 are all the third candidate points. Figure 1h As shown, it is a schematic diagram for determining the third candidate point.
[0174] As can be seen from the description of the matching process above, the matching process depends on the matching degree, so the following will provide an exemplary description of how to calculate the matching degree. In the embodiment of the present application, the matching degree between the point in the global map and the sub-map is calculated by the following method, including:
[0175] A. Determine the difference between the value of each point in the sub-map at that point and the value of the corresponding point in the sub-map.
[0176] In this step, the sub-map at the point is a sub-map within the preset range of the point in the global map. The sub-map should be close enough to each point, and the points in the sub-map should be enough, at least not more than the number of points in the first sub-map. The preset range of the point should be a regular area, such as a circular area, a rectangular area, etc., and should include as few areas without points as possible.
[0177] B. Count the number of points in the sub-image whose difference is greater than the preset upper threshold as the number of matching points; and count the number of points in the sub-image whose difference is less than the preset lower threshold as the number of unmatched points.
[0178] In this step, the preset upper threshold and the preset lower threshold are set by those skilled in the art according to actual application scenarios, in order to distinguish matching points from non-matching points.
[0179] C. Calculate the degree of match between the point and the sub-map based on the number of matching points and the number of unmatched points.
[0180] In this step, the calculated matching degree is positively correlated with the number of matching points and negatively correlated with the number of unmatched points.
[0181] The more matching points there are, the greater the matching value is, and the fewer matching points there are, the smaller the matching value is.
[0182] In this embodiment, the matching degree between the point and the sub-map is calculated by combining the number of matching points and the number of unmatched points. Since the number of unmatched points is added, the influence of interfering points can be avoided, thereby improving the accuracy of matching degree calculation.
[0183] The above respectively determines the difference between the value of each point in the sub-map and the value of the corresponding point in the sub-map, including:
[0184] Determine the difference between the value of each valid point in the sub-graph and the value of the corresponding point in the sub-map.
[0185] In this step, valid points are points in the sub-graph whose values are not 1.
[0186] The above calculation of the matching degree between the submaps at the points in the global map based on the number of matching points and the number of unmatched points includes:
[0187] The matching degree between the submaps at the points in the global map is calculated based on the number of matching points, the number of unmatched points and the number of valid points.
[0188] In this step, the calculated matching degree is negatively correlated with the number of valid points.
[0189] In the above steps, the formula for calculating the matching degree between the submap and the submap at the point in the global map is formula (5):
[0190]
[0191] Where T represents the TSDF value and w represents its weight. f2 represents the number of matching points. When the input is less than 20, the output is 1, otherwise the output is 0. f3 represents the number of mismatching points and is a penalty term. When the input is greater than 100, the output is 1, otherwise the output is 0. f4 represents the score mapping function. When the input is greater than 0, the output is 1, otherwise the output is 0. is the weight of the TSDF value of each point in the sub-graph at that point, is the TSDF value of each point in the sub-image at that point, mn is the horizontal and vertical coordinates of each point in the sub-image at that point, is the weight of the TSDF value of each point in the submap at that point and the corresponding point in the submap, is the TSDF value of each point in the sub-map at the point and the corresponding point in the sub-map, and ij is the horizontal and vertical coordinates of each point in the sub-map at the point and the corresponding point in the sub-map.
[0192] In this application, the original global map and the original sub-map are TSDF maps, and the TSDF map has the advantages of simple calculation, no complex calculation, and the details of the generated map are well maintained. In addition, during the calculation process, only valid points are calculated, which further reduces the amount of calculation, thereby improving calculation efficiency and user experience.
[0193] In a possible embodiment, in order to improve the accuracy of relocation, the embodiment of the present application further provides a relocation method based on machine vision, the method comprising:
[0194] S201: Obtain a map of a sub-region where a movable device to be located in a target scene is located, as an original sub-map.
[0195] This step is the same as the aforementioned S101 and will not be described in detail here.
[0196] S202 . Downsample the original global map and the original sub-map respectively according to the same sampling method to obtain a downsampled global map and a downsampled sub-map.
[0197] This step is the same as the aforementioned S102 and will not be described in detail here.
[0198] S203: In the downsampled global map, select a point whose matching degree with the downsampled sub-map satisfies a preset first matching condition as a first candidate point.
[0199] This step is the same as the aforementioned S103 and will not be described in detail here.
[0200] S204: In the original global map, determine a point located in the neighborhood of the projection point of the first candidate point as a second candidate point.
[0201] This step is the same as the aforementioned S104 and will not be described in detail here.
[0202] S205 . Select, from the second candidate points, points whose matching degree with the original submap satisfies a preset second matching condition as matching points of the original submap in the original global submap.
[0203] This step is the same as the aforementioned S105 and will not be described in detail here.
[0204] S206: Calculate the difference between the first matching degree and the second matching degree.
[0205] In this step, the first matching degree is the matching degree between the matching point and the original submap, the second matching degree is the matching degree between the secondary matching point and the original submap, and the secondary matching point is the point with the highest matching degree with the original submap among the second candidate points except the matching point.
[0206] S207: If the difference is less than the preset difference threshold, then execute step S209; otherwise, execute step S210.
[0207] This step is equivalent to calculating according to formula (6):
[0208]
[0209] Among them, S1 is the first matching degree, S2 is the second matching degree, and R s is the preset difference threshold. A true positive indicates that the point is not an interference point, and a false positive indicates that the point is an interference point.
[0210] S208, controlling the movable device to move in the target scene, and obtaining a map established based on machine vision technology during the movement of the movable device as a third sub-map, expanding the original sub-map according to the third sub-map to obtain a new original sub-map, and returning to execute the above step S202 with the new original sub-map.
[0211] S209: Calculate the target point of the movable device in the original global map based on the matching point and the point of the movable device in the original sub-map.
[0212] This step is the same as the aforementioned S106 and will not be described in detail here. Figure 2 As shown, a flowchart based on machine vision repositioning is provided in an embodiment of the present application, including: obtaining an original sub-map, generating a downsampled global map and a downsampled sub-map, determining matching points, calculating target points, and repositioning.
[0213] In this embodiment, the original global map and the original sub-map are downsampled, and then the first candidate point is determined in the downsampled global map. Since the number of pixels in the downsampled global map is much smaller than the number of pixels in the original global map, the amount of data required to be traversed when determining the first candidate point is greatly reduced. In addition, when positioning in the original global map later, since the first candidate point has been determined, although the number of pixels in the downsampled global map is much smaller than the number of pixels in the original global map, when determining the point in the original global map, that is, during the upsampling process, the second candidate point is located near the first candidate point. Therefore, the second candidate point is determined in the field of the projection point of the first candidate point, which is much less than the number of pixels required to traverse the original global map to determine the second candidate point, and some interfering points are removed by the difference between the first matching degree and the second matching degree. Therefore, the amount of data required to be processed in this application is greatly reduced, and the amount of calculation is also greatly reduced, which improves the efficiency of relocation.
[0214] The present application embodiment provides a repositioning device based on machine vision, such as Figure 3 As shown, the device comprises:
[0215] The submap acquisition module 301 is used to acquire a map of the sub-area where the movable device to be located is located in the target scene as an original sub-map, wherein the original sub-map is a TSDF map established by scanning the ceiling of the sub-area; the value of each point in the TSDF map is used to represent the distance between the point and the ceiling feature line;
[0216] A downsampling module 302 is used to downsample the original global map and the original sub-map respectively according to the same sampling method to obtain a downsampled global map and a downsampled sub-map, wherein the original global map is a TSDF map established in advance by scanning the ceiling of the target scene;
[0217] A first candidate point matching module 303 is used to select a point in the downsampled global map whose matching degree with the downsampled submap satisfies a preset first matching condition as a first candidate point, wherein the matching degree is used to indicate the matching degree between the submap and the submap at the point in the global map;
[0218] A determination module 304 is used to determine, in the original global map, a point located in the neighborhood of the projection point of the first candidate point as a second candidate point;
[0219] The submap point matching module 305 is used to select, from the second candidate points, points whose matching degree with the original submap satisfies a preset second matching condition as matching points of the original submap in the original global submap;
[0220] The calculation module 306 is used to calculate the target point position of the movable device in the original global map according to the matching point position and the point position of the movable device in the original sub-map.
[0221] In a possible implementation, the submap acquisition module 301 acquires a map of a sub-region where the movable device to be located is located in the target scene as an original sub-map, including:
[0222] Acquire a submap established by the mobile device based on machine vision technology as a first submap;
[0223] Controlling the movable device to move in the target scene, and acquiring a map established based on machine vision technology during the movement of the movable device as a second sub-map;
[0224] Expanding the first submap according to the second submap, and returning to execute the step of controlling the movable device to move in the target scene and obtaining a map established based on machine vision technology during the movement of the movable device as a second submap, until the expanded first submap meets a preset minimum submap condition;
[0225] The first submap obtained by expansion is determined as the original submap.
[0226] In a possible implementation, the downsampling module 302 downsamples the original global map and the original sub-map respectively in the same sampling manner to obtain the downsampled global map and the downsampled sub-map, including:
[0227] According to the same sampling method, the original global map and the original sub-map are downsampled respectively to obtain n downsampled global maps and downsampled sub-maps with different resolutions, where n is any positive integer greater than 1;
[0228] The step of selecting, in the downsampled global map, a point whose matching degree with the downsampled submap satisfies a preset first matching condition as a first candidate point includes:
[0229] In the level 1 down-sampled global map, a point whose matching degree with the level 1 down-sampled sub-map satisfies a preset first matching condition is selected as the third candidate point, wherein the level 1 down-sampled global map is a down-sampled global map with the lowest resolution, and the level 1 down-sampled sub-map is a down-sampled sub-map with the lowest resolution;
[0230] In the i-th level downsampled global map, a point in the neighborhood of the projection point of the third candidate point is determined as the fourth candidate point, wherein the i-th level downsampled global map is a downsampled global map with the i-th lowest resolution, and i is initially 2;
[0231] Among the fourth candidate points, a point whose matching degree with the i-th level downsampling submap satisfies a preset first matching condition is selected as the third candidate point, wherein the i-th level downsampling submap is a downsampling submap with the i-th lowest resolution;
[0232] Taking i+1 as the new i, returning to the step of determining, in the i-level downsampled global map, a point in the neighborhood of the projection point of the third candidate point as the fourth candidate point;
[0233] Until i is greater than n, the latest third candidate point is used as the first candidate point.
[0234] In a possible implementation, in the sampling method, the value of the point in the j-level downsampled global map or the j-level downsampled submap is calculated by the following method, including:
[0235] Determine each point in the neighborhood of the projection point of the point in the map to be sampled as the point to be sampled; wherein, when j is greater than 1, the map to be sampled is a j-1 level downsampled global map or downsampled submap, and when j=1, the map to be sampled is an original global map or original submap;
[0236] Determine the maximum value of the values of the points to be sampled;
[0237] The difference between the maximum value and a preset threshold value for j is determined as the value of the point.
[0238] In a possible implementation, the neighborhood of the projection point is an area formed by expanding in a circular shape around the projection point;
[0239] The step of selecting, in the level 1 downsampled global map, a point whose matching degree with the level 1 downsampled submap satisfies a preset first matching condition as the third candidate point includes:
[0240] Calculate the matching degree between the current point in the 1-level downsampled global map and the 1-level downsampled submap, wherein the current point is initially a preset starting point;
[0241] If the calculated matching degree meets the preset first matching condition, the current point is determined as the third candidate point;
[0242] Calculate the traversal step length according to the calculated matching degree, wherein the traversal step length is negatively correlated with the calculated matching degree;
[0243] The traversal step-th point after the current point is taken as the new current point, and the step of calculating the matching degree between the current point in the level 1 down-sampled global map and the level 1 down-sampled sub-map is returned to execute until the preset traversal end condition is met.
[0244] In a possible implementation, the matching degree between the point in the global map and the sub-map is calculated by the following method, including:
[0245] Determine the difference between the value of each point in the submap at the point and the value of the corresponding point in the submap;
[0246] In the sub-graph, the number of points whose difference is greater than a preset upper threshold is counted as the number of matching points; and the number of points whose difference is less than a preset lower threshold is counted in the sub-graph as the number of unmatched points;
[0247] The matching degree between the point and the submap is calculated according to the number of matching points and the number of unmatched points, wherein the calculated matching degree is positively correlated with the number of matching points and negatively correlated with the unmatched points.
[0248] In a possible implementation, the original global map and the original sub-map are truncated distance function maps;
[0249] The step of respectively determining the difference between the value of each point in the submap and the value of the corresponding point in the submap includes:
[0250] Determine the difference between the value of each valid point in the submap and the value of the corresponding point in the submap, wherein the valid point is a point in the submap whose value is not 1;
[0251] The calculating, according to the number of matching points and the number of unmatched points, the matching degree between the submaps at the points in the global map and the submaps includes:
[0252] The matching degree between the submap and the submap at the point in the global map is calculated based on the number of matching points, the number of unmatched points and the number of valid points, wherein the calculated matching degree is negatively correlated with the number of valid points.
[0253] In a possible implementation manner, the second matching condition is a maximum matching degree, and the device further includes:
[0254] The difference module 307 is used to calculate the difference between the first matching degree and the second matching degree, wherein the first matching degree is the matching degree between the matching point and the original sub-map, and the second matching degree is the matching degree between the secondary matching point and the original sub-map, and the secondary matching point is the point with the highest matching degree with the original sub-map among the second candidate points except the matching point;
[0255] If the difference is less than a preset difference threshold, controlling the movable device to move in the target scene, and obtaining a map established based on machine vision technology during the movement of the movable device as a third sub-map;
[0256] Expanding the original submap according to the third submap to obtain a new original submap;
[0257] The new original sub-map is used to return to the step of downsampling the original global map and the original sub-map in the same sampling manner to obtain a downsampled global map and a downsampled sub-map;
[0258] The step of calculating the target point position of the movable device in the original global map according to the matching point position and the point position of the movable device in the original sub-map includes:
[0259] If the difference degree is not less than a preset difference threshold, the target point position of the movable device in the original global map is calculated based on the matching point position and the point position of the movable device in the original sub-map.
[0260] The present application also provides an electronic device, such as Figure 4 As shown, including:
[0261] Memory 401, used for storing computer programs;
[0262] The processor 402 is used to execute the program stored in the memory 401 to implement the following steps:
[0263] Acquire a map of a sub-region where the movable device to be located is located in the target scene as an original sub-map, wherein the original sub-map is established by scanning the sub-region based on machine vision technology;
[0264] According to the same sampling method, the original global map and the original sub-map are downsampled respectively to obtain a downsampled global map and a downsampled sub-map, wherein the original global map is pre-established by scanning the target scene based on the machine vision technology; the value of each point in the TSDF map is used to represent the distance between the point and the ceiling feature line;
[0265] In the downsampled global map, a point whose matching degree with the downsampled submap satisfies a preset first matching condition is selected as a first candidate point, wherein the matching degree is used to indicate the matching degree between the submap and the submap at the point in the global map;
[0266] In the original global map, determining a point located in the neighborhood of the projection point of the first candidate point as a second candidate point;
[0267] Among the second candidate points, a point whose matching degree with the original submap satisfies a preset second matching condition is selected as the matching point of the original submap in the original global submap;
[0268] The target point position of the movable device in the original global map is calculated based on the matching point position and the point position of the movable device in the original sub-map.
[0269] Furthermore, the electronic device may further include a communication bus and / or a communication interface, and the processor 402, the communication interface, and the memory 401 communicate with each other via the communication bus.
[0270] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0271] The communication interface is used for communication between the above electronic device and other devices.
[0272] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0273] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0274] In another embodiment provided in the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned machine vision-based repositioning methods are implemented.
[0275] In another embodiment provided by the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute any one of the machine vision-based repositioning methods in the above embodiments.
[0276] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a solid-state hard disk (SSD), etc.
[0277] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0278] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.
[0279] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.
Claims
1. A relocation method based on machine vision, characterized in that: The method comprises: Obtain a map of the sub-area where the movable device to be located is located in the target scene as an original sub-map, wherein the original sub-map is a TSDF map established by scanning the ceiling of the sub-area, and the value of each point in the TSDF map is used to represent the distance between the point and the ceiling feature line; According to the same sampling method, the original global map and the original sub-map are downsampled respectively to obtain a downsampled global map and a downsampled sub-map, wherein the original global map is a TSDF map established in advance by scanning the ceiling of the target scene; In the downsampled global map, a point whose matching degree with the downsampled submap satisfies a preset first matching condition is selected as a first candidate point, wherein the matching degree is used to indicate the matching degree between the submap and the submap at the point in the global map; In the original global map, determining a point located in the neighborhood of the projection point of the first candidate point as a second candidate point; Among the second candidate points, a point whose matching degree with the original submap satisfies a preset second matching condition is selected as the matching point of the original submap in the original global submap; The target point position of the movable device in the original global map is calculated based on the matching point position and the point position of the movable device in the original sub-map.
2. The method according to claim 1, characterized in that: The step of obtaining a map of a sub-region where the movable device to be located is located in the target scene as an original sub-map includes: Acquire a map established by the movable device based on machine vision technology in response to the relocation instruction as a first sub-map; Controlling the movable device to move in the target scene, and acquiring a map established based on machine vision technology during the movement of the movable device as a second sub-map; Expanding the first submap according to the second submap, and returning to execute the step of controlling the movable device to move in the target scene and obtaining a map established based on machine vision technology during the movement of the movable device as a second submap, until the expanded first submap meets a preset minimum submap condition; The first submap obtained by expansion is determined as the original submap.
3. The method according to claim 1, characterized in that: The method of downsampling the original global map and the original sub-map in the same sampling manner to obtain the downsampled global map and the downsampled sub-map comprises: According to the same sampling method, the original global map and the original sub-map are downsampled respectively to obtain n downsampled global maps and downsampled sub-maps with different resolutions, where n is any positive integer greater than 1; The step of selecting, in the downsampled global map, a point whose matching degree with the downsampled submap satisfies a preset first matching condition as a first candidate point includes: In the level 1 down-sampled global map, a point whose matching degree with the level 1 down-sampled sub-map satisfies a preset first matching condition is selected as the third candidate point, wherein the level 1 down-sampled global map is a down-sampled global map with the lowest resolution, and the level 1 down-sampled sub-map is a down-sampled sub-map with the lowest resolution; In the i-th level downsampled global map, a point in the neighborhood of the projection point of the third candidate point is determined as the fourth candidate point, wherein the i-th level downsampled global map is a downsampled global map with the i-th lowest resolution, and i is initially 2; Among the fourth candidate points, a point whose matching degree with the i-th level downsampling submap satisfies a preset first matching condition is selected as the third candidate point, wherein the i-th level downsampling submap is a downsampling submap with the i-th lowest resolution; Taking i+1 as the new i, returning to the step of determining, in the i-level downsampled global map, a point in the neighborhood of the projection point of the third candidate point as the fourth candidate point; Until i is greater than n, the latest third candidate point is used as the first candidate point.
4. The method according to claim 3, characterized in that In the sampling method, the value of the point position in the j-level downsampled global map or the j-level downsampled submap is calculated by the following method, including: Determine each point in the neighborhood of the projection point of the point in the map to be sampled as the point to be sampled; wherein, when j is greater than 1, the map to be sampled is a j-1 level downsampled global map or downsampled submap, and when j=1, the map to be sampled is an original global map or original submap; Determine the maximum value of the values of the points to be sampled; The difference between the maximum value and a preset threshold value for j is determined as the value of the point.
5. The method according to claim 3, characterized in that: The neighborhood of the projection point is an area formed by a circular expansion around the projection point; The step of selecting, in the level 1 downsampled global map, a point whose matching degree with the level 1 downsampled submap satisfies a preset first matching condition as the third candidate point includes: Calculate the matching degree between the current point in the 1-level downsampled global map and the 1-level downsampled submap, wherein the current point is initially a preset starting point; If the calculated matching degree meets the preset first matching condition, the current point is determined as the third candidate point; Calculate the traversal step length according to the calculated matching degree, wherein the traversal step length is negatively correlated with the calculated matching degree; The traversal step-th point after the current point is taken as the new current point, and the step of calculating the matching degree between the current point in the level 1 down-sampled global map and the level 1 down-sampled sub-map is returned to execute until the preset traversal end condition is met.
6. The method according to any one of claims 1 to 5, characterized in that: The matching degree between the points in the global map and the submap is calculated by the following methods, including: Determine the difference between the value of each point in the submap at the point and the value of the corresponding point in the submap; In the sub-graph, the number of points whose difference is greater than a preset upper threshold is counted as the number of matching points; and the number of points whose difference is less than a preset lower threshold is counted in the sub-graph as the number of unmatched points; The matching degree between the point and the submap is calculated according to the number of matching points and the number of unmatched points, wherein the calculated matching degree is positively correlated with the number of matching points and negatively correlated with the unmatched points.
7. The method according to claim 6, characterized in that The step of respectively determining the difference between the value of each point in the submap and the value of the corresponding point in the submap includes: Determine the difference between the value of each valid point in the submap and the value of the corresponding point in the submap, wherein the valid point is a point in the submap whose value is not 1; The calculating, according to the number of matching points and the number of unmatched points, the matching degree between the submaps at the points in the global map and the submaps includes: The matching degree between the submap and the submap at the point in the global map is calculated based on the number of matching points, the number of unmatched points and the number of valid points, wherein the calculated matching degree is negatively correlated with the number of valid points.
8. The method according to claim 1, characterized in that The second matching condition is that the matching degree is maximum, and the method further includes: Calculating the degree of difference between the first matching degree and the second matching degree, wherein the first matching degree is the matching degree between the matching point and the original sub-map, the second matching degree is the matching degree between the secondary matching point and the original sub-map, and the secondary matching point is the point with the highest matching degree with the original sub-map among the second candidate points except the matching point; If the difference is less than a preset difference threshold, controlling the movable device to move in the target scene, and obtaining a map established based on machine vision technology during the movement of the movable device as a third sub-map; Expanding the original submap according to the third submap to obtain a new original submap; The new original sub-map is used to return to the step of downsampling the original global map and the original sub-map in the same sampling manner to obtain a downsampled global map and a downsampled sub-map; The step of calculating the target point position of the movable device in the original global map according to the matching point position and the point position of the movable device in the original sub-map includes: If the difference degree is not less than a preset difference threshold, the target point position of the movable device in the original global map is calculated based on the matching point position and the point position of the movable device in the original sub-map.
9. A repositioning device based on machine vision, characterized in that: The device comprises: A submap acquisition module is used to acquire a map of the sub-area where the movable device to be located is located in the target scene as an original sub-map, wherein the original sub-map is a TSDF map established by scanning the ceiling of the sub-area, and the value of each point in the TSDF map is used to represent the distance between the point and the ceiling feature line; A downsampling module, used to downsample the original global map and the original sub-map respectively according to the same sampling method to obtain a downsampled global map and a downsampled sub-map, wherein the original global map is a TSDF map established in advance by scanning the ceiling of the target scene; A first candidate point matching module is used to select, in the downsampled global map, a point whose matching degree with the downsampled submap satisfies a preset first matching condition as a first candidate point, wherein the matching degree is used to indicate the matching degree between the submap and the submap at the point in the global map; A determination module, configured to determine, in the original global map, a point located in a neighborhood of a projection point of the first candidate point as a second candidate point; A submap point matching module, configured to select, from the second candidate points, points whose matching degree with the original submap satisfies a preset second matching condition as matching points of the original submap in the original global submap; The calculation module is used to calculate the target point position of the movable device in the original global map according to the matching point position and the point position of the movable device in the original sub-map.
10. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, for implementing any of the methods described in claims 1-8 when executing a program stored in a memory.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
