Three-dimensional scene ranging method, apparatus, device, and medium
Patent Information
- Application Number
- CN202311370732.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-23
- Publication Date
- 2026-09-29
- Estimated Expiration
- 2043-10-23
AI Technical Summary
[0004]因而,常见的三维空间测量技术大多无法实现场景中点之间的距离测量,并且,其对特定相机的依赖使得在实际业务应用中受到一定程度的限制
[0045]本申请实施例提供一种三维场景测距方法、装置、设备及介质,可通过获取目标三维场景在多个视角的图像,根据多个视角的相机参数,以及多个视角的图像,确定世界坐标系下多个视角的相机位置、第一特征点在多个视角的第一射线的方向向量,以及第二特征点在多个视角的第二射线的方向向量,继而根据多个视角的相机位置、多个视角的第一射线的方向向量,确定多个视角的第一射线的交点坐标为第一特征点在世界坐标系的第一三维坐标,以及根据多个视角的相机位置、多个视角的第二射线的方向向量,确定多个视角的第二射线的交点坐标为第二特征点在世界坐标系的第二三维坐标;根据第一三维坐标和第二三维坐标,确定目标三维场景中第一特征点和第二特征点之间的距离。本申请实施例所提供的三维场景测距方法,可根据目标三维场景在多个视角的图像结合多个视角的相机参数,实现第一特征点和第二特征点在世界坐标系中的三维坐标,继而实现三维场景中的特征点之间的测距,并且本实施例提供的三维场景测距方法中,多个视角的图像并不存在对特定相机的依赖,因此,还提高了三维场景测距方法在实际业务应用中的适用性。
Smart Images

Figure CN117629072B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and more specifically, to a three-dimensional scene ranging method, apparatus, device, and medium. Background Technology
[0002] Computer vision technology can process images of three-dimensional scenes to obtain the corresponding three-dimensional information, making machines "human-like" so that they can understand and process information in images, and achieve more intelligent and efficient applications.
[0003] With the development of computer vision technology, the demand for scene image-based 3D spatial measurement technology is increasing in fields such as cultural relics, industrial design, and game development. Many common 3D spatial measurement technologies rely on images captured by depth cameras or specific cameras to measure the entire scene.
[0004] Therefore, most common 3D spatial measurement techniques cannot measure the distance between points in a scene, and their dependence on specific cameras limits their application in practical business applications. Summary of the Invention
[0005] The purpose of this invention is to address the shortcomings of the prior art by providing a three-dimensional scene ranging method, apparatus, device, and medium, thereby improving the applicability of the method while achieving ranging of feature points in a three-dimensional scene.
[0006] To achieve the above objectives, the technical solutions adopted in the embodiments of this application are as follows:
[0007] In a first aspect, embodiments of this application provide a three-dimensional scene ranging method, including:
[0008] Acquire images of the target 3D scene from multiple perspectives;
[0009] Based on the camera parameters of the multiple viewpoints and the images of the multiple viewpoints, determine the camera positions of the multiple viewpoints in the world coordinate system, the direction vector of the first ray of the first feature point in the multiple viewpoints, and the direction vector of the second ray of the second feature point in the multiple viewpoints.
[0010] Based on the camera positions of the multiple viewpoints and the direction vectors of the first rays of the multiple viewpoints, the coordinates of the intersection of the first rays of the multiple viewpoints are determined as the first three-dimensional coordinates of the first feature point in the world coordinate system.
[0011] Based on the camera positions of the multiple viewpoints and the direction vectors of the second rays of the multiple viewpoints, the coordinates of the intersection of the second rays of the multiple viewpoints are determined as the second three-dimensional coordinates of the second feature point in the world coordinate system;
[0012] Based on the first three-dimensional coordinates and the second three-dimensional coordinates, the distance between the first feature point and the second feature point in the target three-dimensional scene is determined.
[0013] In one possible implementation, determining the camera positions of the multiple viewpoints in the world coordinate system, the direction vector of the first ray of the first feature point in the multiple viewpoints, and the direction vector of the second ray of the second feature point in the multiple viewpoints, based on the camera parameters of the multiple viewpoints and the images of the multiple viewpoints, includes:
[0014] Determine multiple first pixel coordinates of the first feature point in the images from multiple viewpoints, and multiple second pixel coordinates of the second feature point in the images from multiple viewpoints;
[0015] Based on the camera parameters of the multiple viewpoints, the multiple first pixel coordinates, and the multiple second pixel coordinates, determine the camera positions of the multiple viewpoints, the direction vectors of the first rays of the multiple viewpoints, and the direction vectors of the second rays of the multiple viewpoints.
[0016] In one possible implementation, determining the camera position of the multiple viewpoints, the direction vector of the first ray of the multiple viewpoints, and the direction vector of the second ray of the multiple viewpoints based on the camera parameters of the multiple viewpoints, the multiple first pixel coordinates, and the multiple second pixel coordinates includes:
[0017] Based on the camera parameters of the multiple viewpoints, determine the camera positions of the multiple viewpoints in the world coordinate system, as well as multiple mapping relationships between the pixel coordinate system and the world coordinate system in the multiple viewpoints;
[0018] Based on the multiple mapping relationships, the multiple first pixel coordinates and the multiple second pixel coordinates are respectively mapped to the world coordinate system to obtain multiple first mapped coordinates of the first feature point in the multiple viewpoints and multiple second mapped coordinates of the second feature point in the multiple viewpoints;
[0019] Based on the multiple first mapping coordinates and the camera positions of the multiple viewpoints, determine the direction vector of the first ray of the multiple viewpoints;
[0020] Based on the multiple second mapping coordinates and the camera positions of the multiple viewpoints, the direction vectors of the second rays from the multiple viewpoints are determined.
[0021] In one possible implementation, determining the coordinates of the first intersection point of the first rays from the multiple viewpoints as the first three-dimensional coordinates of the first feature point in the world coordinate system based on the camera positions of the multiple viewpoints and the direction vectors of the first rays from the multiple viewpoints includes:
[0022] Based on the camera positions of the multiple viewpoints and the direction vectors of the first rays of the multiple viewpoints, determine the coordinates of multiple first points with the smallest sum of distances to the center point from the first rays of the multiple viewpoints;
[0023] The first three-dimensional coordinates are determined based on the coordinates of the center points of the plurality of first points.
[0024] In one possible implementation, determining the coordinates of a plurality of first points with the smallest sum of distances to the center point from the first rays of the plurality of viewpoints, based on the camera positions of the plurality of viewpoints and the direction vectors of the first rays of the plurality of viewpoints, includes:
[0025] Based on the camera positions of the multiple viewpoints and the direction vectors of the first rays of the multiple viewpoints, a first distance function is constructed between the coordinates of the corresponding positions of the first feature point on the multiple first rays and the coordinates of the center point.
[0026] The first distance function is solved using a preset gradient descent algorithm to obtain the coordinates of the plurality of first points.
[0027] In one possible implementation, determining the intersection coordinates of the second rays from the multiple viewpoints as the second three-dimensional coordinates of the second feature point in the world coordinate system based on the camera positions of the multiple viewpoints and the direction vectors of the second rays from the multiple viewpoints includes:
[0028] Based on the camera positions of the multiple viewpoints and the direction vectors of the second rays of the multiple viewpoints, determine the coordinates of multiple second points with the smallest sum of distances to the center point from the second rays of the multiple viewpoints;
[0029] The second three-dimensional coordinates are determined based on the coordinates of the center points of the plurality of second points.
[0030] In one possible implementation, determining the coordinates of a plurality of second points with the smallest sum of distances to the center point from the second rays of the plurality of viewpoints, based on the camera positions of the plurality of viewpoints and the direction vectors of the second rays of the plurality of viewpoints, includes:
[0031] Based on the camera positions of the multiple viewpoints and the direction vectors of the second rays of the multiple viewpoints, a second distance function is constructed between the coordinates of the corresponding positions of the second feature point on the multiple second rays and the coordinates of the center point.
[0032] The second distance function is solved using a preset gradient descent algorithm to obtain the coordinates of the plurality of second points.
[0033] In one possible implementation, acquiring images of the target 3D scene from multiple perspectives includes:
[0034] Using the implicit 3D reconstruction model of the target 3D scene, simulated images from multiple perspectives are obtained as images from those multiple perspectives; or,
[0035] Acquire real images from multiple perspectives of the target 3D scene as images from the multiple perspectives.
[0036] Secondly, embodiments of this application also provide a three-dimensional scene ranging device, including:
[0037] The acquisition module is used to acquire images of the target 3D scene from multiple perspectives;
[0038] The first determining module is used to determine, based on the camera parameters of the multiple viewpoints and the images of the multiple viewpoints, the camera position of the multiple viewpoints in the world coordinate system, the direction vector of the first ray of the first feature point in the multiple viewpoints, and the direction vector of the second ray of the second feature point in the multiple viewpoints.
[0039] The second determining module is used to determine the intersection coordinates of the first rays of the multiple viewpoints as the first three-dimensional coordinates of the first feature point in the world coordinate system based on the camera positions of the multiple viewpoints and the direction vectors of the first rays of the multiple viewpoints.
[0040] The third determining module is used to determine the intersection coordinates of the second rays of the multiple viewpoints as the second three-dimensional coordinates of the second feature point in the world coordinate system based on the camera positions of the multiple viewpoints and the direction vectors of the second rays of the multiple viewpoints.
[0041] The fourth determining module is used to determine the distance between the first feature point and the second feature point in the target three-dimensional scene based on the first three-dimensional coordinates and the second three-dimensional coordinates.
[0042] Thirdly, embodiments of this application also provide an electronic device, including: a processor, a storage medium, and a bus, wherein the storage medium stores program instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the program instructions to perform the steps of the three-dimensional scene ranging method as described in any of the first aspects.
[0043] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the three-dimensional scene ranging method as described in any of the first aspects.
[0044] The beneficial effects of this application are:
[0045] This application provides a three-dimensional scene ranging method, apparatus, device, and medium. It acquires images of a target three-dimensional scene from multiple viewpoints. Based on camera parameters from these viewpoints and the images, it determines the camera positions in the world coordinate system, the direction vectors of the first ray from a first feature point in each viewpoint, and the direction vectors of the second ray from a second feature point in each viewpoint. Then, based on the camera positions and the direction vectors of the first rays from each viewpoint, it determines the intersection coordinates of the first rays as the first three-dimensional coordinates of the first feature point in the world coordinate system. Similarly, based on the camera positions and the direction vectors of the second rays from each viewpoint, it determines the intersection coordinates of the second rays as the second three-dimensional coordinates of the second feature point in the world coordinate system. Finally, based on the first and second three-dimensional coordinates, it determines the distance between the first and second feature points in the target three-dimensional scene. The three-dimensional scene ranging method provided in this application embodiment can realize the three-dimensional coordinates of the first feature point and the second feature point in the world coordinate system based on the images of the target three-dimensional scene from multiple perspectives and the camera parameters of multiple perspectives, thereby realizing the ranging between feature points in the three-dimensional scene. Furthermore, in the three-dimensional scene ranging method provided in this embodiment, the images from multiple perspectives do not depend on a specific camera, thus improving the applicability of the three-dimensional scene ranging method in practical business applications. Attached Figure Description
[0046] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0047] Figure 1 A flowchart illustrating a three-dimensional scene ranging method provided in this application embodiment;
[0048] Figure 2 A flowchart illustrating the determination of a ray direction vector in a three-dimensional scene ranging method provided in this application embodiment;
[0049] Figure 3 A flowchart illustrating another method for determining the ray direction vector in a three-dimensional scene ranging method provided in this application embodiment;
[0050] Figure 4 This is a flowchart of a method for determining the first three-dimensional coordinates of a first feature point in a three-dimensional scene ranging method provided in an embodiment of this application;
[0051] Figure 5 This is a flowchart illustrating a method for determining the second three-dimensional coordinates of a second feature point in a three-dimensional scene ranging method provided in this application embodiment;
[0052] Figure 6 A schematic diagram of a three-dimensional scene ranging device provided in an embodiment of this application;
[0053] Figure 7 This is a schematic diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0054] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are some embodiments of the present invention, but not all embodiments.
[0055] In this application, unless otherwise expressly specified and limited, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one feature. In the description of this invention, "a plurality of" means at least two, such as two or three, unless otherwise expressly specified. The terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes the element.
[0056] To facilitate a better understanding of the three-dimensional scene ranging method provided in the embodiments of this application, the technical terms involved in the following embodiments of this application will be explained first.
[0057] Implicit 3D reconstruction models are 3D reconstruction algorithms based on computer vision technology and deep learning algorithms. They are trained using images of a 3D scene from different viewpoints and camera parameters at those viewpoints to obtain an implicit 3D reconstruction model of the scene. This implicit 3D reconstruction model can be, for example, a Neural Radiance Fields (NeRF) model, or other forms of implicit 3D reconstruction models. Explicit 3D models, such as 3D point cloud models or 3D mesh models, can be directly displayed to the user. However, implicit 3D reconstruction models are implicit precisely because they cannot be directly displayed. Therefore, implicit 3D reconstruction models can also be called implicit representations of 3D scenes. Although implicit 3D reconstruction models cannot be directly displayed, they can be used to obtain rendering parameters for each point in the 3D scene from a new viewpoint, such as volume density and color parameters. Then, based on these rendering parameters, scene rendering is performed to generate a simulated image from the new viewpoint, also known as a rendered image.
[0058] The three-dimensional scene ranging method provided in this application will be explained and illustrated below with reference to the accompanying drawings and through multiple examples. Figure 1 This document provides a flowchart of a three-dimensional scene ranging method according to an embodiment of this application. This method can be implemented by an electronic device running a software program for a three-dimensional scene ranging method, thereby executing the three-dimensional scene ranging method by running the software program. In practical application examples, the actual product form of this electronic device can be, for example, a terminal device or a server; this embodiment of the application does not impose any limitations on this. Figure 1 As shown, the method includes:
[0059] S101. Obtain images of the target 3D scene from multiple perspectives.
[0060] The target 3D scene can be a pre-defined 3D scene in the real world, such as a conference room or laboratory; therefore, the target 3D scene can also be called a real 3D space. To measure the distance of feature points in the target 3D scene, it is necessary to first acquire images of the target 3D scene from multiple perspectives. Each of these multiple perspective images includes the two feature points to be measured, referred to as the first feature point and the second feature point. In other words, the first feature point A and the second feature point B can be observed from images from multiple perspectives. Here, "multiple perspectives" refers to several different perspectives.
[0061] As one possible approach, an implicit 3D reconstruction model of the target 3D scene can be used to obtain simulation images from multiple perspectives as images from multiple viewpoints.
[0062] In implementing this method, an implicit 3D reconstruction model of the target 3D scene can be obtained first. Based on information from multiple preset perspectives, the implicit 3D reconstruction model is used to render the target 3D scene, resulting in a simulation image of the target 3D scene from multiple perspectives. This simulation image from multiple perspectives is then used as the image from multiple perspectives.
[0063] Here, the training process of the implicit 3D reconstruction model can be, for example, as follows: based on the real images of the target 3D scene from multiple known viewpoints and the camera parameters from multiple known viewpoints, the target 3D scene is reconstructed to obtain the implicit 3D reconstruction model of the target 3D scene.
[0064] As another possible implementation, real images from multiple perspectives of the target 3D scene can be acquired as images from multiple perspectives.
[0065] Among them, the real images from multiple perspectives can be real images obtained by image acquisition devices, such as cameras or webcams, from multiple perspectives of the target 3D scene.
[0066] It should be noted that the number of viewpoints n selected for ranging the target 3D scene can be a preset integer greater than or equal to 2. The larger the number of viewpoints n, the smaller the ranging error and the more accurate the ranging result.
[0067] S102. Based on the camera parameters from multiple viewpoints and the images from multiple viewpoints, determine the camera positions from multiple viewpoints in the world coordinate system, the direction vector of the first ray from the first feature point in multiple viewpoints, and the direction vector of the second ray from the second feature point in multiple viewpoints.
[0068] In acquiring images from multiple perspectives, camera parameters for those perspectives are also obtained. In one implementation, the images from multiple perspectives can be processed using a pre-defined camera parameter estimation algorithm to obtain the camera parameters for each perspective. In another implementation, if the images from multiple perspectives are simulation images obtained using an implicit 3D reconstruction model of the target 3D scene, then the camera parameters for each perspective can be the camera parameters obtained when generating simulation images from multiple perspectives using the implicit 3D reconstruction model of the target 3D scene.
[0069] Camera parameters for each viewpoint can be used to characterize the camera state when acquiring or rendering images from each viewpoint. Camera parameters for each viewpoint can include: camera intrinsic parameters and camera extrinsic parameters.
[0070] In one possible implementation, camera positions can be estimated based on camera parameters from multiple viewpoints to obtain camera positions in the world coordinate system. Then, based on these camera positions and their parameters, the direction vectors of the first ray from the first feature point and the second ray from the second feature point in the world coordinate system are determined. The world coordinate system can also be referred to as the real coordinate system of the actual environment in which the target 3D scene is located.
[0071] Here, the first ray from multiple viewpoints can be a ray pointing from the camera positions of multiple viewpoints to the first feature point, and the second ray from multiple viewpoints can be a ray pointing from the camera position of each viewpoint to the second feature point. The camera position of the i-th viewpoint can be represented as o. i , where i = any integer from 1 to n, and n is the total number of multiple viewpoints.
[0072] The direction vector of the first ray from the i-th viewpoint can be represented as d A,i The direction vector of the second ray from the i-th viewpoint can be represented as d B,i .
[0073] S103. Based on the camera positions from multiple viewpoints and the direction vectors of the first rays from multiple viewpoints, determine the coordinates of the intersection of the first rays from multiple viewpoints as the first three-dimensional coordinates of the first feature point in the world coordinate system.
[0074] The first ray of each viewpoint is actually a first ray pointing from the camera position in each viewpoint to the position of the first feature point in the corresponding viewpoint. In possible implementations, the coordinates of the intersection of multiple first rays can be determined based on the camera positions of multiple viewpoints and the direction vectors of multiple first rays, which is the first three-dimensional coordinate of the first feature point in the world coordinate system.
[0075] S104. Based on the camera positions from multiple viewpoints and the direction vectors of the second rays from multiple viewpoints, determine the coordinates of the intersection of the second rays from multiple viewpoints as the second three-dimensional coordinates of the second feature point in the world coordinate system.
[0076] Correspondingly, the second ray of each viewpoint is actually a second ray pointing from the camera position in each viewpoint to the position of the second feature point in the corresponding viewpoint. In possible implementations, the intersection coordinates of multiple first rays can be determined based on the camera positions of multiple viewpoints and the direction vectors of multiple second rays, which are the second three-dimensional coordinates of the second feature point in the world coordinate system.
[0077] S105. Based on the first three-dimensional coordinates and the second three-dimensional coordinates, determine the distance between the first feature point and the second feature point in the target three-dimensional scene.
[0078] Given the three-dimensional coordinates of the first feature point and the second feature point, that is, the first three-dimensional coordinates and the second three-dimensional coordinates, the three-dimensional distance can be calculated based on the first three-dimensional coordinates and the second three-dimensional coordinates to obtain the distance between the first feature point and the second feature point in the target three-dimensional scene.
[0079] In summary, this application provides a three-dimensional scene ranging method. It acquires images of a target three-dimensional scene from multiple viewpoints. Based on camera parameters from these viewpoints and the images, it determines the camera positions in the world coordinate system, the direction vectors of the first ray from a first feature point in each viewpoint, and the direction vectors of the second ray from a second feature point in each viewpoint. Then, based on the camera positions and the direction vectors of the first rays from each viewpoint, it determines the intersection coordinates of the first rays from each viewpoint as the first three-dimensional coordinates of the first feature point in the world coordinate system. Similarly, based on the camera positions and the direction vectors of the second rays from each viewpoint, it determines the intersection coordinates of the second rays from each viewpoint as the second three-dimensional coordinates of the second feature point in the world coordinate system. Finally, based on the first and second three-dimensional coordinates, it determines the distance between the first and second feature points in the target three-dimensional scene. The three-dimensional scene ranging method provided in this application embodiment can realize the three-dimensional coordinates of the first feature point and the second feature point in the world coordinate system based on the images of the target three-dimensional scene from multiple perspectives and the camera parameters of multiple perspectives, thereby realizing the ranging between feature points in the three-dimensional scene. Furthermore, in the three-dimensional scene ranging method provided in this embodiment, the images from multiple perspectives do not depend on a specific camera, thus improving the applicability of the three-dimensional scene ranging method in practical business applications.
[0080] Based on the three-dimensional scene ranging method provided in the above embodiments, this application further provides a possible implementation example for obtaining the direction vector of rays and the camera position from each viewpoint. Figure 2 A flowchart illustrating the determination of a ray direction vector in a three-dimensional scene ranging method provided in this application embodiment; as shown... Figure 2 As shown in the above embodiment, in S102, determining the camera positions in the world coordinate system, the direction vectors of the first ray from the first feature point in the multiple viewpoints, and the direction vectors of the second ray from the second feature point in the multiple viewpoints, based on the camera parameters from multiple viewpoints and the images from multiple viewpoints, may include:
[0081] S201. Determine multiple first pixel coordinates of the first feature point in images from multiple viewpoints, and multiple second pixel coordinates of the second feature point in images from multiple viewpoints.
[0082] In one possible implementation, after acquiring images from multiple perspectives, the images from multiple perspectives can be displayed, and based on the input feature point marking operation for the images from the multiple perspectives, the pixel coordinates of the first feature point in the images from the multiple perspectives can be determined as multiple first pixel coordinates, and the pixel coordinates of the second feature point in the images from the multiple perspectives can be determined as multiple second pixel coordinates.
[0083] In another possible implementation, after acquiring images from multiple viewpoints, a first preset feature can be detected in each of the multiple viewpoints. The coordinates of the positions in the images from the multiple viewpoints that match the first preset feature are then the pixel coordinates of the first feature points in the images from the multiple viewpoints, which are multiple first pixel coordinates. Correspondingly, a second preset feature can also be detected in each of the multiple viewpoints. The coordinates of the positions in the images from the multiple viewpoints that match the second preset feature are then the pixel coordinates of the second feature points in the images from the multiple viewpoints, which are multiple second pixel coordinates.
[0084] S202. Based on the camera parameters corresponding to the images from multiple viewpoints, multiple first pixel coordinates, and multiple second pixel coordinates, determine the camera positions from multiple viewpoints, the direction vectors of the first rays from multiple viewpoints, and the direction vectors of the second rays from multiple viewpoints.
[0085] In one possible implementation, the camera position can be estimated based on the camera parameters of multiple viewpoints to obtain the camera position of multiple viewpoints in the world coordinate system. Then, based on the camera position of multiple viewpoints, the camera parameters of the multiple viewpoints, multiple first pixel coordinates, and multiple second pixel coordinates, the direction vector of the first ray of the multiple viewpoints and the direction vector of the second ray of the multiple viewpoints are determined.
[0086] In the three-dimensional scene ranging method provided in this embodiment, the camera position of each viewpoint can be determined by the pixel coordinates of two feature points in each viewpoint and the camera parameters of each viewpoint, as well as the direction vector of the rays of the two feature points in each viewpoint. This makes the determination of the ray direction vector more accurate, thereby ensuring that the three-dimensional coordinates of each feature point in the world coordinate system can be accurately determined based on the direction vector of the rays of each feature point in each viewpoint, thus ensuring the accuracy of ranging of the three-dimensional scene.
[0087] Regarding the determination of the positions of each camera and the direction vector of the ray under each viewpoint mentioned in the above embodiments, the embodiments of this application also provide the following possible implementation methods. Figure 3 This is a flowchart illustrating another method for determining the ray direction vector in a three-dimensional scene ranging method provided in this application embodiment. (See attached flowchart.) Figure 3As shown, in the method described above, step S202, which determines the camera positions, direction vectors of the first rays, and direction vectors of the second rays from multiple viewpoints based on the camera parameters, multiple first pixel coordinates, and multiple second pixel coordinates corresponding to images from multiple viewpoints, may include:
[0088] S301. Based on the camera parameters from multiple viewpoints, determine the camera positions from multiple viewpoints in the world coordinate system, as well as the multiple mapping relationships between the pixel coordinate system and the world coordinate system from multiple viewpoints.
[0089] The camera parameters for each viewpoint include camera intrinsics and camera extrinsics. In possible implementations, the camera position in the world coordinate system for each viewpoint, and the mapping relationship between the camera coordinate system and the world coordinate system for each viewpoint, can be determined based on the camera extrinsics in the camera parameters for each viewpoint. Similarly, the mapping relationship between the camera coordinate system and the pixel coordinate system for each viewpoint can be determined based on the camera intrinsics in the camera parameters for each viewpoint. Thus, the mapping relationship between the pixel coordinate system and the world coordinate system for each viewpoint can be obtained based on the mapping relationships between the camera coordinate system and the world coordinate system, and between the camera coordinate system and the pixel coordinate system. Therefore, for multiple viewpoints, multiple mapping relationships can be obtained, where each mapping relationship is the mapping relationship between the pixel coordinate system and the world coordinate system for a given viewpoint.
[0090] S302. Based on multiple mapping relationships, map multiple first pixel coordinates and multiple second pixel coordinates to the world coordinate system respectively, to obtain multiple first mapped coordinates of the first feature point in multiple views and multiple second mapped coordinates of the second feature point in multiple views.
[0091] For example, based on each mapping relationship, the first pixel coordinates of the first feature point in the corresponding viewpoint and the second pixel coordinates of the second feature point in the corresponding viewpoint can be mapped from the pixel coordinate system of that viewpoint to the world coordinate system, resulting in the first mapped coordinates of the first feature point in the corresponding viewpoint and the second mapped coordinates of the second feature point in the corresponding viewpoint. Therefore, for the first feature point, multiple first mapped coordinates can be obtained from multiple viewpoints; similarly, for the second feature point, multiple second mapped coordinates can be obtained from multiple viewpoints.
[0092] S303. Based on multiple first mapping coordinates and camera positions from multiple viewpoints, determine the direction vectors of the first rays from multiple viewpoints.
[0093] Multiple first mapping coordinates can be used to indicate the corresponding positions of the first feature point under multiple viewpoints. Therefore, in possible implementations, the ray pointing from the camera position of each viewpoint to the first mapping coordinate under that viewpoint can be determined based on the camera position of each viewpoint and the first mapping coordinate under that viewpoint, and the direction vector of the first ray of each viewpoint can be determined.
[0094] S304. Based on multiple second-mapped coordinates and camera positions from multiple viewpoints, determine the direction vectors of the second rays from multiple viewpoints.
[0095] Multiple second mapping coordinates can be used to indicate the corresponding positions of the second feature points under multiple viewpoints. Therefore, in possible implementations, the ray pointing from the camera position of each viewpoint to the second mapping coordinate under that viewpoint can be determined based on the camera position of each viewpoint and the second mapping coordinate under that viewpoint, and the direction vector of the second ray of each viewpoint can be determined.
[0096] In the 3D scene ranging method provided in this embodiment, the camera position of each viewpoint and the mapping relationship between the pixel coordinate system and the world coordinate system under each viewpoint can be determined by the camera parameters of each viewpoint. Based on the mapping relationship, the pixel coordinates of two feature points under multiple viewpoints, i.e., multiple pixel coordinates and multiple second pixel coordinates, are mapped to the world coordinate system. Then, based on the mapped coordinates of the two feature points under multiple viewpoints and the camera position under each viewpoint, the ray direction vector of each feature point under each viewpoint is determined, which ensures that the determination of the ray direction vector is more accurate, thereby ensuring the accuracy of the 3D coordinates of each feature point in the world coordinate system, and thus ensuring the accuracy of ranging of the 3D scene.
[0097] Based on the three-dimensional scene ranging method shown in any of the above embodiments, the following embodiments of this application illustrate the three-dimensional coordinates of the first feature point and the second feature point in the world coordinate system through specific possible implementation methods. Figure 4 This is a flowchart illustrating a method for determining the first three-dimensional coordinates of a first feature point in a three-dimensional scene ranging method provided in an embodiment of this application. Figure 4 As shown, in S103 above, determining the intersection coordinates of the first rays from multiple viewpoints as the first three-dimensional coordinates of the first feature point in the world coordinate system based on the camera positions from multiple viewpoints and the direction vectors of the first rays from multiple viewpoints can include:
[0098] S401. Based on the camera positions from multiple viewpoints and the direction vectors of the first rays from multiple viewpoints, determine the coordinates of multiple first points on the first rays from multiple viewpoints that have the smallest sum of distances to the center point.
[0099] In a specific implementation, the first relationship between the position of the first feature point in each viewpoint, the camera position in each viewpoint, and the direction vector of the first ray in each viewpoint can be determined based on the camera position in each viewpoint and the direction vector of the first ray in each viewpoint.
[0100] This first relation can be represented as, for example, r A,i =o i +t A,i d A,i , where r A,i Let o be the first three-dimensional coordinate, that is, the coordinates of the first feature point A at the corresponding positions in the i-th viewpoints. i Let d be the camera position of the i-th viewpoint, where i = any integer from 1 to n, n is the total number of viewpoints, and d A,i Let t be the direction vector of the first ray from the i-th viewpoint. A,i Let be the position of the first feature point A in the i-th view, and the offset relative to the camera position in that view.
[0101] Therefore, as long as the offset of the corresponding position of the first feature point in each viewpoint relative to the camera position of the corresponding viewpoint is determined, the corresponding position of the first feature point in each viewpoint, i.e., the coordinates of multiple first points, can be determined.
[0102] In this regard, the present application provides two possible implementation methods to determine the coordinates of multiple first points in the following embodiments.
[0103] In a first possible implementation, points on the first rays from multiple viewpoints are traversed based on the camera positions from multiple perspectives and the direction vectors of the first rays from those perspectives, using a preset first initial offset. The distances between the traversed points and their center points are determined. The first initial offset is adjusted, and the traversal continues based on the same adjusted offset until the distances between the traversed points and their corresponding center points are minimized. The offset at the end of the traversal is then the first optimal offset of the first feature point from multiple viewpoints. Furthermore, the coordinates of multiple first points can be determined based on the first optimal offset at the end of the traversal, the camera positions from multiple viewpoints, and the direction vectors of the first rays from those viewpoints. These coordinates represent the optimal positions of the first feature points from multiple viewpoints.
[0104] In the second possible implementation, a first distance function can be constructed between the coordinates of the corresponding positions of the first feature points on the multiple first rays and the coordinates of the center point, based on the camera positions from multiple viewpoints and the direction vectors of the first rays from multiple viewpoints; the first distance function is solved using a preset gradient descent algorithm to obtain the coordinates of the multiple first points.
[0105] The first distance function can be expressed as follows:
[0106]
[0107] Among them, o i +t A,i d A,i Used to represent the coordinates of a point on the first ray from the i-th viewpoint of the first feature point A. Used to represent the center point coordinates of the first feature point A at the corresponding positions in n viewpoints.
[0108] Given the first distance function, t can be obtained by differentiating the first distance function. A,i The partial derivative function is then used, and a preset gradient descent algorithm is employed, based on a preset first initial offset, to determine the value of t in the first distance function. A,i By iteratively solving the partial derivative function, the sum of distances in the first distance function can be minimized, thus obtaining the first optimal offset, i.e., a set of t... A,i Once the first optimal offset is obtained, the coordinates of multiple first points can be determined based on the first optimal offset, the camera positions from multiple viewpoints, and the direction vector of the first ray from each viewpoint. These coordinates represent the optimal positions of the first feature points from multiple viewpoints. The derivative of the first distance function can be calculated using a pre-defined derivative tool.
[0109] Regardless of the method used to determine the coordinates of multiple first points, the initial offset can be, for example, t. A,1 =t A,2 =…t A,n =0. Of course, in other possible implementations, the first initial offset can also be configured with other parameters, and this application embodiment does not limit this.
[0110] S402. Determine the first three-dimensional coordinates based on the coordinates of the center points of multiple first points.
[0111] Given the coordinates of multiple first points, the coordinates of the center point of these multiple first points can be calculated based on these coordinates, and the coordinates of the center point of these multiple first points can be determined as the first three-dimensional coordinates.
[0112] Correspondingly, regarding the second three-dimensional coordinates of the second feature point in the world coordinate system, the method provided in this application embodiment can also be implemented in a corresponding manner. The implementation of determining the second three-dimensional coordinates is explained below with reference to the flowchart, and the similarities will not be repeated here. Figure 5 This is a flowchart illustrating a method for determining the second three-dimensional coordinates of a second feature point in a three-dimensional scene ranging method provided in an embodiment of this application. Figure 5As shown, in S104 above, determining the intersection coordinates of the second rays from multiple viewpoints as the second three-dimensional coordinates of the second feature point in the world coordinate system based on the camera positions from multiple viewpoints and the direction vectors of the second rays from multiple viewpoints can include:
[0113] S501. Based on the camera positions from multiple viewpoints and the direction vectors of the second rays from multiple viewpoints, determine the coordinates of multiple second points on the second rays from multiple viewpoints that have the smallest sum of distances to the center point.
[0114] In a specific implementation, the second relationship between the position of the second feature point in each viewpoint, the camera position in each viewpoint, and the direction vector of the second ray in each viewpoint can be determined based on the camera position in each viewpoint and the direction vector of the second ray in each viewpoint.
[0115] This second relation can be represented, for example, as: r B,i =o i +t B,i d B,i , where r B,i The second three-dimensional coordinates, i.e., the coordinates of the second feature point B at the corresponding positions in the i-th viewpoint, o i Let d be the camera position of the i-th viewpoint, where i = any integer from 1 to n, n is the total number of viewpoints, and d B,i Let t be the direction vector of the second ray from the i-th viewpoint. B,i Let be the offset of the second feature point B relative to the camera position in the i-th view.
[0116] Therefore, as long as the offset of the corresponding position of the second feature point in each viewpoint relative to the camera position of the corresponding viewpoint is determined, the corresponding position of the second feature point in each viewpoint, i.e., the coordinates of multiple second points, can be determined.
[0117] In this regard, embodiments of this application also provide two possible implementations for the second feature point to determine the coordinates of multiple second points.
[0118] In the first possible implementation, based on the camera positions from multiple viewpoints and the direction vectors of the second rays from multiple viewpoints, and using a second initial offset, points on the second rays from multiple viewpoints are traversed, and the distances between the traversed points and their center points are determined. The second initial offset is adjusted, and based on the same adjusted offset, the traversal of points on the second rays from multiple viewpoints continues until the distances between the traversed points and their corresponding center points are minimized. The offset at the end of the traversal is then the second optimal offset of the second feature point under multiple viewpoints. Furthermore, based on the second optimal offset at the end of the traversal, the camera positions from multiple viewpoints, and the direction vectors of the second rays from those viewpoints, the coordinates of multiple second points can be determined, which are the coordinates of the optimal position of the second feature point under multiple viewpoints.
[0119] In the second possible implementation, a second distance function can be constructed based on the camera positions from multiple viewpoints and the direction vectors of the second rays from multiple viewpoints, between the coordinates of the corresponding positions of the second feature points on multiple second rays and the coordinates of the center point; a preset gradient descent algorithm is used to solve the second distance function to obtain the coordinates of multiple second points.
[0120] The second distance function can be expressed as follows:
[0121]
[0122] Among them, o i +t B,i d B,i The coordinates of the point on the second ray at the i-th viewpoint of the second feature point B are used to represent the coordinates of the point. This is used to represent the center point coordinates of the second feature point B at the corresponding positions in n viewpoints.
[0123] Given the second distance function, t can be obtained by differentiating the second distance function. B,i The partial derivative function is then used, and a preset gradient descent algorithm is employed to process t in the second distance function. B,i By iteratively solving the partial derivative function, the sum of distances in the second distance function can be minimized, thus obtaining the second optimal offset, i.e., a set of t B,i Once the second optimal offset is obtained, the coordinates of multiple second points can be determined based on the second optimal offset, the camera positions from multiple viewpoints, and the direction vector of the second ray from each viewpoint. These coordinates represent the optimal positions of the second feature points from multiple viewpoints. The derivative of the second distance function can be calculated using a pre-defined derivative tool.
[0124] S502. Determine the second three-dimensional coordinates based on the coordinates of the center points of multiple second points.
[0125] Given the coordinates of multiple second points, the coordinates of the center point of these multiple second points can be calculated based on these coordinates, and the coordinates of the center point of these multiple second points can be determined as the second three-dimensional coordinates.
[0126] In the three-dimensional scene ranging method provided in this embodiment, the coordinates of multiple first points with the smallest sum of distances to the center point can be determined from the first rays of multiple viewpoints using the camera positions of multiple viewpoints and the direction vectors of the first rays of multiple viewpoints. Then, the first three-dimensional coordinates are determined. At the same time, the second feature point can also be determined in a similar way to determine the second three-dimensional coordinates. This can improve the accuracy of determining the three-dimensional coordinates of the first feature point and the second feature point, thereby improving the accuracy of three-dimensional scene ranging.
[0127] The following describes the three-dimensional scene ranging device, electronic device and storage medium used to execute the three-dimensional scene ranging device, electronic device and storage medium provided in this application. The specific implementation process and technical effects are described above and will not be repeated below.
[0128] This application provides a possible implementation example of a three-dimensional scene ranging device, which can perform the three-dimensional scene ranging method provided in the above embodiments. Figure 6 This is a schematic diagram of a three-dimensional scene ranging device provided in an embodiment of this application. Figure 6 As shown, the three-dimensional scene ranging device 600 includes:
[0129] The acquisition module 601 is used to acquire images of the target 3D scene from multiple perspectives.
[0130] The first determining module 602 is used to determine the camera positions of multiple viewpoints in the world coordinate system, the direction vector of the first ray of the first feature point in the multiple viewpoints, and the direction vector of the second ray of the second feature point in the multiple viewpoints, based on the camera parameters of multiple viewpoints and the images of multiple viewpoints.
[0131] The second determining module 603 is used to determine the intersection coordinates of the first rays from multiple perspectives as the first three-dimensional coordinates of the first feature point in the world coordinate system based on the camera positions from multiple perspectives and the direction vectors of the first rays from multiple perspectives.
[0132] The third determining module 604 is used to determine the intersection coordinates of the second rays from multiple perspectives as the second three-dimensional coordinates of the second feature point in the world coordinate system based on the camera positions from multiple perspectives and the direction vectors of the second rays from multiple perspectives.
[0133] The fourth determining module 605 is used to determine the distance between the first feature point and the second feature point in the target three-dimensional scene based on the first three-dimensional coordinates and the second three-dimensional coordinates.
[0134] Optionally, the first determining module 602 is specifically used to: determine multiple first pixel coordinates of the first feature point in the image from multiple viewpoints, and multiple second pixel coordinates of the second feature point in the image from multiple viewpoints; and determine the camera position of the multiple viewpoints, the direction vector of the first ray of the multiple viewpoints, and the direction vector of the second ray of the multiple viewpoints based on the camera parameters of the multiple viewpoints, the multiple first pixel coordinates, and the multiple second pixel coordinates.
[0135] Optionally, the first determining module 602 is specifically used for: determining the camera positions of multiple viewpoints in the world coordinate system and multiple mapping relationships between the pixel coordinate system and the world coordinate system in the multiple viewpoints based on the camera parameters of multiple viewpoints; mapping multiple first pixel coordinates and multiple second pixel coordinates to the world coordinate system according to the multiple mapping relationships to obtain multiple first mapped coordinates of the first feature point in the multiple viewpoints and multiple second mapped coordinates of the second feature point in the multiple viewpoints; determining the direction vector of the first ray in the multiple viewpoints based on the multiple first mapped coordinates and the camera positions of the multiple viewpoints; and determining the direction vector of the second ray in the multiple viewpoints based on the multiple second mapped coordinates and the camera positions of the multiple viewpoints.
[0136] Optionally, the second determining module 603 is specifically used to: determine the coordinates of a plurality of first points with the smallest sum of distances to the center point from the first rays of the plurality of views based on the camera positions of the plurality of views and the direction vectors of the first rays of the plurality of views; and determine the first three-dimensional coordinates based on the coordinates of the center point of the plurality of first points.
[0137] Optionally, the second determining module 603 is specifically used to: construct a first distance function between the coordinates of the corresponding positions of the first feature points on the multiple first rays and the coordinates of the center point, based on the camera positions from multiple viewpoints and the direction vectors of the first rays from multiple viewpoints; and solve the first distance function using a preset gradient descent algorithm to obtain the coordinates of the multiple first points.
[0138] Optionally, the third determining module 604 is specifically used to: determine the coordinates of multiple second points with the smallest sum of distances to the center point from the second rays of the multiple viewpoints based on the camera positions of the multiple viewpoints and the direction vectors of the second rays of the multiple viewpoints; and determine the second three-dimensional coordinates based on the coordinates of the center point of the multiple second points.
[0139] Optionally, the third determining module 604 is specifically used to: construct a second distance function between the coordinates of the corresponding positions of the second feature points on the multiple second rays and the coordinates of the center point, based on the camera positions from multiple viewpoints and the direction vectors of the second rays from multiple viewpoints; and solve the second distance function using a preset gradient descent algorithm to obtain the coordinates of the multiple second points.
[0140] Optionally, the acquisition module 601 is specifically used to: use the implicit 3D reconstruction model of the target 3D scene to acquire simulation images from multiple perspectives as images from multiple perspectives; or, acquire real images from multiple perspectives collected for the target 3D scene as images from multiple perspectives.
[0141] The above-described device is used to execute the method provided in the foregoing embodiments, and its implementation principle and technical effect are similar, so they will not be described again here.
[0142] These modules can be one or more integrated circuits configured to implement the above methods, such as one or more Application Specific Integrated Circuits (ASICs), one or more digital signal processors (DSPs), or one or more Field Programmable Gate Arrays (FPGAs). Alternatively, when a module is implemented using processing element scheduler code, the processing element can be a general-purpose processor, such as a Central Processing Unit (CPU) or other processor capable of calling program code. Furthermore, these modules can be integrated together as a system-on-a-chip (SOC).
[0143] This application provides a possible implementation example of an electronic device capable of executing the three-dimensional scene ranging method provided in the above embodiments. Figure 7 This is a schematic diagram of an electronic device provided in an embodiment of this application. The device can be integrated into a terminal device or a chip of a terminal device, and the device can be a computing device with data processing capabilities.
[0144] The electronic device 700 includes a processor 701, a storage medium 702, and a bus. The storage medium 702 stores program instructions executable by the processor 701. When the electronic device 700 is running, the processor 701 communicates with the storage medium 702 via the bus, and the processor 701 executes the program instructions to perform the steps of the aforementioned three-dimensional scene ranging method. The specific implementation and technical effects are similar and will not be described in detail here.
[0145] This application provides a possible implementation example of a computer-readable storage medium capable of executing the three-dimensional scene ranging method provided in the above embodiments. The storage medium stores a computer program, which is executed by a processor to perform the steps of the three-dimensional scene ranging method described above.
[0146] A computer program stored in a storage medium may include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute some steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0147] In the several embodiments provided by this invention, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0148] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0149] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional units.
[0150] The integrated units implemented as software functional units described above can be stored in a computer-readable storage medium. These software functional units, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute some steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0151] The above are merely specific embodiments 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 scope of the technology 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 three-dimensional scene ranging method, characterized in that, include: Acquire images of the target 3D scene from multiple perspectives; Based on the camera parameters of the multiple viewpoints and the images of the multiple viewpoints, determine the camera positions of the multiple viewpoints in the world coordinate system, the direction vector of the first ray of the first feature point in the multiple viewpoints, and the direction vector of the second ray of the second feature point in the multiple viewpoints. Based on the camera positions of the multiple viewpoints and the direction vectors of the first rays of the multiple viewpoints, the coordinates of the intersection point of the first rays of the multiple viewpoints are determined as the first three-dimensional coordinates of the first feature point in the world coordinate system. Based on the camera positions of the multiple viewpoints and the direction vectors of the second rays of the multiple viewpoints, the coordinates of the intersection of the second rays of the multiple viewpoints are determined as the second three-dimensional coordinates of the second feature point in the world coordinate system; Based on the first three-dimensional coordinates and the second three-dimensional coordinates, the distance between the first feature point and the second feature point in the target three-dimensional scene is determined.
2. The method according to claim 1, characterized in that, The step of determining the camera positions of the multiple viewpoints in the world coordinate system, the direction vector of the first ray of the first feature point in the multiple viewpoints, and the direction vector of the second ray of the second feature point in the multiple viewpoints, based on the camera parameters of the multiple viewpoints and the images of the multiple viewpoints, includes: Determine multiple first pixel coordinates of the first feature point in the images from multiple viewpoints, and multiple second pixel coordinates of the second feature point in the images from multiple viewpoints; Based on the camera parameters of the multiple viewpoints, the multiple first pixel coordinates, and the multiple second pixel coordinates, determine the camera positions of the multiple viewpoints, the direction vectors of the first rays of the multiple viewpoints, and the direction vectors of the second rays of the multiple viewpoints.
3. The method according to claim 2, characterized in that, The step of determining the camera positions of the multiple viewpoints, the direction vectors of the first rays of the multiple viewpoints, and the direction vectors of the second rays of the multiple viewpoints based on the camera parameters of the multiple viewpoints, the multiple first pixel coordinates, and the multiple second pixel coordinates includes: Based on the camera parameters of the multiple viewpoints, determine the camera positions of the multiple viewpoints in the world coordinate system, as well as multiple mapping relationships between the pixel coordinate system and the world coordinate system in the multiple viewpoints; Based on the multiple mapping relationships, the multiple first pixel coordinates and the multiple second pixel coordinates are respectively mapped to the world coordinate system to obtain multiple first mapped coordinates of the first feature point in the multiple viewpoints and multiple second mapped coordinates of the second feature point in the multiple viewpoints; Based on the multiple first mapping coordinates and the camera positions of the multiple viewpoints, determine the direction vector of the first ray of the multiple viewpoints; Based on the multiple second mapping coordinates and the camera positions of the multiple viewpoints, the direction vectors of the second rays from the multiple viewpoints are determined.
4. The method according to claim 1, characterized in that, The step of determining the coordinates of the first intersection point of the first rays from the multiple viewpoints as the first three-dimensional coordinates of the first feature point in the world coordinate system based on the camera positions from the multiple viewpoints and the direction vectors of the first rays from the multiple viewpoints includes: Based on the camera positions of the multiple viewpoints and the direction vectors of the first rays of the multiple viewpoints, determine the coordinates of multiple first points with the smallest sum of distances to the center point from the first rays of the multiple viewpoints; The first three-dimensional coordinates are determined based on the coordinates of the center points of the plurality of first points.
5. The method according to claim 4, characterized in that, The step of determining the coordinates of multiple first points with the smallest sum of distances to the center point from the first rays of the multiple viewpoints, based on the camera positions of the multiple viewpoints and the direction vectors of the first rays of the multiple viewpoints, includes: Based on the camera positions of the multiple viewpoints and the direction vectors of the first rays of the multiple viewpoints, a first distance function is constructed between the coordinates of the corresponding positions of the first feature point on the multiple first rays and the coordinates of the center point. The first distance function is solved using a preset gradient descent algorithm to obtain the coordinates of the plurality of first points.
6. The method according to claim 1, characterized in that, The step of determining the intersection coordinates of the second rays from the multiple viewpoints as the second three-dimensional coordinates of the second feature point in the world coordinate system based on the camera positions from the multiple viewpoints and the direction vectors of the second rays from the multiple viewpoints includes: Based on the camera positions of the multiple viewpoints and the direction vectors of the second rays of the multiple viewpoints, determine the coordinates of multiple second points with the smallest sum of distances to the center point from the second rays of the multiple viewpoints; The second three-dimensional coordinates are determined based on the coordinates of the center points of the plurality of second points.
7. The method according to claim 6, characterized in that, The step of determining the coordinates of multiple second points with the smallest sum of distances to the center point from the second rays of the multiple viewpoints, based on the camera positions of the multiple viewpoints and the direction vectors of the second rays of the multiple viewpoints, includes: Based on the camera positions of the multiple viewpoints and the direction vectors of the second rays of the multiple viewpoints, a second distance function is constructed between the coordinates of the corresponding positions of the second feature point on the multiple second rays and the coordinates of the center point. The second distance function is solved using a preset gradient descent algorithm to obtain the coordinates of the plurality of second points.
8. The method according to any one of claims 1-7, characterized in that, The acquisition of images of the target 3D scene from multiple perspectives includes: Using the implicit 3D reconstruction model of the target 3D scene, simulated images from multiple perspectives are obtained as images from those multiple perspectives; or, Acquire real images from multiple perspectives of the target 3D scene as images from the multiple perspectives.
9. A three-dimensional scene ranging device, characterized in that, The three-dimensional scene ranging device includes: The acquisition module is used to acquire images of the target 3D scene from multiple perspectives; The first determining module is used to determine, based on the camera parameters of the multiple viewpoints and the images of the multiple viewpoints, the camera position of the multiple viewpoints in the world coordinate system, the direction vector of the first ray of the first feature point in the multiple viewpoints, and the direction vector of the second ray of the second feature point in the multiple viewpoints. The second determining module is used to determine the intersection coordinates of the first rays of the multiple viewpoints as the first three-dimensional coordinates of the first feature point in the world coordinate system based on the camera positions of the multiple viewpoints and the direction vectors of the first rays of the multiple viewpoints. The third determining module is used to determine the intersection coordinates of the second rays of the multiple viewpoints as the second three-dimensional coordinates of the second feature point in the world coordinate system based on the camera positions of the multiple viewpoints and the direction vectors of the second rays of the multiple viewpoints. The fourth determining module is used to determine the distance between the first feature point and the second feature point in the target three-dimensional scene based on the first three-dimensional coordinates and the second three-dimensional coordinates.
10. An electronic device, characterized in that, include: The device includes a processor, a storage medium, and a bus. The storage medium stores program instructions executable by the processor. When the electronic device is running, the processor communicates with the storage medium via the bus. The processor executes the program instructions to perform the steps of the three-dimensional scene ranging method as described in any one of claims 1-8.
Citation Information
Patent Citations
Measurement method of planeness based on image processing and pattern recognizing
CN101033953A
Electronic equipment as well as single-camera object-positioning device and method thereof
CN101887330A