Three-dimensional reconstruction method and device, electronic equipment and computer readable storage medium
By using a method based on an undirected distance field and using sampling weights and volume rendering weights for 3D reconstruction, the problem of low accuracy in the reconstruction of non-closed curved surfaces and complex topological surfaces in the existing technology is solved, and the application scope of 3D reconstruction is expanded.
Patent Information
- Application Number
- CN202310430582.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-13
- Publication Date
- 2024-10-18
AI Technical Summary
Existing three-dimensional reconstruction methods are difficult to handle the reconstruction of non-closed surfaces, especially the reconstruction of complex topological surfaces with low accuracy and limited application range.
A method based on the undirected distance field is used to establish an initial undirected distance field through image and camera parameters, determine the sampling weight and volume rendering weight, and perform iterative updates to achieve three-dimensional reconstruction, which is suitable for the reconstruction of closed and open surfaces.
It improves the accuracy and application scope of 3D reconstruction, can handle 3D models of any topology, and does not require additional 3D supervision, relying only on 2D image supervision.
Smart Images

Figure CN118799530A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of the Internet, and relate to but are not limited to a three-dimensional reconstruction method, device, electronic device, and computer-readable storage medium. Background Art
[0002] Three-dimensional reconstruction is an important and fundamental problem in computer graphics and computer vision. Reconstructing open surfaces of arbitrary topology from two-dimensional images is an important research direction.
[0003] In related technologies, when performing 3D reconstruction, the Neural Radiance Field (NeRF) is usually used to broaden the field of vision of learning 3D information from 2D images, or, in work based on NeRF, the Signed Distance Function (SDF) is further introduced into the NeRF, thereby obtaining the ability to extract high-quality closed surfaces from 2D images, and the reconstruction effect has been significantly improved compared with traditional methods. In addition, some methods based on NeRF also enhance the ability to process open surfaces by improving the signed distance field.
[0004] However, these methods can only achieve 3D reconstruction of closed surfaces, which greatly limits the scope of application of 3D reconstruction, making the scope of application of 3D reconstruction methods relatively narrow. As for the 3D reconstruction of non-closed surfaces, since the neural implicit field-based methods in related technologies require 3D data as supervision, the accuracy of 3D reconstruction of non-closed surfaces is low, and it is unable to handle the reconstruction of surfaces with complex topology. Summary of the invention
[0005] The embodiments of the present application provide a three-dimensional reconstruction method, device, electronic device and computer-readable storage medium, which can at least be applied to the fields of artificial intelligence and three-dimensional model reconstruction, and can reconstruct three-dimensional models for different target objects, thereby improving the scope of application of the three-dimensional reconstruction method and the accuracy of reconstruction.
[0006] The technical solution of the embodiment of the present application is implemented as follows:
[0007] The embodiment of the present application provides a three-dimensional reconstruction method, comprising: establishing an initial undirected distance field of a space where the target object is located based on multiple images of the target object and camera parameters corresponding to each of the images; the initial undirected distance field includes an initial distance value between each spatial point in the space and the surface of the target object; determining a sampling weight and a volume rendering weight of the corresponding spatial point based on the initial distance value of each spatial point and a preset light direction; performing upsampling processing on all spatial points in the space based on the sampling weight to obtain multiple sampling points; performing volume rendering on the multiple sampling points based on the volume rendering weight to obtain a rendering color value of each of the sampling points; iteratively updating the initial undirected distance field of the target object based on the rendering color values of the sampling points to obtain an updated undirected distance field of the space where the target object is located; and performing three-dimensional reconstruction on the target object based on the updated undirected distance field to obtain a three-dimensional model of the target object.
[0008] The embodiment of the present application provides a three-dimensional reconstruction device, which includes: an undirected distance field establishment module, which is used to establish an initial undirected distance field of the space where the target object is located based on multiple images of the target object and camera parameters corresponding to each of the images; the initial undirected distance field includes an initial distance value between each spatial point in the space and the surface of the target object; a weight determination module, which is used to determine the sampling weight and volume rendering weight of the corresponding spatial point based on the initial distance value of each spatial point and a preset light direction; a processing module, which is used to perform upsampling processing on all spatial points in the space based on the sampling weight to obtain multiple sampling points; based on the volume rendering weight, perform volume rendering on the multiple sampling points to obtain a rendering color value of each of the sampling points; an iterative update module, which is used to iteratively update the initial undirected distance field of the target object based on the rendering color value of the sampling point to obtain an updated undirected distance field of the space where the target object is located; and a three-dimensional reconstruction module, which is used to perform three-dimensional reconstruction on the target object based on the updated undirected distance field to obtain a three-dimensional model of the target object.
[0009] In some embodiments, the undirected distance field establishment module is further used to: extract scene boundary information and shooting parameters of the space from the camera parameters; determine the space where the target object is located based on the scene boundary information; determine the position information of each spatial point in the space based on the shooting parameters; input the position information and the multiple images into the neural radiation field network to obtain an initial distance value between each spatial point in the space and the surface of the target object; and establish an initial undirected distance field of the space where the target object is located through the initial distance value between each spatial point in the space and the surface of the target object.
[0010] In some embodiments, the weight determination module is further used to: determine the sampling weight of the corresponding spatial point based on the initial distance value of each spatial point; determine the volume rendering weight of the corresponding spatial point based on the initial distance value of each spatial point and a preset light direction.
[0011] In some embodiments, the weight determination module is further used to: obtain a preset upsampling weight function; determine the sampling density of the upsampling process in the current iterative update process; the sampling density is a parameter determined based on the historical updated undirected distance field, and the historical updated undirected distance field is an updated undirected distance field obtained in the last iterative update process before the current iterative update; the sampling density includes a first type of sampling density and a second type of sampling density, and the first type of sampling density is greater than the second type of sampling density; when iteratively updating the initial undirected distance field, cyclically using the first type of sampling density and the second type of sampling density to determine the sampling weight; the sampling density and the initial distance value of each spatial point are input into the upsampling weight function to obtain the sampling weight of the corresponding spatial point.
[0012] In some embodiments, the weight determination module is also used to: obtain the normal direction of each of the spatial points mapped to the surface position of the target object; determine the angle value of the angle between the normal direction and the light direction; obtain a preset volume rendering weight function; determine the parameters to be learned for volume rendering during the current iterative update process; the parameters to be learned are parameters determined based on the historical updated undirected distance field, and the historical updated undirected distance field is the updated undirected distance field obtained in the last iterative update process before the current iterative update; the parameters to be learned and the angle value are input into the volume rendering weight function to obtain the volume rendering weight of the corresponding spatial point.
[0013] In some embodiments, the volume rendering weights of all spatial points determined by the volume rendering weight function satisfy at least one of the following conditions: global unbiased, local unbiased, and occlusion-aware; the global unbiased means that as the number of iterative updates increases, when the volume rendering weights are determined by the volume rendering weight function, the volume rendering weights of the spatial points at the surface interface with the target object are equal to 1; the local unbiased means that as the number of iterative updates increases, when the volume rendering weights are determined by the volume rendering weight function, the volume rendering weights of the spatial points at the surface interface with the target object are greater than the volume rendering weights of other spatial points at non-surface interfaces; the occlusion-aware means that along the direction of the light, in an area obscured by a portion of the surface of the target object, if there is another portion of the surface of the target object, the volume rendering weights of the spatial points at the other portion of the surface are less than the volume rendering weights of the spatial points at the portion of the surface of the target object.
[0014] In some embodiments, the processing module is further used to: based on the sampling weight, upsample the spatial points in the space in the direction of light corresponding to the camera parameter to obtain a plurality of sampling points.
[0015] In some embodiments, the processing module is also used to: obtain the sampling weight of each of the multiple spatial points in each of the multiple light directions corresponding to the camera parameters; and determine the spatial point whose sampling weight is greater than the sampling weight threshold as the sampling point in the light direction.
[0016] In some embodiments, the processing module is also used to: perform feature extraction on the multiple images to obtain an initial color value of each of the sampling points; and perform color integration on the initial color values of multiple sampling points in the direction of each light ray based on the volume rendering weight to obtain a rendering color value of each of the sampling points.
[0017] In some embodiments, the processing module is further used to: obtain initial color values of multiple sampling points in the direction of each light ray and a volume rendering weight of each of the sampling points; determine the color product between the volume rendering weight of each of the sampling points and the initial color value; and along the direction of the light ray, perform color integration on the color product, accumulate the color product of each sampling point in turn, and obtain a rendering color value projected onto the surface of the target object.
[0018] In some embodiments, the apparatus further comprises: a zero point set acquisition module, configured to acquire a zero point set corresponding to the initial undirected distance field, wherein the zero point set corresponds to a plurality of zero point set sampling points whose initial distance value is zero; a gradient determination module, configured to determine a gradient value of each of the zero point set sampling points based on the initial undirected distance field; an offset acquisition module, configured to acquire a preset offset; a gradient update module, configured to update the gradient value of each of the zero point set sampling points based on the offset to obtain an updated gradient value; and a distance field update module, configured to update the initial undirected distance field based on the updated gradient value to obtain an updated undirected distance field in the space where the target object is located.
[0019] In some embodiments, the iterative update module is further used to: obtain the rendered color value and the real color value of the sampling point on the surface of the target object; determine the color difference between the rendered color value and the real color value; determine the loss result of the neural radiation field network based on the color difference; the neural radiation field network is used to predict each initial distance value in the initial undirected distance field; based on the loss result, the network parameters of the neural radiation field network are updated to obtain an updated neural radiation field network; the initial undirected distance field of the target object is iteratively updated by the updated neural radiation field network to obtain an updated undirected distance field in the space where the target object is located.
[0020] An embodiment of the present application provides an electronic device, comprising: a memory for storing executable instructions; and a processor for implementing the above-mentioned three-dimensional reconstruction method when executing the executable instructions stored in the memory.
[0021] An embodiment of the present application provides a computer program product, which includes executable instructions stored in a computer-readable storage medium; wherein a processor of an electronic device reads the executable instructions from the computer-readable storage medium, and when executing the executable instructions, the above-mentioned three-dimensional reconstruction method is implemented.
[0022] An embodiment of the present application provides a computer-readable storage medium storing executable instructions for causing a processor to execute the executable instructions to implement the above-mentioned three-dimensional reconstruction method.
[0023] The embodiments of the present application have the following beneficial effects: based on the initial distance value of each spatial point in the space where the target object is located and the preset light direction, the sampling weight and volume rendering weight of the corresponding spatial point are respectively determined; thus, based on the sampling weight and the volume rendering weight, the spatial points in the space are sequentially upsampled and volume rendered to obtain the rendering color value of the spatial point; and then based on the rendering color value of the spatial point, the initial undirected distance field of the target object is iteratively updated to obtain the updated undirected distance field of the space where the target object is located. In this way, since when the initial undirected distance field is iteratively updated, the upsampling and volume rendering are performed based on the determined sampling weight and volume rendering weight, and the sampling weight and volume rendering weight are determined based on the initial distance value of each spatial point and the preset light direction, therefore, the sampling weight can ensure accurate upsampling of the spatial point, and the volume rendering weight can accurately perform volume rendering on the sampling points obtained by the upsampling process, thereby obtaining a rendering color value that is closer to the real color value of the target object, and obtaining an accurate undirected distance field of the target object. In addition, the three-dimensional reconstruction method of the embodiment of the present application can handle the reconstruction of any open surface, has a wider range of applications, and is processed through sampling weights and volume rendering weights. It does not require additional three-dimensional supervision and can handle surface reconstruction with complex topology using only two-dimensional image supervision. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 It is a flow chart of realizing the neural radiation field in the related art;
[0025] Figure 2 It is a schematic diagram of weight design in the related art;
[0026] Figure 3 It is a schematic diagram of the implementation process of the 3PSDF technology in the related art using additional symbols to represent the open surface;
[0027] Figure 4 is an optional architecture diagram of a three-dimensional reconstruction system provided in an embodiment of the present application;
[0028] Figure 5 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0029] Figure 6 This is an optional flowchart of the three-dimensional reconstruction method provided in the embodiment of the present application;
[0030] Figure 7 is another optional flowchart of the three-dimensional reconstruction method provided in the embodiment of the present application;
[0031] Figure 8 It is a schematic diagram of the implementation process of establishing an initial undirected distance field provided by an embodiment of the present application;
[0032] Fig. 9 is a schematic diagram of an implementation flow of determining sampling weights provided in an embodiment of the present application;
[0033] Fig.10 is a schematic diagram of an implementation flow of determining volume rendering weights provided in an embodiment of the present application;
[0034] Fig.11 It is a schematic diagram of the implementation process of iteratively updating the initial undirected distance field provided by an embodiment of the present application;
[0035] Fig.12 is a schematic diagram of an algorithm flow of a three-dimensional reconstruction method provided in an embodiment of the present application;
[0036] Fig.13 is a schematic diagram of changes in global unbiased volume rendering weights provided in an embodiment of the present application;
[0037] Fig.14 is a schematic diagram of changes in local unbiased volume rendering weights provided in an embodiment of the present application;
[0038] Fig.15 is a schematic diagram of changes in occlusion-aware volume rendering weights provided in an embodiment of the present application;
[0039] Fig.16 This is a schematic diagram of the effect of separating volume rendering weights and sampling weights provided in an embodiment of the present application;
[0040] Fig.17 Schematic diagram of the principle of normal regularization provided in the embodiment of the present application;
[0041] Fig.18 It is a schematic diagram of qualitative and quantitative comparison between the embodiments of the present application and previous work on complex surface structures. DETAILED DESCRIPTION
[0042] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0043] In the following description, reference is made to "some embodiments", which describe a subset of all possible embodiments, but it is understood that "some embodiments" may be the same subset or different subsets of all possible embodiments, and may be combined with each other without conflict. Unless otherwise defined, all technical and scientific terms used in the embodiments of the present application have the same meaning as those commonly understood by those skilled in the art of the technical field of the embodiments of the present application. The terms used in the embodiments of the present application are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.
[0044] Before explaining the information recommendation method of the embodiment of the present application, the method in the related art is first described.
[0045] In the related technologies, one way to achieve three-dimensional reconstruction is through neural radiation fields. Neural radiation fields have greatly broadened the field of vision for learning three-dimensional information from two-dimensional images and have made significant progress in tasks such as new perspective synthesis. However, the density-based representation of neural radiation fields is not suitable for the extraction of three-dimensional meshes. Other works based on neural radiation fields further introduce signed distance fields into neural radiation fields, thereby gaining the ability to extract high-quality closed surfaces from two-dimensional images. The reconstruction effect has been significantly improved compared with traditional methods. However, these methods are limited to processing closed surfaces and ignore the reconstruction of open surfaces. In addition, there are some works based on neural implicit fields that enhance the ability to process open surfaces by improving signed distance fields, but these methods require three-dimensional data as supervision and are not compatible with existing neural radiation fields.
[0046] Here is a description of the method in the related art:
[0047] (1) Methods for achieving three-dimensional reconstruction of neural radiation fields, such as Figure 1 The figure shows the implementation flow chart of the neural radiation field in the related art. The neural radiation field uses a multilayer perceptron (MLP) to learn the color and density of the three-dimensional space point from the 5D input, that is, the position and viewing direction of the input three-dimensional space. The neural radiation field integrates the color along the sampling light through the volume rendering method, compares the rendered image with the real input image, and optimizes the entire network to obtain a credible representation of the scene. Using the network's density representation of the scene, the neural radiation field can obtain high-quality image synthesis from a new perspective.
[0048] However, neural radiance fields are designed to solve the problem of synthesizing new perspectives under the supervision of 2D images, while the density representation of neural radiance fields is not suitable for 3D reconstruction. Extracting 3D meshes from the density requires artificially setting the density threshold, and only closed surfaces can be obtained, and the surface quality is not guaranteed.
[0049] (2) In order to solve the problem that the density representation of the neural radiation field cannot extract high-quality meshes, a new volume rendering method based on a signed distance field is proposed in the related art. Signed distance field (SDF) is a three-dimensional implicit field. For a spatial point in three-dimensional space, it returns a signed distance value (i.e., SDF value) from the spatial point to the surface of the object. A positive SDF value indicates that the spatial point is outside the object, and a negative SDF value indicates that the spatial point is inside the object. The zero isosurface of the SDF field is the surface of the object. In the implementation process, the SDF value is used to encode an object, and the zero isosurface of the SDF field is used to represent the surface of the object. In this way, closed meshes can be naturally extracted from the SDF field through methods such as isosurface extraction (MC, Marching Cubes). In addition, the related art also proposes a weight function that can obtain unbiased and closed-perception rendering weights from the SDF field, thereby promoting the convergence of the network, such as Figure 2 The figure shows a schematic diagram of weight design in the related art. The rendering weight can solve the problem of local bias in rendering in NeRF in the general method. In addition, the related art also uses a DF-based neural radiation field, which can obtain high-quality closed surfaces from multi-view input images. The surface quality has been significantly improved compared to the neural radiation field based on density representation. Among them, f(t) represents the SDF value, w(t) represents the weight value used in rendering, σ(t) represents the density function designed by the general method (for each point in space, there is a visibility of a ray), and ρ(t) represents the density function designed by the related art.
[0050] Although the SDF-based neural radiance field can obtain high-quality closed surfaces from multi-view input images, and its surface quality has been significantly improved compared to the density-represented neural radiance field, SDF can only represent closed surfaces. Therefore, it greatly limits the application of volume rendering methods based on signed distance fields in practical scenarios, such as the reconstruction of thin-film structure objects with open surfaces such as clothes, and the reconstruction of real 3D scanning data.
[0051] (3) Some implicit field-based works have improved the SDF field, making it possible to reconstruct open surfaces. For example, unsigned distance fields (UDFs) are used to represent objects with complex open surface structures, and a neural network is used to model UDFs and extract surface meshes from 3D point clouds. In addition, Figure 3 As shown, it is a schematic diagram of the implementation process of the 3PSDF technology in the related art using additional symbols to represent the open surface, and also using an additional clipping symbol 301 to limit the inner and outer interfaces of the SDF to the vicinity of the open surface, so as to obtain an open surface representation from the SDF field. When extracting the mesh, it is determined whether MC needs to be applied based on the third clipping symbol.
[0052] Although implicit field-based work can solve the problem that SDF cannot represent open surfaces in point cloud reconstruction, these methods require 3D point cloud data as supervision, which greatly limits the scope of application of implicit field-based work. In addition, these methods are not compatible with existing neural radiation field methods, and therefore cannot take advantage of the high-quality 3D reconstruction capabilities of neural radiation fields. SDF cropping-based methods are also limited by the representation capabilities of SDF and cannot represent surfaces with complex topology. Learning high-quality 3D open surface reconstruction of arbitrary topology from only 2D image supervision remains an open problem.
[0053] Based on at least one of the above problems existing in the related art, the embodiment of the present application proposes a multi-eye three-dimensional reconstruction method based on an undirected distance function, which can be used to accurately reconstruct triangular meshes with arbitrary topology, such as closed surfaces and open surfaces. The method proposes to encode objects in three-dimensional space with an undirected distance field, so that structures with open surfaces can be represented. In the implementation process, the undirected distance field is combined with the neural radiation field, and the mesh with open surfaces is trained and extracted from multi-eye input pictures using volume rendering technology. Then a new rendering function and a sampling function are proposed. The rendering function can achieve the effect of unbiased and closed perception in the rendering process based on the undirected distance field, and the sampling function can keep the distribution of sampling points balanced, so as to ensure that the undirected distance field fully converges during the training process. In addition, a normal regularization method for the undirected distance field is also proposed, which uses the sampling point neighborhood information to solve the ambiguity of the normal direction in the undirected distance field. Compared with the method based on the directed distance field in the related art, the method of the embodiment of the present application is more flexible in topology and can represent any object with open and closed surface structures.
[0054] The three-dimensional reconstruction method provided by the embodiment of the present application first establishes an initial undirected distance field of the space where the target object is located based on multiple images of the target object and camera parameters corresponding to each image; the initial undirected distance field includes an initial distance value between each spatial point in the space and the surface of the target object; then, based on the initial distance value of each spatial point and a preset light direction, respectively determine the sampling weight and volume rendering weight of the corresponding spatial point; and based on the sampling weight and the volume rendering weight, sequentially perform upsampling processing and volume rendering on the spatial points in the space to obtain the rendering color value of the spatial points, that is, firstly perform upsampling processing on all spatial points in the space based on the sampling weight to obtain multiple sampling points, and then perform volume rendering on the multiple sampling points based on the volume rendering weight to obtain the rendering color value of each sampling point; then, based on the rendering color value of the spatial point, iteratively update the initial undirected distance field of the target object to obtain an updated undirected distance field of the space where the target object is located; finally, perform three-dimensional reconstruction on the target object based on the updated undirected distance field to obtain a three-dimensional model of the target object. In this way, since upsampling and volume rendering are performed based on the determined sampling weights and volume rendering weights when the initial undirected distance field is iteratively updated, and the sampling weights and volume rendering weights are determined based on the initial distance value of each spatial point and the preset light direction, the sampling weights can ensure accurate upsampling of the spatial points, and the volume rendering weights can accurately perform volume rendering on the sampling points obtained by the upsampling process, thereby obtaining a rendering color value that is closer to the true color value of the target object, and obtaining an accurate undirected distance field for the target object. In addition, the three-dimensional reconstruction method of the embodiment of the present application can handle the reconstruction of any open surface, has a wider range of applications, and is processed by sampling weights and volume rendering weights without the need for additional three-dimensional supervision, and can handle surface reconstruction with complex topology using only two-dimensional image supervision.
[0055] Here, firstly, an exemplary application of the three-dimensional reconstruction device of the embodiment of the present application is described, and the three-dimensional reconstruction device is an electronic device for implementing the three-dimensional reconstruction method. In one implementation, the three-dimensional reconstruction device (i.e., electronic device) provided in the embodiment of the present application can be implemented as a terminal or a server. In one implementation, the three-dimensional reconstruction device provided in the embodiment of the present application can be implemented as a laptop, a tablet computer, a desktop computer, a mobile phone, a portable music player, a personal digital assistant, a dedicated messaging device, a portable gaming device, an intelligent robot, an intelligent home appliance, and an intelligent vehicle-mounted device, and any terminal with a three-dimensional model reconstruction function and an image rendering function; in another implementation, the three-dimensional reconstruction device provided in the embodiment of the present application can also be implemented as a server, wherein the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content distribution networks (CDN, Content Delivery Network), and big data and artificial intelligence platforms. The terminal and the server can be directly or indirectly connected by wired or wireless communication, which is not limited in the embodiment of the present application. Next, an exemplary application when the three-dimensional reconstruction apparatus is implemented as a server will be described.
[0056] See also Figure 4 , Figure 4 It is an optional architectural diagram of the three-dimensional reconstruction system provided in the embodiment of the present application. The embodiment of the present application is explained by applying the three-dimensional reconstruction method to any three-dimensional reconstruction application as an example. In the three-dimensional reconstruction application, the user can request to reconstruct the three-dimensional model of any target object with an open surface and a closed surface structure. In the embodiment of the present application, the three-dimensional reconstruction system 10 includes at least a terminal 100, a network 200 and a server 300. Among them, the server 300 can be a server of the three-dimensional reconstruction application. The server 300 can constitute the three-dimensional reconstruction device of the embodiment of the present application. The terminal 100 is connected to the server 300 via the network 200, and the network 200 can be a wide area network or a local area network, or a combination of the two.
[0057] In an embodiment of the present application, when reconstructing a three-dimensional model of a target object, the terminal 100 receives multiple images of the target object and camera parameters corresponding to each of the images through a client of a three-dimensional reconstruction application, encapsulates the multiple images of the target object and the camera parameters corresponding to each of the images into a three-dimensional reconstruction request, and the terminal 100 sends the three-dimensional reconstruction request to the server 300 through a network 200. After receiving the three-dimensional reconstruction request, the server 300 establishes an initial undirected distance field of the space where the target object is located based on multiple images of the target object and camera parameters corresponding to each image in response to the three-dimensional reconstruction request; the initial undirected distance field includes an initial distance value between each spatial point in the space and the surface of the target object; then, based on the initial distance value of each spatial point and a preset light direction, the sampling weight and volume rendering weight of the corresponding spatial point are respectively determined; and based on the sampling weight and the volume rendering weight, the spatial points in the space are sequentially upsampled and volume rendered to obtain the rendering color value of the spatial point; then, based on the rendering color value of the spatial point, the initial undirected distance field of the target object is iteratively updated to obtain an updated undirected distance field of the space where the target object is located; after obtaining the updated undirected distance field, the server 300 sends the updated undirected distance field to the terminal, and the terminal 100 performs three-dimensional reconstruction on the target object based on the updated undirected distance field to obtain a three-dimensional model of the target object, and displays the three-dimensional model of the target object on the current interface.
[0058] In other embodiments, the three-dimensional reconstruction device can also be implemented as a terminal, that is, the three-dimensional reconstruction method of the embodiment of the present application is implemented with the terminal as the execution subject. In the implementation process, the terminal collects multiple images of the target object and the camera parameters corresponding to each image. In addition, the terminal establishes an initial undirected distance field in the space where the target object is located based on the multiple images of the target object and the camera parameters corresponding to each image; the terminal determines the sampling weight and volume rendering weight of the corresponding spatial point based on the initial distance value of each spatial point and the preset light direction, and performs upsampling and volume rendering on the spatial points in the space in turn based on the sampling weight and the volume rendering weight to obtain the rendering color value of the spatial point; and the terminal iteratively updates the initial undirected distance field of the target object to obtain an updated undirected distance field in the space where the target object is located, thereby performing three-dimensional reconstruction of the target object based on the updated undirected distance field.
[0059] The three-dimensional reconstruction method provided in the embodiment of the present application can also be implemented based on a cloud platform and through cloud technology. For example, the server 300 can be a cloud server. The initial undirected distance field of the space where the target object is located is established through the cloud server, or the sampling weight and volume rendering weight of each spatial point are determined through the cloud server, and the spatial points in the space are sequentially upsampled and volume rendered through the cloud server, and the initial undirected distance field of the target object is iteratively updated through the cloud server.
[0060] In some embodiments, a cloud storage may be provided, and multiple images of the target object and camera parameters corresponding to each image may be stored in the cloud storage, or a three-dimensional model of the target object may be stored in the cloud storage. In this way, when a three-dimensional reconstruction request is received, multiple images of the target object and camera parameters corresponding to each image may be obtained from the cloud storage to establish and update the undirected distance field, thereby improving the efficiency of three-dimensional reconstruction.
[0061] It should be noted here that cloud technology refers to a hosting technology that unifies hardware, software, network and other resources in a wide area network or local area network to achieve data computing, storage, processing and sharing. Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, application technology, etc. based on the cloud computing business model. It can form a resource pool that is used on demand and is flexible and convenient. Cloud computing technology will become an important support. The background services of the technical network system require a large amount of computing and storage resources, such as video websites, picture websites and more portal websites. With the high development and application of the Internet industry, in the future, each item may have its own identification mark, and all need to be transmitted to the background system for logical processing. Data of different levels will be processed separately. All kinds of industry data require strong system backing support, which can be achieved through cloud computing.
[0062] Figure 5 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application, Figure 5 The electronic device shown may be a 3D reconstruction device, which includes: at least one processor 310, a memory 350, at least one network interface 320, and a user interface 330. The various components in the 3D reconstruction device are coupled together via a bus system 340. It is understood that the bus system 340 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 340 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, the bus system 340 is not described in detail. Figure 5 Various buses are labeled as bus system 340 .
[0063] The processor 310 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0064] The user interface 330 includes one or more output devices 331 that enable presentation of media content, and one or more input devices 332 .
[0065] The memory 350 may be removable, non-removable or a combination thereof. Exemplary hardware devices include solid-state memory, hard disk drive, optical disk drive, etc. The memory 350 may optionally include one or more storage devices physically away from the processor 310. The memory 350 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memory. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 350 described in the embodiment of the present application is intended to include any suitable type of memory. In some embodiments, the memory 350 can store data to support various operations, and examples of these data include programs, modules, and data structures or subsets or supersets thereof, as exemplarily described below.
[0066] An operating system 351 includes system programs for processing various basic system services and performing hardware-related tasks, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic businesses and processing hardware-based tasks; a network communication module 352 is used to reach other computing devices via one or more (wired or wireless) network interfaces 320. Exemplary network interfaces 320 include: Bluetooth, wireless compatibility certification (WiFi), and Universal Serial Bus (USB), etc.; an input processing module 353 is used to detect one or more user inputs or interactions from one of the one or more input devices 332 and translate the detected inputs or interactions.
[0067] In some embodiments, the device provided in the embodiments of the present application can be implemented in software. Figure 5 A 3D reconstruction device 354 stored in a memory 350 is shown. The 3D reconstruction device 354 may be a 3D reconstruction device in an electronic device, which may be software in the form of a program or a plug-in, and includes the following software modules: an undirected distance field establishment module 3541, a weight determination module 3542, a processing module 3543, an iterative update module 3544, and a 3D reconstruction module 3545. These modules are logical, and therefore may be arbitrarily combined or further split according to the functions implemented. The functions of each module will be described below.
[0068] In other embodiments, the device provided in the embodiments of the present application can be implemented in hardware. As an example, the device provided in the embodiments of the present application can be a processor in the form of a hardware decoding processor, which is programmed to execute the three-dimensional reconstruction method provided in the embodiments of the present application. For example, the processor in the form of a hardware decoding processor can adopt one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs) or other electronic components.
[0069] The three-dimensional reconstruction method provided in each embodiment of the present application can be executed by an electronic device, wherein the electronic device can be a server or a terminal, that is, the three-dimensional reconstruction method provided in each embodiment of the present application can be executed by a server, or by a terminal, or by interaction between a server and a terminal.
[0070] Figure 6 This is an optional flow chart of the 3D reconstruction method provided in the embodiment of the present application. Figure 6 The steps shown are explained, and it should be noted that Figure 6 The 3D reconstruction method in the example is explained by taking the server as the execution subject. Figure 6 As shown, the method includes the following steps S101 to S105:
[0071] Step S101 : establishing an initial undirected distance field of the space where the target object is located based on multiple images of the target object and camera parameters corresponding to each image; the initial undirected distance field includes an initial distance value between each spatial point in the space and the surface of the target object.
[0072] Here, the target object refers to any three-dimensional object composed of closed surfaces or non-closed surfaces, for example, the target object can be a person, an animal, a building, furniture, an electrical appliance, etc. The three-dimensional reconstruction method of the embodiment of the present application is used to perform three-dimensional reconstruction of the target object based on multiple images of the given target object and the camera parameters of each image object to form a three-dimensional model of the target object.
[0073] In the multiple images of the target object, each image corresponds to a camera parameter, and each image can be an image taken from any angle of the target object. In other words, the camera that shoots the target object can have different camera pose information, and the camera can shoot the target object at camera positions corresponding to multiple camera pose information to obtain multiple images.
[0074] The camera parameters include but are not limited to camera pose information and camera rays, wherein the camera pose information refers to the position and attitude of the camera, the position of the camera is used to characterize the relative distance and orientation of the camera relative to the target object, and the camera attitude includes the angle of the camera. The camera ray refers to the direction of the ray emitted by the camera at the camera position corresponding to any camera pose information, and the ray is the ray connecting the camera and the surface position of the target object facing the camera.
[0075] In some embodiments, the camera parameters may also include the camera's shooting angle. The scene boundary information of the space where the target object currently being photographed is located may also be determined based on the camera position and the shooting angle, wherein the scene boundary information refers to the position information of the spatial boundary of the space where the target object is located.
[0076] In an embodiment of the present application, based on multiple images of the target object and the camera parameters corresponding to each image, the initial distance value between each spatial point in the space where the target object is located and the surface of the target object can be determined. Among them, the initial distance value is an undirected distance value, which refers to a distance value without positive and negative signs, and the undirected distance value is used to characterize the closest distance between the current spatial point and the surface of the target object; the closest distance refers to making a ray along the spatial point to the surface of the target object, and the normal at the intersection point where the ray intersects with the surface of the target object coincides with the ray, that is, the ray is a line segment perpendicular to the surface of the target object at the intersection point. In other embodiments, the undirected distance value can also characterize the distance between each spatial point in the extension direction of the camera light and the intersection point between the camera light and the surface of the target object; that is, for the ray corresponding to the camera light, the ray has at least one intersection point with the surface of the target object, and for the first intersection point, the distance between each spatial point on the camera light and the first intersection point is the undirected distance value of the spatial point.
[0077] In the implementation process, the undirected distance value of each spatial point can be determined by a neural radiation field network, and the neural radiation field network can be composed of a multi-layer MLP network, wherein the neural radiation field network composed of a multi-layer MLP grid is a deep learning model for three-dimensional implicit space modeling, and this deep learning model is also called a fully connected neural network. When performing three-dimensional reconstruction, the three-dimensional space where the target object is located is represented as a set of learnable and continuous radiation fields. The input perspective and position are learned through the multi-layer MLP network to obtain the undirected distance value of each spatial point and output it. In other words, multiple images of the target object and the camera parameters corresponding to each image can be input into the neural radiation field network, and the multiple images and camera parameters are processed by multiple MLP networks connected in sequence in the neural radiation field network to output the undirected distance value of each spatial point. After obtaining the initial distance value between each spatial point in the space and the surface of the target object, the initial undirected distance field of the space where the target object is located can be established based on the initial distance value.
[0078] Step S102 : Based on the initial distance value of each spatial point and the preset light direction, respectively determine the sampling weight and volume rendering weight of the corresponding spatial point.
[0079] In an embodiment of the present application, a preset upsampling weight function and a volume rendering weight function may be provided. After the undirected distance value of each spatial point is obtained through the neural radiation field network, the sampling weight and the volume rendering weight of the spatial point may also be determined through the upsampling weight function and the volume rendering weight function.
[0080] Sampling weight refers to the weight of the sampling point to be integrated when performing color integration on any point on the surface of the target object and calculating the rendering color value of the point; that is, the sampling weight can be used to determine which spatial points in the light direction corresponding to each point on the surface of the target object are to be sampled and which are not to be sampled. Among them, the light direction refers to the shooting direction when the camera shoots the target object. In the actual calculation process, the light direction can be the extension direction of the ray outside the target object that is perpendicular to any point on the surface of the target object.
[0081] The volume rendering weight refers to the integral weight when integrating each spatial point in the light direction corresponding to any point on the surface of the target object to calculate the rendering color value of the point by performing color integration on the surface of the target object. That is, in the process of color integration, the initial color value of each spatial point is multiplied by the volume rendering weight of the spatial point, and the calculated products are integrated in turn to obtain the rendering color value on the surface of the target object in the direction of the light.
[0082] In the implementation process, the initial distance value can be directly input into the upsampling weight function and the volume rendering weight function based on the initial distance value of each spatial point and the preset light direction, so as to obtain the sampling weight and volume rendering weight of each spatial point.
[0083] In some embodiments, the upsampling weight function and the volume rendering weight function also include parameters to be learned. After the sampling weight and volume rendering weight of each spatial point are determined based on the initial distance value and the preset light direction, upsampling processing and volume rendering are performed based on the sampling weight and the volume rendering weight, and then the initial undirected distance field is updated to obtain an updated undirected distance field. After obtaining the updated undirected distance field, the updated undirected distance field is also subjected to loss calculation and updated again. When the updated undirected distance field is updated again, the parameters to be learned in the upsampling weight function and the volume rendering weight function need to be updated at the same time, so that the sampling weight and the volume rendering weight are recalculated by the upsampling weight function and the volume rendering weight function with the updated parameters to be learned. In this way, the sampling weight and the volume rendering weight are calculated repeatedly, the upsampling processing and the volume rendering are performed, the undirected distance field is updated, the parameters to be learned in the upsampling weight function and the volume rendering weight function are updated, and the sampling weight and the volume rendering weight are calculated again until the difference between the updated undirected distance field obtained and the real undirected distance field of the target object is less than the preset threshold, thereby achieving accurate three-dimensional reconstruction of the target object. It should be noted that the above cycle process will be described in detail below.
[0084] Step S103 , based on the sampling weights, up-sampling is performed on all spatial points in the space to obtain a plurality of sampling points; and based on the volume rendering weights, volume rendering is performed on the plurality of sampling points to obtain a rendering color value of each sampling point.
[0085] In the embodiment of the present application, based on the sampling weight and the volume rendering weight, the spatial points of the space are sequentially upsampled and volume rendered to obtain the rendering color value of the spatial points. In the implementation process, when the spatial points of the space are sequentially upsampled and volume rendered, all the spatial points of the space can be upsampled based on the sampling weight to obtain multiple sampling points; then, based on the volume rendering weight, the multiple sampling points are volume rendered to obtain the rendering color value of each sampling point.
[0086] Here, upsampling refers to any technology that can make an image higher in resolution. In the embodiment of the present application, upsampling of spatial points in space refers to extracting some spatial points that contribute to the surface rendering of the target object from a plurality of continuous spatial points as sampling points. In this way, in the subsequent volume rendering process, color integration can be performed based only on the initial color values of these sampling points to obtain the rendering color value at the surface of the target object.
[0087] Here, the rendered color value refers to the color value at the surface of the target object predicted by the neural radiation field network of the embodiment of the present application. The color value is a predicted color value, that is, the color value of each point on the surface of the target object is predicted by the neural radiation field network, and then the surface of the target object can be rendered by the color value to obtain the rendering result of the target object. In the embodiment of the present application, after obtaining the rendered color value at the surface of the target object, any image rendering method can be used to render the image of the target object based on the rendered color value to obtain the rendering result of the target object.
[0088] In some embodiments, the rendering color value of each point on the surface of the target object may be the RGB color value of the point. After obtaining the RGB color value of each point on the surface of the target object, the surface of the target object may be rendered based on the RGB color value to obtain a rendering result of the target object.
[0089] Volume rendering refers to the differential probability of terminating at an infinitesimal particle from any point in space along the direction of the light, which can be understood as the opacity of the surface position of the target object in the direction of the light.
[0090] In the embodiment of the present application, volume rendering can be performed on multiple sampling points obtained after upsampling processing to obtain rendering color values of spatial points (i.e., sampling points), wherein the rendering color values of the sampling points refer to the rendering color values of the points on the surface of the target object.
[0091] Step S104 : iteratively updating the initial undirected distance field of the target object based on the rendering color value of the sampling point to obtain an updated undirected distance field of the space where the target object is located.
[0092] Here, after obtaining the rendered color value of each sampling point, the true color value of each point on the surface of the target object can be obtained from the input multiple images, and for each point on the surface of the target object, the color difference between the rendered color value and the true color value is determined, and the color difference is input into the preset loss model to calculate the loss result.
[0093] If the loss result shows that the color difference between the rendered color value and the true color value is greater than the color difference threshold, it indicates that the network parameters of the neural radiation field network currently used to extract the undirected distance field need to be further updated. Therefore, after adjusting the network parameters of the neural radiation field network, an updated neural radiation field network is obtained, and the updated neural radiation field network is used to re-extract the undirected distance field of the target object to obtain an updated undirected distance field; if the loss result shows that the color difference between the rendered color value and the true color value is less than or equal to the color difference threshold, it indicates that the network parameters of the neural radiation field network currently used to extract the undirected distance field do not need to be updated, and the current neural radiation field network can accurately extract the undirected distance field of the target object, so the iterative update process is stopped.
[0094] Step S105 , performing three-dimensional reconstruction on the target object based on the updated undirected distance field to obtain a three-dimensional model of the target object.
[0095] In the embodiment of the present application, after obtaining an updated undirected distance field that can accurately characterize the target object, the target object is three-dimensionally reconstructed by updating the undirected distance field to obtain a three-dimensional model of the target object. Here, any three-dimensional reconstruction method can be used to implement the three-dimensional reconstruction process of the target object. For example, the three-dimensional model of the target object can be extracted from the updated undirected distance field by using an undirected distance meshing (meshUDF) or an isosurface extraction algorithm (MC, MarchingCubes).
[0096] The three-dimensional reconstruction method provided by the embodiment of the present application determines the sampling weight and volume rendering weight of the corresponding spatial point based on the initial distance value of each spatial point in the space where the target object is located and the preset light direction; thus, based on the sampling weight and the volume rendering weight, the spatial points in the space are sequentially upsampled and volume rendered to obtain the rendering color value of the spatial point; and then based on the rendering color value of the spatial point, the initial undirected distance field of the target object is iteratively updated to obtain the updated undirected distance field of the space where the target object is located. In this way, since when the initial undirected distance field is iteratively updated, the upsampling and volume rendering are performed based on the determined sampling weight and volume rendering weight, and the sampling weight and volume rendering weight are determined based on the initial distance value of each spatial point and the preset light direction, the sampling weight can ensure accurate upsampling of the spatial point, and the volume rendering weight can accurately perform volume rendering on the sampling points obtained by the upsampling process, thereby obtaining a rendering color value that is closer to the real color value of the target object, and obtaining an accurate undirected distance field of the target object. In addition, the three-dimensional reconstruction method of the embodiment of the present application can handle the reconstruction of any open surface, has a wider range of applications, and is processed through sampling weights and volume rendering weights. It does not require additional three-dimensional supervision and can handle surface reconstruction with complex topology using only two-dimensional image supervision.
[0097] In some embodiments, the 3D reconstruction system includes at least a terminal and a server, and a 3D reconstruction application is installed on the terminal. In the 3D reconstruction application, a user can request to reconstruct a 3D model of any target object with an open surface and a closed surface structure. Figure 7 is another optional flow chart of the three-dimensional reconstruction method provided in the embodiment of the present application, such as Figure 7 As shown, the method includes the following steps S201 to S217:
[0098] Step S201: The terminal receives multiple images of a target object and camera parameters corresponding to each image through a client of a three-dimensional reconstruction application.
[0099] Here, the target object may be any three-dimensional object composed of closed surfaces or non-closed surfaces, for example, the target object may be a person, an animal, a building, furniture, an electrical appliance, etc. The three-dimensional reconstruction method of the embodiment of the present application is used to perform three-dimensional reconstruction of the target object based on multiple images of the given target object and camera parameters corresponding to each image to form a three-dimensional model of the target object.
[0100] The terminal can acquire multiple images of the target object through an image acquisition device, for example, multiple images can be taken by a camera, and the camera parameters of each shot can be recorded; or the terminal can download multiple images of the target object from the network, and download the camera parameters of each image; or the terminal can also receive multiple images of the target object sent by other users, and receive the camera parameters of each image.
[0101] The camera parameters include, but are not limited to, camera pose information and camera light, which corresponds to a light direction, and in this light direction, there may be multiple parallel light beams. In the light direction of each light beam, there are multiple spatial points in the space where the target object is located, and the light direction of the light beam has at least one intersection point with the surface of the target object, and the intersection point constitutes a surface point of the surface of the target object. In the three-dimensional reconstruction method of the embodiment of the present application, when performing volume rendering, what is determined is the rendering color value of each surface point.
[0102] In step S202 , the terminal encapsulates multiple images of the target object and camera parameters corresponding to each image into a three-dimensional reconstruction request.
[0103] After acquiring multiple images of the target object and the camera parameters corresponding to each image, the terminal can receive the user's 3D reconstruction operation. In the implementation process, a 3D reconstruction button can be provided on the client of the 3D reconstruction application. After the user inputs multiple images and the camera parameters corresponding to each image, the user can select the 3D reconstruction button to trigger the 3D reconstruction operation.
[0104] In an embodiment of the present application, after receiving a three-dimensional reconstruction operation, the terminal responds to the three-dimensional reconstruction operation by encapsulating multiple images of the target object and the camera parameters corresponding to each image into a three-dimensional reconstruction request, so as to request the server to reconstruct a three-dimensional model of the target object based on the multiple images and the camera parameters corresponding to each image.
[0105] Step S203: The terminal sends a 3D reconstruction request to the server.
[0106] Step S204, in response to the 3D reconstruction request, the server establishes an initial undirected distance field of the space where the target object is located based on multiple images of the target object and camera parameters corresponding to each image; the initial undirected distance field includes an initial distance value between each spatial point in the space and the surface of the target object.
[0107] In some embodiments, see Figure 8 , Figure 8 It is shown that step S204 can be implemented by the following steps S2041 to S2045:
[0108] Step S2041, extracting spatial scene boundary information and shooting parameters from camera parameters.
[0109] In the embodiment of the present application, the camera parameters include but are not limited to the camera posture information, the camera light and the camera shooting angle. According to the camera position and the shooting angle, the scene boundary information of the space where the target object currently being photographed is located can also be determined, wherein the scene boundary information refers to the position information of the spatial boundary of the space where the target object is located, that is, the position information of the spatial boundary of the space where the target object currently located captured by the camera is located. In the embodiment of the present application, the camera parameters can be obtained simultaneously when acquiring multiple images of the target object, and the space where the target object is located can be accurately determined through the camera parameters of the multiple images, thereby accurately determining the scene boundary information of the space.
[0110] The shooting parameters include but are not limited to the shooting position, shooting focal length and other parameters related to camera shooting.
[0111] Step S2042: determine the space where the target object is located based on the scene boundary information.
[0112] In an embodiment of the present application, after the scene boundary information of the space is extracted, the space boundary in the space corresponding to each image can be determined based on the scene boundary information, and then all the space boundaries are connected to obtain the space where the target object is located.
[0113] Step S2043, determining the position information of each spatial point in the space based on the shooting parameters.
[0114] Here, the shooting parameters include but are not limited to shooting position, shooting focal length and other parameters related to camera shooting. The position information of each spatial point in the space can be determined based on the shooting position, shooting focal length and other parameters of the camera.
[0115] In some embodiments, the shooting position of the camera can be used as the coordinate origin to construct a three-dimensional coordinate system corresponding to the space, and then the distance and angle between each spatial point and the coordinate origin are determined to determine the three-dimensional coordinates of each spatial point, and the three-dimensional coordinates of each spatial point are determined as the position information of the spatial point.
[0116] Step S2044, inputting the position information and multiple images into the neural radiation field network to obtain the initial distance value between each spatial point in the space and the surface of the target object.
[0117] Here, the initial distance value is an undirected distance value, which refers to a distance value without a positive or negative sign, and is used to represent the closest distance between the current spatial point and the surface of the target object; the closest distance refers to a ray along the spatial point to the surface of the target object, and the normal at the intersection point where the ray intersects with the surface of the target object coincides with the ray, that is, the ray is a line segment perpendicular to the surface of the target object at the intersection point. In other embodiments, the undirected distance value can also represent the distance between each spatial point in the extension direction of the camera light and the intersection point between the camera light and the surface of the target object; that is, for the ray corresponding to the camera light, the ray has at least one intersection point with the surface of the target object, and for the first intersection point, the distance between each spatial point on the camera light and the first intersection point is the undirected distance value of the spatial point.
[0118] In the implementation process, the undirected distance value of each spatial point can be determined by a neural radiation field network, and the neural radiation field network can be composed of a multi-layer MLP network. Multiple images of the target object and the camera parameters corresponding to each image can be input into the neural radiation field network, and the undirected distance value of each spatial point can be output.
[0119] Step S2045 , establishing an initial undirected distance field of the space where the target object is located through the initial distance value between each spatial point in the space and the surface of the target object.
[0120] After obtaining the initial distance value between each spatial point in the space and the surface of the target object, an initial undirected distance field of the space where the target object is located can be established based on the initial distance value. The initial undirected distance field is a distance field composed of the initial distance value of each spatial point in the space.
[0121] It should be noted that an undirected distance field refers to establishing a spatial field in which each pixel or voxel (i.e., a spatial point) records the distance between itself and the surrounding pixels or voxels. Since the embodiment of the present application establishes an undirected distance field, no matter whether the spatial point is inside or outside the target object, there is no positive or negative sign.
[0122] Step S205: The server determines the sampling weight of the corresponding spatial point based on the initial distance value of each spatial point.
[0123] The sampling weight refers to the weight of the sampling point to be integrated when performing color integration on any point on the surface of the target object to calculate the rendering color value of the point; that is, the sampling weight can be used to determine which spatial points in the light direction corresponding to each point on the surface of the target object are to be sampled and which spatial points are not to be sampled. In some embodiments, see Fig. 9 , Fig. 9 It is shown that step S205 can be implemented by the following steps S2051 to S2053:
[0124] Step S2051, obtaining a preset upsampling weight function.
[0125] In the embodiment of the present application, the upsampling weight function is a pre-constructed exponential function for calculating the sampling weight. In the upsampling weight function, the independent variables include the sampling density and the undirected distance value output by the neural radiation field network, and the dependent variable is the sampling weight. In other words, the sampling density and the undirected distance value of each spatial point output by the neural radiation field network can be used as the input value of the upsampling weight function, and the sampling weight of each spatial point can be output through the upsampling weight function.
[0126] Step S2052, determining the sampling density of the upsampling process in the current iterative update process.
[0127] Here, the sampling density is determined based on the updated undirected distance field obtained in the last iterative update before the current iterative update, that is, the sampling density is a parameter determined based on the historical updated undirected distance field, and the historical updated undirected distance field is the updated undirected distance field obtained in the last iterative update process before the current iterative update; that is, through the iterative update process, a new sampling density can be determined after each update, and the new sampling density is used to calculate the sampling weight in the next update process. In the embodiment of the present application, the continuous updating of the sampling density through the continuous iterative update process can realize the continuous updating of the sampling weight, so that the finally obtained sampling weight can accurately upsample the space where the target object is located, and then accurately determine the rendering color value of each point on the surface of the target object.
[0128] In one implementation, the sampling density includes a first type of sampling density and a second type of sampling density, and the first type of sampling density is greater than the second type of sampling density; when the initial undirected distance field is iteratively updated, the first type of sampling density and the second type of sampling density are cyclically used to determine the sampling weight. In this way, it is possible to implement sampling by cyclically using different sampling densities during upsampling through sampling density control, for example, first sparse sampling once and then dense sampling once, then sparse sampling once and then dense sampling once, and so on and so forth, until the sampling obtains a spatial point that can accurately calculate the rendering color value of the point on the surface of the target object.
[0129] Step S2053, input the sampling density and the distance value of each spatial point into the upsampling weight function to obtain the sampling weight of the corresponding spatial point.
[0130] In the embodiment of the present application, in each round of iterative update, after the sampling density is determined based on the updated undirected distance field obtained in the previous iterative update, the sampling density and the distance value of the spatial point are input into the upsampling weight function to obtain the sampling weight of the corresponding spatial point. It should be noted that for the distance value input into the upsampling weight function, if the current is the first round of iterative update, the distance value input into the upsampling weight function is the initial distance value corresponding to the initial undirected distance field; if the current is the Nth round of iterative update, N is an integer greater than 1, then the distance value input into the upsampling weight function is the updated distance value corresponding to the updated undirected distance field.
[0131] Step S206: The server determines a volume rendering weight of a corresponding spatial point based on an initial distance value of each spatial point and a preset light direction.
[0132] The volume rendering weight refers to the integral weight when performing color integration on any point on the surface of the target object to calculate the rendering color value of the point, and integrating each spatial point in the light direction corresponding to the point; that is, in the color integration process, the initial color value of each spatial point is multiplied by the volume rendering weight of the spatial point, and the calculated product is then integrated in turn to obtain the rendering color value of the target object surface in the light direction. In some embodiments, see Fig.10 , Fig.10 It is shown that step S206 can be implemented by the following steps S2061 to S2065:
[0133] Step S2061 , obtaining the normal direction of each spatial point mapped to the surface position of the target object.
[0134] Here, since the surface of the target object is a curved surface, each point on the curved surface has a normal perpendicular to the point on the curved surface. Therefore, the spatial point in the normal direction of each point on the surface of the target object in the space where the target object is located can be mapped to the normal, that is, the spatial point in the normal direction of each point on the surface of the target object can be matched to the normal. In this way, for each point on the surface of the target object, according to the mapping relationship, the normal of the point, the normal direction, and multiple spatial points in the normal direction can be determined, and these spatial points do not overlap with the points on the surface of the target object.
[0135] Step S2062, determining the angle value of the angle between the normal direction and the light direction.
[0136] After obtaining the camera parameters, the light direction can be extracted from the camera parameters, and the light direction is the shooting direction of the camera. Since the light direction and the normal direction of the point on the surface of the target object are not necessarily coincident or parallel, for any spatial point, the normal direction with a mapping relationship with the spatial point can be calculated to determine the angle value between the normal direction and the light direction.
[0137] Step S2063: obtaining a preset volume rendering weight function.
[0138] In the embodiment of the present application, the volume rendering weight function is a pre-constructed exponential function for calculating the volume rendering weight. In the volume rendering weight function, the independent variables include the parameters to be learned for volume rendering and the angle values corresponding to the spatial points for which the volume rendering weight is to be calculated (i.e., the angle value of the angle between the normal direction corresponding to the spatial point and the light direction), and the dependent variable is the volume rendering weight. In other words, the angle values corresponding to the parameters to be learned for volume rendering and the spatial points for which the volume rendering weight is to be calculated can be used as the input values of the volume rendering weight function, and the volume rendering weight of each spatial point can be output through the volume rendering weight function.
[0139] Step S2064, determining the parameters to be learned for volume rendering in the current iterative update process; the parameters to be learned are determined based on the updated undirected distance field obtained in the last iterative update before the current iterative update.
[0140] In the embodiment of the present application, the parameters to be learned are parameters determined based on the historical updated undirected distance field, and the historical updated undirected distance field is the updated undirected distance field obtained in the last iterative update process before the current iterative update. Through the iterative update process, a new parameter to be learned for volume rendering can be determined after each update, and the volume rendering weight in the next update process can be calculated using the new parameter to be learned for volume rendering. In the embodiment of the present application, the parameters to be learned for volume rendering are continuously updated through the continuous iterative update process, and the volume rendering weight can be continuously updated, so that the volume rendering weight finally obtained can accurately perform volume rendering processing on each point indicated by the target object, and then accurately determine the rendering color value of each point on the surface of the target object.
[0141] Step S2065 , input the parameters to be learned and the angle value into the volume rendering weight function to obtain the volume rendering weight of the corresponding spatial point.
[0142] In the embodiment of the present application, during each round of iterative update, after determining the parameters to be learned based on the updated undirected distance field obtained in the previous iterative update, the parameters to be learned and the angle value are input into the volume rendering weight function to obtain the volume rendering weight of the corresponding spatial point.
[0143] In the embodiment of the present application, for each spatial point, since the angle value of the angle between the normal direction and the light direction is a fixed value, the angle value of each spatial point can be cached after determining the angle value of the angle between the normal direction and the light direction during the first round of volume rendering weight calculation. In this way, in each subsequent round of iterative update, the angle value can be directly obtained from the cache, and the parameters to be learned are determined based on the updated undirected distance field obtained in the previous iterative update, thereby determining the volume rendering weight of each spatial point based on the parameters to be learned and the angle value. In this way, there is no need to calculate the angle value once in each round of volume rendering weight calculation, which can greatly improve the calculation efficiency of volume rendering weight.
[0144] In some embodiments, the volume rendering weight of each spatial point in the space where the target object is located can be determined by the volume rendering weight function, and the volume rendering weights of all spatial points in the space meet at least one of the following conditions: global unbiasedness, local unbiasedness, and occlusion perception. That is to say, the volume rendering weights of all spatial points determined by the volume rendering weight function can ensure global unbiasedness, local unbiasedness, and occlusion perception when performing volume rendering of the target object.
[0145] It should be noted that global unbiased means that as the number of iterative updates increases, when the volume rendering weight is determined by the volume rendering weight function, the volume rendering weight of the spatial point at the intersection with the surface of the target object is equal to 1. In other words, global unbiased means that as the training process continues, the volume rendering weight will all be concentrated at the first intersection. When the neural radiation field network is fully converged, the weight at the first intersection of the light direction and the surface of the target object is 1. In this way, it can be ensured that the rendering color values in the volume rendering process all come from the first surface seen by the line of sight, that is, the rendering color value is equal to the true color value of the surface, thereby ensuring that the neural radiation field network can accurately allocate rendering weights according to the surface position.
[0146] Local unbiased means that as the number of iterations increases, when the volume rendering weight is determined by the volume rendering weight function, the volume rendering weight of the spatial point at the surface intersection with the target object is greater than the volume rendering weight of other spatial points at non-surface intersections. In other words, local unbiased means that as the training process continues, the weight at the intersection of the light direction and the surface of the target object is the local maximum. During the training process, the weight at the intersection is larger than that at the non-intersection point, so that the neural radiation field network can learn the precise surface position of the target object through the volume rendering weight.
[0147] Occlusion perception refers to the situation along the direction of light, in the area occluded by a part of the surface of the target object, if there is another part of the surface of the target object, the volume rendering weight of the spatial point at the other part of the surface is less than the volume rendering weight of the spatial point at the part of the surface of the target object. In other words, occlusion perception means that the part where the target object is occluded contributes less to the total volume rendering weight. When there are multiple intersections between the light direction and the target object, the first intersection contributes more to the volume rendering color than the subsequent intersections, so that the neural radiation field network can determine whether the surface of the target object is occluded.
[0148] Step S207: The server performs upsampling processing on the spatial points in the space in the direction of light corresponding to the camera parameters based on the sampling weights to obtain multiple sampling points.
[0149] In some embodiments, upsampling processing can be achieved in the following way: first, for multiple spatial points in each of the multiple light directions corresponding to the camera parameters, the sampling weight of each of the multiple spatial points is obtained; then, the spatial point whose sampling weight is greater than the sampling weight threshold is determined as the sampling point in the light direction.
[0150] For example, the sampling weight can be any real number ranging from 0 to 1, and the sampling weight threshold can be 0.6. Then, all spatial points in each light direction and the sampling weight of each spatial point can be obtained, and the spatial points with sampling weights greater than 0.6 are determined as sampling points in the light direction.
[0151] Step S208: The server performs volume rendering on the plurality of sampling points based on the volume rendering weight to obtain a rendering color value of each sampling point.
[0152] In some embodiments, volume rendering can be implemented in the following manner: first, feature extraction is performed on multiple images to obtain the initial color value of each sampling point; then, along each light direction, the initial color values of multiple sampling points in the light direction are color integrated based on the volume rendering weight to obtain the rendering color value of each sampling point.
[0153] In the embodiment of the present application, after color integration is performed on the initial color values of all sampling points in the light direction, the color information of each sampling point can be accumulated to obtain the rendering color value at the intersection of the light direction and the surface of the target object.
[0154] When color integration is performed on the initial color values of multiple sampling points in the direction of each light ray based on the volume rendering weight, the initial color values of the multiple sampling points in the direction of each light ray and the volume rendering weight of each sampling point can be obtained first; then, the color product between the volume rendering weight and the initial color value of each sampling point is determined; finally, along the direction of the light ray, the color product is color integrated, and the color product of each sampling point is accumulated in sequence to obtain the rendering color value projected onto the surface of the target object.
[0155] It should be noted that for the above color integration process, if the current is the first round of iterative update, the initial color values of multiple sampling points in the direction of the light are color integrated based on the volume rendering weight; if the current is the Nth round of iterative update, N is an integer greater than 1, then the rendering color value obtained in the previous round of iterative update is obtained, and the rendering color value of multiple sampling points in the direction of the light is color integrated based on the volume rendering weight. In other words, if the current is the Nth round of iterative update, N is an integer greater than 1, the calculation is based on the data obtained in the previous round of iterative update. In this way, the iterative update process can be ensured to be carried out accurately and orderly.
[0156] Step S209: the server iteratively updates the initial undirected distance field of the target object based on the rendering color value of the sampling point to obtain an updated undirected distance field of the space where the target object is located.
[0157] In some embodiments, see Fig.11 , Fig.11 It is shown that step S209 can be implemented by following steps S2091 to S2095:
[0158] Step S2091, obtaining the rendering color value and the real color value of the spatial point on the surface of the target object.
[0159] Here, the real color value of each spatial point (i.e., sampling point) on the surface of the target object can be obtained by performing feature extraction on the input multiple images. The sampling point on the surface of the target object is the point on the surface of the target object. Through the above steps, the rendering color value of each sampling point on the surface of the target object can be obtained.
[0160] Step S2092, determining the color difference between the rendered color value and the real color value.
[0161] For each sampling point on the surface of the target object, the color difference between the rendered color value and the true color value of the sampling point may be calculated.
[0162] Step S2093, determining a loss result of a neural radiance field network based on the color difference; the neural radiance field network is used to predict each initial distance value in the initial undirected distance field.
[0163] In an embodiment of the present application, a loss result of the neural radiation field network can be determined based on the color difference through a preset loss function.
[0164] Step S2094, updating the network parameters of the neural radiation field network based on the loss result to obtain an updated neural radiation field network.
[0165] If the loss result shows that the current neural radiation field network can accurately determine the undirected distance field of the space where the target object is located, the training process of the neural radiation field network is stopped, the current network parameters of the neural radiation field network are determined as the network parameters of the trained neural radiation field network, and the undirected distance field of the space where the target object is located is determined by the trained neural radiation field network.
[0166] If the loss result indicates that the current neural radiation field network cannot accurately determine the undirected distance field of the space where the target object is located, the neural radiation field network continues to be trained. The network parameters of the neural radiation field network can be updated. The network parameters of the neural radiation field network here include: the internal parameters of different multi-layer perceptrons in the neural radiation field, the sampling density of the upsampling weight function, and the parameters to be learned for volume rendering in the volume rendering weight function.
[0167] Step S2095, iteratively updating the initial undirected distance field of the target object through the updated neural radiation field network to obtain an updated undirected distance field of the space where the target object is located.
[0168] In the embodiment of the present application, the initial undirected distance field is obtained through the neural radiation field network. In this update process, the updated undirected distance field of the space where the target object is located can be determined through the updated neural radiation field network, that is, the initial undirected distance field is updated once. In this way, by continuously iteratively updating the neural radiation field network, the undirected distance field of the space where the target object is located can be iteratively updated to obtain a new round of updated undirected distance field of the space where the target object is located.
[0169] Please continue to refer to Figure 7 In some embodiments, the method may further include the following steps:
[0170] Step S210: the server obtains a zero point set corresponding to the initial undirected distance field, where the zero point set corresponds to a plurality of zero point set sampling points whose initial distance values are zero.
[0171] Here, the zero point set is a set of spatial points whose initial distance value between the spatial point and the surface of the target object is zero. The sampling points are obtained by upsampling the spatial points, so the zero point set includes the zero point set sampling points whose initial distance value is zero.
[0172] Step S211 : the server determines the gradient value of each zero-point set sampling point based on the initial undirected distance field.
[0173] The gradient value of the zero-point set sampling point refers to the gradient difference (ie, position difference) between the initial distance values between two adjacent zero-point set sampling points. The position information of each zero-point set sampling point in the initial undirected distance field can be obtained, and the gradient value is determined based on the position information.
[0174] Step S212: The server obtains a preset offset.
[0175] Here, the preset offset is a fixed value, and the same offset can be used to update the gradient value for different zero-point set sampling points.
[0176] Step S213: The server updates the gradient value of each zero-point set sampling point based on the offset to obtain an updated gradient value.
[0177] Here, the gradient value of each zero-point set sampling point can be updated based on the offset. That is, when the gradient value is updated, the zero-point set sampling point is moved in the normal direction of the zero-point set sampling point by a distance corresponding to the offset according to the offset to obtain the updated position of the zero-point set sampling point, and the gradient value of each zero-point set sampling point is recalculated based on the updated position.
[0178] In the embodiment of the present application, normal regularization of the neural radiation field network is implemented through steps S210 to S213. Since an inherent problem of the undirected distance field is that the gradient value near the zero point set is not stable, the unstable gradient value calculation will affect the robustness of the neural radiation field network optimization. Therefore, the embodiment of the present application proposes the normal regularization method to solve the problem of gradient instability in the undirected distance field. A small offset is added to the sampling points near each zero point in the zero point set (i.e., the zero point set sampling points), and the gradient of the offset point is used to replace the gradient of the original zero point set sampling point. The gradient of the offset point is more stable, so the training is more reliable.
[0179] Step S214: the server updates the initial undirected distance field based on the updated gradient value to obtain an updated undirected distance field of the space where the target object is located.
[0180] In the embodiment of the present application, after the updated gradient value is obtained, the initial distance value of each zero-point set sampling point is also changed. Therefore, the undirected distance field of the target object is re-established based on the changed initial distance value, the initial undirected distance field is updated, and the updated undirected distance field of the space where the target object is located is obtained.
[0181] Step S215: the server performs three-dimensional reconstruction on the target object based on the updated undirected distance field to obtain a three-dimensional model of the target object.
[0182] In the embodiment of the present application, after obtaining the updated undirected distance field of the space where the target object is located, any 3D reconstruction method can be used to implement the 3D reconstruction process of the target object. For example, meshUDF or MC can be used to extract the 3D model of the target object from the updated undirected distance field.
[0183] Step S216: The server sends the three-dimensional model of the target object to the terminal.
[0184] Step S217: the terminal displays the three-dimensional model of the target object on the current interface.
[0185] The three-dimensional reconstruction method provided by the embodiment of the present application, when iteratively updating the initial undirected distance field, upsampling processing and volume rendering are performed based on the determined sampling weights and volume rendering weights, and the sampling weights and volume rendering weights are determined based on the initial distance value of each spatial point and the preset light direction. At the same time, by training the neural radiation field network, the internal parameters of different multi-layer perceptrons in the neural radiation field, the sampling density of the upsampling weight function and the parameters to be learned for volume rendering in the volume rendering weight function are continuously updated, so that the upsampling weight function and the volume rendering weight function in the neural radiation field network after the training convergence can determine accurate sampling weights and volume rendering weights. Therefore, the sampling weights can ensure accurate upsampling processing of spatial points, and the volume rendering weights can accurately render the sampling points obtained by the upsampling processing, so as to obtain a rendering color value that is closer to the real color value of the target object, and obtain an accurate undirected distance field of the target object. In addition, the three-dimensional reconstruction method of the embodiment of the present application can handle the reconstruction of any open surface, and has a wider range of applications. Moreover, by processing through sampling weights and volume rendering weights, no additional three-dimensional supervision is required, and only two-dimensional image supervision can be used to handle surface reconstruction with complex topology.
[0186] In some embodiments, the above three-dimensional reconstruction method can also be applied to the game field to achieve reconstruction of three-dimensional target objects in the game.
[0187] For example, for real-time battle games, when a player and an opponent player are fighting in real time, the player's character hero can be located at any position of the opponent player's opponent character hero. Therefore, it is necessary to perform three-dimensional reconstruction on the hero in the game so that the opponent character hero can be displayed on the player's terminal at different angles. In the process of implementation, multiple images of the opponent character hero and the camera parameters corresponding to each image can be obtained to establish an initial undirected distance field of the space where the opponent character hero is located. Then, the method of the embodiment of the present application is adopted to iteratively update the initial undirected distance field of the opponent character hero to obtain an updated undirected distance field of the space where the opponent character hero is located, and the opponent character hero is reconstructed in three dimensions based on the updated undirected distance field to obtain a three-dimensional model of the opponent character hero. In this way, after obtaining the three-dimensional model of the opponent character hero, when the player's character hero is located at any position of the opponent character hero, the opponent character hero can be accurately displayed, and because the opponent character hero is a three-dimensional model, the displayed game scene will be more realistic, thereby improving the player's game experience.
[0188] For another example, for scenario games, players can perform game operations in different scenarios, such as picking equipment in a building. Therefore, it is necessary to perform three-dimensional reconstruction of the building and the equipment in the building. In the implementation process, multiple images of the building in the game and the camera parameters corresponding to each image can be obtained to establish an initial undirected distance field of the space where the building is located. Then, the method of the embodiment of the present application is used to iteratively update the initial undirected distance field of the building to obtain an updated undirected distance field of the building, and the building is reconstructed in three dimensions based on the updated undirected distance field to obtain a three-dimensional model of the building. In this way, after obtaining the three-dimensional model of the building, when the player's character hero is located at any position of the building, the building can be accurately displayed, and the equipment can be picked inside and outside the building. Since the building is a three-dimensional model, the displayed game scene will be more realistic, which improves the player's gaming experience.
[0189] The following is an explanation of an exemplary application of the embodiments of the present application in a practical application scenario.
[0190] The embodiment of the present application provides a three-dimensional reconstruction method. Compared with the neural radiation field, the UDF representation of the object in the three-dimensional reconstruction method provided by the embodiment of the present application is specially designed for the three-dimensional reconstruction task, so high-quality three-dimensional meshes can be extracted; and it can handle the reconstruction of open surfaces, and has a wider range of applications; at the same time, compared with the three-dimensional reconstruction based on implicit fields, the method of the embodiment of the present application does not require additional three-dimensional supervision, and can handle the reconstruction of surfaces with complex topology using only two-dimensional image supervision.
[0191] Fig.12 is a schematic diagram of the algorithm flow of the three-dimensional reconstruction method provided in the embodiment of the present application, such as Fig.12As shown, the three-dimensional reconstruction method provided in the embodiment of the present application uses UDF-based volume rendering 121 to optimize the neural radiation field according to the input 2D picture set (i.e., the multiple images of the target object mentioned above), so as to obtain the corresponding UDF field and extract the mesh 123 (mesh) with arbitrary topology. That is to say, for the input 2D picture set, the 2D picture set can first be subjected to UDF-based volume rendering 121; then, through network optimization, the UDF field 122 (i.e., the above-mentioned updated undirected distance field) of the space where the target object is located is obtained; finally, by gridding the UDF field, the mesh 123 of the target object in arbitrary topology is extracted. The core of the three-dimensional reconstruction method provided in the embodiment of the present application is the volume rendering process designed for UDF, which is divided into three parts: first, a new UDF-based volume rendering weight function 124 is proposed, and the volume rendering weight function 124 can achieve an unbiased and occlusion-aware rendering process for the UDF field. Second, the corresponding upsampling weight function 125 is adopted, which can ensure balanced sampling near the surface intersection during the sampling process. Third, a UDF-based normal regularization 126 is proposed to solve the problem of normal instability of the UDF field near the zero point set during volume rendering. These three parts work simultaneously during volume rendering to achieve accurate surface reconstruction.
[0192] These three parts will be described in detail below.
[0193] (1) For the volume rendering weight function based on UDF: the volume rendering process is the color integration process along the sampling light. The key to the volume rendering process is the weight function, which connects the UDF network and the real input image. The embodiment of the present application designs a volume rendering weight function based on UDF, so that the volume rendering weight function specifically handles thin-film structures, that is, the weight is the largest at the thin film, the weight is small at the non-thin film, and the occluded part can be perceived when there are multiple thin films. In the implementation process, the volume rendering weight function is required to satisfy three properties: global unbiased, local unbiased, and closed perception.
[0194] Here, if Fig.13 The figure shows a schematic diagram of the change of the global unbiased volume rendering weight provided by the embodiment of the present application. Global unbiased means that the volume rendering weight is all concentrated at the first intersection during the training process. When fully converged, the weight at the first intersection is 1. In this way, the rendering color will all come from the first surface seen by the line of sight, that is, the rendering color is equal to the real color of the surface, ensuring that the neural radiation field network can accurately allocate the volume rendering weight according to the surface position. Among them, the global unbiased property can be expressed by the following formula (1):
[0195]
[0196] Wherein, r represents a parameter to be learned in the volume rendering weight function. The neural radiation field network in the embodiment of the present application can make the volume rendering weight distribution more accurate by learning this parameter and continuously increasing r; It means that for any case where ε is greater than 0, formula (1) is valid; w r (t) represents the volume rendering weight at point t, w r (t) is calculated based on the value of UDF.
[0197] Fig.14 This is a schematic diagram of the change of the local unbiased volume rendering weight provided by the embodiment of the present application. Local unbiased means that the volume rendering weight at the intersection during the training process is the local maximum. During the training process, the volume rendering weight at the intersection is larger than that at the non-intersection, which can ensure that the neural radiation field network learns the accurate surface position through the rendering weight. Among them, the local unbiased property can be expressed by the following formula (2):
[0198]
[0199] Among them, t 1 The position is the first surface seen by the line of sight, that is, the intersection of the camera ray and the surface of the target object. Represents a function that evaluates a function to a set of parameters.
[0200] Fig.15 This is a schematic diagram of the change of the volume rendering weight of occlusion perception provided by the embodiment of the present application. Occlusion perception means that the occluded area contributes less to the overall rendering weight. When there are multiple intersections between the camera light and the surface of the target object, the first intersection contributes more to the rendering color than the subsequent intersections. In this way, the neural radiation field network can determine whether the surface is occluded. Among them, the nature of occlusion perception can be expressed by the following formula (3):
[0201]
[0202] Where Ψ represents a neural radiation field network (a UDF network), Ψ(t a ) indicates t a The UDF value of this spatial point is the UDF value output by the neural radiation field network; Ψ(t b ) indicates t b The UDF value of this spatial point. δ is an arbitrary positive number. Formula (3) indicates that for a degree of δ change in the UDF value, the volume rendering weight of the embodiment of the present application will integrate the UDF value within the distance of the change δ to ensure that the value of the integral is smaller in the obscured area and larger in the unobstructed area.
[0203] Based on the above formulas (1) to (3), the present embodiment designs the following rendering weight function (4) that satisfies the above three conditions:
[0204]
[0205] Among them, θ represents the angle between the direction of the camera light and the surface normal direction of the target object at any point in space. Since the surface of the target object is a curved surface, the curved surface has a normal at each point. p(t) represents the spatial point information of a point in space that is reached by moving a distance t from the camera position for each camera light; p(u) represents the spatial point information of a point in space that is reached by moving a distance u from the camera position for each camera light. It means that p(t) is used as the independent variable of the Ψ function, that is, the UDF value of the spatial point corresponding to p(t), which can also be expressed as Ψ(p(t)); It means taking p(u) as the independent variable of the Ψ function, that is, the UDF value of the spatial point corresponding to p(u), which can also be expressed as Ψ(p(u)).
[0206] In an embodiment of the present application, by designing a volume rendering weight function that satisfies the three conditions of the above formulas (1) to (3), the neural radiation field network can render a picture that is exactly the same as the real image, and at the same time learn an accurate open surface representation from picture supervision.
[0207] (2) For the upsampling weight function: In order to match the volume rendering weight designed for UDF rendering, the embodiment of the present application also designs a light sampling weight, and the two weights act together in the volume rendering process. Compared with the volume rendering process, the sampling process pays more attention to the balance of sampling, that is, whether the UDF fields on both sides of the surface of the target object can be fully regularized. Therefore, the embodiment of the present application separates the volume rendering weight from the sampling weight, and designs the following sampling weight w for the sampling process s (t) is calculated by formula (5):
[0208]
[0209] Among them, s is a parameter given in advance during volume rendering. s can control whether the spatial points are densely sampled or sparsely sampled during upsampling. In the implementation process, sparse sampling can be performed once and then dense sampling can be performed once. The density of each sampling can be controlled by s.
[0210] In the embodiment of the present application, the sampling weights can be evenly distributed on both sides of the surface of the target object, thereby ensuring that the neural radiation field network is fully regularized. Compared with using a single weight as the weight for both volume rendering and upsampling, this method of separating the volume rendering weight from the sampling weight can ensure both rendering accuracy and sampling balance. Directly using the volume rendering weight as the sampling weight will result in an unbalanced distribution of sampling points, that is, almost all of the sampling points are distributed on one side of the surface of the target object, resulting in a serious deviation in regularization. Fig.16 FIG. 1 is a schematic diagram of the effect of separating the volume rendering weight and the sampling weight provided by an embodiment of the present application, wherein the volume rendering weight is sharp and accurate (ie, t 1 and t 2 position), the sampling weight is smooth and balanced overall.
[0211] (3) For normal regularization: Since an inherent problem of the UDF field is that the gradient near the zero point set is not stable, unstable gradient calculation will affect the robustness of the neural radiation field network optimization. Therefore, the embodiment of the present application proposes a normal regularization method to solve the problem of gradient instability in the UDF field. In the implementation process, a small offset is added to the sampling point near each zero point in the zero point set, and the gradient of the offset point is used to replace the gradient of the original sampling point. The gradient of the offset point is more stable, so the training is more reliable. The formula for normal regularization is shown in the following formulas (6) and (7):
[0212]
[0213]
[0214] Where n represents the estimated normal direction, n(p(t i )) represents p(t i ) point estimated normal; Ψ′(p(t i-k ) indicates that the UDF field is in p(t i-k ) point; p(t i-k ) represents the sampling point that is shifted k steps forward from the ith sampling point, where K is a pre-set number, indicating that a maximum of K steps are taken during the shift.
[0215] By normal regularization, the method of the embodiment of the present application uses neighborhood information to help solve the instability of the normal, so that a smoother surface reconstruction can be learned from the image. Fig.17 , which is a schematic diagram of the principle of normal regularization provided in an embodiment of the present application. The normal regularization method provided in an embodiment of the present application can approximate an unstable surface normal with a more stable normal in the neighborhood.
[0216] The three-dimensional reconstruction method provided in the embodiment of the present application can reconstruct high-quality open surfaces. Table 1 shows the quantitative comparison of the reconstruction quality of the method of the embodiment of the present application on the open surface dataset DF3D. The method of the embodiment of the present application has achieved a better reconstruction effect (1.61) than the previous methods (IDR, VoISDF, NeuS, NeuralUDF), and is 70% higher than the reconstruction work NeuS (5.45) in the related art. It also has a significant advantage over the NeuralUDF work of the same period (1.93).
[0217] Table 1
[0218]
[0219]
[0220] At the same time, the method of the embodiment of the present application has also achieved significant improvement in surface reconstruction with complex geometry and topology. Fig.18 The qualitative and quantitative comparison with previous work on complex surface structures is shown. The method of the embodiment of the present application not only achieves a significantly better error value (1.81), but also can accurately reconstruct complex open surface structures. Among them, Fig.18 (a) shows the input image, (b) shows the 3D reconstruction result of the IDR method, (c) shows the 3D reconstruction result of the NeuS method, (d) shows the 3D reconstruction result of the method of an embodiment of the present application, and (e) is a schematic diagram of the true 3D model (GT, Ground Truth) of the input image.
[0221] It should be noted that in the method of the embodiment of the present application, any weight that meets the conditions is feasible when designing the weight. The method framework of the embodiment of the present application is inclusive for the selection of sampling weight function, and a wide range of functions can be used as qualified sampling weights, such as uniform sampling and gradually increasing sampling density.
[0222] It can be understood that in the embodiments of the present application, the content involving user information, such as multiple images of the target object, camera parameters, three-dimensional model of the target object and other information, if it involves data related to user information or corporate information, when the embodiments of the present application are applied to specific products or technologies, it is necessary to obtain user permission or consent, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.
[0223] The following is a description of an exemplary structure of a 3D reconstruction device 354 implemented as a software module provided in an embodiment of the present application. In some embodiments, for example, Figure 5As shown, the three-dimensional reconstruction device 354 includes: an undirected distance field establishment module 3541, which is used to establish an initial undirected distance field of the space where the target object is located based on multiple images of the target object and camera parameters corresponding to each of the images; the initial undirected distance field includes an initial distance value between each spatial point in the space and the surface of the target object; a weight determination module 3542, which is used to determine the sampling weight and volume rendering weight of the corresponding spatial point based on the initial distance value of each spatial point and a preset light direction; a processing module 3543, which is used to perform upsampling processing on all spatial points in the space based on the sampling weight to obtain multiple sampling points; based on the volume rendering weight, the multiple sampling points are volume rendered to obtain a rendering color value of each sampling point; an iterative update module 3544, which is used to iteratively update the initial undirected distance field of the target object based on the rendering color value of the sampling point to obtain an updated undirected distance field of the space where the target object is located; a three-dimensional reconstruction module 3545, which is used to perform three-dimensional reconstruction on the target object based on the updated undirected distance field to obtain a three-dimensional model of the target object.
[0224] In some embodiments, the undirected distance field establishment module is further used to: extract scene boundary information and shooting parameters of the space from the camera parameters; determine the space where the target object is located based on the scene boundary information; determine the position information of each spatial point in the space based on the shooting parameters; input the position information and the multiple images into the neural radiation field network to obtain an initial distance value between each spatial point in the space and the surface of the target object; and establish an initial undirected distance field of the space where the target object is located through the initial distance value between each spatial point in the space and the surface of the target object.
[0225] In some embodiments, the weight determination module is further used to: determine the sampling weight of the corresponding spatial point based on the initial distance value of each spatial point; determine the volume rendering weight of the corresponding spatial point based on the initial distance value of each spatial point and a preset light direction.
[0226] In some embodiments, the weight determination module is further used to: obtain a preset upsampling weight function; determine the sampling density of the upsampling process in the current iterative update process; the sampling density is a parameter determined based on the historical updated undirected distance field, and the historical updated undirected distance field is an updated undirected distance field obtained in the last iterative update process before the current iterative update; the sampling density includes a first type of sampling density and a second type of sampling density, and the first type of sampling density is greater than the second type of sampling density; when iteratively updating the initial undirected distance field, cyclically using the first type of sampling density and the second type of sampling density to determine the sampling weight; the sampling density and the initial distance value of each spatial point are input into the upsampling weight function to obtain the sampling weight of the corresponding spatial point.
[0227] In some embodiments, the weight determination module is also used to: obtain the normal direction of each of the spatial points mapped to the surface position of the target object; determine the angle value of the angle between the normal direction and the light direction; obtain a preset volume rendering weight function; determine the parameters to be learned for volume rendering during the current iterative update process; the parameters to be learned are parameters determined based on the historical updated undirected distance field, and the historical updated undirected distance field is the updated undirected distance field obtained in the last iterative update process before the current iterative update; the parameters to be learned and the angle value are input into the volume rendering weight function to obtain the volume rendering weight of the corresponding spatial point.
[0228] In some embodiments, the volume rendering weights of all spatial points determined by the volume rendering weight function satisfy at least one of the following conditions: global unbiased, local unbiased, and occlusion-aware; the global unbiased means that as the number of iterative updates increases, when the volume rendering weights are determined by the volume rendering weight function, the volume rendering weights of the spatial points at the surface interface with the target object are equal to 1; the local unbiased means that as the number of iterative updates increases, when the volume rendering weights are determined by the volume rendering weight function, the volume rendering weights of the spatial points at the surface interface with the target object are greater than the volume rendering weights of other spatial points at non-surface interfaces; the occlusion-aware means that along the direction of the light, in an area obscured by a portion of the surface of the target object, if there is another portion of the surface of the target object, the volume rendering weights of the spatial points at the other portion of the surface are less than the volume rendering weights of the spatial points at the portion of the surface of the target object.
[0229] In some embodiments, the processing module is further used to: based on the sampling weight, upsample the spatial points in the space in the direction of light corresponding to the camera parameter to obtain a plurality of sampling points.
[0230] In some embodiments, the processing module is also used to: obtain the sampling weight of each of the multiple spatial points in each of the multiple light directions corresponding to the camera parameters; and determine the spatial point whose sampling weight is greater than the sampling weight threshold as the sampling point in the light direction.
[0231] In some embodiments, the processing module is also used to: perform feature extraction on the multiple images to obtain an initial color value of each of the sampling points; and perform color integration on the initial color values of multiple sampling points in the direction of each light ray based on the volume rendering weight to obtain a rendering color value of each of the sampling points.
[0232] In some embodiments, the processing module is further used to: obtain initial color values of multiple sampling points in the direction of each light ray and a volume rendering weight of each of the sampling points; determine the color product between the volume rendering weight of each of the sampling points and the initial color value; and along the direction of the light ray, perform color integration on the color product, accumulate the color product of each sampling point in turn, and obtain a rendering color value projected onto the surface of the target object.
[0233] In some embodiments, the apparatus further comprises: a zero point set acquisition module, configured to acquire a zero point set corresponding to the initial undirected distance field, wherein the zero point set corresponds to a plurality of zero point set sampling points whose initial distance value is zero; a gradient determination module, configured to determine a gradient value of each of the zero point set sampling points based on the initial undirected distance field; an offset acquisition module, configured to acquire a preset offset; a gradient update module, configured to update the gradient value of each of the zero point set sampling points based on the offset to obtain an updated gradient value; and a distance field update module, configured to update the initial undirected distance field based on the updated gradient value to obtain an updated undirected distance field in the space where the target object is located.
[0234] In some embodiments, the iterative update module is further used to: obtain the rendered color value and the real color value of the sampling point on the surface of the target object; determine the color difference between the rendered color value and the real color value; determine the loss result of the neural radiation field network based on the color difference; the neural radiation field network is used to predict each initial distance value in the initial undirected distance field; based on the loss result, the network parameters of the neural radiation field network are updated to obtain an updated neural radiation field network; the initial undirected distance field of the target object is iteratively updated by the updated neural radiation field network to obtain an updated undirected distance field in the space where the target object is located.
[0235] It should be noted that the description of the device of the embodiment of the present application is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment, so it is not repeated. For technical details not disclosed in the embodiment of the device, please refer to the description of the method embodiment of the present application for understanding.
[0236] The embodiment of the present application provides a computer program product, which includes an executable instruction, which is a computer instruction; the executable instruction is stored in a computer-readable storage medium. When a processor of an electronic device reads the executable instruction from the computer-readable storage medium and the processor executes the executable instruction, the electronic device executes the method described in the embodiment of the present application.
[0237] The embodiment of the present application provides a storage medium storing executable instructions, wherein the executable instructions are stored. When the executable instructions are executed by a processor, the processor will execute the method provided by the embodiment of the present application, for example, Figure 6 The method shown.
[0238] In some embodiments, the storage medium can be a computer-readable storage medium, for example, a ferroelectric random access memory (FRAM), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPR OM), a flash memory, a magnetic surface memory, an optical disk, or a compact disk read-only memory (CD-ROM), etc.; it can also be various devices including one or any combination of the above memories.
[0239] In some embodiments, executable instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.
[0240] As an example, executable instructions may, but need not correspond to, a file in a file system, may be stored as part of a file storing other programs or data, for example, in one or more scripts in a Hyper Text Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files storing one or more modules, subroutines, or code portions). As an example, executable instructions may be deployed to be executed on one electronic device, or on multiple electronic devices located at one location, or on multiple electronic devices distributed at multiple locations and interconnected by a communication network.
[0241] The above is only an embodiment of the present application and is not intended to limit the protection scope of the present application. Any modifications, equivalent substitutions and improvements made within the spirit and scope of the present application are included in the protection scope of the present application.
Claims
1. A three-dimensional reconstruction method, characterized in that: The method comprises: Based on multiple images of the target object and camera parameters corresponding to each of the images, an initial undirected distance field of the space where the target object is located is established; the initial undirected distance field includes an initial distance value between each spatial point in the space and the surface of the target object; Based on the initial distance value of each spatial point and the preset light direction, respectively determine the sampling weight and volume rendering weight of the corresponding spatial point; Based on the sampling weights, up-sampling is performed on all spatial points in the space to obtain a plurality of sampling points; Based on the volume rendering weight, performing volume rendering on the plurality of sampling points to obtain a rendering color value of each of the sampling points; Iteratively updating the initial undirected distance field of the target object based on the rendering color value of the sampling point to obtain an updated undirected distance field of the space where the target object is located; The target object is three-dimensionally reconstructed based on the updated undirected distance field to obtain a three-dimensional model of the target object.
2. The method according to claim 1, characterized in that The step of establishing an initial undirected distance field of a space where the target object is located based on multiple images of the target object and camera parameters corresponding to each of the images includes: Extracting scene boundary information and shooting parameters of the space from the camera parameters; Determine the space where the target object is located based on the scene boundary information; Based on the shooting parameters, determining position information of each spatial point in the space; Inputting the position information and the plurality of images into a neural radiation field network to obtain an initial distance value between each spatial point in the space and the surface of the target object; An initial undirected distance field of the space where the target object is located is established by using the initial distance value between each spatial point in the space and the surface of the target object.
3. The method according to claim 1, characterized in that The step of determining the sampling weight and volume rendering weight of the corresponding spatial point based on the initial distance value of each spatial point and the preset light direction comprises: Based on the initial distance value of each spatial point, determining a sampling weight of the corresponding spatial point; Based on the initial distance value of each spatial point and a preset light direction, a volume rendering weight of the corresponding spatial point is determined.
4. The method according to claim 3, characterized in that The step of determining the sampling weight of the corresponding spatial point based on the initial distance value of each spatial point includes: Get the preset upsampling weight function; Determine a sampling density of upsampling processing in the current iterative update process; the sampling density is a parameter determined according to a historical updated undirected distance field, the historical updated undirected distance field is an updated undirected distance field obtained in the last iterative update process before the current iterative update; the sampling density includes a first type of sampling density and a second type of sampling density, the first type of sampling density is greater than the second type of sampling density; when iteratively updating the initial undirected distance field, cyclically adopt the first type of sampling density and the second type of sampling density to determine the sampling weight; The sampling density and the initial distance value of each spatial point are input into the upsampling weight function to obtain the sampling weight of the corresponding spatial point.
5. The method according to claim 3, characterized in that: The determining, based on the initial distance value of each spatial point and a preset light direction, a volume rendering weight of the corresponding spatial point comprises: Obtaining the normal direction of each of the spatial points mapped to the surface position of the target object; Determine the angle value of the angle between the normal direction and the light direction; Get the preset volume rendering weight function; Determine a parameter to be learned for volume rendering in a current iterative update process; the parameter to be learned is a parameter determined according to a historical updated undirected distance field, wherein the historical updated undirected distance field is an updated undirected distance field obtained in a previous iterative update process before the current iterative update; The parameters to be learned and the angle values are input into the volume rendering weight function to obtain the volume rendering weight of the corresponding spatial point.
6. The method according to claim 5, characterized in that The volume rendering weights of all spatial points determined by the volume rendering weight function satisfy at least one of the following conditions: global unbiased, local unbiased, and occlusion-aware; The global unbiased means that as the number of iterative updates increases, when the volume rendering weight is determined by the volume rendering weight function, the volume rendering weight of the spatial point at the interface with the surface of the target object is equal to 1; The local unbiased means that as the number of iterative updates increases, when the volume rendering weight is determined by the volume rendering weight function, the volume rendering weight of the spatial point at the surface interface with the target object is greater than the volume rendering weight of other spatial points at non-surface interfaces; The occlusion perception means that along the direction of the light, in an area occluded by a portion of the surface of the target object, if there is another portion of the surface of the target object, the volume rendering weight of the spatial point at the other portion of the surface is less than the volume rendering weight of the spatial point at the portion of the surface of the target object.
7. The method according to claim 1, characterized in that The upsampling process is performed on all spatial points in the space based on the sampling weights to obtain a plurality of sampling points, including: Based on the sampling weights, up-sampling processing is performed on the spatial points in the space in the light direction corresponding to the camera parameters to obtain the multiple sampling points.
8. The method according to claim 7, characterized in that The upsampling process is performed on the spatial points of the space in the direction of the light corresponding to the camera parameter based on the sampling weight to obtain the multiple sampling points, including: For a plurality of spatial points in each light direction of a plurality of light directions corresponding to the camera parameters, obtaining a sampling weight for each of the plurality of spatial points; A spatial point whose sampling weight is greater than a sampling weight threshold is determined as a sampling point in the direction of the light.
9. The method according to claim 8, characterized in that The performing the volume rendering on the plurality of sampling points based on the volume rendering weight to obtain a rendering color value of each of the sampling points includes: Performing feature extraction on the multiple images to obtain an initial color value of each sampling point; Along each light direction, color integration is performed on the initial color values of multiple sampling points in the light direction based on the volume rendering weight to obtain a rendering color value of each sampling point.
10. The method according to claim 8, characterized in that The step of performing color integration on initial color values of a plurality of sampling points in the direction of each light ray based on the volume rendering weight to obtain a rendering color value of each sampling point comprises: Obtaining initial color values of multiple sampling points in the direction of each light ray and a volume rendering weight of each sampling point; Determine a color product between a volume rendering weight of each of the sampling points and the initial color value; Along the direction of the light, by performing color integration on the color product, the color product of each sampling point is accumulated in sequence to obtain a rendering color value projected onto the surface of the target object.
11. The method according to claim 7, characterized in that The method further comprises: Acquire a zero point set corresponding to the initial undirected distance field, wherein the zero point set corresponds to a plurality of zero point set sampling points whose initial distance value is zero; Determine a gradient value of each sampling point of the zero point set based on the initial undirected distance field; Get the preset offset; Based on the offset, the gradient value of each sampling point of the zero point set is updated to obtain an updated gradient value; The initial undirected distance field is updated based on the updated gradient value to obtain an updated undirected distance field of the space where the target object is located.
12. The method according to any one of claims 1 to 11, characterized in that: The iterative updating of the initial undirected distance field of the target object based on the rendering color value of the sampling point to obtain an updated undirected distance field of the space where the target object is located includes: Obtaining a rendering color value and a real color value of a sampling point on the surface of the target object; determining a color difference between the rendered color value and the true color value; determining a loss result of a neural radiance field network based on the color difference; the neural radiance field network is used to predict each initial distance value in the initial undirected distance field; Based on the loss result, the network parameters of the neural radiation field network are updated to obtain an updated neural radiation field network; The initial undirected distance field of the target object is iteratively updated through the updated neural radiation field network to obtain an updated undirected distance field of the space where the target object is located.
13. A three-dimensional reconstruction device, characterized in that: The device comprises: An undirected distance field establishment module, configured to establish an initial undirected distance field of a space where the target object is located based on multiple images of the target object and camera parameters corresponding to each of the images; the initial undirected distance field includes an initial distance value between each spatial point in the space and a surface of the target object; A weight determination module, used to determine the sampling weight and volume rendering weight of the corresponding spatial point based on the initial distance value of each spatial point and the preset light direction; A processing module, configured to perform upsampling processing on all spatial points of the space based on the sampling weights to obtain a plurality of sampling points; and perform volume rendering on the plurality of sampling points based on the volume rendering weights to obtain a rendering color value of each of the sampling points; an iterative updating module, configured to iteratively update the initial undirected distance field of the target object based on the rendering color value of the sampling point, so as to obtain an updated undirected distance field of the space where the target object is located; The three-dimensional reconstruction module is used to perform three-dimensional reconstruction on the target object based on the updated undirected distance field to obtain a three-dimensional model of the target object.
14. An electronic device, characterized in that: include: A memory for storing executable instructions; A processor, configured to implement the three-dimensional reconstruction method according to any one of claims 1 to 12 when executing the executable instructions stored in the memory.
15. A computer-readable storage medium, characterized in that: Executable instructions are stored, which are used to cause a processor to execute the executable instructions to implement the three-dimensional reconstruction method described in any one of claims 1 to 12.
