CN117372612A - Bundling adjustment method and electronic equipment - Google Patents
Bundling adjustment method and electronic equipment Download PDFInfo
- Publication number
- CN117372612A CN117372612A CN202311288934.5A CN202311288934A CN117372612A CN 117372612 A CN117372612 A CN 117372612A CN 202311288934 A CN202311288934 A CN 202311288934A CN 117372612 A CN117372612 A CN 117372612A
- Authority
- CN
- China
- Prior art keywords
- dimensional
- image
- camera
- points
- point
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 75
- 238000005457 optimization Methods 0.000 claims abstract description 71
- 238000000605 extraction Methods 0.000 claims description 34
- 230000004044 response Effects 0.000 claims description 34
- 238000012545 processing Methods 0.000 claims description 31
- 238000004590 computer program Methods 0.000 claims description 11
- 230000008569 process Effects 0.000 claims description 9
- 238000013519 translation Methods 0.000 claims description 3
- 238000004422 calculation algorithm Methods 0.000 description 24
- 239000010410 layer Substances 0.000 description 24
- 239000011159 matrix material Substances 0.000 description 22
- 238000004891 communication Methods 0.000 description 16
- 238000010586 diagram Methods 0.000 description 12
- 230000000694 effects Effects 0.000 description 8
- 230000006870 function Effects 0.000 description 8
- 238000013507 mapping Methods 0.000 description 7
- 239000013256 coordination polymer Substances 0.000 description 5
- 238000005516 engineering process Methods 0.000 description 5
- 229920001621 AMOLED Polymers 0.000 description 4
- 238000004364 calculation method Methods 0.000 description 4
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 238000013461 design Methods 0.000 description 3
- 230000004927 fusion Effects 0.000 description 3
- 230000033001 locomotion Effects 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 238000013459 approach Methods 0.000 description 2
- 238000013473 artificial intelligence Methods 0.000 description 2
- 238000013528 artificial neural network Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 2
- 230000001186 cumulative effect Effects 0.000 description 2
- 238000011161 development Methods 0.000 description 2
- 230000018109 developmental process Effects 0.000 description 2
- 239000000284 extract Substances 0.000 description 2
- 238000007429 general method Methods 0.000 description 2
- 238000005286 illumination Methods 0.000 description 2
- 239000004973 liquid crystal related substance Substances 0.000 description 2
- 238000013178 mathematical model Methods 0.000 description 2
- 239000002096 quantum dot Substances 0.000 description 2
- 239000007787 solid Substances 0.000 description 2
- 230000009466 transformation Effects 0.000 description 2
- 230000001133 acceleration Effects 0.000 description 1
- 238000004458 analytical method Methods 0.000 description 1
- 230000003190 augmentative effect Effects 0.000 description 1
- 230000015572 biosynthetic process Effects 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 230000000295 complement effect Effects 0.000 description 1
- 230000010485 coping Effects 0.000 description 1
- 239000012792 core layer Substances 0.000 description 1
- 238000012937 correction Methods 0.000 description 1
- 230000008030 elimination Effects 0.000 description 1
- 238000003379 elimination reaction Methods 0.000 description 1
- 238000001914 filtration Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000010365 information processing Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 230000004807 localization Effects 0.000 description 1
- 229910044991 metal oxide Inorganic materials 0.000 description 1
- 150000004706 metal oxides Chemical class 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000005855 radiation Effects 0.000 description 1
- 238000011084 recovery Methods 0.000 description 1
- 238000009877 rendering Methods 0.000 description 1
- 230000011218 segmentation Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000003786 synthesis reaction Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T17/00—Three dimensional [3D] modelling, e.g. data description of 3D objects
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02T—CLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO TRANSPORTATION
- Y02T10/00—Road transport of goods or passengers
- Y02T10/10—Internal combustion engine [ICE] based vehicles
- Y02T10/40—Engine management systems
Landscapes
- Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Computer Graphics (AREA)
- Geometry (AREA)
- Software Systems (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Image Processing (AREA)
Abstract
The embodiment of the application provides a bundling adjustment method and electronic equipment. In the method, firstly, the electronic equipment selects a plurality of target three-dimensional points from all three-dimensional points to be optimized according to a preset strategy, and performs cluster adjustment optimization on the target three-dimensional points, the camera pose to be optimized and the camera internal parameters to obtain the optimized camera pose and camera internal parameters; and then, the electronic equipment takes the camera pose and the camera internal parameter obtained after optimization as a fixed value, and performs cluster adjustment optimization on all three-dimensional points to be optimized to obtain all the three-dimensional points after optimization. Therefore, the cluster adjustment optimization is divided into two steps of optimizing the pose of the camera, partial three-dimensional points and internal parameters of the camera and optimizing the positions of all map points, so that the time consumption of the cluster adjustment optimization is greatly reduced.
Description
The present application is a divisional application, the name of the original application is a bundle adjustment method and an electronic device, the application number of the original application is 202210926339.9, the date of the original application is 2022, month 08 and 03, and the entire content of the original application is incorporated by reference in the present application.
Technical Field
The present disclosure relates to the field of image processing technologies, and in particular, to a bundle adjustment method and an electronic device.
Background
With the development of terminal technology and the improvement of information processing capability of people, two-dimensional images cannot meet the demands of work and life. Three-dimensional models are the most intuitive structure for humans compared to two-dimensional images, and viewing objects and environments based on three-dimensional angles can enable people to process information with high efficiency. Three-dimensional reconstruction therefore constitutes one of the hot spots in the field of image processing technology, which builds a mathematical model for three-dimensional objects that is suitable for computer representation and processing, so that electronic devices can process, manipulate and analyze objects in a computer environment.
Currently, reconstructing a three-dimensional model of an object based on a motion structure recovery (structurefrom motion, SFM) algorithm is a common way. This approach may reconstruct a three-dimensional model of an object by gathering a series of unordered pictures and extracting sufficient feature points therefrom for analysis. The cluster adjustment is an important link in three-dimensional reconstruction and is used for eliminating cumulative errors of the camera pose and the map point position. However, when the number of pictures and the number of feature points are increased, the solving time of the bundling adjustment is exponentially increased, which is very time-consuming.
Disclosure of Invention
In order to solve the above technical problems, embodiments of the present application provide a bundle adjustment method and an electronic device. In the method, the cluster adjustment optimization is divided into two steps of optimizing the pose of the camera, partial three-dimensional points and internal parameters of the camera and optimizing the positions of all map points, so that the time consumption of the cluster adjustment optimization is greatly reduced.
In a first aspect, an embodiment of the present application provides a bundle adjustment method. The method comprises the following steps: the electronic equipment acquires the pose of the camera to be optimized, the internal parameters of the camera and all three-dimensional points; the electronic equipment determines target three-dimensional points in all three-dimensional points according to a preset strategy; the electronic equipment performs cluster adjustment optimization on the camera pose and the camera internal reference to be optimized and the target three-dimensional point to obtain the optimized camera pose and the camera internal reference; and the electronic equipment takes the optimized camera pose and camera internal parameters as constant values, and performs cluster adjustment optimization on all three-dimensional points to obtain all the optimized three-dimensional points.
Therefore, the electronic equipment divides the cluster adjustment optimization into two steps of optimizing the pose of the camera, partial three-dimensional points and internal parameters of the camera, and optimizing the positions of all map points, so that the time consumption of the cluster adjustment optimization is greatly reduced.
According to the first aspect, the data quality of the target three-dimensional point is better than the data quality of all three-dimensional points; the data quality is used for representing the accuracy degree of the three-dimensional points when the three-dimensional points are used for three-dimensional reconstruction.
The data quality may be identified by a correlation index, for example, a feature extraction response value of an image feature point corresponding to the three-dimensional point.
In this way, during the first step of beam adjustment optimization, the electronic device selects some three-dimensional points with better data quality, namely, selects some important three-dimensional points, and the three-dimensional points, the camera pose and the camera internal parameters are subjected to beam adjustment optimization together so as to obtain the optimized camera pose and the camera internal parameters, and further, during the second step of beam adjustment optimization, the optimized camera pose and the optimized camera internal parameters are used as fixed values, and only all the three-dimensional points are subjected to beam adjustment optimization. Therefore, not only can the optimization accuracy not be reduced, but also the optimization solving time is greatly reduced.
According to the first aspect, or any implementation manner of the first aspect, the determining, by the electronic device, a target three-dimensional point from all three-dimensional points according to a preset policy includes: the electronic equipment traverses an image corresponding to the position of the camera to be optimized; selecting a target three-dimensional point from the three-dimensional points corresponding to each image by the electronic equipment; the feature extraction response value of the image feature point corresponding to the target three-dimensional point is larger than a first threshold value.
It should be noted that the image feature points corresponding to any three-dimensional points are two-dimensional points in the image.
Therefore, the electronic equipment selects part of three-dimensional points in the first-step cluster adjustment optimization according to the feature extraction response value of the image feature points corresponding to the three-dimensional points, and the optimization precision of the two-step optimization cluster adjustment method is effectively ensured.
According to the first aspect, or any implementation manner of the first aspect, the method further includes: the electronic equipment equally divides each image into a plurality of image grids; wherein the number of target feature points included in each image grid is not greater than a second threshold; the target feature points are image feature points corresponding to the target three-dimensional points.
Therefore, when the electronic equipment selects part of three-dimensional points in the first-step cluster adjustment optimization, the distribution balance of the three-dimensional points can be ensured, and the optimization precision of the two-step optimization cluster adjustment method is further improved.
According to the first aspect, or any implementation manner of the first aspect, the selecting, by the electronic device, a target three-dimensional point from three-dimensional points corresponding to each image may include: the electronic device arranges the three-dimensional points corresponding to each image in descending order of feature extraction response values (i.e., in descending order of feature extraction response values of the two-dimensional image feature points corresponding to the three-dimensional points); the electronic equipment sequentially acquires a three-dimensional point as a current three-dimensional point according to the descending order of the characteristic extraction response value; if the feature extraction response value of the image feature points corresponding to the current three-dimensional points is larger than a first threshold value and the total number of target feature points included in the current image grid is not larger than a second threshold value, the electronic equipment takes the current three-dimensional points as target three-dimensional points and updates the total number of target feature points included in the current image grid; the current image grid is the image grid where the image feature points corresponding to the current three-dimensional points are located; the electronic equipment sequentially acquires a three-dimensional point as a current three-dimensional point according to the descending order of the feature extraction response values until each three-dimensional point corresponding to each image is traversed, or until the feature extraction response value of the image feature point corresponding to the current three-dimensional point is traversed to be not more than a first threshold value.
In this way, the electronic device selects part of the three-dimensional points during the first-step cluster adjustment optimization according to the feature extraction response value of the image feature points corresponding to the three-dimensional points, and can ensure the distribution balance of the three-dimensional points, thereby improving the optimization precision of the two-step optimization cluster adjustment method. And for each image, when the characteristic extraction response value of the image characteristic point corresponding to the current three-dimensional point is not more than a first threshold value, finishing the traversal of the three-dimensional point corresponding to the image, and effectively improving the efficiency of selecting the target three-dimensional point from the three-dimensional points corresponding to each image.
According to the first aspect, or any implementation manner of the first aspect, the difference between the number of all three-dimensional points and the number of camera poses is greater than a first preset number threshold.
According to the first aspect, or any implementation manner of the first aspect, the number of camera poses to be optimized is greater than a second preset number threshold.
When the number of three-dimensional points is far greater than the number of camera poses, or when the number of images used for constructing a three-dimensional model is increased, compared with the existing method, the two-step optimization cluster adjustment method provided by the embodiment is adopted, and the cluster adjustment optimization time consumption is reduced more obviously.
According to the first aspect, or any implementation manner of the first aspect, the electronic device obtaining the pose of the camera to be optimized, the internal parameters of the camera and all three-dimensional points may include: and the electronic equipment acquires the pose of the camera, the internal parameters of the camera and all three-dimensional points to be optimized during local bundling adjustment.
According to the first aspect, or any implementation manner of the first aspect, the electronic device obtaining the pose of the camera to be optimized, the internal parameters of the camera and all three-dimensional points may include: and the electronic equipment acquires the pose of the camera, the internal parameters of the camera and all three-dimensional points to be optimized during global bundling adjustment.
Thus, the two-step optimization bundle adjustment method provided in this embodiment is applicable to the local bundle adjustment optimization stage and also applicable to the global bundle adjustment optimization stage.
In a second aspect, embodiments of the present application provide an electronic device. The electronic device includes: one or more processors; a memory; and one or more computer programs, wherein the one or more computer programs are stored on the memory, which when executed by the one or more processors, cause the electronic device to perform the bundle adjustment method as in any of the first aspect and the first aspect.
Any implementation manner of the second aspect and the second aspect corresponds to any implementation manner of the first aspect and the first aspect, respectively. The technical effects corresponding to the second aspect and any implementation manner of the second aspect may be referred to the technical effects corresponding to the first aspect and any implementation manner of the first aspect, which are not described herein.
In a third aspect, embodiments of the present application provide a computer-readable storage medium. The computer readable storage medium comprises a computer program which, when run on an electronic device, causes the electronic device to perform the bundle adjustment method of any one of the first aspect and the first aspect.
Any implementation manner of the third aspect and any implementation manner of the third aspect corresponds to any implementation manner of the first aspect and any implementation manner of the first aspect, respectively. The technical effects corresponding to the third aspect and any implementation manner of the third aspect may be referred to the technical effects corresponding to the first aspect and any implementation manner of the first aspect, which are not described herein.
In a fourth aspect, embodiments of the present application provide a computer program product comprising a computer program which, when executed, causes a computer to perform the bundle adjustment method according to the first aspect or any one of the first aspects.
Any implementation manner of the fourth aspect and any implementation manner of the fourth aspect corresponds to any implementation manner of the first aspect and any implementation manner of the first aspect, respectively. Technical effects corresponding to any implementation manner of the fourth aspect may be referred to the technical effects corresponding to any implementation manner of the first aspect, and are not described herein.
In a fifth aspect, the present application provides a chip comprising processing circuitry, a transceiver pin. Wherein the transceiver pin and the processing circuit communicate with each other via an internal connection path, the processing circuit executing the bundling adjustment method according to any one of the first aspect or the first aspect to control the receiving pin to receive signals and to control the transmitting pin to transmit signals.
Any implementation manner of the fifth aspect and any implementation manner of the fifth aspect corresponds to any implementation manner of the first aspect and any implementation manner of the first aspect, respectively. Technical effects corresponding to any implementation manner of the fifth aspect may be referred to the technical effects corresponding to any implementation manner of the first aspect, and are not described herein.
Drawings
FIG. 1a is a schematic diagram of an exemplary three-dimensional reconstruction process;
FIG. 1b is a schematic diagram of an exemplary sparse point cloud reconstruction;
FIG. 2a is a schematic diagram of exemplary feature point matching;
2 b-2 f are exemplary illustrative sparse point cloud reconstruction schematics;
FIG. 3 is a schematic diagram of an exemplary illustrated Hessian matrix;
fig. 4a is a schematic diagram of a hardware structure of an exemplary electronic device;
FIG. 4b is a schematic diagram of a software architecture of an exemplary electronic device;
fig. 5 is a schematic flow chart of a bundle adjustment method according to an embodiment of the present application;
FIG. 6a is a schematic diagram of a Hessian matrix involved in a first step of cluster adjustment optimization in an embodiment of the present application;
FIG. 6b is a schematic diagram of a Hessian matrix involved in the second step of cluster adjustment optimization in the embodiment of the present application;
fig. 7 is a schematic diagram illustrating comparison results of cluster adjustment optimization time consumption.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, are intended to be within the scope of the present application.
The term "and/or" is herein merely an association relationship describing an associated object, meaning that there may be three relationships, e.g., a and/or B, may represent: a exists alone, A and B exist together, and B exists alone.
The terms first and second and the like in the description and in the claims of embodiments of the present application are used for distinguishing between different objects and not necessarily for describing a particular sequential order of objects. For example, the first target object and the second target object, etc., are used to distinguish between different target objects, and are not used to describe a particular order of target objects.
In the embodiments of the present application, words such as "exemplary" or "such as" are used to mean serving as examples, illustrations, or descriptions. Any embodiment or design described herein as "exemplary" or "for example" should not be construed as preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "such as" is intended to present related concepts in a concrete fashion.
In the description of the embodiments of the present application, unless otherwise indicated, the meaning of "a plurality" means two or more. For example, the plurality of processing units refers to two or more processing units; the plurality of systems means two or more systems.
At present, three-dimensional reconstruction is one of hot spots in the technical field of image processing, which builds a mathematical model suitable for computer representation and processing for a three-dimensional object, so that electronic equipment can process, operate and analyze the object in a computer environment.
As shown in fig. 1a, a large amount of aerial images, ground images and the like and GPS (Global Positioning System ) information are input into a three-dimensional reconstruction system, and sparse point clouds, dense point clouds, geometric models, texture models and the like can be obtained through processing of the three-dimensional reconstruction system. The three-dimensional reconstruction system can be roughly divided into a sparse point cloud reconstruction module, a dense point cloud reconstruction module and a texture model reconstruction module.
With continued reference to fig. 1a, the processing flow involved in the sparse point cloud reconstruction module generally includes: extracting image features, matching the image features, generating a matching point sequence, performing incremental reconstruction and performing global nonlinear optimization; the process flow involved in the dense point cloud reconstruction module generally includes: image distortion correction, neighborhood image selection, depth map calculation, depth map filtering and depth map fusion; the texture model reconstruction module generally comprises a processing flow including point cloud segmentation, point cloud gridding, grid fusion, grid conclusion and texture mapping.
As shown in fig. 1b, after the multi-view image is input to the sparse point cloud reconstruction module, the pose and the scene structure of the camera can be obtained through the processing of the sparse point cloud reconstruction module. The following describes the processing flow related to the sparse point cloud reconstruction module in detail with reference to fig. 2 a-2 f. The process flow of the dense point cloud reconstruction module and the texture model reconstruction module may refer to the prior art, and will not be described herein.
Referring to fig. 1a, in the sparse point cloud reconstruction stage, the processing flow of the electronic device may specifically include the following steps:
1. the electronic device obtains a set of images including a target object.
Specifically, the electronic device may capture and acquire a plurality of images including the target object through a camera disposed on the device, and the plurality of images may be referred to as an image set including the target object. The electronic device may also acquire a set of images including the target object captured by other devices. That is, the present application is not limited to the source of the image set including the target object. In this set of images, each image may show the target object in a different state (e.g., angle, orientation, time, illumination, etc.).
In one possible implementation, the electronic device may obtain a video sequence including the target object. The video sequence may be captured by the electronic device through a camera disposed on the device, or may be captured by another device. In the video sequence, each video frame image may show the target object in different states (e.g., angle, azimuth, time, illumination, etc.).
2. The electronic device extracts feature points of each image in the image set.
Specifically, the electronic device may extract feature points in each image based on the first algorithm. Wherein the feature points are used to describe points in the image that have certain feature information. That is, the camera captures the same object or scene during movement to obtain a plurality of images, and if the same actual places in the object or scene can be identified from the images, the corresponding pixels of the same places in the images may be referred to as feature points.
Feature point extraction refers to extracting the appropriate descriptive features from the image in which the object or scene is located. The characteristics not only can clearly distinguish the target from the background, but also have robustness in coping with the conditions of scale expansion of the target, shape change of the target, shielding of the target and the like. The first algorithm for extracting feature points may be a scale-invariant feature transform (SIFT) algorithm, an accelerated robust feature algorithm (speeded uprobust features, SURF) algorithm, a self-supervision based feature point extraction algorithm (which may also be referred to as a superpoint algorithm), or the like.
3. The electronic equipment matches the feature points extracted from the images in the image set and eliminates the outer points.
Specifically, the electronic device may perform matching of feature points between two images based on the second algorithm. The matching of the feature points between every two images means that the two feature points which have the same feature information and belong to different images are matched. Feature points having the same feature information for which a matching relationship has been established may correspond to one feature point set. The second algorithm described above may be a Brute force matching algorithm (also known as the Brute-Froce Matcher), a K-dtree algorithm, or the like. By way of example, fig. 2a shows two images, image 101 and image 102, respectively. Image 101 and image 102 include the same object 1011. The object 1011 displayed in the image 101 includes a feature point a. The object 1011 displayed in the image 102 includes a feature point b. The feature information included in the feature point a and the feature information included in the feature point b are the same, and therefore, the feature point a and the feature point b can be matched.
When a mismatch occurs between feature points, the mismatch feature points (i.e., outliers) may be removed by a random sample consensus (random sample consensus, RANSAC) algorithm. It should be noted that, the method for eliminating the feature points of mismatching is not limited in the present application.
After the matching relationship between the feature points is established, a feature point set may be generated. For example, the electronic device may generate a feature point trajectory (track) list based on the matching relationship between the feature points. For example, if the feature information contained in the feature point 1 of the first drawing, the feature point 2 of the second drawing, and the feature point 3 of the third drawing are the same, the feature points may establish a matching relationship. Assuming that the feature point 1 of the first figure is represented by (1, 1), the feature point 2 of the second figure is represented by (2, 2), and the feature point 3 in the third figure can be represented by (3, 3), then (1, 1), (2, 2), and (3, 3) belong to one track (may also be referred to as one feature point set having the same feature information). The electronic device 100 may generate a track set according to the above examples, the track set including one or more tracks, different tracks corresponding to different characteristic information. For example, if the same track contains the same graph multiple times, which means that multiple feature points in the same graph all match the same feature point, and incorrect matching occurs, the track should be removed. If too few elements are included in the same track, e.g. only two elements, indicating that only two images include the same target point, the track should be rejected.
4. And the electronic equipment performs three-dimensional reconstruction initialization based on the image pairs matched with the feature points.
The image pairs with matched feature points may refer to image pairs with feature points with established matching relations greater than a number threshold (e.g., 100, 200, etc.).
The electronic device may perform an initialization of three-dimensional reconstruction based on the feature point matched image pairs (e.g., image 1 and image 2). Specifically, in one possible implementation manner, a three-dimensional coordinate system is established with the image 1 as a standard, and the feature points on the image 1 can be mapped to the three-dimensional coordinate system to obtain corresponding three-dimensional point information. The electronic device may calculate, based on the matching relationship between the feature points in the image 1 and the image 2, the camera pose of the image 2 obtained by using a PnP (superpositive-n-point) method, where the camera pose includes a rotation matrix (may also be referred to as an R matrix) and a translation vector (may also be referred to as a t vector). Then, the electronic device may calculate, through a direct linear transformation (direct linear transformation, DLT) algorithm, based on the camera internal parameter K, the R matrix, the t vector, and the feature points on the image 2, to obtain corresponding three-dimensional point information. The electronic device may construct a preliminary three-dimensional model based on the obtained three-dimensional point information.
Wherein the camera pose may be used to map two-dimensional points on the image to three-dimensional points in a three-dimensional coordinate system. For example, the camera pose corresponding to the image 2 may be used to map the feature point on the image 2 to a three-dimensional point in a three-dimensional coordinate system, or map the three-dimensional point in the three-dimensional coordinate system to a corresponding feature point on the image 2.
It should be noted that the present application is not limited to the method of initializing the three-dimensional reconstruction based on the image 1 and the image 2.
Next, the electronic device may register the image 3 and calculate three-dimensional point information corresponding to the feature points in the image 3. Wherein the electronic device registering the image 3 refers to the electronic device updating the three-dimensional model of the target object based on the image 3 in combination with the generated three-dimensional model (i.e. the aforementioned incremental reconstruction). Wherein an image that has been constructed with the three-dimensional model may be referred to as a registered image, and an image that has not been constructed with the three-dimensional model may be referred to as an image to be registered. For example, based on the above description, image 3 may be referred to as an image to be registered, and image 1 and image 2 may be referred to as registered images.
The electronic device may obtain a mapping relationship between the feature points in the image 3 (i.e., feature points matching the feature points in the registered image) and the corresponding three-dimensional points through a matching relationship (e.g., track list in the foregoing example) between the image 3 and the registered image, and calculate a camera pose corresponding to the image 3 based on the mapping relationship. Then, the electronic device calculates corresponding three-dimensional point information (for example, feature information, three-dimensional coordinates and the like in the feature points) based on the camera pose corresponding to the estimated image 3 without mapping the feature points in the image 3 to the three-dimensional coordinate system, and then reconstruct a three-dimensional model of the target object based on the calculated three-dimensional point information.
Illustratively, as shown in fig. 2b, in the three-dimensional coordinate system, three-dimensional points with an a region have been generated based on image 103 (which can be regarded as image 1 mentioned above) and image 104 (which can be regarded as image 2 mentioned above). The three-dimensional points of the A area are mapped on the image 103 and are characteristic points of the A1 area; the three-dimensional points of the a region are mapped on the image 104 as feature points of the A2 region. The feature points of the A1 region on the image 103, the feature points of the A2 region on the image 104, and the feature points of the A3 region on the image 105 (which can also be regarded as the above-mentioned image 3) have established matching relations. That is, the A1, A2, and A3 regions map three-dimensional points of the same region in a three-dimensional coordinate system. Therefore, the feature point of the A3 region is mapped to a three-dimensional coordinate system and is also a three-dimensional point of the a region. Based on the feature points of the A3 region and the three-dimensional points of the a region, the electronic device 100 may calculate a camera pose corresponding to the image 105.
As shown in fig. 2c, the electronic device 100 has calculated the camera pose corresponding to the image 105. The image 105 includes feature points of an A4 region, and the feature points of the A4 region are not mapped to the three-dimensional coordinate system. The electronic device may map the feature points of the A4 region to a three-dimensional coordinate system based on the camera pose corresponding to the image 105, to obtain three-dimensional points of the B region.
Similarly, the electronic device may also map other feature points in the image 3 that are not mapped to the three-dimensional coordinate system, so as to complete registration of the image 3. Similarly, the electronic device can also register other images (such as images 4, 5 and 6 …) to realize incremental reconstruction of the three-dimensional model.
However, in the above incremental reconstruction process, three-dimensional points generated based on the feature points and the estimated camera pose are subject to a re-projection error. Therefore, optimization of camera pose ([ R, t ]), camera reference (K), and three-dimensional point coordinates (P) is required to minimize the re-projection error.
The re-projection error of the three-dimensional point generated for the feature point may refer to a distance error generated by re-projecting the three-dimensional point as a two-dimensional coordinate point on the corresponding image, and comparing the two-dimensional coordinate point with the two-dimensional coordinate of the feature point of the three-dimensional point on the image.
For example, as shown in fig. 2d, there is a three-dimensional point P in the three-dimensional coordinate system, where the three-dimensional point P corresponds to a feature point P1 on the image 106, and the two-dimensional coordinate point of the three-dimensional point P re-projected on the image 106 is P2, where the P2 and the P1 have a re-projection error e.
In this embodiment, the electronic device may perform multi-feature bundling adjustment based on a beam-method adjustment (bundle adjustment, BA) algorithm to eliminate cumulative errors in camera pose and map-point position. The bundling adjustment method is to construct a nonlinear optimization problem for solving the minimization of the re-projection error according to the pose of the camera to be optimized, the internal parameters of the camera and the map points. Specifically, the electronic device may perform local bundling adjustment based on the BA algorithm, or may perform global bundling adjustment.
For example, the electronic device may adjust coordinates of three-dimensional points generated at the time of registration of the image 3 based on a specified direction (for example, a gradient direction corresponding to each three-dimensional point) through a BA algorithm, so that a sum of the adjusted re-projection errors corresponding to the three-dimensional points generated based on the image 3 is smaller than an error threshold (for example, 0.3, 0.5, etc.). The calculation of the reprojection error may be based on a mapping relationship between each three-dimensional point and the corresponding feature point generated by the image 3.
Illustratively, as shown in FIG. 2e, taking the foregoing embodiment of FIG. 2c as an example, the three-dimensional points of the B region are generated based on the feature points of the A4 region in the image 105. The B region has three-dimensional points B1, B2, B3, and B4. The three-dimensional points in the B region do not map corresponding feature points in the images 103 and 104. Therefore, only the re-projection error on the image 105 needs to be calculated. Assuming that the re-projection errors of the three-dimensional points B1, B2, B3, B4 mapped onto the image 105 are e1, e2, e3, e4, respectively, the electronic device may adjust the three-dimensional coordinates of the three-dimensional points B1, B2, B3, B4 based on the BA algorithm such that the sum of the re-projection errors e1, e2, e3, e4 is less than the error threshold.
For another example, the electronic device may adjust coordinates of three-dimensional points generated based on the registered image based on a specified direction (e.g., a corresponding gradient direction of each three-dimensional point) through a BA algorithm such that a sum of the adjusted re-projection errors of the three-dimensional points generated based on the registered image is less than an error threshold (e.g., 0.3, 0.5, etc.). The calculation of the reprojection error may be based on a mapping relationship between each three-dimensional point and a corresponding feature point generated by the registered image. For example, the electronic device may make global multi-feature bundling adjustments each time a specified number (e.g., 100, etc.) of images are registered.
Illustratively, as shown in FIG. 2f, the currently registered images include image 106, image 107, and image 108, based on which three-dimensional points B5, B6, B7, B8 are generated. Wherein the three-dimensional point B5 corresponds to the feature point on the image 106, the image 107, and the image 108, respectively; three-dimensional point B6 corresponds to a feature point on image 106, image 107, and image 108, respectively; the three-dimensional point B7 corresponds to the feature point on the image 107 and the image 108, respectively; the three-dimensional point B8 corresponds to the feature point on the image 106 and the image 107, respectively.
Assume that the re-projection errors of three-dimensional point B5 on image 106, image 107, and image 108 are e5, e6, and e7, respectively; the re-projection errors of the three-dimensional point B6 on the image 106, the image 107 and the image 108 are e8, e9 and e10 respectively; the re-projection errors of the three-dimensional point B7 on the image 107 and the image 108 are e11 and e12, respectively; the re-projection errors of the three-dimensional point B8 on the image 106 and the image 1078 are e13 and e14, respectively. The electronic device may adjust the three-dimensional coordinates of the three-dimensional points B5, B6, B7, B8 based on the BA algorithm such that the sum of the re-projection errors e5, e6, e7, e8, e9, e10, e11, e12, e13, e14 is less than the error threshold.
Similarly, when all images in the image set are registered, the electronic device may adjust, by using a BA algorithm, coordinates of three-dimensional points generated based on all the images and camera poses (or camera coordinates) corresponding to all the images based on a specified direction (for example, a gradient direction corresponding to each three-dimensional point), so that a sum of the adjusted re-projection errors corresponding to the three-dimensional points generated based on all the images is smaller than an error threshold. The processing flow of the electronic device may refer to the foregoing, and will not be described herein. At this time, the calculation of the re-projection error is based on the mapping relationship between each three-dimensional point and the corresponding feature point generated by all the images.
After the global multi-feature bundling adjustment is completed, the electronic device can output a three-dimensional model of the target object. The three-dimensional model can comprise sparse three-dimensional point clouds and various camera poses.
The bundling adjustment method is to construct a nonlinear optimization problem for solving the minimization of the re-projection error according to the pose of the camera to be optimized and the map points. The sum of the reprojection errors corresponding to the three-dimensional points can be expressed as:
wherein C= { C 1 ,C 2 ,…,C N },P={P 1 ,P 2 ,…,P D N is the number of images, D is the number of feature points, P j For the three-dimensional point coordinate corresponding to the jth feature point, p ji Is the two-dimensional coordinates of the jth feature point in the ith image.
Wherein ci=ki [ Ri, ti ]]K is the internal reference of the camera, [ R, t ]]The camera pose is represented by R, a rotation matrix and t, a translation vector. Ki [ Ri, ti ]]Pj=ki (ri×pj+ti) for identifying the corresponding two-dimensional coordinates obtained by re-projecting the 3D point into the image. Further, the processing unit is used for processing the data,the reprojection error of the jth three-dimensional point in the ith image may be represented.
Further, the nonlinear optimization problem related to the bundle adjustment method can be expressed as:
in this nonlinear optimization problem, the amount to be optimized is a camera parameter C and a three-dimensional point P, wherein the camera parameter C includes a camera internal parameter (K) and a camera pose ([ R, t ]).
Solving the nonlinear problem usually adopts a Gaussian Newton method or an LM (Levenberg-Marquardt) method, and calculates a state increment in each iteration based on a Hessian matrix, so that the sum of the re-projection errors is smaller than an error threshold value by using a camera parameter C and a three-dimensional point P obtained after a plurality of iterations.
Wherein the general form of the incremental linear equation based on the Hessian matrix is hΔx=b.
The incremental linear equation is written as camera parameters and three-dimensional points (or map points) in the form of:
wherein Deltax is C Delta x is the increment of camera parameter C P Is the increment of the three-dimensional point P coordinate.
At the position ofIn (H) CC In the form of a diagonal array, only at H i,i Where there are non-0 blocks, H CC The dimension of (2) is the number of camera parameters C; h PP In the form of a diagonal array, only at H j,j Where there are non-0 blocks, H PP Is the number of three-dimensional points (i.e., map points) P; h CP Is H PC The transpose of (2) may be a sparse matrix or a dense matrix, depending on the particular observation data.
Typically the number of three-dimensional points is much greater than the number of camera parameters, in practice the H matrix will be as shown in fig. 3, the upper left corner portion (i.e. H CC ) Appears to be very small, the lower right corner portion (i.e., H PP ) Occupies a large space, and the upper right corner and the lower left corner are distributed with scattered observation data. At this time, the H matrix may be referred to as an arrow matrix or a pick matrix.
To accelerate the solving speed of the incremental linear equation, the schulk method is generally adopted. The incremental linear equation is formed by a Shuercompensation primordial method:
further, the following incremental solution equation can be obtained:
Δx C =(H CC -H CP H PP - 1 H PC )- 1 (b C -H CP H PP - 1 b P );
Δx P =H PP -1 (b P -H PC Δx C )。
however, as the number of images and the number of feature points increase, the bundle adjustment solution time increases exponentially. When the pose of the camera, the internal parameters of the camera and the number of three-dimensional points are very large, even if the solution acceleration of the cluster adjustment is carried out based on the Shuercompensation method, the time consumption of the cluster adjustment solution is very large compared with the time consumption of other modules in the three-dimensional reconstruction.
In order to solve the above problems, the embodiments of the present application provide a bundle adjustment method, so as to reduce the time consumption for solving the bundle adjustment and improve the bundle adjustment efficiency. Firstly, selecting some important three-dimensional points or three-dimensional points with better data quality from all three-dimensional points (or map points) to be optimized by the electronic equipment according to a preset strategy, and performing cluster adjustment optimization on the important three-dimensional points, camera pose and camera internal parameters to be optimized by a BA algorithm to obtain the optimized camera pose and camera internal parameters; and then, the electronic equipment takes the camera pose and the camera internal parameters obtained after optimization as fixed values, and performs cluster adjustment optimization on all three-dimensional points to be optimized through a BA algorithm to obtain all the three-dimensional points after optimization.
Therefore, the bundling adjustment method provided by the embodiment of the application is realized in a two-step optimization mode, so that the optimization precision can be ensured, the optimization solving time can be greatly reduced, and the bundling adjustment efficiency is improved.
Fig. 4a is a schematic diagram of a hardware structure of the electronic device 100.
The electronic device 100 may be a cell phone, tablet computer, desktop computer, laptop computer, handheld computer, notebook computer, ultra-mobile personal computer (UMPC), netbook, cellular telephone, personal digital assistant (personal digital assistant, PDA), augmented Reality (AR) device, virtual Reality (VR) device, artificial intelligence (artificial intelligence, AI) device, wearable device, vehicle device, smart home device, and/or smart city device, and the specific type of the electronic device is not particularly limited in the embodiments of the present application.
The electronic device 100 may include a processor 110, a memory 120, a wireless communication module 130, and a display screen 140. The above modules may be connected by a bus or other manner, and in this embodiment of the present application, a bus connection is taken as an example.
It should be understood that the illustrated structure of the embodiment of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, electronic device 100 may also include more or fewer components than shown, or certain components may be combined, or certain components may be split, or different arrangements of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
The processor 110 may include one or more processor units, for example, the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and/or a neural network processor (neural-network processing unit, NPU), etc. Wherein the different processing units may be separate devices or may be integrated in one or more processors. The controller can generate operation control signals according to the instruction operation codes and the time sequence signals to finish the control of instruction fetching and instruction execution.
A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may hold instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to reuse the instruction or data, it can be called directly from the memory. Repeated accesses are avoided and the latency of the processor 110 is reduced, thereby improving the efficiency of the system.
In some embodiments, the processor 110 may include one or more interfaces. The interfaces may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous receiver transmitter (universal asynchronous receiver/transmitter, UART) interface, a mobile industry processor interface (mobile industry processor interface, MIPI), a general-purpose input/output (GPIO) interface, a subscriber identity module (subscriber identity module, SIM) interface, and/or a universal serial bus (universal serial bus, USB) interface, among others.
Memory 120 is coupled to processor 110 for storing various software programs and/or sets of instructions. In particular implementations, memory 120 may include volatile memory (RAM), such as random access memory (random access memory); non-volatile memory (non-volatile memory) such as ROM, flash memory (flash memory), hard Disk Drive (HDD) or solid state Disk (Solid State Drives, SSD) may also be included; memory 120 may also include a combination of the types of memory described above. The memory 120 may store some program code (e.g., SFM algorithm program code, etc.) so that the processor 110 invokes the program code stored in the memory 120 to implement the method of implementing the embodiments of the present application in the electronic device 100. The memory 120 may store an operating system, such as an embedded operating system, for example uCOS, vxWorks, RTLinux.
The wireless communication module 130 may provide solutions for wireless communication including wireless local area network (wireless local area networks, WLAN) (e.g., wireless fidelity (wireless fidelity, wi-Fi) network), bluetooth (BT), global navigation satellite system (global navigation satellite system, GNSS), frequency modulation (frequency modulation, FM), near field wireless communication technology (near field communication, NFC), infrared technology (IR), etc., as applied on the electronic device 100. The wireless communication module 130 may be one or more devices integrating at least one communication processing module. The wireless communication module 130 receives electromagnetic waves via an antenna, modulates the electromagnetic wave signals, filters the electromagnetic wave signals, and transmits the processed signals to the processor 110. The wireless communication module 130 may also receive a signal to be transmitted from the processor 110, frequency modulate it, amplify it, and convert it to electromagnetic waves for radiation via an antenna. In some embodiments, the electronic device 100 may detect or scan devices in the vicinity of the electronic device 100 by transmitting signals through a bluetooth module (not shown in fig. 4 a), a WLAN module (not shown in fig. 4 a) in the wireless communication module 130, and establish a wireless communication connection with the nearby devices and transmit data. Among other things, the bluetooth module may provide solutions that include one or more of classical bluetooth (BR/EDR) or bluetooth low energy (bluetooth low energy, BLE) communication. The WLAN module may provide a solution that includes one or more WLAN communications of Wi-Fi direct, wi-Fi LAN, or Wi-Fi softAP.
The display screen 140 may be used to display images, video, and the like. The display screen 140 may include a display panel. The display panel may employ a liquid crystal display (liquid crystal display, LCD), an organic light emitting diode (organic lightemitting diode, OLED), an active matrix organic light emitting diode or active matrix organic light emitting diode (activematrix organic light emitting diode, AMOLED), a flexible light emitting diode (flex lightemitting diode, FLED), miniled, micro-OLED, quantum dot light emitting diode (quantum dot light emitting diodes, QLED), or the like. In some embodiments, the electronic device 100 may include 1 or N display screens 140, N being a positive integer greater than 1.
Optionally, the electronic device 100 may also comprise a camera (not shown in fig. 4 a). The camera may be used to capture still images or video. The object generates an optical image through the lens and projects the optical image onto the photosensitive element. The photosensitive element may be a charge coupled device (charge coupled device, CCD) or a Complementary Metal Oxide Semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, which is then transferred to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV, or the like format. In some embodiments, the electronic device 100 may include 1 or N cameras, N being a positive integer greater than 1.
The software system of the electronic device 100 may employ a layered architecture, an event driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture. The embodiments of the present application exemplify a software structure of the electronic device 100 by taking a hierarchical operating system as an example.
Fig. 4b is a software architecture block diagram of the electronic device 100 according to an embodiment of the present application.
The layered architecture of the electronic device 100 divides the software into several layers, each with a distinct role and division of labor. The layers communicate with each other through a software interface. In some embodiments, the Android system is divided into four layers, from top to bottom, an application layer, an application framework layer, a hardware abstraction layer (hardware abstraction layer, HAL), and a kernel layer, respectively.
The application layer may include a series of application packages.
As shown in fig. 4b, the application package may include application programs such as a camera, an AR application, a 3D application, and the like. The application packages may also include calendar, weather, memo, game, video and music applications.
The application framework layer provides an application programming interface (Application Programming Interface, API) and programming framework for application programs of the application layer, including various components and services to support the android development of the developer. The application framework layer includes a number of predefined functions.
As shown in fig. 4b, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, a camera service, etc.
The window manager is used for managing window programs. The window manager can acquire the size of the display screen, judge whether a status bar exists, lock the screen, intercept the screen and the like.
The content provider is used to store and retrieve data and make such data accessible to applications. The data may include video, images, audio, calls made and received, browsing history and bookmarks, phonebooks, etc.
The view system includes visual controls, such as controls to display text, controls to display pictures, and the like. The view system may be used to build applications. The display interface may be composed of one or more views. For example, a display interface including a text message notification icon may include a view displaying text and a view displaying a picture.
The telephony manager is used to provide the communication functions of the electronic device 100. Such as the management of call status (including on, hung-up, etc.).
The resource manager provides various resources for the application program, such as localization strings, icons, pictures, layout files, video files, and the like.
The notification manager allows the application to display notification information in a status bar, can be used to communicate notification type messages, can automatically disappear after a short dwell, and does not require user interaction. Such as notification information is used to inform that the download is complete, a message alert, etc. The notification information may also be a notification in the form of a chart or scroll bar text appearing in the system top status bar, such as a notification of a background running application, or a notification appearing on the screen in the form of a dialog window. For example, a text message is prompted in a status bar, a prompt tone is emitted, the electronic device vibrates, and an indicator light blinks, etc.
The camera service is used for calling cameras (including front cameras and rear cameras) in response to requests of applications.
Android run time includes a core library and virtual machines. Android run time is responsible for scheduling and management of the Android system.
The core library consists of two parts: one part is a function which needs to be called by java language, and the other part is a core library of android.
The application layer and the application framework layer run in a virtual machine. The virtual machine executes java files of the application program layer and the application program framework layer as binary files. The virtual machine is used for executing the functions of object life cycle management, stack management, thread management, security and exception management, garbage collection and the like.
The system library may include a plurality of functional modules. For example: surface manager (surface manager), media Libraries (Media Libraries), three-dimensional graphics processing Libraries (e.g., openGL ES), 2D graphics engines (e.g., SGL), etc.
The surface manager is used to manage the display subsystem and provides a fusion of 2D and 3D layers for multiple applications.
Media libraries support a variety of commonly used audio, video format playback and recording, still image files, and the like. The media library may support a variety of audio video encoding formats, such as: MPEG4, h.264, MP3, AAC, AMR, JPG, PNG, etc.
The three-dimensional graphic processing library is used for realizing three-dimensional graphic drawing, image rendering, synthesis, layer processing and the like.
The 2D graphics engine is a drawing engine for 2D drawing.
The kernel layer is a layer between hardware and software. The inner core layer at least comprises a display driver, a camera driver, an audio driver and a sensor driver. The hardware may include a camera, a display screen, a processor, a memory, and the like.
It will be appreciated that the layers and components contained in the layers in the software structure shown in fig. 4b do not constitute a specific limitation of the electronic device 100. In other embodiments of the present application, electronic device 100 may include more or fewer layers than shown, and more or fewer components may be included in each layer, as the present application is not limited.
It can be understood that, in order to implement the bundle adjustment method in the embodiments of the present application, the electronic device includes corresponding hardware and/or software modules that perform each function. The steps of an algorithm for each example described in connection with the embodiments disclosed herein may be embodied in hardware or a combination of hardware and computer software. Whether a function is implemented as hardware or computer software driven hardware depends upon the particular application and design constraints imposed on the solution. Those skilled in the art may implement the described functionality using different approaches for each particular application in conjunction with the embodiments, but such implementation is not to be considered as outside the scope of this application.
Fig. 5 shows a flowchart of a bundle adjustment method provided in an embodiment of the present application. As shown in fig. 5, the flow of the bundle adjustment method provided in the embodiment of the present application specifically includes:
s201, the electronic equipment acquires the pose of the camera, the three-dimensional point (or map point) and the internal parameters of the camera.
In this step, the camera pose, map points, and camera internal parameters acquired by the electronic device are the camera pose, map points, and camera internal parameters to be optimized. The camera pose, map point and camera reference to be optimized may be the camera pose, map point and camera reference to be optimized during global beam adjustment, or may be the camera pose, map point and camera reference to be optimized during local beam adjustment, which is not limited in this embodiment.
In general, the number of camera poses to be optimized is much smaller than the number of three-dimensional points. Illustratively, the three-dimensional points are orders of magnitude greater than the camera poses, e.g., the number of three-dimensional points is about thousands or even tens of thousands of times the number of camera poses.
S202, the electronic equipment sequentially acquires one image from a plurality of images corresponding to the camera pose as a current image.
When the pose of the camera to be optimized is multiple, multiple images corresponding to the corresponding three-dimensional modeling are provided.
And traversing each image in the plurality of images by electrons, selecting a plurality of important three-dimensional points in the three-dimensional points corresponding to each image, and taking the important three-dimensional points as the three-dimensional points to be optimized in the first step of bundling adjustment, wherein the three-dimensional points can be called target three-dimensional points.
S203, the electronic device equally divides the current image into a plurality of networks.
For each image, the electronic device first divides it into a plurality of equal grids, which may be, for example, grids of M x N pixels.
S204, the electronic equipment sequentially acquires one three-dimensional point from a plurality of three-dimensional points corresponding to the current image as the current three-dimensional point according to the descending order of the feature extraction response values.
The feature extraction response value refers to a response value of a feature point extracted in an image in the image feature extraction stage. The response value of the feature point is used for representing the strength of the feature point, more precisely, representing the degree of the corner point.
For each image, all three-dimensional points corresponding to the image are traversed to select the target three-dimensional point. Wherein the traversal order may be a descending order of feature extraction response values. The descending order of feature extraction response values refers to the order of feature extraction response values of image feature points corresponding to three-dimensional points from large to small. Note that an image feature point corresponding to a three-dimensional point can be understood as an image feature point used to generate the three-dimensional point.
S205, the electronic device judges whether the feature extraction response value of the feature point corresponding to the current three-dimensional point is larger than a first threshold value, if yes, S206 is executed, and if not, S208 is executed.
In this embodiment, the feature extraction response value of the image feature point corresponding to the target three-dimensional point needs to be larger than the first threshold value. That is, the three-dimensional points to be optimized in the first step of cluster adjustment need to be generated based on the two-dimensional image feature points with larger feature extraction response values.
S206, the electronic device judges whether the selected number of the three-dimensional points corresponding to the grids where the feature points corresponding to the current three-dimensional points are located is larger than a second threshold value, if not, S207 is executed, and if so, S208 is executed.
In this embodiment, in order to ensure the distribution balance of the three-dimensional points to be optimized during the first-step bundle adjustment, the electronic device defines the distribution of the two-dimensional image feature points corresponding to the target three-dimensional points. Wherein, in each image, the upper limit of the selected number of the three-dimensional points corresponding to the same grid is a second threshold. It should be noted that the selected number of three-dimensional points corresponding to one grid can be understood as the number of image feature points corresponding to the target three-dimensional point falling within the network. That is, the number of target feature points included in each image mesh is not greater than the second threshold, the target feature points being image feature points corresponding to the target three-dimensional points.
In this embodiment, when the electronic device traverses the three-dimensional points according to the descending order of the feature extraction response values to determine the target three-dimensional point, if the feature extraction response value of the two-dimensional image feature point corresponding to a certain three-dimensional point is greater than the first threshold, but the selected number of three-dimensional points currently corresponding to the image grid where the two-dimensional image feature point is located is greater than the second threshold, or in other words, the total number of image feature points included in the image grid where the image feature point is located is greater than the second threshold, the three-dimensional point cannot be selected as the target three-dimensional point any more.
S207, the electronic equipment takes the current three-dimensional point as a target three-dimensional point and updates the selected number of the three-dimensional points corresponding to each grid of the current image.
In this embodiment, when the electronic device traverses the three-dimensional points according to the descending order of the feature extraction response values to determine the target three-dimensional point, if the feature extraction response value of the image feature point corresponding to a certain three-dimensional point is greater than a first threshold, and the selected number of three-dimensional points currently corresponding to the image grid where the image feature point is located is not greater than a second threshold, or in other words, the total number of image feature points included in the image grid where the image feature point is located is not greater than the second threshold, the three-dimensional point may be selected as the target three-dimensional point.
After the electronic device selects a three-dimensional point as a target three-dimensional point, the selected number of the three-dimensional points corresponding to the image grid where the image feature points corresponding to the three-dimensional point are located can be updated, namely, the value of the selected number of the three-dimensional points is accumulated by 1. In each image, the initial value of the selected number of three-dimensional points corresponding to each image network is 0, or, the initial value of the total number of target feature points included in each image grid is 0.
S208, the electronic device judges whether all three-dimensional points corresponding to the current image are traversed, if yes, S209 is executed, and if not, S204 is executed.
Referring to S204-S207, the electronic device traverses each three-dimensional point corresponding to the current image until the traversal completes all three-dimensional points corresponding to the current image, and determines all target three-dimensional points corresponding to the current image.
In an alternative embodiment, referring to S204-S207, the electronic device traverses each three-dimensional point corresponding to the current image until the feature extraction response value of the image feature point corresponding to the current three-dimensional point is not greater than the first threshold. In this way, the electronic device does not need to process other three-dimensional points (the feature extraction response value of the corresponding image feature points is not necessarily larger than the first threshold value) after the sorting, so that the selection efficiency of the target three-dimensional points is improved.
S209, the electronic equipment judges whether all images corresponding to the camera pose are traversed, if not, S202 is executed, and if yes, S210 is executed.
Referring to S202-S208, the electronic device traverses each image corresponding to each camera pose to be optimized, until the traversing completes all images corresponding to the camera poses to be optimized, and determines all target three-dimensional points, that is, determines the three-dimensional points to be optimized during the first step of cluster adjustment.
S210, the electronic equipment performs bundling adjustment on the target three-dimensional point, the camera pose and the camera internal parameters to obtain the optimized camera pose and the camera internal parameters.
After the electronic equipment selects some important three-dimensional points (namely target three-dimensional points) from all three-dimensional points, the target three-dimensional points, the camera pose to be optimized and the camera internal parameters can be subjected to bundling adjustment, and the camera pose and the camera internal parameters after optimization are obtained.
In the first step of cluster adjustment optimization, the state increment to be solved is the increment of camera parameters (including camera pose and camera internal parameters) and the increment of partial three-dimensional point coordinates.
In the first step of cluster adjustment optimization, the incremental linear equation is written as:
wherein Deltax is C Delta x is the increment of camera parameter C P′ Is the increment of the P coordinate of the three-dimensional point of the target.
At the position ofIn (H) CC In the form of a diagonal array, only at H i,i Where there are non-0 blocks, H CC The dimension of (2) is the number of camera parameters C; h P′P′ In the form of a diagonal array, only at H j,j Where there are non-0 blocks, H P′P′ Is the number of target three-dimensional points (i.e., selected map points) P'; h CP′ Is H P′C The transpose of (2) may be a sparse matrix or a dense matrix, depending on the particular observation data.
In the present embodiment, since the current step of beam adjustment optimizes a part of three-dimensional points (i.e. target three-dimensional points), and camera parameters (including camera pose and camera internal parameters), thenThe matrix (H matrix) may be as shown in fig. 6 a. The bundling adjustment optimization in this step is a partial three-dimensional point (i.e., target three-dimensional point), and the number of target three-dimensional points is relatively reduced. For example, the number of all three-dimensional points is about several hundred times or even ten times the number of camera poses, and the number of target three-dimensional points is about several hundred times or even ten times the number of camera poses. Thus, the lower left corner of the H matrix (i.e., H P′C ) And the upper right corner portion (i.e. H CP′ ) The dimensions of (a) are greatly reduced, namely, the observation data distributed in the upper right corner part and the lower left corner part of the H matrix are greatly reduced. Furthermore, the solution time required for the first step of cluster adjustment optimization is also reduced.
S211, the electronic equipment takes the camera pose and the camera internal parameters after optimization as fixed values, and performs bundling adjustment on all three-dimensional points to obtain all the three-dimensional points after optimization.
After the first step of optimization is completed to obtain the optimized camera pose and camera internal parameters, only bundling adjustment is carried out on all three-dimensional points in the second step of optimization to obtain all the optimized three-dimensional points.
In the second step of cluster adjustment optimization, the state increment to be solved is the increment of all three-dimensional point coordinates.
In the second step of cluster adjustment optimization, the incremental linear equation is written as:
H PP Δx P =b P the method comprises the steps of carrying out a first treatment on the surface of the Wherein,
H PP in the form of a diagonal array, only at H j,j Where there are non-0 blocks, H PP Is the number of all three-dimensional points P.
In the present embodiment, since the current step of bundling adjustment optimizes only all three-dimensional points, H PP The matrix may be as shown in fig. 6 b. At this time, the incremental linear equation H PP Δx P =b P The method can directly solve, does not need to do Shull elimination processing, and takes less time to solve for the second step of cluster adjustment optimization.
At this time, the electronic device may obtain the optimized camera pose, the camera internal parameters, and all three-dimensional points, and update the camera pose, the three-dimensional points (or map points), and the camera internal parameters obtained in S201.
The electronic device performs two-step optimization to complete the adjustment of the camera pose, the three-dimensional point (or map point) and the camera internal parameters acquired by the electronic device in S201. Furthermore, the electronic device may reconstruct a three-dimensional model according to the optimized data, where the three-dimensional model may include a sparse three-dimensional point cloud and pose of each camera.
In this way, in the method provided in this embodiment, the bundle adjustment optimization is divided into two steps of optimizing the pose of the camera, part of the map point positions, the camera internal parameters, and then optimizing all the map point positions. The partial map points optimized in the first step are selected according to a certain strategy, and the optimization solving time is greatly reduced under the condition that the optimization accuracy is not reduced by the two-step optimization method.
Fig. 7 shows a time-consuming comparison result diagram of bundle adjustment based on the general method and the method according to the scheme. As shown in fig. 7, when the number of three-dimensional modeling images is the same, the time consumption of bundle adjustment by the method according to the scheme is less than that of bundle adjustment by a general method. Moreover, as the number of three-dimensional modeling images increases, the time consumption of the bundling adjustment by adopting the method of the scheme is obviously reduced.
The present embodiment also provides a computer storage medium having stored therein computer instructions that, when executed on an electronic device, cause the electronic device to execute the above-described related method steps to implement the bundle adjustment method in the above-described embodiments.
The present embodiment also provides a computer program product, which when run on a computer, causes the computer to perform the above-mentioned related steps to implement the bundle adjustment method in the above-mentioned embodiments.
In addition, embodiments of the present application also provide an apparatus, which may be specifically a chip, a component, or a module, and may include a processor and a memory connected to each other; the memory is used for storing computer-executed instructions, and when the device is operated, the processor can execute the computer-executed instructions stored in the memory, so that the chip executes the bundling adjustment method in each method embodiment.
The electronic device, the computer storage medium, the computer program product, or the chip provided in this embodiment are used to execute the corresponding methods provided above, so that the beneficial effects thereof can be referred to the beneficial effects in the corresponding methods provided above, and will not be described herein.
It will be appreciated by those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional modules is illustrated, and in practical application, the above-described functional allocation may be performed by different functional modules according to needs, i.e. the internal structure of the apparatus is divided into different functional modules to perform all or part of the functions described above.
In the several embodiments provided in this application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of modules or units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another apparatus, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The above embodiments are merely for illustrating the technical solution of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.
Claims (11)
1. A bundle adjustment method, comprising:
acquiring the pose of a camera to be optimized, internal parameters of the camera and all three-dimensional points;
determining target three-dimensional points in all three-dimensional points according to a preset strategy;
performing cluster adjustment optimization on the camera pose to be optimized, the camera internal parameters and the target three-dimensional points to obtain optimized camera pose and camera internal parameters;
taking the optimized camera pose and camera internal parameters as constant values, and performing cluster adjustment optimization on all three-dimensional points to obtain all the optimized three-dimensional points;
the processing of the bundle adjustment optimization is as follows: solving a three-dimensional point re-projection error according to the pose of the camera, the internal parameters of the camera, the three-dimensional coordinates of the three-dimensional point and the two-dimensional coordinates of the three-dimensional point in each image, and carrying out nonlinear optimization processing for minimizing the three-dimensional point re-projection error.
2. The method of claim 1, wherein the data quality of the target three-dimensional point is better than the data quality of all three-dimensional points; wherein the data quality is used to characterize the degree of accuracy of the three-dimensional points when used in three-dimensional reconstruction.
3. The method according to claim 1 or 2, wherein determining a target three-dimensional point among the all three-dimensional points according to a preset strategy comprises:
Traversing the image corresponding to the camera position to be optimized;
selecting the target three-dimensional point from the three-dimensional points corresponding to each image; and the feature extraction response value of the image feature point corresponding to the target three-dimensional point is larger than a first threshold value.
4. A method according to claim 3, further comprising:
equally dividing each image into a plurality of image grids;
wherein the number of target feature points included in each image grid is not greater than a second threshold; the target feature points are image feature points corresponding to the target three-dimensional points.
5. The method of claim 4, wherein selecting the target three-dimensional point from the three-dimensional points corresponding to each image comprises:
arranging three-dimensional points corresponding to each image in descending order of feature extraction response values;
sequentially obtaining a three-dimensional point as a current three-dimensional point according to the descending order of the feature extraction response values;
if the feature extraction response value of the image feature points corresponding to the current three-dimensional points is larger than a first threshold value and the total number of target feature points included in the current image grid is not larger than a second threshold value, taking the current three-dimensional points as the target three-dimensional points and updating the total number of target feature points included in the current image grid; the current image grid is the image grid where the image feature points corresponding to the current three-dimensional points are located;
And sequentially obtaining a three-dimensional point as a current three-dimensional point according to the feature extraction response value descending order until each three-dimensional point corresponding to each image is traversed, or until the feature extraction response value of the image feature point corresponding to the current three-dimensional point is traversed to be not more than the first threshold value.
6. The method according to claim 1 or 2, wherein the difference between the number of all three-dimensional points and the number of camera poses is greater than a preset number threshold.
7. The method according to claim 1 or 2, wherein acquiring the camera pose to be optimized, the camera internal parameters and all three-dimensional points comprises:
and acquiring the pose of the camera, the internal parameters of the camera and all three-dimensional points to be optimized during local bundling adjustment.
8. The method according to claim 1 or 2, wherein acquiring the camera pose to be optimized, the camera internal parameters and all three-dimensional points comprises:
and acquiring the pose of the camera, the internal parameters of the camera and all three-dimensional points to be optimized during global bundling adjustment.
9. The method of claim 1, wherein solving the three-dimensional point re-projection error based on the camera pose, the camera internal parameters, the three-dimensional coordinates of the three-dimensional point, and the two-dimensional coordinates of the three-dimensional point in each image, and performing a nonlinear optimization process that minimizes the three-dimensional point re-projection error, comprises:
And realizing nonlinear optimization processing for minimizing the three-dimensional point re-projection error based on the following formula:
wherein f (C, P) is the sum of the reprojection errors corresponding to the three-dimensional points, N is the number of images, D is the number of feature points, and P j For the three-dimensional point coordinate corresponding to the jth feature point, p ji For the two-dimensional coordinates of the jth feature point in the ith image, ci=ki [ Ri, ti ]]K is the internal reference of the camera, [ R, t ]]For camera pose, R is rotationMatrix, t is the translation vector.
10. An electronic device, comprising:
one or more processors;
a memory;
and one or more computer programs, wherein the one or more computer programs are stored on the memory, which when executed by the one or more processors, cause the electronic device to perform the bundle adjustment method of any of claims 1-9.
11. A computer readable storage medium comprising a computer program, characterized in that the computer program, when run on an electronic device, causes the electronic device to perform the bundle adjustment method according to any of the claims 1-9.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311288934.5A CN117372612B (en) | 2022-08-03 | Bundling adjustment method and electronic equipment |
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311288934.5A CN117372612B (en) | 2022-08-03 | Bundling adjustment method and electronic equipment | |
CN202210926339.9A CN116051723B (en) | 2022-08-03 | 2022-08-03 | Bundling adjustment method and electronic equipment |
Related Parent Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210926339.9A Division CN116051723B (en) | 2022-08-03 | 2022-08-03 | Bundling adjustment method and electronic equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN117372612A true CN117372612A (en) | 2024-01-09 |
CN117372612B CN117372612B (en) | 2024-08-27 |
Family
ID=
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104933755A (en) * | 2014-03-18 | 2015-09-23 | 华为技术有限公司 | Static object reconstruction method and system |
CN109242959A (en) * | 2018-08-29 | 2019-01-18 | 清华大学 | Method for reconstructing three-dimensional scene and system |
CN110211223A (en) * | 2019-05-28 | 2019-09-06 | 哈工大新材料智能装备技术研究院(招远)有限公司 | A kind of increment type multiview three-dimensional method for reconstructing |
US20200134847A1 (en) * | 2018-10-31 | 2020-04-30 | Bentley Systems, Incorporated | Structure depth-aware weighting in bundle adjustment |
CN112102458A (en) * | 2020-08-31 | 2020-12-18 | 湖南盛鼎科技发展有限责任公司 | Single-lens three-dimensional image reconstruction method based on laser radar point cloud data assistance |
CN112767541A (en) * | 2021-01-15 | 2021-05-07 | 浙江商汤科技开发有限公司 | Three-dimensional reconstruction method and device, electronic equipment and storage medium |
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104933755A (en) * | 2014-03-18 | 2015-09-23 | 华为技术有限公司 | Static object reconstruction method and system |
US20160350904A1 (en) * | 2014-03-18 | 2016-12-01 | Huawei Technologies Co., Ltd. | Static Object Reconstruction Method and System |
CN109242959A (en) * | 2018-08-29 | 2019-01-18 | 清华大学 | Method for reconstructing three-dimensional scene and system |
US20200134847A1 (en) * | 2018-10-31 | 2020-04-30 | Bentley Systems, Incorporated | Structure depth-aware weighting in bundle adjustment |
CN110211223A (en) * | 2019-05-28 | 2019-09-06 | 哈工大新材料智能装备技术研究院(招远)有限公司 | A kind of increment type multiview three-dimensional method for reconstructing |
CN112102458A (en) * | 2020-08-31 | 2020-12-18 | 湖南盛鼎科技发展有限责任公司 | Single-lens three-dimensional image reconstruction method based on laser radar point cloud data assistance |
CN112767541A (en) * | 2021-01-15 | 2021-05-07 | 浙江商汤科技开发有限公司 | Three-dimensional reconstruction method and device, electronic equipment and storage medium |
Non-Patent Citations (2)
Title |
---|
安帅;杨杰;乔羽;李鹏;: "基于单目增量式稀疏SFM研究与实现", 青岛大学学报(自然科学版), no. 02, 15 May 2018 (2018-05-15), pages 102 - 106 * |
邱笑晨;赵晨旭;张海;许辉;: "ORB-SLAM系统优化框架分析概述", 导航定位与授时, no. 03, 15 May 2019 (2019-05-15), pages 45 - 50 * |
Also Published As
Publication number | Publication date |
---|---|
CN116051723B (en) | 2023-10-20 |
CN116051723A (en) | 2023-05-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10963727B2 (en) | Method, device and storage medium for determining camera posture information | |
US20160292900A1 (en) | Image group processing and visualization | |
Chen et al. | An improved augmented reality system based on AndAR | |
US9058655B2 (en) | Region of interest based image registration | |
WO2011161579A1 (en) | Method, apparatus and computer program product for providing object tracking using template switching and feature adaptation | |
CN108776822B (en) | Target area detection method, device, terminal and storage medium | |
CN112041887A (en) | Efficient parallel optical flow algorithm and GPU implementation | |
WO2023124948A1 (en) | Three-dimensional map creation method and electronic device | |
CN114782296B (en) | Image fusion method, device and storage medium | |
CN113436338A (en) | Three-dimensional reconstruction method and device for fire scene, server and readable storage medium | |
CN114298902A (en) | Image alignment method and device, electronic equipment and storage medium | |
US11908096B2 (en) | Stereoscopic image acquisition method, electronic device and storage medium | |
CN116630139A (en) | Method, device, equipment and storage medium for generating data | |
CN112734772B (en) | Image processing method, image processing apparatus, electronic device, and storage medium | |
CN112288878B (en) | Augmented reality preview method and preview device, electronic equipment and storage medium | |
CN114170366B (en) | Three-dimensional reconstruction method based on dotted line feature fusion and electronic equipment | |
CN117372612B (en) | Bundling adjustment method and electronic equipment | |
CN116051723B (en) | Bundling adjustment method and electronic equipment | |
CN115933949A (en) | Coordinate conversion method and device, electronic equipment and storage medium | |
CN115880347B (en) | Image processing method, electronic device, storage medium, and program product | |
CN111652831B (en) | Object fusion method and device, computer-readable storage medium and electronic equipment | |
CN115100536A (en) | Building identification method, building identification device, electronic equipment and computer readable medium | |
CN111784607A (en) | Image tone mapping method, device, terminal equipment and storage medium | |
CN116091572B (en) | Method for acquiring image depth information, electronic equipment and storage medium | |
CN117131213B (en) | Image processing method and related equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant |