Camera pose estimation method, apparatus, device, and storage medium
By projecting image coordinate points and 3D coordinate points onto the camera's standardized sphere, the problem of inconsistent errors caused by distortion in camera pose calculation is solved, achieving more accurate camera pose estimation and map construction.
Patent Information
- Application Number
- CN202310146152.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-14
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2043-02-14
AI Technical Summary
In existing technologies, distortion occurs when a camera captures an image, resulting in varying projection errors of image feature points at different locations. Using the same error threshold to determine matching accuracy is inaccurate and affects the accuracy of camera pose calculation.
Image coordinate points and 3D coordinate points are projected onto the camera's standardized sphere to make each point equidistant from the camera's optical center. The camera pose is calculated using a personalized error threshold, and the distortion effect is eliminated by projecting onto the standardized sphere.
It improves the accuracy of camera pose calculation, reduces the chance of the algorithm getting stuck in local minima, and improves computational efficiency and map construction accuracy.
Smart Images

Figure CN116309801B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of machine vision technology, specifically to a camera pose estimation method, apparatus, device, and storage medium. Background Technology
[0002] Currently, robots used for real-time mapping and localization are typically equipped with one or more cameras. Optimizing the camera pose of these cameras is of great significance for processes such as map building, localization, and target tracking.
[0003] In related technologies, 3D points in the camera scene and points in the image captured by the camera are projected onto the camera's normalized plane, respectively. The camera pose is then calculated based on the reprojection error between the two projections onto the normalized plane. During this process, the same error threshold is used to determine whether the projected coordinates of each point in the 2D image on the normalized plane match the projected coordinates of the corresponding 3D point in the real-world scene on the normalized plane.
[0004] Because cameras capture 2D images, they distort the 3D information of the real-world scene, and the degree of distortion varies at different locations. The aforementioned techniques use the same error threshold for each point to determine if the projection matches, which leads to inaccurate camera pose calculations or even causes the calculation to fail. Summary of the Invention
[0005] To address the above issues, this application provides a camera pose estimation method, apparatus, device, and storage medium. It projects both image coordinate points and three-dimensional coordinate points in the displayed scene onto the camera's normalized sphere. Since the distance from each point on the normalized sphere to the camera's optical center is equal, the influence of each image coordinate point on the pose is equal. Using the same error threshold for each point also allows for accurate calculation of the camera's pose, reducing the adverse effects of image distortion on camera pose calculation.
[0006] In a first aspect, embodiments of this application provide a camera pose estimation method, including:
[0007] By capturing images of a real-world scene with a camera, image coordinate points corresponding to pre-calculated three-dimensional coordinate points in the real-world scene are obtained from the images;
[0008] The image coordinates are projected onto the normalized sphere of the camera to obtain the first projected coordinates corresponding to the image coordinates. The normalized sphere is a sphere with the optical center of the camera as its center.
[0009] The three-dimensional coordinate points are projected onto the normalized sphere to obtain the second projected coordinates corresponding to the three-dimensional coordinate points.
[0010] The pose of the camera is calculated based on the three-dimensional coordinate point, the first projected coordinate corresponding to the image coordinate point, and the second projected coordinate corresponding to the three-dimensional coordinate point.
[0011] An embodiment of the second aspect of this application provides a camera pose estimation device, comprising:
[0012] The acquisition module is used to capture images of a real scene using a camera and obtain image coordinate points from the images that correspond to pre-calculated three-dimensional coordinate points in the real scene.
[0013] The projection module is used to project the image coordinate points onto the normalized sphere of the camera to obtain the first projected coordinates corresponding to the image coordinate points, wherein the normalized sphere is a sphere with the optical center of the camera as its center; and to project the three-dimensional coordinate points onto the normalized sphere to obtain the second projected coordinates corresponding to the three-dimensional coordinate points.
[0014] The pose calculation module is used to calculate the pose of the camera based on the three-dimensional coordinate point, the first projected coordinate corresponding to the image coordinate point, and the second projected coordinate corresponding to the three-dimensional coordinate point.
[0015] An embodiment of the third aspect of this application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, it implements the method described in the first aspect above.
[0016] An embodiment of the fourth aspect of this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method described in the first aspect above.
[0017] An embodiment of the fifth aspect of this application provides a computer program product including a computer program that is executed by a processor to implement the method described in the first aspect above.
[0018] The technical solutions provided in this application embodiment have at least the following technical effects or advantages:
[0019] This application's embodiments project image coordinate points in a camera-captured image and their corresponding 3D coordinate points in the world coordinate system onto a normalized sphere of the camera, solving the problem of minimizing the projection error of these two points projected onto the normalized sphere. By projecting onto the normalized sphere, all projected points are at the same distance from the camera's optical center, thus all points contribute equally to the pose. This makes iterative optimization of the pose easier to converge, the calculation process more reasonable, reduces the possibility of the algorithm getting trapped in local minima during iterative calculation of camera pose, and improves the accuracy of the calculated pose.
[0020] Furthermore, it can simultaneously optimize the pose at multiple moments during camera motion through a single optimization iteration, improving the efficiency of pose optimization calculations. Simultaneously with pose optimization, the coordinates of points in the map constructed during camera motion can also be optimized, improving the accuracy of the constructed map.
[0021] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description
[0022] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the scope of this application. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:
[0023] Figure 1 This shows a geometric view of a 3D coordinate point in a real-world scene projected onto a camera image;
[0024] Figure 2 A flowchart of a camera pose estimation method provided in an embodiment of this application is shown;
[0025] Figure 3 This illustration shows a schematic diagram of image coordinate points on an image captured by a camera according to an embodiment of this application projected onto the normalized sphere of the camera;
[0026] Figure 4 This illustration shows a schematic diagram of the structure of a camera pose estimation device provided in an embodiment of this application;
[0027] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of this application is shown. Detailed Implementation
[0028] Exemplary embodiments of this application will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of this application are shown in the drawings, it should be understood that this application may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of this application and to fully convey the scope of this application to those skilled in the art.
[0029] First, the terms used in the embodiments of this application will be explained:
[0030] Image pixel coordinate system: In an image captured by a camera, a planar coordinate system is constructed with the top left corner as the origin of the image coordinate system, the horizontal direction as the x-axis, and the vertical direction as the y-axis.
[0031] Camera coordinate system: The origin is the optical center of the camera, the z-axis is the front of the camera's field of view, and the x and y axes are in the same direction as the x and y axes of the image coordinate system.
[0032] World coordinate system: A fixed coordinate system in three-dimensional space, used as a reference coordinate system to describe the position of objects in three-dimensional space.
[0033] A standardized sphere is a sphere with the camera's optical center as its center and a radius of unit length. Its surface is a two-dimensional manifold embedded in the camera's coordinate system within a three-dimensional space. The unit length can be 1 meter or 1.5 meters, etc.
[0034] First projection coordinates: The projection coordinates of image coordinate points in the image captured by the camera onto a normalized sphere.
[0035] Second projection coordinates: The projection coordinates of the three-dimensional coordinate points corresponding to the image coordinate points in the image captured by the camera onto the normalized sphere.
[0036] Currently, robots capable of real-time mapping and localization are frequently used in various scenarios, including daily life and industrial production. These robots are equipped with at least one camera, which captures images of the surrounding scene to build maps and locate targets. Because these robots often need to track and locate targets during their operations, they typically use cameras with a large field of view, such as fisheye cameras, to cover as large an area of the scene as possible.
[0037] For cameras on robots, estimating the camera's pose during robot movement is crucial, playing an irreplaceable role in map building, target localization, and tracking. However, the projection of 3D information from the real-world scene onto the 2D image captured by the camera introduces distortion. The larger the camera's field of view, the greater the distortion, and points closer to the edges of the image experience the greatest distortion.
[0038] Figure 1 This shows a geometric view of a 3D coordinate point in a real-world scene projected onto a camera image. For example... Figure 1As shown, the intersection of the line connecting the 3D coordinate point and the camera's optical center with the camera's imaging plane constitutes the image captured by the camera. This intersection is the image coordinate point corresponding to the 3D coordinate point in the image captured by the camera. In related technologies, the 3D coordinate point and its corresponding image coordinate point are projected onto alternating normalized planes to obtain the projected coordinates of the 3D coordinate point and the projected coordinates of the corresponding image coordinate point. The camera pose is calculated based on the reprojection error between the two projections onto the normalized plane. In this process, the same error threshold is used to determine whether the projected coordinates of each image coordinate point on the normalized plane match the projected coordinates of the corresponding 3D coordinate point on the normalized plane. The distance between the center point of the normalized plane and the camera's optical center can be a preset distance, such as 1 meter or 1.5 meters.
[0039] While the aforementioned techniques can be used to determine camera pose, the inventors of this application have discovered that due to distortion during image capture, the projection errors of image feature points at different locations on the image onto the standardized plane vary significantly. The aforementioned techniques use the same error threshold for different points to determine projection matching; however, given the distortion, using the same threshold is clearly unreasonable, reducing the accuracy of pose calculation and potentially causing it to fail.
[0040] Based on this, embodiments of this application provide a camera pose estimation method, apparatus, device, and storage medium. This application projects image coordinate points and three-dimensional coordinate points onto a normalized sphere of the camera. Each point on this normalized sphere is equidistant from the camera's optical center. Therefore, projecting image coordinate points onto the normalized sphere eliminates the influence of varying degrees of distortion caused by image coordinate points at different locations, ensuring that each image coordinate point has the same impact during camera pose calculation, thereby improving the accuracy of pose calculation. The following detailed description of the embodiments of this application is provided in conjunction with the accompanying drawings.
[0041] See Figure 2 The flowchart shown illustrates a camera pose estimation method, which specifically includes the following steps:
[0042] Step 101: Capture an image of the real scene using a camera, and obtain the image coordinates corresponding to the pre-calculated 3D coordinates in the real scene from the image.
[0043] The cameras used in the embodiments of this application may include pinhole cameras or fisheye cameras, etc.
[0044] The aforementioned real-world scenario can be any scene in three-dimensional space. Multiple three-dimensional coordinate points in the world coordinate system can be calculated in the real-world scene through triangulation or manual measurement. By capturing the real-world scene with a camera, the resulting image contains the image coordinates corresponding to the pre-calculated three-dimensional coordinate points.
[0045] In some embodiments, the correspondence between image coordinate points in an image and 3D coordinate points in 3D space can be determined as follows: Specifically, a calibration board such as a checkerboard is given in the image. A world coordinate system is determined based on the calibration board, for example, with the first checkerboard corner point as the origin of the world coordinate system, the longer side of the checkerboard as the x-axis, and the shorter side as the y-axis. If the length and shortness of the checkerboard are equal, any side can be chosen as the x-axis. The direction of the z-axis is determined according to the selected x-axis, y-axis, and right-hand screw rule. In this established coordinate system, the interval of the checkerboard is fixed, so the 3D coordinates of each corner point of the checkerboard in this coordinate system are fixed, thus obtaining the 3D coordinates of each checkerboard corner point. In this image, the image coordinates of each checkerboard corner point in the image can also be determined based on the image pixel coordinate system, thus obtaining the 3D coordinates of the same corner point in the world coordinate system and its image coordinates in the image, thereby obtaining multiple sets of correspondences between image coordinate points and 3D coordinate points. At least three sets of point pairs are required for each pose calculation.
[0046] In other embodiments, the camera captures the same point in three-dimensional space at two different times, and the relative positional relationship between the cameras at different times is known. In this case, the triangulation principle of binocular imaging is used to calculate the three-dimensional coordinates of the point in three-dimensional space. For the images captured by the camera at the two different times, feature points are extracted from the images, and each feature point has a unique descriptor. If the similarity between the descriptor of a point in one image and the descriptor of a point in another image is greater than a threshold, then it is determined that the two points in the two images were captured from the same point in three-dimensional space. This allows for the determination of a one-to-one mapping relationship between image coordinates and three-dimensional coordinates.
[0047] Step 102: Project the image coordinate points onto the camera's normalized sphere to obtain the first projected coordinates corresponding to the image coordinate points. The normalized sphere is a sphere with the camera's optical center as its center.
[0048] Figure 3 This diagram illustrates the projection of image coordinates from a captured image onto the camera's normalized sphere. (See diagram for example.) Figure 3 As shown, when a 3D coordinate point in the world coordinate system is projected onto the camera's image, it will also have a unique intersection with the camera's normalized sphere. This intersection is the first projected coordinate of the corresponding image coordinate point on the camera image projected onto the normalized sphere.
[0049] After obtaining multiple image coordinate points through step 101, each obtained image coordinate point is projected onto the normalized sphere of the camera to obtain the first projected coordinates corresponding to each image coordinate point.
[0050] Specifically, the image coordinates are first projected onto the camera's normalized plane to obtain the coordinates of the corresponding image coordinates on the normalized plane. Then, the transformation parameters for converting the camera's normalized plane coordinates to the camera's normalized spherical coordinates are calculated. Based on the calculated transformation parameters, the coordinates of the corresponding image coordinates on the normalized plane are transformed onto the camera's normalized sphere to obtain the first projected coordinates of the image coordinates projected onto the normalized sphere.
[0051] The following example uses a pinhole camera to illustrate the specific process of projecting image coordinate points onto the standardized sphere of a fisheye camera.
[0052] The first step is to project the image coordinates of the image captured by the fisheye camera onto the normalized plane of the fisheye camera using the following formula (1).
[0053]
[0054] In formula (1), p x and p y These are the x and y coordinates of the image coordinate points, respectively. x f y c x and c y This refers to the camera's internal parameters. Let the coordinates of the image coordinate point be projected onto the normalized plane of the pinhole camera.
[0055] The second step is to calculate the transformation parameters from the standardized planar coordinates of the pinhole camera to the standardized spherical coordinates of the pinhole camera using the following formula (2).
[0056]
[0057] In formula (2), β=θ-α,
[0058] Where s is the transformation parameter mentioned above. for The first two coordinates and The sum of squares. k0, k1, k2, and k3 are the camera distortion coefficients.
[0059] The third step is to transform the coordinate points on the normalized plane corresponding to the image coordinate points to the normalized sphere of the camera using the following formula (3) based on the calculated transformation parameters.
[0060]
[0061] In formula (3), p i The first projected coordinates of the image coordinate point onto the normalized sphere.
[0062] For each image coordinate point obtained in step 101, multiple sets of correspondences between image coordinate points and the first projection coordinates were obtained in the manner described above.
[0063] Step 103: Project the three-dimensional coordinate points onto the normalized sphere to obtain the second projected coordinates corresponding to the three-dimensional coordinate points.
[0064] After obtaining the correspondence between multiple sets of image coordinate points and three-dimensional coordinate points through step 101, each three-dimensional coordinate point is also projected onto the normalized sphere of the camera to obtain the second projected coordinates corresponding to each three-dimensional coordinate point.
[0065] First, the initial pose of the camera is calculated based on the first projected coordinates corresponding to each image coordinate point and each 3D coordinate point. Specifically, the initial value of the camera's rotation matrix is calculated based on the first projected coordinates corresponding to each image coordinate point and each 3D coordinate point. The initial value of the camera's displacement vector is set to zero. Based on the initial values of the rotation matrix and displacement vector, the initial pose of the camera is constructed.
[0066] The initial values of the rotation matrix can be obtained by inputting the first projected coordinates and the three-dimensional coordinates corresponding to each image coordinate point into a preset pose estimation algorithm. The preset pose estimation algorithm can include PnP (Perspective-n-Point) algorithms, such as the P3P algorithm.
[0067] The initial pose value constructed in the above manner can be represented by the following formula (4).
[0068]
[0069] In formula (4), T cw R is the initial pose value. cw Let t be the initial value of the rotation matrix. cw This is the initial value of the displacement vector.
[0070] After obtaining the initial pose value of the camera, based on the initial pose value and each 3D coordinate point, the second projected coordinates obtained by projecting each 3D coordinate point onto the normalized sphere are calculated. Since the method for calculating the second projected coordinates of each 3D coordinate point is the same, the specific calculation process is illustrated using a single 3D coordinate point as an example. This application refers to this 3D coordinate point as the first 3D coordinate point, which can be any one of the 3D coordinate points obtained in step 101.
[0071] Specifically, firstly, the product of the initial pose value and the coordinate vector of the first 3D coordinate point is calculated to obtain the second 3D coordinate point corresponding to the first 3D coordinate point in the camera's camera coordinate system. Then, the norm of the coordinate vector of the second 3D coordinate point is taken, and the ratio between the coordinate vector of the second 3D coordinate point and the norm is calculated to obtain the second projected coordinates of the first 3D coordinate point on the normalized sphere.
[0072] Specifically, the second projected coordinates can be calculated using the projection function of the three-dimensional coordinate points shown in the following formula (5).
[0073]
[0074] In formula (5), P wi Let i be the i-th three-dimensional coordinate point. Let T be the second projected coordinate of the i-th 3D coordinate point projected onto the normalized sphere. cw The initial pose of the camera.
[0075] For each three-dimensional coordinate point obtained in step 101, the second projected coordinates corresponding to each three-dimensional coordinate point are calculated in the manner described above.
[0076] In the process of calculating the three-dimensional coordinate points described above, T cw P wi That is, to set the i-th three-dimensional coordinate point P in the world coordinate system wi The second 3D coordinate point obtained by transforming to the camera coordinate system. ||T cw P wi To obtain the norm of the second three-dimensional coordinate point, calculate the second three-dimensional coordinate point T. cw P wi Its norm ||T cw P wi The ratio of || is used to obtain the i-th three-dimensional coordinate point P. wi The second projected coordinates on the normalized sphere. Where the norm ||T cw P wiThe || contains information about the x, y, and z coordinates of the second three-dimensional coordinate point. Compared to related technologies that only use the z coordinate, this embodiment utilizes the complete coordinate information of the second three-dimensional coordinate point. This allows for higher accuracy in calculating the second projection coordinates of the three-dimensional point projected onto the standardized sphere in the world coordinate system. Consequently, when using the calculated second projection coordinates for subsequent camera pose calculations, it reduces the possibility of pose optimization iterations getting trapped in local minima, thus improving the accuracy of pose calculation.
[0077] The embodiments of this application do not limit the execution order of the above steps 102 and 103. In actual application, these two steps can be executed synchronously or in any order.
[0078] Steps 102 and 103 respectively obtain the first projected coordinates of each image coordinate point projected onto the normalized sphere, and the second projected coordinates of the corresponding three-dimensional coordinate point on the normalized sphere. Then, the pose of the connected points is calculated through the operation in step 104.
[0079] Step 104: Calculate the camera pose based on the first projected coordinates corresponding to the 3D coordinate points and the image coordinate points, and the second projected coordinates corresponding to the 3D coordinate points.
[0080] After obtaining the first projected coordinates corresponding to each image coordinate point and the second projected coordinates corresponding to the three-dimensional coordinates of each image coordinate point in the world coordinate system, the difference between the first projected coordinates and the second projected coordinates of the three-dimensional coordinates of each image coordinate point is calculated to obtain the projection error corresponding to each three-dimensional coordinate point. Specifically, the projection error corresponding to each three-dimensional coordinate point can be calculated using the following formula (6).
[0081]
[0082] In formula (6), e i Let P be the i-th three-dimensional coordinate point. wi The corresponding projection error, p i Let P be the i-th three-dimensional coordinate point. wi The corresponding image coordinates are projected onto the first coordinate of the normalized sphere. Let P be the i-th three-dimensional coordinate point. wi The second projected coordinates on the normalized sphere. T cw The initial pose of the camera.
[0083] Due to the calculation of the second projected coordinates The three-dimensional coordinate point P in the world coordinate system was used. wiThe x, y, and z coordinates of the corresponding second 3D coordinate point in the camera coordinate system make the second projected coordinates The accuracy is very high, which also helps to improve the accuracy of three-dimensional coordinate point P. wi The accuracy of the corresponding projection error.
[0084] After obtaining the projection error corresponding to each 3D coordinate point, the projection error from the 3D coordinate point to the camera's normalized sphere in the world coordinate system is optimized based on the camera's initial pose, the projection error corresponding to each 3D coordinate point, and each 3D coordinate point, to obtain the camera's pose.
[0085] Specifically, the first total projection error is calculated based on the projection error corresponding to each three-dimensional coordinate point. The first total projection error can be obtained by summing the projection errors corresponding to each three-dimensional coordinate point. Alternatively, the first total projection error function can be obtained by summing the squares of the projection error magnitudes of all three-dimensional coordinate points, and calculated using the following formula (7).
[0086]
[0087] In formula (7), error1 is the first total projection error, e i Let be the projection error corresponding to the i-th 3D coordinate point.
[0088] This application also calculates the Jacobian matrix of the projection error required during the optimization process, where the optimization variable is the camera pose.
[0089] Specifically, based on the camera's initial pose value, each 3D coordinate point, and the corresponding projection error of each 3D coordinate point, the first Jacobian matrix of the projection error of each 3D coordinate point relative to the initial pose value is calculated. The specific calculation process is as follows.
[0090] Let P be the i-th three-dimensional coordinate point in the world coordinate system. wi The corresponding 3D coordinate point in the camera coordinate system is P. ci Then let P ci =T cw P wi =[X ci ,Y ci Z ci ] T The projection error e corresponding to the i-th three-dimensional coordinate point is calculated using the following formula (8). i For the three-dimensional coordinate point P in the camera coordinate system ci The first Lie algebra derivative is obtained. And, the three-dimensional coordinates of point P in the camera coordinate system are calculated using formula (9). ciThe second Lie algebra is derived with respect to the initial pose of the camera. The product of the derivatives of the first and second Lie algebras is calculated using formula (10) to obtain the projection error e corresponding to the i-th three-dimensional coordinate point. i The first Jacobian matrix for the initial pose values.
[0091]
[0092]
[0093]
[0094] In formulas (8), (9) and (10), I is the identity matrix, X ci ,Y ci and Z ci These are the three-dimensional coordinates of point P in the camera coordinate system. ci x, y, and z coordinates
[0095] The steps of calculating the first total projection error and the first Jacobian matrix can be performed simultaneously or sequentially in any order.
[0096] Then, based on the initial pose of the camera, the first total projection error, and the first Jacobian matrix corresponding to each 3D coordinate point, the first total projection error function is optimized iteratively using a preset optimization algorithm. The pose value when the first total projection error function reaches its minimum value is taken as the camera pose. The preset optimization algorithm can be the LM (Levenberg-Marquardt) algorithm, Newton's method, or Gauss-Newton's method, etc. The implemented optimization model is shown in formula (11).
[0097]
[0098] In formula (11), SE3 represents the transformation space of all rigid bodies, and error1 is the first total projection error.
[0099] The initial pose value, the first total projection error, and the first Jacobian matrix corresponding to each 3D coordinate point are input into the LM algorithm. The LM algorithm performs optimization iterations until the minimum value of the first total projection error is found, at which point the iteration stops. The pose value at which the first total projection error reaches its minimum value is taken as the current pose of the camera.
[0100] This application's embodiments project image coordinate points in a camera-captured image and their corresponding 3D coordinate points in the world coordinate system onto a normalized sphere of the camera, solving the problem of minimizing the projection error of these two points projected onto the normalized sphere. By projecting onto the normalized sphere, all projected points are at the same distance from the camera's optical center, thus all points contribute equally to the pose. This makes iterative optimization of the pose easier to converge, the calculation process more reasonable, reduces the possibility of the algorithm getting trapped in local minima during iterative calculation of camera pose, and improves the accuracy of the calculated pose.
[0101] The camera pose estimation method provided in the above embodiments allows for the calculation of the camera's current pose after each image is captured in a real-world scene. In another application scenario, considering the robot's movement, the camera mounted on the robot moves with it, and this movement may affect the accuracy of the calculated camera pose. Therefore, in some other embodiments of this application, an overall optimization adjustment is performed on the camera's pose at multiple moments during its movement.
[0102] During the robot's movement, cameras on it capture multiple images of the real-world scene at different times. Assume that for T moments in the movement, the camera captures one image at each of those T moments, resulting in a total of T images. For K 3D coordinate points in the real-world scene, the camera may capture all K points at any of the T moments, or it may capture only a subset of them. Where T ≥ 2.
[0103] For each of the T images mentioned above, some processing is required, and the processing procedure is the same for each image. This embodiment uses the image captured at the i-th time moment as an example to illustrate the processing procedure.
[0104] First, determine the 3D coordinates of each point captured in the image at time i, and extract the corresponding image coordinates from the image. Project each extracted image coordinate onto the camera's normalized sphere to obtain the first projected coordinates. Then project each captured 3D coordinate onto the camera's normalized sphere to obtain the second projected coordinates. Finally, based on the first projected coordinates of each extracted image coordinate and the captured 3D coordinates, calculate the initial pose of the camera at time i.
[0105] The calculation process of the first projection coordinates, the second projection coordinates, and the initial pose value is the same as the corresponding calculation process in the above embodiments, and will not be repeated here.
[0106] In this embodiment of the application, P is used. wk This represents the k-th 3D coordinate point captured by the camera. Since the 3D coordinate points captured by the camera at each moment may only be a subset of all pre-calculated 3D coordinate points, a variable μ is added. ijk Represents the three-dimensional coordinate point P wk Whether a photo is captured by the camera at time i is expressed by the variable μ using the following formula (12). ijk .
[0107]
[0108] Suppose that the camera captures N images at time i. i Given 3D coordinate points, then Ni image coordinate points are extracted from the image captured by the camera at time i. P represents the k-th three-dimensional coordinate point. wk The image coordinates point corresponding to the image captured by the camera at time i, where j indicates that the image coordinates point is the j-th point among the image coordinates points extracted from the image captured by the camera at time i. ijk T represents the first projected coordinate of the image coordinate point onto the normalized sphere of the camera at time i. iw This represents the initial pose of the camera at time i. Represents the three-dimensional coordinate point P wk The second projected coordinates of the camera on the normalized sphere at time i.
[0109] e ijk Represents image coordinates The first projected coordinate p on the normalized sphere of the camera at time i. ijk With three-dimensional coordinate point P wk Second projected coordinates on the normalized sphere The projection error between the two points can be calculated using formula (13) for the three-dimensional coordinate point P. wk The corresponding projection error e ijk .
[0110]
[0111] For each image captured at any given moment, the projection error corresponding to each three-dimensional coordinate point captured by the camera at each moment is calculated using the above method, as well as the initial pose value of the camera at each moment.
[0112] Then, based on the initial pose of the camera at each moment, the projection error corresponding to each 3D coordinate point captured by the camera at each moment, and each 3D coordinate point, the pose of the camera at each moment is calculated.
[0113] Specifically, the second total projection error is calculated based on the projection error corresponding to each three-dimensional coordinate point captured by the camera at each time step. The second total projection error can be obtained by summing the projection errors corresponding to each three-dimensional coordinate point captured by the camera at each time step. Alternatively, the second total projection error can also be calculated using the following formula (14).
[0114]
[0115] This application embodiment further calculates the first Jacobian matrix of the projection error of each three-dimensional coordinate point captured by the camera at each time step, based on the initial pose value at each time step, each three-dimensional coordinate point captured by the camera at each time step, and the projection error corresponding to each three-dimensional coordinate point. Since the calculation process of the first Jacobian matrix corresponding to each three-dimensional coordinate point captured at each time step is the same, this application embodiment uses the first time step as an example to illustrate the calculation process of the first Jacobian matrix. The first time step can be any time step among multiple time steps during the camera movement.
[0116] Specifically, based on the initial pose value at the first moment, each three-dimensional coordinate point captured by the camera at the first moment, and the projection error corresponding to each three-dimensional coordinate point captured at the first moment, the first Jacobian matrix of the projection error of each three-dimensional coordinate point captured at the first moment with respect to the initial pose value at the first moment is calculated.
[0117] First, calculate the Lie algebra derivative of the projection error corresponding to the three-dimensional coordinate point at the first moment with respect to the initial pose value of the camera at the first moment, as shown in the following formula (15).
[0118]
[0119] In formula (15), P cik Represents the three-dimensional coordinate point P wk The three-dimensional coordinate point P corresponding to the camera in the camera coordinate system at time i. cik =T iw P wk =[X cik ,Y cik Z cik ] T X cik ,Y cik and Z cik P respectively cik 3D coordinate point P wk The x, y, and z coordinates of the corresponding 3D coordinate point in the camera coordinate system at time i.
[0120] Then, the three-dimensional coordinate point P in the camera coordinate system is calculated using formula (16). cikThe derivative of the Lie algebra of the initial pose of the camera at time i is:
[0121]
[0122] In formula (16),
[0123] Based on the above formulas (15) and (16), the three-dimensional coordinate point P at the i-th moment is calculated using the following formula (17). wk Projection error e ijk The initial pose value T at time i iw The first Jacobian matrix.
[0124]
[0125] After obtaining the second total projection error and the first Jacobian matrix at each time step, based on the initial pose value at each time step, the second total projection error, and the first Jacobian matrix at each time step, the second total projection error is optimized iteratively using a preset optimization algorithm. The pose value at each time step when the second total projection error reaches its minimum value is taken as the pose of the camera at each time step.
[0126] The preset optimization algorithm can be the LM algorithm, Newton's method, or Gauss-Newton's method, etc. For example, the LM algorithm can be constructed using the g2o backend optimization library to solve the problem of minimizing the second total projection error. The specific solution formula can be shown in formula (18).
[0127]
[0128] The initial pose value, the second total projection error, and the first Jacobian matrix corresponding to the 3D coordinate points captured at each time step are input into the LM algorithm. The LM algorithm is used for optimization iteration until the minimum value of the second total projection error is obtained, at which point the iteration stops. The pose value at each time step when the second total projection error reaches its minimum value is taken as the pose of the camera at that time step.
[0129] In some other embodiments of this application, the coordinates of the three-dimensional coordinate points captured by the camera at each time step can also be optimized and adjusted during the process of optimizing the pose at each time step. First, the projection error of the three-dimensional coordinate points captured at each time step is calculated as the second Jacobian matrix of the three-dimensional coordinate points captured at each time step. Taking the first time step as an example, the first time step is any one of the above time steps. Specifically, the initial value of the rotation matrix of the camera at the first time step is obtained from the initial pose value at the first time step. Based on the initial pose value and initial value of the rotation matrix at the first time step, each three-dimensional coordinate point captured by the camera at the first time step, and the projection error corresponding to each three-dimensional coordinate point captured at the first time step, the projection error of the three-dimensional coordinate points captured at the first time step is calculated as the second Jacobian matrix of the three-dimensional coordinate points captured at the first time step. Specifically, the second Jacobian matrix can be calculated using the following formula (19).
[0130]
[0131] In formula (19), R(T) iw Let T be the initial pose value at time i. iw The initial value of the rotation matrix.
[0132] For each 3D coordinate point captured by the camera at each time step, the second Jacobian matrix of the projection error corresponding to the 3D coordinate point is calculated according to the above method. Then, based on the initial pose value, the second total projection error, the first Jacobian matrix and the second Jacobian matrix at each time step, the second total projection error is optimized iteratively by a preset optimization algorithm to solve the problem of minimizing the second total projection error. The specific solution formula can be shown in formula (20).
[0133]
[0134] In formula (20), P wk ∈R 3 P represents the k-th three-dimensional coordinate point. wk World coordinate system R 3 The coordinates of the point below.
[0135] Based on the coordinate values of each 3D coordinate point when the second total projection error reaches its minimum, the coordinates of the corresponding 3D coordinate points on the map constructed during camera movement are updated. This optimizes both the camera pose and the position of the 3D coordinate points on the constructed map, improving the accuracy of the constructed map.
[0136] In this embodiment, based on images captured at multiple moments during camera motion, the image coordinates and their corresponding 3D coordinates in the world coordinate system of each captured image are projected onto the camera's normalized sphere. This ensures that all projected points are at the same distance from the camera's optical center, resulting in equal contributions to the pose. This makes iterative pose optimization easier to converge, the calculation process more reasonable, and reduces the likelihood of the algorithm getting trapped in local minima during iterative pose calculation, thus improving the accuracy of the calculated pose. Furthermore, it enables simultaneous optimization of the pose at multiple moments during camera motion in a single optimization iteration, improving the efficiency of pose optimization calculations. Simultaneously, the coordinates of points in the map constructed during camera motion can also be optimized, improving the accuracy of the constructed map.
[0137] See Figure 4 This application also provides a camera pose estimation apparatus for performing the camera pose estimation method described in the above embodiments. The apparatus includes:
[0138] The acquisition module 201 is used to capture images of a real scene with a camera and obtain image coordinate points corresponding to pre-calculated three-dimensional coordinate points in the real scene from the images;
[0139] The projection module 202 is used to project image coordinate points onto the normalized sphere of the camera to obtain the first projected coordinates corresponding to the image coordinate points. The normalized sphere is a sphere with the optical center of the camera as its center. It also projects three-dimensional coordinate points onto the normalized sphere to obtain the second projected coordinates corresponding to the three-dimensional coordinate points.
[0140] The pose calculation module 203 is used to calculate the camera pose based on the first projected coordinates corresponding to the three-dimensional coordinate points and the image coordinate points, and the second projected coordinates corresponding to the three-dimensional coordinate points.
[0141] The projection module 202 is used to calculate the initial pose value of the camera based on the first projection coordinates corresponding to each image coordinate point and each three-dimensional coordinate point; and to calculate the second projection coordinates obtained by projecting each three-dimensional coordinate point onto a normalized sphere based on the initial pose value and each three-dimensional coordinate point.
[0142] The projection module 202 is used to calculate the product of the initial pose value and the coordinate vector of the first three-dimensional coordinate point to obtain the second three-dimensional coordinate point corresponding to the first three-dimensional coordinate point in the camera coordinate system; the first three-dimensional coordinate point is any three-dimensional coordinate point among all three-dimensional coordinate points; the norm of the coordinate vector of the second three-dimensional coordinate point is taken, and the ratio between the coordinate vector of the second three-dimensional coordinate point and the norm is calculated to obtain the second projected coordinates of the first three-dimensional coordinate point on the normalized sphere.
[0143] The projection module 202 is used to calculate the initial value of the camera's rotation matrix based on the first projection coordinates corresponding to each image coordinate point and each three-dimensional coordinate point; set the initial value of the camera's displacement vector to zero; and construct the initial value of the camera's pose based on the initial value of the rotation matrix and the initial value of the displacement vector.
[0144] The pose calculation module 203 is used to calculate the initial pose value of the camera based on the first projected coordinates corresponding to each image coordinate point and each three-dimensional coordinate point; calculate the difference between the first projected coordinates corresponding to each image coordinate point and the second projected coordinates corresponding to each three-dimensional coordinate point to obtain the projection error corresponding to each three-dimensional coordinate point; and optimize the projection error from the three-dimensional coordinate point to the normalized sphere based on the initial pose value, the projection error corresponding to each three-dimensional coordinate point, and each three-dimensional coordinate point to obtain the pose of the camera.
[0145] The pose calculation module 203 is used to calculate the first Jacobian matrix of the projection error of each three-dimensional coordinate point relative to the initial pose value based on the initial pose value, each three-dimensional coordinate point and the projection error corresponding to each three-dimensional coordinate point; calculate the first total projection error based on the projection error corresponding to each three-dimensional coordinate point; and optimize and iterate the first total projection error through a preset optimization algorithm based on the initial pose value, the first total projection error and the first Jacobian matrix, and take the pose value when the first total projection error reaches the minimum value as the pose of the camera.
[0146] In other embodiments of this application, the image includes multiple images of the real scene captured at multiple moments during camera movement; the initial pose value includes the initial pose value of the camera at each of the multiple moments.
[0147] The pose calculation module 203 is used to calculate the first Jacobian matrix of the projection error of each three-dimensional coordinate point captured by the camera at the first moment versus the initial pose value at the first moment, based on the initial pose value at the first moment, each three-dimensional coordinate point captured by the camera at the first moment, and the projection error corresponding to each three-dimensional coordinate point captured at the first moment. The first moment can be any moment among multiple moments. Based on the projection error corresponding to each three-dimensional coordinate point captured by the camera at each moment, the second total projection error is calculated. Based on the initial pose value at each moment, the second total projection error, and the first Jacobian matrix at each moment, the second total projection error is optimized and iterated through a preset optimization algorithm. The pose value at each moment when the second total projection error reaches the minimum value is taken as the pose of the camera at each moment.
[0148] The pose calculation module 203 is further configured to obtain the initial value of the camera's rotation matrix at the first moment from the initial pose value at the first moment; based on the initial pose value and initial value of the rotation matrix at the first moment, each three-dimensional coordinate point captured by the camera at the first moment, and the projection error corresponding to each three-dimensional coordinate point captured at the first moment, calculate the second Jacobian matrix of the projection error of the three-dimensional coordinate points captured at the first moment to the three-dimensional coordinate points captured at the first moment; based on the initial pose value, the second total projection error, the first Jacobian matrix at each moment, and the second Jacobian matrix at each moment, optimize and iterate the second total projection error through a preset optimization algorithm; based on the coordinate value of each three-dimensional coordinate point when the second total projection error reaches its minimum value, update the coordinates of the corresponding three-dimensional coordinate points on the map constructed during the camera movement.
[0149] The camera pose estimation device provided in this application embodiment is based on the same inventive concept as the camera pose estimation method provided in the above embodiment, and has the same beneficial effects as the method used, operated or implemented therein.
[0150] This application also provides an electronic device corresponding to the camera pose estimation method provided in the foregoing embodiments. Please refer to... Figure 5 This illustrates a schematic diagram of an electronic device provided by some embodiments of this application. For example... Figure 5 As shown, the electronic device 30 may include: a processor 300, a memory 301, a bus 302, and a communication interface 303. The processor 300, the communication interface 303, and the memory 301 are connected via the bus 302. The memory 301 stores a computer program that can run on the processor 300. When the processor 300 runs the computer program, it executes the camera pose estimation method provided in any of the foregoing embodiments of this application.
[0151] The memory 301 may include high-speed random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one physical port 303 (which can be wired or wireless), such as the Internet, wide area network, local area network, or metropolitan area network.
[0152] Bus 302 can be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. Memory 301 is used to store programs. After receiving an execution instruction, the processor 300 executes the program. The camera pose estimation method disclosed in any of the foregoing embodiments of this application can be applied to the processor 300, or implemented by the processor 300.
[0153] The processor 300 may be an integrated circuit with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of the processor 300 or by instructions in software form. The processor 300 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), an off-the-shelf programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules may reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in memory 301. The processor 300 reads the information in memory 301 and, in conjunction with its hardware, completes the steps of the above method.
[0154] The electronic device provided in this application embodiment and the camera pose estimation method provided in this application embodiment are based on the same inventive concept and have the same beneficial effects as the methods they adopt, operate or implement.
[0155] This application also provides a computer-readable storage medium corresponding to the camera pose estimation method provided in the foregoing embodiments, wherein a computer program (i.e., a program product) is stored thereon, and the computer program, when run by a processor, executes the camera pose estimation method provided in any of the foregoing embodiments.
[0156] It should be noted that examples of the computer-readable storage medium may also include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other optical and magnetic storage media, which will not be elaborated here.
[0157] This application also provides a computer program product corresponding to the camera pose estimation method provided in the foregoing embodiments, including a computer program that is executed by a processor to implement the camera pose estimation method provided in the above embodiments.
[0158] The computer-readable storage medium and computer program product provided in the above embodiments of this application are based on the same inventive concept as the camera pose estimation method provided in the embodiments of this application, and have the same beneficial effects as the methods adopted, run or implemented by the application programs stored therein.
[0159] It should be noted that:
[0160] The algorithms and displays provided herein are not inherently related to any particular computer, virtual device, or other equipment. Various general-purpose devices can also be used in conjunction with the teachings herein. The required structure for constructing such devices is apparent from the above description. Furthermore, this application is not directed to any particular programming language. It should be understood that the content of this application described herein can be implemented using various programming languages, and the above description of specific languages is for the purpose of disclosing the best mode of implementation of this application.
[0161] Numerous specific details are set forth in the specification provided herein. However, it will be understood that embodiments of this application may be practiced without these specific details. In some instances, well-known methods, structures, and techniques have not been shown in detail so as not to obscure the understanding of this specification.
[0162] Similarly, it should be understood that, in order to simplify this application and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of this application, various features of this application are sometimes grouped together into a single embodiment, figure, or description thereof. However, this method of disclosure should not be construed as reflecting an intention that the claimed application requires more features than are expressly recited in each claim. Rather, as reflected in the following claims, inventive aspects lie in fewer than all features of a single foregoing disclosed embodiment. Therefore, the claims following the detailed description are hereby expressly incorporated into that detailed description, wherein each claim itself is a separate embodiment of this application.
[0163] Those skilled in the art will understand that modules in the device of the embodiments can be adaptively changed and placed in one or more devices different from that embodiment. Modules, units, or components in the embodiments can be combined into a single module, unit, or component, and further, they can be divided into multiple sub-modules, sub-units, or sub-components. Except where at least some of such features and / or processes or units are mutually exclusive, any combination can be used to combine all features disclosed in this specification (including the accompanying claims, abstract, and drawings) and all processes or units of any method or device so disclosed. Unless expressly stated otherwise, each feature disclosed in this specification (including the accompanying claims, abstract, and drawings) may be replaced by an alternative feature that serves the same, equivalent, or similar purpose.
[0164] Furthermore, those skilled in the art will understand that although some embodiments described herein include certain features but not others included in other embodiments, combinations of features from different embodiments are intended to be within the scope of this application and form different embodiments. For example, in the following claims, any of the claimed embodiments can be used in any combination.
[0165] The various component embodiments of this application can be implemented in hardware, or as software modules running on one or more processors, or a combination thereof. Those skilled in the art will understand that microprocessors or digital signal processors (DSPs) can be used in practice to implement some or all of the functions of some or all of the components in the virtual machine creation apparatus according to embodiments of this application. This application can also be implemented as a device or apparatus program (e.g., a computer program and computer program product) for performing part or all of the methods described herein. Such an implementation of this application can be stored on a computer-readable medium, or can be in the form of one or more signals. Such signals can be downloaded from an Internet website, provided on a carrier signal, or provided in any other form.
[0166] It should be noted that the above embodiments are illustrative of this application and not restrictive, and that those skilled in the art can devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses should not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. This application can be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third, etc., does not indicate any order. These words can be interpreted as names.
[0167] The above description is merely a preferred embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A camera pose estimation method, characterized in that, include: By capturing images of a real-world scene with a camera, image coordinate points corresponding to pre-calculated three-dimensional coordinate points in the real-world scene are obtained from the images; The image coordinates are projected onto the normalized sphere of the camera to obtain the first projected coordinates corresponding to the image coordinates. The normalized sphere is a sphere with the optical center of the camera as its center. The three-dimensional coordinate points are projected onto the normalized sphere to obtain the second projected coordinates corresponding to the three-dimensional coordinate points. The initial pose of the camera is calculated based on the first projected coordinates corresponding to each image coordinate point and each three-dimensional coordinate point. Calculate the difference between the first projected coordinates corresponding to each image coordinate point and the second projected coordinates corresponding to each three-dimensional coordinate point to obtain the projection error corresponding to each three-dimensional coordinate point. Based on the initial pose value, the projection error corresponding to each three-dimensional coordinate point, and each three-dimensional coordinate point, the projection error from the three-dimensional coordinate point to the standardized sphere is optimized to obtain the pose of the camera. The step of projecting the three-dimensional coordinate point onto the normalized sphere to obtain the second projected coordinates corresponding to the three-dimensional coordinate point includes: Based on the first projected coordinates corresponding to each image coordinate point and each three-dimensional coordinate point, calculate the initial value of the rotation matrix of the camera; Set the initial value of the camera's displacement vector to zero; Based on the initial values of the rotation matrix and the initial values of the displacement vector, the initial pose values of the camera are constructed. Calculate the product of the initial pose value and the coordinate vector of the first three-dimensional coordinate point to obtain the second three-dimensional coordinate point corresponding to the first three-dimensional coordinate point in the camera coordinate system of the camera; the first three-dimensional coordinate point is any three-dimensional coordinate point among the three-dimensional coordinate points; The norm of the coordinate vector of the second three-dimensional coordinate point is taken, and the ratio between the coordinate vector of the second three-dimensional coordinate point and the norm is calculated to obtain the second projected coordinates of the first three-dimensional coordinate point on the normalized sphere. The norm of the coordinate vector of the second three-dimensional coordinate point contains the x-coordinate, y-coordinate and z-coordinate information of the second three-dimensional coordinate point. The step of optimizing the projection error from the three-dimensional coordinate points to the normalized sphere based on the initial pose value, the projection error corresponding to each three-dimensional coordinate point, and each three-dimensional coordinate point to obtain the camera pose includes: Based on the initial pose value, each three-dimensional coordinate point and the projection error corresponding to each three-dimensional coordinate point, calculate the first Jacobian matrix of the projection error of each three-dimensional coordinate point relative to the initial pose value; Calculate the first total projection error based on the projection error corresponding to each three-dimensional coordinate point; Based on the initial pose value, the first total projection error, and the first Jacobian matrix, the first total projection error is optimized and iterated using a preset optimization algorithm, and the pose value when the first total projection error reaches its minimum value is taken as the pose of the camera.
2. The method according to claim 1, characterized in that, The image includes multiple images of the real scene captured at multiple moments during the camera's movement; the initial pose value includes the initial pose value of the camera at each of the multiple moments. Based on the initial pose value, the projection error corresponding to each 3D coordinate point, and the projection error from each 3D coordinate point to the normalized sphere, the pose of the camera is optimized, including: Based on the initial pose value at the first moment, each 3D coordinate point captured by the camera at the first moment, and the projection error corresponding to each 3D coordinate point captured at the first moment, the first Jacobian matrix of the projection error of each 3D coordinate point captured at the first moment with respect to the initial pose value at the first moment is calculated respectively; the first moment is any one of the plurality of moments; The second total projection error is calculated based on the projection error corresponding to each three-dimensional coordinate point captured by the camera at each time moment. Based on the initial pose value at each time step, the second total projection error, and the first Jacobian matrix at each time step, the second total projection error is optimized and iterated through a preset optimization algorithm. The pose value at each time step when the second total projection error reaches its minimum value is taken as the pose of the camera at each time step.
3. The method according to claim 2, characterized in that, The method further includes: From the initial pose value at the first moment, obtain the initial value of the rotation matrix of the camera at the first moment; Based on the initial pose value and initial rotation matrix value at the first moment, each three-dimensional coordinate point captured by the camera at the first moment, and the projection error corresponding to each three-dimensional coordinate point captured at the first moment, the second Jacobian matrix of the projection error of the three-dimensional coordinate points captured at the first moment is calculated respectively. Based on the initial pose value at each time step, the second total projection error, the first Jacobian matrix at each time step, and the second Jacobian matrix at each time step, the second total projection error is optimized iteratively using a preset optimization algorithm. Based on the coordinate values of each three-dimensional coordinate point when the second total projection error reaches its minimum value, the coordinates of the corresponding three-dimensional coordinate points on the map constructed during the camera movement are updated respectively.
4. A camera pose estimation device, characterized in that, include: The acquisition module is used to capture images of a real scene using a camera and obtain image coordinate points from the images that correspond to pre-calculated three-dimensional coordinate points in the real scene. The projection module is used to project the image coordinate points onto the normalized sphere of the camera to obtain the first projected coordinates corresponding to the image coordinate points, wherein the normalized sphere is a sphere with the optical center of the camera as its center; and to project the three-dimensional coordinate points onto the normalized sphere to obtain the second projected coordinates corresponding to the three-dimensional coordinate points. The pose calculation module is used to calculate the initial pose value of the camera based on the first projected coordinates corresponding to each image coordinate point and each three-dimensional coordinate point. The difference between the first projected coordinates corresponding to each image coordinate point and the second projected coordinates corresponding to each three-dimensional coordinate point is calculated to obtain the projection error corresponding to each three-dimensional coordinate point. Based on the initial pose value, the projection error corresponding to each three-dimensional coordinate point, and each three-dimensional coordinate point, the projection error from the three-dimensional coordinate point to the normalized sphere is optimized to obtain the pose of the camera. The step of projecting the three-dimensional coordinate point onto the normalized sphere to obtain the second projected coordinates corresponding to the three-dimensional coordinate point includes: Based on the first projected coordinates corresponding to each image coordinate point and each three-dimensional coordinate point, calculate the initial value of the rotation matrix of the camera; Set the initial value of the camera's displacement vector to zero; Based on the initial values of the rotation matrix and the initial values of the displacement vector, the initial pose values of the camera are constructed. Calculate the product of the initial pose value and the coordinate vector of the first three-dimensional coordinate point to obtain the second three-dimensional coordinate point corresponding to the first three-dimensional coordinate point in the camera coordinate system of the camera; the first three-dimensional coordinate point is any three-dimensional coordinate point among the three-dimensional coordinate points; Take the norm of the coordinate vector of the second three-dimensional coordinate point, calculate the ratio between the coordinate vector of the second three-dimensional coordinate point and the norm, and obtain the second projected coordinates of the first three-dimensional coordinate point on the normalized sphere; The step of optimizing the projection error from the three-dimensional coordinate points to the normalized sphere based on the initial pose value, the projection error corresponding to each three-dimensional coordinate point, and each three-dimensional coordinate point to obtain the camera pose includes: Based on the initial pose value, each three-dimensional coordinate point and the projection error corresponding to each three-dimensional coordinate point, calculate the first Jacobian matrix of the projection error of each three-dimensional coordinate point relative to the initial pose value; Calculate the first total projection error based on the projection error corresponding to each three-dimensional coordinate point; Based on the initial pose value, the first total projection error, and the first Jacobian matrix, the first total projection error is optimized and iterated using a preset optimization algorithm, and the pose value when the first total projection error reaches its minimum value is taken as the pose of the camera.
5. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method described in any one of claims 1-3.
6. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the method described in any one of claims 1-3.
7. A computer program product, comprising a computer program, characterized in that, The computer program is executed by a processor to implement the method according to any one of claims 1-3.
Citation Information
Patent Citations
Single-camera spherical mirror reflection imaging projection device
CN113989105A
Interactive presentation method of point cloud data and storage medium
CN115439634A
