A method and device for measuring spatial distance
By using the device camera to acquire images, perform feature detection and motion trajectory estimation in spatial distance measurement, forming plane assumptions and calculating the distance between virtual anchor points, the problems of low accuracy and high complexity of traditional measurement methods are solved, and more efficient and accurate measurements are achieved.
Patent Information
- Application Number
- CN202510362028.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-26
- Publication Date
- 2025-06-10
- Estimated Expiration
- 2045-03-26
AI Technical Summary
Traditional spatial distance measurement methods have problems such as low measurement accuracy, poor environmental adaptability, high operational complexity and low measurement efficiency.
The device's camera acquires continuous multi-frame images, performs feature detection and descriptor extraction, forms feature point pairs, and combines the device's acceleration and angular velocity information to estimate the device's motion trajectory, form a plane assumption, and then calculates the spatial distance through the virtual anchor point.
Improves the accuracy and environmental adaptability of spatial distance measurement, reduces operational complexity, and improves measurement efficiency.
Smart Images

Figure CN119879863B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular, to a method and device for measuring spatial distance. Background Art
[0002] In the era of rapid technological development today, spatial distance measurement technology plays a crucial role in many fields, and its application scenarios cover multiple industries such as construction, surveying and mapping, industrial automation, smart home, virtual reality, augmented reality, and aerospace. However, traditional spatial distance measurement methods have many limitations, such as being greatly affected by the environment in terms of measurement accuracy, complex measurement processes, low efficiency, and difficulty in implementation in specific scenarios.
[0003] Traditional spatial distance measurement methods mainly include laser ranging, total station measurement, and GPS measurement, etc. Laser ranging technology calculates the distance using the round-trip time of laser pulses, which has the characteristics of high accuracy and fast measurement, but its measurement range is limited and it is more sensitive to environmental conditions. Total station measurement can measure horizontal distance, vertical distance, and height difference simultaneously through electronic distance measurement and angle measurement functions, and is suitable for medium and long-distance topographic surveying and engineering surveying.
[0004] However, traditional spatial distance measurement methods have many disadvantages in terms of measurement accuracy, environmental adaptability, operation complexity, and measurement efficiency. These disadvantages limit their application in some complex environments or scenarios with high-precision requirements, and there are obvious limitations. Summary of the Invention
[0005] The present invention provides a method and device for measuring spatial distance to solve the problems of low measurement accuracy, poor environmental adaptability, high operation complexity, and low measurement efficiency existing in the prior art.
[0006] In the first aspect, the present invention provides a method for measuring spatial distance, specifically including the following steps:
[0007] Step S1: Obtain a continuous plurality of frames of images through the camera of the device;
[0008] Step S2: Perform feature detection on each frame of the continuous plurality of frames of images to form feature points in the continuous plurality of frames of images, and extract the feature point information to form a descriptor for each feature point;
[0009] Step S3: Compare the feature points pairwise according to the descriptor of each feature point to form a pair of matching feature points;
[0010] Step S4: Estimate the movement trajectory of the device between consecutive frames according to the pair of matching feature points, the acceleration information and the angular velocity information of the device to form an estimation of the movement trajectory of the device;
[0011] Step S5. Estimate based on the feature points and the motion trajectory of the device to form a plane hypothesis.
[0012] Step S6. Combine the plane hypothesis, obtain two virtual anchor points through the device screen, perform coordinate transformation on the two virtual anchor points to form the true coordinates of the two virtual anchor points, and calculate the distance between the two virtual anchor points.
[0013] In this application, a descriptor represents a set of vectors that can characterize the local features of the image around the feature point, including information such as the position, direction, scale of the feature point, and the texture information of the surrounding image.
[0014] Preferably, in step S2, feature detection is performed through the FAST (Features from Accelerated Segment Test) algorithm, and feature point extraction is performed through the BRIEF (Binary Robust Independent Elementary Features) algorithm.
[0015] Preferably, in step S2, feature detection and feature extraction are performed through the ORB (Oriented FAST and Rotated BRIEF) algorithm.
[0016] Preferably, in step S3, the brute-force matching algorithm (Brute-Force Matcher) is used to calculate the distance between feature point descriptors, and the feature point pairs with the distance less than the first threshold (in this application, the "first threshold" changes according to specific application requirements) are regarded as matching feature point pairs.
[0017] More preferably, the distance includes but is not limited to one of Euclidean distance, Manhattan distance, Chebyshev distance, Minkowski distance, Mahalanobis distance, Hamming distance.
[0018] Preferably, in step S4, ARCore is used to estimate the motion trajectory of the device between consecutive frames.
[0019] Preferably, in step S5, based on the feature points and the motion trajectory estimation of the device, forming a plane hypothesis specifically includes the following steps:
[0020] Step S501. Screen out the set of feature points used to form the plane hypothesis through the RANSAC (Random Sample Consensus) algorithm.
[0021] Step S502: Form the parameters of the plane hypothesis ax + by + cz + d = 0 based on the set of feature points;
[0022] Step S503: Optimize the parameters of the plane hypothesis until the number of inliers in the plane hypothesis is the largest, and then output the optimized parameters of the plane hypothesis.
[0023] Among them, the set of feature points represents the set of feature points that can best reflect the plane hypothesis.
[0024] Among them, for an inlier, calculate the straight-line distance between it and the plane hypothesis. If the distance is less than the distance threshold, then this feature point is an inlier of the plane hypothesis.
[0025] Preferably, in step S6, the coordinate system conversion specifically includes: multiplying the virtual anchor point coordinates in the device screen coordinate system by the external parameter matrix of the camera to obtain the virtual anchor point coordinates (i.e., the real coordinates) in the world coordinate system.
[0026] Preferably, step S6 specifically includes:
[0027] Step S601: Obtain two virtual anchor points through the device screen, and after coordinate system conversion, the coordinates are respectively 、 ;
[0028] Step S602: Calculate the Euclidean distance between the two virtual anchor points.
[0029] Among them, for the distance d, its specific calculation is as follows:
[0030] ;
[0031] The distance d is the actual distance of the area that the user wants to measure.
[0032] In the second aspect, the present invention also provides a spatial distance measurement device, which specifically includes the following modules:
[0033] An image acquisition module, which is used to acquire multiple consecutive frames of images through the camera of the device; among them, the device is an external device or integrated inside this device;
[0034] A feature point and descriptor generation module, which is used to perform feature detection on each frame of the multiple consecutive frames of images to form feature points in the multiple consecutive frames of images, and extract the feature point information to form a descriptor for each feature point;
[0035] A feature point pair matching module, which is used to pairwise compare the feature points according to the descriptor of each feature point to form matching feature point pairs;
[0036] A motion trajectory estimation module, configured to estimate the motion trajectory of the device between consecutive frames based on the matched feature point pairs, the acceleration information, and the angular velocity information of the device, and form the motion trajectory estimation of the device;
[0037] A plane hypothesis generation module, configured to form a plane hypothesis according to the feature points and the motion trajectory estimation of the device;
[0038] A distance measurement module, configured to combine the plane hypothesis, obtain two virtual anchor points through the device screen, perform coordinate transformation on the two virtual anchor points to form the real coordinates of the two virtual anchor points, and calculate the distance between the two virtual anchor points.
[0039] Preferably, in the feature point and descriptor generation module, feature detection is performed through the FAST algorithm, and feature points are extracted through the BRIEF algorithm.
[0040] Preferably, in the feature point and descriptor generation module, feature detection and feature extraction are performed through the ORB algorithm.
[0041] Preferably, in the feature point pair matching module, the distance between feature point descriptors is calculated through a brute-force matching algorithm, and the feature point pairs with the distance less than the first threshold are regarded as the matched feature point pairs.
[0042] More preferably, the distance includes, but is not limited to, one of Euclidean distance, Manhattan distance, Chebyshev distance, Minkowski distance, Mahalanobis distance, and Hamming distance.
[0043] Preferably, in the motion trajectory estimation module, the ARCore is used to estimate the motion trajectory of the device between consecutive frames.
[0044] Preferably, the plane hypothesis generation module specifically includes the following sub-modules:
[0045] A first sub-module for generating a plane hypothesis, configured to screen out a set of feature points for forming a plane hypothesis through the random sample consensus algorithm;
[0046] A second sub-module for generating a plane hypothesis, configured to form the parameters of the plane hypothesis ax + by + cz + d = 0 according to the set of feature points;
[0047] A third sub-module for generating a plane hypothesis, configured to optimize the parameters of the plane hypothesis until the number of inliers in the plane hypothesis is the largest, and output the optimized plane hypothesis parameters.
[0048] Wherein, the set of feature points represents the set of feature points that can best reflect the plane hypothesis.
[0049] Among them, the inner point represents that for a feature point, the straight-line distance between it and the plane hypothesis is calculated. If the distance is less than the distance threshold, the feature point is the inner point of the plane hypothesis.
[0050] Preferably, the coordinate system conversion in the distance measurement module specifically includes: multiplying the virtual anchor point coordinates in the device screen coordinate system by the external parameter matrix of the camera to obtain the virtual anchor point coordinates (i.e., the real coordinates) in the world coordinate system.
[0051] Preferably, the distance measurement module specifically includes the following sub-modules:
[0052] The first sub-module of distance measurement is used to obtain two virtual anchor points through the device screen, and the coordinates after coordinate system conversion are respectively 、 ;
[0053] The second sub-module of distance measurement is used to calculate the Euclidean distance between the two virtual anchor points.
[0054] Among them, for the distance d, its calculation is specifically expressed as follows:
[0055] ;
[0056] The distance d is the actual distance of the area that the user wants to measure.
[0057] In a third aspect, the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements a spatial distance measurement method described in any one of the first aspects of the present application.
[0058] In a fourth aspect, the present invention also provides an electronic device. The electronic device includes: a memory storing a computer program; a processor communicatively connected to the memory and executing a spatial distance measurement method described in any one of the first aspects of the present application when calling the computer program.
[0059] Compared with the prior art, the present invention has the following obvious outstanding substantive features and remarkable advantages:
[0060] The present invention provides a spatial distance measurement method and device, which solves the problems of low measurement accuracy, poor environmental adaptability, high operation complexity, and low measurement efficiency existing in the prior art. By generating a plane hypothesis and combining the plane hypothesis to complete the construction of virtual anchor points, and then calculating the distance between the two virtual anchor points. While improving the accuracy and environmental adaptability of spatial distance measurement, it also improves the measurement efficiency and reduces the operation complexity. Description of the Drawings
[0061] The accompanying drawings forming a part of the present invention are used to provide a further understanding of the present invention. The schematic embodiments and descriptions thereof of the present invention are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0062] Figure 1 is a flowchart of a method for measuring spatial distance according to a preferred embodiment of the present invention.
[0063] Figure 2 is a schematic structural diagram of a device for measuring spatial distance according to a preferred embodiment of the present invention. Detailed implementation manners
[0064] The present invention provides a method and a device for measuring spatial distance. To make the objectives, technical solutions and effects of the present invention clearer and more definite, the following further describes the present invention in detail with reference to the accompanying drawings and by way of examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0065] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned accompanying drawings are used to distinguish similar objects and do not necessarily need to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device including a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0066] Example 1:
[0067] As Figure 1 shown, a method for measuring spatial distance described in this embodiment specifically includes the following steps:
[0068] Step S1, obtain a continuous plurality of frames of images through the camera of a device (such as a mobile phone, a tablet, a VR glasses, etc. with a camera).
[0069] Augmented Reality (AR) technology integrates the virtual environment generated by a computer with the real environment around the user by means of optoelectronic display technology, interaction technology, a variety of sensor technologies, and computer graphics and multimedia technology, so that the user is convinced from the sensory effect that the virtual environment is an integral part of the real environment around them. Augmented Reality has the characteristics of combining virtual and real, real-time interaction, and three-dimensional registration.
[0070] Step S2: Perform feature detection on each of the consecutive multiple frames of images to form feature points in the consecutive multiple frames of images, and extract the feature point information to form a descriptor for each feature point.
[0071] In a specific implementation process, the FAST algorithm can be first used to perform feature detection on each frame of the image to form feature points in the consecutive multiple frames of images. The BRIEF algorithm is used to extract the information of the feature points to form a descriptor including information such as the position of the feature point, the method of the feature point, the scale of the feature point, and the texture of the image around the feature point. However, both the FAST algorithm and the BRIEF algorithm have the disadvantages of not having scale invariance and rotation invariance. To avoid this defect, the ORB algorithm can also be used for feature detection and feature extraction, so that a descriptor with scale invariance and rotation invariance can be obtained. Such a descriptor can better handle the feature matching problem in cases where the image is translated, rotated, scaled, etc.
[0072] Among them, scale invariance means that the algorithm or feature descriptor can still maintain the consistency of feature expression and the accuracy of recognition / matching when the scale (spatial resolution or physical size) of the target object changes linearly or non-linearly; rotation invariance means that the algorithm or feature descriptor is invariant to any rotation transformation of the target object in the image plane, that is, the feature expression and the matching result are not affected by the rotation angle of the target.
[0073] Step S3: According to the descriptors of each feature point, compare the feature points pairwise to form matching feature point pairs. In a specific implementation process, the distance between the feature point descriptors is calculated by a brute-force matching algorithm (one of the Euclidean distance, Manhattan distance, Chebyshev distance, Minkowski distance, Mahalanobis distance, Hamming distance can be selected for distance calculation), and the feature point pairs with a distance less than the first threshold are regarded as matching feature point pairs.
[0074] Step S4: According to the matching feature point pairs, the acceleration information and angular velocity information of the device, estimate the motion trajectory of the device between consecutive frames to form an estimated motion trajectory of the device; among them, ARCore is used to estimate the motion trajectory of the device between consecutive frames.
[0075] ARCore is an augmented reality platform developed by Google, aiming to achieve a high-precision virtual-real fusion interaction experience through mobile devices such as smartphones and tablets. As the core AR technology framework of the Android ecosystem, ARCore combines computer vision, sensor fusion and machine learning algorithms to endow developers with the ability to build immersive AR applications.
[0076] Step S5: Based on the feature points and the motion trajectory estimation of the device, a plane hypothesis is formed.
[0077] Among them, step S5 specifically includes the following steps:
[0078] Step S501: Use the Random Sample Consensus (RANSAC) algorithm to screen out the set of feature points for forming the plane hypothesis (the set of feature points represents the set of feature points that best reflect the plane hypothesis); in addition, before using the RANSAC algorithm, a simple judgment can be made on whether a plane hypothesis can be formed, that is, the relative position relationship of the feature points remains unchanged. For example, in consecutive frames of images, if it is found that the relative position relationship between some feature points remains unchanged, and the coordinates of these feature points in three-dimensional space show a certain coplanar characteristic, at this time, it can be speculated that there is a plane hypothesis. The above judgment provides a basis for the subsequent plane hypothesis fitting, makes a preliminary judgment on the existence of the plane hypothesis, and screens out the cases where there is no plane hypothesis.
[0079] Step S502: Based on the set of feature points, form the parameters of the plane hypothesis ax + by + cz + d = 0.
[0080] Step S503: Optimize the parameters of the plane hypothesis until the number of inliers of the plane hypothesis (an inlier means that for a feature point, calculate the straight-line distance between it and the plane hypothesis. If the distance is less than the distance threshold, then the feature point is an inlier of the plane hypothesis) is the largest, and then output the optimized plane hypothesis parameters. Through continuous iteration, finally, the plane hypothesis with the largest number of inliers is selected as the final plane hypothesis, making the finally generated plane hypothesis more accurate and reliable.
[0081] Step S6: Combine the plane hypothesis, obtain two virtual anchor points through the device screen, perform coordinate transformation on the two virtual anchor points to form the real coordinates of the two virtual anchor points, and calculate the distance between the two virtual anchor points.
[0082] Among them, there are various ways to obtain virtual anchor points through the device screen. For example, the user can use a device such as a mobile phone or a tablet, manually select two points on the screen of the mobile phone or tablet as virtual anchor points to complete subsequent spatial distance measurement, or the user can use a wearable device with a display device (such as an AR glasses), through eye movements, the wearable device generates an eye movement signal based on the eye movements, and then completes the generation of virtual anchor points and displays them on the display screen of the user's wearable device.
[0083] Among them, the coordinate system conversion specifically includes: multiplying the virtual anchor point coordinates (two-dimensional coordinates) in the device screen coordinate system by the external parameter matrix of the camera (including the position and attitude information of the camera in the world coordinate system) to obtain the virtual anchor point coordinates (three-dimensional coordinates) in the world coordinate system, that is, the real coordinates.
[0084] Optionally, step S6 specifically includes:
[0085] Step S601: Obtain two virtual anchor points through the device screen, and the coordinates after coordinate system conversion are respectively 、 ;
[0086] Step S602: Calculate the Euclidean distance d between the two virtual anchor points, which is specifically expressed as follows:
[0087] ;
[0088] The distance d is the actual distance of the area that the user wants to measure.
[0089] In this application, the role of the plane assumption in the measurement of spatial distance is mainly reflected in the following aspects:
[0090] 1. Determine the placement plane of the virtual anchor point
[0091] After the user generates a strike point by touching the screen, it is necessary to place the virtual anchor point on a suitable plane. The plane assumption provides a basis for the placement of the virtual anchor point. By generating a plane assumption through feature points, it is determined that there may be a plane assumption in the 3D environment. In this way, when the user constructs a virtual anchor point, the virtual anchor point can be accurately placed on these planes, ensuring that the virtual anchor point has actual physical meaning and corresponds to the plane in the real scene.
[0092] 2. Ensure the accuracy of spatial distance measurement
[0093] The measurement of spatial distance is based on the real coordinates of the virtual anchor point in the 3D environment. The plane assumption can help determine the accuracy of these coordinates. Without the plane assumption, the placement of the virtual anchor point will be deviated, resulting in a large error between the measured spatial distance and the actual distance. Through the plane assumption, ARCore can place the virtual anchor point on a relatively accurate plane, making the error between the calculated spatial distance between the two virtual anchor points and the actual distance or height of the area that the user wants to measure smaller.
[0094] 3. Assist coordinate system conversion
[0095] When performing coordinate system conversion, the plane assumption also plays an auxiliary role. The plane assumption provides information about planes in the 3D environment, which can enable ARCore to more accurately estimate the position and orientation of the camera, thereby optimizing the conversion process from the screen coordinate system to the world coordinate system. For example, when using the RANSAC algorithm to generate the plane assumption, the obtained plane parameters can be used as additional constraint conditions to improve the estimation accuracy of the external camera matrix, and thus improve the accuracy of coordinate system conversion.
[0096] Example 2:
[0097] As Figure 2 shown, a spatial distance measurement device described in this embodiment specifically includes the following modules:
[0098] An image acquisition module, configured to acquire multiple consecutive frames of images through a camera of the device; wherein, the device is an external device or integrated inside this device;
[0099] A feature point and descriptor generation module, configured to perform feature detection on each frame of the multiple consecutive frames of images to form feature points in the multiple consecutive frames of images, and extract the feature point information to form a descriptor for each feature point;
[0100] Among them, feature detection is performed through the FAST algorithm, and feature points are extracted through the BRIEF algorithm, or alternatively, feature detection and feature extraction can also be performed through the ORB algorithm.
[0101] A feature point pair matching module, configured to pairwise compare the feature points according to the descriptor of each feature point to form matching feature point pairs;
[0102] Optionally, the distance between feature point descriptors is calculated through a brute-force matching algorithm, and the feature point pairs with the distance less than a first threshold are regarded as matching feature point pairs; wherein, the distance includes but is not limited to one of Euclidean distance, Manhattan distance, Chebyshev distance, Minkowski distance, Mahalanobis distance, and Hamming distance.
[0103] A motion trajectory estimation module, configured to estimate the motion trajectory of the device between consecutive frames according to the matching feature point pairs, the acceleration information and angular velocity information of the device, to form the motion trajectory estimation of the device; wherein, the ARCore is used to estimate the motion trajectory of the device between consecutive frames.
[0104] A plane assumption generation module, configured to form a plane assumption according to the feature points and the motion trajectory estimation of the device.
[0105] Among them, the plane hypothesis generation module specifically includes a first sub-module for plane hypothesis generation, a second sub-module for plane hypothesis generation, and a third sub-module for plane hypothesis generation.
[0106] The first sub-module for plane hypothesis generation is used to screen out the feature point set for forming the plane hypothesis through the random sample consensus algorithm.
[0107] The second sub-module for plane hypothesis generation is used to form the parameters of the plane hypothesis ax + by + cz + d = 0 according to the feature point set.
[0108] The third sub-module for plane hypothesis generation is used to optimize the parameters of the plane hypothesis until the number of inliers in the plane hypothesis is the largest, and then output the optimized plane hypothesis parameters.
[0109] Among them, the feature point set represents the set of feature points that can best reflect the plane hypothesis; the inlier means that for a feature point, calculate the straight-line distance between it and the plane hypothesis. If the distance is less than the distance threshold, then the feature point is an inlier of the plane hypothesis.
[0110] The distance measurement module is used to combine the plane hypothesis, obtain two virtual anchor points through the device screen, perform coordinate transformation on the two virtual anchor points to form the real coordinates of the two virtual anchor points, and calculate the distance between the two virtual anchor points.
[0111] Among them, the coordinate system transformation specifically includes: multiplying the virtual anchor point coordinates in the device screen coordinate system by the external parameter matrix of the camera to obtain the virtual anchor point coordinates in the world coordinate system, that is, the real coordinates.
[0112] Among them, the distance measurement module specifically includes a first sub-module for distance measurement and a second sub-module for distance measurement.
[0113] The first sub-module for distance measurement is used to obtain two virtual anchor points through the device screen, and the coordinates after coordinate transformation are respectively 、 。
[0114] The second sub-module for distance measurement is used to calculate the Euclidean distance between the two virtual anchor points.
[0115] Among them, for the distance d, its calculation is specifically expressed as follows:
[0116] ;
[0117] The distance d is the actual distance of the area that the user wants to measure.
[0118] The specific embodiments of the present invention have been described in detail above, but they are only examples, and the present invention is not limited to the specific embodiments described above. For those skilled in the art, any equivalent modifications and substitutions to the present invention are also within the scope of the present invention. Therefore, equivalent transformations and modifications made without departing from the spirit and scope of the present invention should all be covered within the scope of the present invention.
Claims
1. A spatial distance measurement method, characterized in that: The specific steps include: Step S1, acquiring multiple consecutive frames of images through the camera of the device; Step S2, performing feature detection on each frame of the continuous multiple frames of images to form feature points in the continuous multiple frames of images, and extracting the feature point information to form a descriptor for each feature point; Step S3, comparing the feature points in pairs according to the descriptors of each feature point to form matching feature point pairs; Step S4, estimating the motion trajectory of the device between consecutive frames according to the matched feature point pairs, the acceleration information and the angular velocity information of the device, to form a motion trajectory estimate of the device; Step S5, forming a plane hypothesis based on the feature points and the motion trajectory of the device; Step S6: In combination with the plane hypothesis, two virtual anchor points are obtained through the device screen, coordinates of the two virtual anchor points are transformed to form the real coordinates of the two virtual anchor points, and the distance between the two virtual anchor points is calculated.
2. A spatial distance measurement method according to claim 1, characterized in that: In step S2, feature detection is performed using the FAST algorithm, and feature point extraction is performed using the BRIEF algorithm.
3. A spatial distance measurement method according to claim 1, characterized in that: Feature detection and feature extraction are performed through the ORB algorithm.
4. A spatial distance measurement method according to claim 1, characterized in that: In step S3, the distance between feature point descriptors is calculated by a brute force matching algorithm, and feature point pairs whose distance is less than a first threshold are regarded as matched feature point pairs.
5. A spatial distance measurement method according to claim 4, characterized in that: The distance includes one of Euclidean distance, Manhattan distance, Chebyshev distance, Minkowski distance, Mahalanobis distance, and Hamming distance.
6. A spatial distance measurement method according to claim 1, characterized in that: In step S4, the motion trajectory of the device between consecutive frames is estimated through ARCore.
7. A spatial distance measurement method according to claim 1, characterized in that: In step S5, a plane hypothesis is formed based on the feature points and the motion trajectory of the device, which specifically includes the following steps: Step S501, selecting a feature point set for forming a plane hypothesis through a random sampling consensus algorithm; Step S502, forming parameters of a plane hypothesis ax+by+cz+d=0 according to the feature point set; Step S503, optimizing the parameters of the plane hypothesis until the number of the inner points of the plane hypothesis is the largest, and outputting the optimized plane hypothesis parameters; The feature point set represents a set of feature points that best reflects the plane hypothesis; the interior point represents a straight-line distance between a feature point and the plane hypothesis, and if the distance is less than a distance threshold, the feature point is an interior point of the plane hypothesis.
8. A spatial distance measurement method according to claim 1, characterized in that: In step S6, the coordinate conversion specifically includes: multiplying the virtual anchor point coordinates in the device screen coordinate system and the external parameter matrix of the camera to form the virtual anchor point coordinates in the world coordinate system.
9. A spatial distance measurement method according to claim 1, characterized in that: Step S6 specifically includes: Step S601: Obtain two virtual anchor points through the device screen. After conversion through the coordinate system, the coordinates are , ; Step S602: Calculate the Euclidean distance between two virtual anchor points; Among them, the distance d is calculated as follows: ; The distance d is the actual distance of the area that the user wants to measure.
10. A spatial distance measuring device, characterized in that: The modules include: An image acquisition module, used to acquire multiple frames of continuous images through a camera of a device; wherein the device is an external device or integrated into the device; A feature point and descriptor generation module, used to perform feature detection on each frame of the continuous multi-frame image to form feature points in the continuous multi-frame image, and extract the feature point information to form a descriptor for each feature point; A feature point pair matching module is used to compare the feature points in pairs according to the descriptors of each feature point to form matching feature point pairs; A motion trajectory estimation module, used to estimate the motion trajectory of the device between consecutive frames according to the matched feature point pairs, acceleration information and angular velocity information of the device, to form a motion trajectory estimation of the device; A plane hypothesis generating module, used to form a plane hypothesis based on the feature points and the motion trajectory estimation of the device; The distance measurement module is used to obtain two virtual anchor points through the device screen in combination with the plane hypothesis, perform coordinate transformation on the two virtual anchor points to form the real coordinates of the two virtual anchor points, and calculate the distance between the two virtual anchor points.
Citation Information
Patent Citations
Target distance measurement method and device based on front view image of unmanned aerial vehicle
CN114322943A
Visual mapping and positioning method based on binocular camera
CN115049731A