A monocular image three-dimensional reconstruction method, device, equipment and medium
By optimizing the gradient descent algorithm and cost function of single-frame side-scan sonar images, the problem of low efficiency in 3D reconstruction in existing technologies is solved, achieving efficient monocular image 3D reconstruction and supporting real-time scene understanding and interaction.
Patent Information
- Application Number
- CN202311669544.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-06
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2043-12-06
AI Technical Summary
In existing technologies, 3D reconstruction requires multiple images and time-matching points, resulting in low efficiency and inability to meet real-time requirements.
By acquiring a single side-scan sonar image, the acoustic intensity, reflectivity, and surface height values of each pixel are iteratively optimized using a preset gradient descent algorithm and cost function, and then three-dimensional reconstruction is performed by combining the image depth data.
It enables real-time 3D reconstruction of a single image, improving reconstruction efficiency and accuracy. Users can understand the full 3D view of a scene without leaving home, and it supports offline scene interaction.
Smart Images

Figure CN117671148B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a method, apparatus, device, and medium for three-dimensional reconstruction of monocular images. Background Technology
[0002] With the advancement of digital transformation, increasing people's participation and interaction in virtual scenarios has become increasingly urgent. This aligns with the currently popular concept of the metaverse and allows people to understand the layout of physical stores and participate in various activities without leaving home. In recent years, with the development of 3D reconstruction technology, how to quickly and effectively convert the layout of physical stores into virtual 3D scenes in real time is a problem that digital transformation must solve in its journey towards the metaverse.
[0003] In existing technologies, 3D scene reconstruction is usually performed using SFM (Single-view Image Function). This method requires images of the same scene from multiple angles to complete the 3D reconstruction, which consumes unnecessary materials and time. Furthermore, it takes time to determine the matching points between images. Correct reconstruction can only be achieved when the feature points in the images meet the matching conditions. Therefore, the selection of key feature points and a good matching algorithm have a significant impact on the reconstruction effect. Due to the need for feature point matching, the reconstruction efficiency cannot meet real-time requirements. Therefore, there is an urgent need for a monocular image 3D reconstruction method to solve the above problems. Summary of the Invention
[0004] In view of this, the present invention provides a method, apparatus, device and medium for monocular image 3D reconstruction, which can improve reconstruction efficiency and accuracy, and achieve real-time 3D reconstruction of the target scene using only a single image. This can help users understand the 3D full view of various scenes without leaving home and realize offline scene interaction.
[0005] According to one aspect of the present invention, an embodiment of the present invention provides a method for three-dimensional reconstruction of a monocular image, the method comprising:
[0006] Acquire a monocular image to be reconstructed, and extract each pixel from the monocular image to be reconstructed; wherein, the monocular image to be reconstructed is a side-scan sonar image;
[0007] Based on a preset gradient descent algorithm and a pre-constructed cost function, the acoustic intensity, reflectivity, and surface height values corresponding to each pixel in the side-scan sonar image are iteratively optimized to obtain the optimized target acoustic intensity, target reflectivity, and target surface height values.
[0008] The image depth data of the monocular image to be reconstructed is obtained, and the monocular image to be reconstructed is reconstructed in three dimensions based on the target acoustic intensity, target reflectivity, target height value and the image depth data.
[0009] According to another aspect of the present invention, embodiments of the present invention also provide a monocular image three-dimensional reconstruction apparatus, the apparatus comprising:
[0010] The extraction module is used to acquire the monocular image to be reconstructed and extract each pixel from the monocular image to be reconstructed; wherein, the monocular image to be reconstructed is a side-scan sonar image.
[0011] The determination module is used to iteratively optimize the acoustic intensity, reflectivity, and surface height values corresponding to each pixel in the side-scan sonar image based on a preset gradient descent algorithm and a pre-constructed cost function, so as to obtain the optimized target acoustic intensity, target reflectivity, and target surface height values.
[0012] The reconstruction module is used to acquire the image depth data of the monocular image to be reconstructed, and to perform three-dimensional reconstruction of the monocular image to be reconstructed based on the target acoustic intensity, target reflectivity, target height value and the image depth data.
[0013] According to another aspect of the present invention, embodiments of the present invention also provide an electronic device, the electronic device comprising:
[0014] At least one processor; and
[0015] A memory communicatively connected to the at least one processor; wherein,
[0016] The memory stores a computer program that can be executed by the at least one processor, which enables the at least one processor to perform the monocular image three-dimensional reconstruction method according to any embodiment of the present invention.
[0017] According to another aspect of the present invention, embodiments of the present invention also provide a computer-readable storage medium storing computer instructions for causing a processor to execute and implement the monocular image three-dimensional reconstruction method according to any embodiment of the present invention.
[0018] The technical solution of this invention extracts each pixel from the monocular image to be reconstructed, and iteratively optimizes the acoustic intensity, reflectivity, and height values corresponding to each pixel in the side-scan sonar image based on a preset gradient descent algorithm and a pre-constructed cost function to obtain optimized target acoustic intensity, target reflectivity, and target height values. Based on the target acoustic intensity, target reflectivity, and target height values, as well as the image depth data acquired by the depth acquisition device, three-dimensional reconstruction is performed on the monocular image to be reconstructed. This can improve reconstruction efficiency and accuracy, and achieve real-time three-dimensional reconstruction of the target scene using only a single image. This can help users understand the three-dimensional panorama of various scenes without leaving home, and realize offline scene interaction.
[0019] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0020] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 A flowchart of a monocular image three-dimensional reconstruction method provided in an embodiment of the present invention;
[0022] Figure 2 A flowchart of another monocular image three-dimensional reconstruction method provided in an embodiment of the present invention;
[0023] Figure 3 This is a structural block diagram of a monocular image three-dimensional reconstruction device according to an embodiment of the present invention;
[0024] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0025] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0026] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0027] In one embodiment, Figure 1 This is a flowchart of a monocular image 3D reconstruction method according to an embodiment of the present invention. This embodiment is applicable to the situation of 3D scene reconstruction of monocular images. The method can be executed by a monocular image 3D reconstruction device, which can be implemented in hardware and / or software and can be configured in an electronic device.
[0028] like Figure 1 As shown in this embodiment, the method for 3D reconstruction of a monocular image includes the following specific steps:
[0029] S110. Obtain the monocular image to be reconstructed and extract each pixel in the monocular image to be reconstructed.
[0030] The monocular image to be reconstructed is the image that needs to be reconstructed in three dimensions. The monocular image to be reconstructed is a side-scan sonar image. This image can be an image of a business hall in a financial institution, or an image collected in other institutions or other scenarios. This embodiment does not impose any restrictions on this.
[0031] In this embodiment, a monocular image for 3D reconstruction can be obtained. This monocular image includes multiple pixels. The monocular image can be converted into a grayscale image, and then each pixel contained in the grayscale image can be extracted using an image information extraction tool. In some embodiments, the Pillow library in Python can be used to traverse each pixel of the image and obtain the RGB value of the current pixel. In other embodiments, OpenCV can be used to extract the image pixels. This embodiment does not impose any limitations on this.
[0032] S120. Based on the preset gradient descent algorithm and the pre-constructed cost function, the acoustic intensity, reflectivity and height values corresponding to each pixel value in the side-scan sonar image are iteratively optimized to obtain the optimized target acoustic intensity, target reflectivity and target height values.
[0033] The pre-defined gradient descent algorithm can be understood as a method to find the minimum objective function by calculating its derivative. The target acoustic intensity, target reflectivity, and target height values are the optimal solutions obtained after optimization for constructing the 3D scene.
[0034] In this embodiment, the pre-constructed cost function can ensure the consistency between the reconstructed image and the original image. A brightness constraint can be added to the cost function. In order to ensure that the reconstructed surface is a smooth surface, a surface smoothness constraint can also be introduced. At the same time, a brightness gradient constraint is added to ensure that the error of the surface normal before and after reconstruction is minimized.
[0035] In one embodiment, the pre-constructed cost function is expressed by the formula F=∫∫(1-λ)((IR)). 2 +(R x (x,y)-I x (x,y)) 2 +(R y (x,y)-I y (x,y)) 2 )+λ(p x (x,y) 2 +q y (x,y) 2 )dxdy; where λ is the weighting coefficient; I represents the input monocular image to be reconstructed; R represents the reflectance map corresponding to the monocular image to be reconstructed, I x (x,y)=I(x+1,y)-I(x,y) represents the partial derivative of I, characterizing the first change in the monocular image to be reconstructed at point X+1 relative to point x; I y (x,y)=I(x,y+1)-I(x,y); This represents the partial derivative of R, characterizing the second change in the monocular image to be reconstructed at point y+1 relative to point y; R x (x,y)=R(x+1,y)-R(x,y) represents the third change in the reflection map at point X+1 relative to point x; R y (x,y)=R(x,y+1)-R(x,y) represents the fourth change in the reflection map at point y+1 relative to point y; p x (x,y) represents the partial derivative in the x-direction; q y (x,y) represents the partial derivative in the y-direction; p x (x,y) and q y (x,y) represents the surface height gradient, p x (x,y)=z(x+1,y)-2z(x,y)+z(x-1,y); q y(x,y)=z(x,y+1)-2z(x,y)+z(x,y-1);
[0036] Among them, (IR) 2 Indicates brightness constraint; (R) x (x,y)-I x (x,y)) 2 +(R y (x,y)-I y (x,y)) 2 Represented as brightness gradient constraint; (p x (x,y) 2 +q y (x,y) 2 ) indicates a surface smooth constraint.
[0037] In some embodiments, the process of constructing the cost function may include:
[0038] Define the Langber model; where the Langber model is expressed by the formula: I(p)=ρΦcos(θ(p)); where I(p) represents the reflected intensity and light intensity at a point p on the surface of the object; θ represents the angle between the ray and point p along the vertical direction; ρ represents the reflectivity; Φ represents the incident direction vector of the light wave;
[0039] Given the following assumptions: the surface normal vector of the object at any point in three-dimensional space and the incident direction vector of the light wave; where the surface normal vector is expressed by the formula: The incident direction vector of a light wave is the light wave intensity, which can be expressed by the formula: Φ(x,y)=(x,0,z(x,y));
[0040] Calculate the cosine angle between the surface normal of the object and the incident direction vector of the light wave; where the cosine angle is expressed by the formula: Where Φ(x,y) represents the light wave intensity; n(x,y) represents the surface normal vector of the object;
[0041] Substituting the cosine angle into the Langber model yields the objective function; the objective function is expressed by the formula: I represents the input monocular image to be reconstructed, ρ(x,y) represents the reflectivity, Ф(x,y) represents the light intensity, and z(x,y) represents the surface height value.
[0042] The objective function is transformed into a cost function, thus completing the construction of the cost function.
[0043] In this embodiment, the Lambertian model can be understood as a surface diffuse reflection model. This model gives the relationship between the reflection intensity and light intensity at a point p on the surface of an object, the surface reflectivity ρ, and the surface height. Given a reflection intensity, the surface height of the object can be derived. In this embodiment, the Lambertian model can be defined first; where the Lambertian model is expressed by the formula: I(p)=ρΦcos(θ(p)); where I(p) represents the reflection intensity and light intensity at a point p on the surface of the object; θ represents the angle between the ray and point p along the vertical direction; ρ represents the reflectivity; and Φ represents the incident direction vector of the light wave.
[0044] In this embodiment, after defining the Langber model, the following assumptions can be given: the surface normal vector of the object at any point in three-dimensional space and the incident direction vector of the light wave; wherein, the surface normal vector is expressed by the formula: The incident direction vector of a light wave is its intensity, expressed by the formula: Φ(x,y)=(x,0,z(x,y)); this can be understood as a three-dimensional coordinate system, assuming partial differentials are performed on all three directions in three-dimensional space. The cosine angle between the surface normal of the object and the incident direction vector of the light wave is calculated; the cosine angle is expressed by the formula: Where Φ(x,y) represents the light wave intensity; n(x,y) represents the surface normal vector of the object; and the objective function is expressed by the formula: I represents the input monocular image to be reconstructed, ρ(x,y) represents the reflectivity, Ф(x,y) represents the light intensity, and z(x,y) represents the surface height value.
[0045] In this embodiment, the known quantity I(x,y) in the objective function is the brightness map of the image. It is necessary to estimate the reflectivity ρ(x,y) and light intensity Ф(x,y) at different locations on the object's surface, while the object's surface height is unknown and is also the target of 3D reconstruction. Therefore, the object's surface height can be derived using the objective function. Under the assumptions of the Lambertian model, the brightness recovery shape algorithm can be used to solve this problem. To improve computational efficiency, a method combining minimization iteration and linearization can be used. As can be seen from the objective formula, at least three components need to be solved, so additional constraints are necessary. The minimization method is the process of minimizing the error formula composed of multiple constraints. To ensure consistency between the reconstructed image and the original image, brightness constraints can be added to the formula; to ensure the reconstructed surface is smooth, surface smoothness constraints are introduced; and brightness gradient constraints are added to ensure the minimum error of the surface normal before and after reconstruction. This can be understood as transforming the objective function to obtain the cost function for easier solution, and using the cost function as the final objective function for solving, thus completing the construction of the cost function.
[0046] S130. Obtain the image depth data of the monocular image to be reconstructed, and perform three-dimensional reconstruction of the monocular image to be reconstructed based on the target acoustic intensity, target reflectivity, target height value, and image depth data.
[0047] Image depth data includes the actual size of objects in the image, or the size required for reconstruction.
[0048] In this embodiment, image depth data can be acquired through a preset depth acquisition device, or it can be customized according to the user's 3D reconstruction needs; this embodiment does not impose any limitations. The image depth data in this embodiment can be understood as the surface height information of objects in the image. This surface height information can be obtained through various methods of scanning the scene with a depth camera. In this embodiment, different image heights result in different image brightness.
[0049] In this embodiment, the preset depth acquisition device may include, but is not limited to, image depth acquisition devices such as depth cameras, sensors, and LiDAR. For example, depth can be directly acquired through specialized hardware devices, such as 3D LiDAR and RGB-D cameras, which use single or multiple visible light image sequences of the same scene to estimate depth.
[0050] In this embodiment, the image depth data is multiplied by the target acoustic intensity, target reflectivity and target height to obtain the reconstruction data information, and the monocular image to be reconstructed is reconstructed in three dimensions based on the reconstruction data information. In some embodiments, other methods can also be used to reconstruct the monocular image to be reconstructed in three dimensions, and this embodiment does not impose any restrictions.
[0051] The technical solution of this invention extracts each pixel value from the monocular image to be reconstructed; iteratively optimizes the sound wave intensity, reflectivity, and height values corresponding to each pixel value in the monocular image to be reconstructed based on a preset gradient descent algorithm and a pre-constructed cost function, to obtain optimized target sound wave intensity, target reflectivity, and target height values. Based on the target sound wave intensity, target reflectivity, and target height values, as well as the image depth data acquired by the depth acquisition device, three-dimensional reconstruction is performed on the monocular image to be reconstructed. This can improve reconstruction efficiency and accuracy, and achieve real-time three-dimensional reconstruction of the target scene using only a single image. This can help users understand the three-dimensional panorama of various scenes without leaving home, and realize offline scene interaction.
[0052] In one embodiment, Figure 2This is a flowchart of another monocular image 3D reconstruction method provided by an embodiment of the present invention. Based on the above embodiments, this embodiment extracts each pixel in the monocular image to be reconstructed; iteratively optimizes the acoustic intensity, reflectivity, and height values corresponding to each pixel in the side-scan sonar image based on a preset gradient descent algorithm and a pre-constructed cost function to obtain optimized target acoustic intensity, target reflectivity, and target height values; and further refines the 3D reconstruction of the monocular image to be reconstructed based on the target acoustic intensity, target reflectivity, target height values, and image depth data.
[0053] like Figure 2 As shown, the monocular image 3D reconstruction method in this embodiment may specifically include the following steps:
[0054] S210. Obtain the monocular image to be reconstructed. Read the monocular image to be reconstructed using OpenCV, convert the monocular image to be reconstructed into a grayscale image, and extract each pixel from the grayscale image.
[0055] Each pixel forms a pixel matrix; each pixel in the pixel matrix corresponds to a grayscale value; the grayscale value is stored in variable I for preservation.
[0056] In this embodiment, the monocular image to be reconstructed is obtained, and OpenCV is used to read the monocular image to be reconstructed. Each pixel value in the monocular image to be reconstructed is extracted from the monocular image to be reconstructed. This can be understood as an image processing library, such as OpenCV, directly reading the image and generating a matrix.
[0057] S220, Initialize the sound wave intensity, reflectivity, and surface height values; where the surface height value represents the surface height of the object.
[0058] In this embodiment, the sound wave intensity, reflectivity, and height values corresponding to the pixel values are initialized; where the height value represents the object's surface height. In this embodiment, the sound wave intensity, reflectivity, and surface height value z are initialized. The reflectivity can be initialized within the range of 0 to 1, and the object's surface height can be initialized using a normalized value from a depth map acquired by a depth camera; the incident light wave intensity can be initialized to the pixel values of the input image.
[0059] In one embodiment, initializing the sound wave intensity, reflectivity, and height values includes:
[0060] The reflectivity is initialized to a range of 0 to 1.
[0061] The initialization of the height value is as follows: the depth map acquired by the preset depth acquisition device is normalized to obtain the normalized parameter value, and the parameter value is used as the initial value;
[0062] The initialization of the sound wave intensity is as follows: the pixel values of the monocular image to be reconstructed are used as the initial values of the sound wave intensity.
[0063] In this embodiment, the reflectivity is initialized within the range of 0 to 1; the height value is initialized by normalizing the depth map acquired by the preset depth acquisition device to obtain the normalized parameter value, and using the parameter value as the initial value; the sound wave intensity is initialized by using the pixel value of the monocular image to be reconstructed as the initial value of the sound wave intensity.
[0064] S230. Select any pixel value from the pixels as the current pixel, determine the height and width corresponding to the current pixel, and obtain the sound wave intensity, reflectivity and surface height values corresponding to the current pixel through the cost function. Update the sound wave intensity, reflectivity and surface height values according to the preset update formula to obtain the updated new sound wave intensity, new reflectivity and new height values, and save the new sound wave intensity, new reflectivity and new height values.
[0065] The preset update formulas include: sound wave intensity update formula. Reflectivity update formula and the surface height value update formula
[0066] In this embodiment, a pixel value is arbitrarily selected from the pixels as the current pixel, the height and width corresponding to the current pixel are determined, and the sound wave intensity, reflectivity and surface height values corresponding to the current pixel are obtained through a cost function. The sound wave intensity, reflectivity and surface height values are updated according to a preset update formula to obtain the updated new sound wave intensity, new reflectivity and new height values, and the new sound wave intensity, new reflectivity and new height values are saved.
[0067] S240. Select the next pixel and use it as the current pixel. Return to the step of determining the height and width of the current pixel until the number of iterations reaches the preset number of iterations, or until the new sound wave intensity, new reflectivity and new height values reach the preset thresholds respectively, and obtain the target sound wave intensity, target reflectivity and target height values.
[0068] In this embodiment, the next pixel is selected and used as the current pixel. The steps to determine the height and width corresponding to the current pixel are returned until the number of iterations reaches a preset number of iterations, or until the new sound wave intensity, new reflectivity, and new height values reach preset thresholds respectively, thus obtaining the target sound wave intensity, target reflectivity, and target height values. This can be understood as follows: each pixel in the image corresponds to a gray level, and each gray level is updated through a cost function to obtain the corresponding sound wave intensity, reflectivity, and surface height values. After traversing the image, the sum of the cost functions corresponding to each pixel in the image is obtained. The method for updating the sound wave intensity, reflectivity, and surface height values each time can be as follows: for the cost function formula, the first-order partial derivatives of the cost function for sound wave intensity, reflectivity, and surface height values can be performed separately.
[0069] S250. Multiply the image depth data with the target acoustic intensity, target reflectivity and target height to obtain the reconstructed data information.
[0070] Image depth data includes the actual size of objects in the image, or the size required for reconstruction.
[0071] In this embodiment, the reconstructed data is obtained by multiplying the monocular image depth data with the target acoustic intensity, target reflectivity, and target height. The monocular image depth data includes the actual size of the object in the image, or the size required for reconstruction. This can be understood as follows: the object's surface height z can be obtained by acquiring a depth map using a depth camera. During reconstruction, the size is not necessarily based on the actual scene; the reconstructed size can be adjusted and modified manually. Only the unit value needs to be determined; the specific size to be reconstructed can be determined according to requirements.
[0072] S260. Perform three-dimensional reconstruction of the monocular image to be reconstructed based on the reconstruction data information.
[0073] In this embodiment, 3D reconstruction is performed on the monocular image to be reconstructed based on the reconstruction data. This can be understood as follows: the surface height z of an object can be obtained by acquiring a depth map using a depth camera. During reconstruction, the size is not necessarily based on the actual scene; the reconstructed size can be adjusted and modified manually. Only the unit value needs to be determined, and the specific size to be reconstructed can be determined according to requirements.
[0074] The above technical solution of the embodiment of the present invention initializes sound wave intensity, reflectivity and surface height value, wherein the surface height value represents the height of the object surface; arbitrarily selects a pixel value from the pixel points as the current pixel point, determines the height and width corresponding to the current pixel point, and obtains the sound wave intensity, reflectivity and surface height value corresponding to the current pixel point through the cost function, and updates the sound wave intensity, reflectivity and surface height value to obtain an updated new sound wave intensity, new reflectivity and new height value, and saves the new sound wave intensity, new reflectivity and new height value, selects a next pixel point, and takes the next pixel point as the current pixel point, and returns to the step of determining the height and width corresponding to the current pixel point until the number of iterations reaches a preset number of iterations, or the new sound wave intensity, the new reflectivity and the new height value respectively reach a preset threshold, to obtain a target sound wave intensity, a target reflectivity and a target height value; multiplies monocular image depth data by the target sound wave intensity, the target reflectivity and the target height value to obtain reconstruction data information, and performs three-dimensional reconstruction on the monocular image to be reconstructed according to the reconstruction data information, which can further improve reconstruction efficiency and reconstruction accuracy, realize real-time three-dimensional reconstruction of a target scene only by means of a single image, and help a user to understand a three-dimensional overview of each scene of a camp without going out, thereby realizing offline scene interaction.
[0075] In an embodiment, to facilitate better understanding of a cost function minimization iteration method in monocular image three-dimensional reconstruction, this embodiment provides a cost function minimization iteration step in monocular image three-dimensional reconstruction, and the specific steps are as follows:
[0076] a1: input a side-scan sonar image I to be reconstructed, and initialize sound wave intensity Ф(x,y), reflectivity ρ(x,y) and a surface height value z(x,y)
[0077] a2: start iteration n from 0
[0078] a3: F←0
[0079] a4: traverse a height and a width of an image
[0080] a5: F+=F(Ф,ρ,z)
[0081] a6: sound wave intensity update formula
[0082] reflectivity update formula
[0083] surface height value update formula
[0084] a7: termination condition: F<K1, or n>K2, wherein K1 represents a preset threshold, and K2 represents a preset maximum number of iterations.
[0085] In this embodiment, the grayscale values of the original image to be reconstructed are first read in and stored in variable I. Then, the acoustic intensity Ф(x,y), reflectivity ρ(x,y), and surface height z(x,y) are initialized. The reflectivity ρ can be initialized between 0 and 1, and the surface height z can be a normalized value obtained from a depth map captured by a depth camera. The incident light intensity Ф(x,y) can be initialized to the pixel values of the input image. After initialization, a loop is entered to iteratively optimize the error function. The three initialized components are used to calculate the image's reflection intensity, and then the values of several components in the error term are calculated and compared with the true values to obtain the error energy function. The optimization of the cost function is continuously performed within the loop using gradient descent. The loop terminates when either the number of iterations exceeds the maximum iteration count K2 or the error value is less than the minimum threshold K1, thus completing the iterative optimization process. This can be understood as using an iterative least squares method. The iteration can be stopped when the sum of all errors is less than a given threshold, or when the number of iterations is greater than the given maximum number of iterations. The resulting height map is the final height map.
[0086] In one embodiment, Figure 3 This is a structural block diagram of a monocular image 3D reconstruction device according to an embodiment of the present invention. This device is suitable for reconstructing 3D scenes from monocular images and can be implemented in hardware or software. It can be configured in an electronic device to implement a monocular image 3D reconstruction method according to an embodiment of the present invention.
[0087] like Figure 3 As shown, the device includes: an extraction module 310, a determination module 320, and a reconstruction module 330.
[0088] The extraction module 310 is used to acquire the monocular image to be reconstructed and extract each pixel in the monocular image to be reconstructed; wherein the monocular image to be reconstructed is a side-scan sonar image.
[0089] The determination module 320 is used to iteratively optimize the acoustic intensity, reflectivity and surface height values corresponding to each pixel in the side-scan sonar image based on a preset gradient descent algorithm and a pre-constructed cost function, so as to obtain the optimized target acoustic intensity, target reflectivity and target surface height values.
[0090] The reconstruction module 330 is used to iteratively optimize the acoustic intensity, reflectivity and surface height values corresponding to each pixel in the side-scan sonar image based on a preset gradient descent algorithm and a pre-constructed cost function, so as to obtain the optimized target acoustic intensity, target reflectivity and target surface height values.
[0091] In this embodiment of the invention, the extraction module extracts each pixel value from the monocular image to be reconstructed; the determination module iteratively optimizes the acoustic intensity, reflectivity, and height values corresponding to each pixel value in the monocular image to be reconstructed based on a preset gradient descent algorithm and a pre-constructed cost function to obtain optimized target acoustic intensity, target reflectivity, and target height values; and the reconstruction module performs three-dimensional reconstruction of the monocular image to be reconstructed based on the target acoustic intensity, target reflectivity, and target height values, as well as the image depth data acquired by the depth acquisition device. This improves reconstruction efficiency and accuracy, enabling real-time three-dimensional reconstruction of the target scene using only a single image. This allows users to understand the three-dimensional panorama of various scenes without leaving home, facilitating offline scene interaction.
[0092] In one embodiment, the extraction module 310 includes:
[0093] The extraction unit is used to read the monocular image to be reconstructed using OpenCV, convert the monocular image to be reconstructed into a grayscale image, and extract each pixel from the grayscale image; wherein, each pixel forms a pixel matrix; each pixel in the pixel matrix corresponds to a grayscale value; the grayscale value is stored in variable I for preservation.
[0094] In one embodiment, the pre-constructed cost function is expressed by the formula: F=∫∫(1-λ)((IR)) 2 +(R x (x,y)-I x (x,y)) 2 +(R y (x,y)-I y (x,y)) 2 )+λ(p x (x,y) 2 +q y (x,y) 2 )dxdy; where λ is the weighting coefficient; I represents the input monocular image to be reconstructed; R represents the reflectance map corresponding to the monocular image to be reconstructed, I x (x,y)=I(x+1,y)-I(x,y) represents the partial derivative of I, characterizing the first change of the monocular image to be reconstructed at point X+1 relative to point x; I y (x,y)=I(x,y+1)-I(x,y); is expressed as the partial derivative of R, representing the second change of the monocular image to be reconstructed at point y+1 relative to point y; R x (x,y)=R(x+1,y)-R(x,y) represents the third change in the reflection map at point X+1 relative to point x; R y(x,y)=R(x,y+1)-R(x,y) represents the fourth change in the reflection map at point y+1 relative to point y; p x (x,y) represents the partial derivative in the x-direction; q y (x,y) represents the partial derivative in the y-direction; p x (x,y) and q y (x,y) represents the surface height gradient, p x (x,y)=z(x+1,y)-2z(x,y)+z(x-1,y); q y (x,y)=z(x,y+1)-2z(x,y)+z(x,y-1);
[0095] Among them, (IR) 2 Indicates brightness constraint; (R) x (x,y)-I x (x,y)) 2 +(R y (x,y)-I y (x,y)) 2 Represented as brightness gradient constraint; (p x (x,y) 2 +q y (x,y) 2 ) indicates a surface smooth constraint.
[0096] In one embodiment, the construction of the cost function includes:
[0097] Define the Langber model; wherein the Langber model is expressed by the formula: I(p)=ρΦcos(θ(p)); where I(p) represents the reflection intensity and light intensity at a point p on the surface of an object; θ represents the angle between the ray and point p along the vertical direction; ρ represents the reflectivity; Φ represents the incident direction vector of the light wave;
[0098] Given the following assumptions: the surface normal vector of the object at any point in three-dimensional space and the incident direction vector of the light wave; where the surface normal vector is expressed by the formula: The incident direction vector of the light wave is the light wave intensity, which can be expressed by the formula: Φ(x,y)=(x,0,z(x,y));
[0099] Calculate the cosine angle between the surface normal of the object and the incident direction vector of the light wave; wherein the cosine angle is expressed by the formula: Where Φ(x,y) represents the light wave intensity; n(x,y) represents the surface normal vector of the object;
[0100] Substituting the cosine angle into the Langber model yields the objective function; wherein the objective function is expressed by the formula: I represents the input monocular image to be reconstructed, ρ(x,y) represents the reflectivity, Ф(x,y) represents the light intensity, and z(x,y) represents the surface height value.
[0101] The objective function is converted into a cost function, thus completing the construction of the cost function.
[0102] In one embodiment, the determining module 320 includes:
[0103] An initialization unit is used to initialize the sound wave intensity, reflectivity, and surface height values; wherein the surface height value represents the surface height of the object;
[0104] The update unit is configured to arbitrarily select a pixel value from the pixels as the current pixel, determine the height and width corresponding to the current pixel, obtain the sound wave intensity, reflectivity, and surface height values corresponding to the current pixel through the cost function, update the sound wave intensity, reflectivity, and surface height values respectively according to a preset update formula to obtain updated new sound wave intensity, new reflectivity, and new height values, and save the updated new sound wave intensity, new reflectivity, and new height values; wherein, the preset update formula includes: the sound wave intensity update formula. The reflectivity update formula and the surface height value update formula
[0105] A determining unit is used to select the next pixel point and use the next pixel point as the current pixel point, and return to the step of determining the height and width corresponding to the current pixel point until the number of iterations reaches a preset number of iterations, or until the new sound wave intensity, new reflectivity and new height values reach preset thresholds respectively, so as to obtain the target sound wave intensity, target reflectivity and target height values.
[0106] In one embodiment, the initialization of the sound wave intensity, the reflectivity, and the surface height values includes:
[0107] The reflectivity is initialized within the range of 0 to 1;
[0108] The initialization of the height value is as follows: normalize the depth map acquired by the preset depth acquisition device to obtain the normalized parameter value, and use the parameter value as the initial value;
[0109] The initialization of the sound wave intensity is as follows: the pixel value of the monocular image to be reconstructed is used as the initial value of the sound wave intensity.
[0110] In one embodiment, the reconstruction module 330 includes:
[0111] An information determination unit is used to multiply the image depth data with the target acoustic wave intensity, target reflectivity, and target height value to obtain reconstructed data information; wherein, the image depth data includes the actual size of the object in the image, or the size required for reconstruction;
[0112] The reconstruction unit is used to perform three-dimensional reconstruction of the monocular image to be reconstructed based on the reconstruction data information.
[0113] The monocular image 3D reconstruction device provided in this embodiment of the invention can execute the monocular image 3D reconstruction processing method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the method.
[0114] In one embodiment, Figure 4 This is a schematic diagram of an electronic device provided for an embodiment of the present invention. The electronic device 10 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0115] like Figure 4 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0116] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0117] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as monocular image 3D reconstruction methods.
[0118] In some embodiments, the monocular image 3D reconstruction processing method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or mounted on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the monocular image 3D reconstruction method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the monocular image 3D reconstruction method by any other suitable means (e.g., by means of firmware).
[0119] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0120] Computer programs used to implement the methods of the present invention can be written in any combination of one or more programming languages. These computer programs can be provided to the processor of a general-purpose computer, a special-purpose computer, or other programmable monocular image 3D reconstruction apparatus, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The computer programs can be executed entirely on the machine, partially on the machine, as a standalone software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0121] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0122] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0123] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0124] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0125] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0126] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method for three-dimensional reconstruction of a monocular image, characterized in that, include: Acquire a monocular image to be reconstructed, and extract each pixel from the monocular image to be reconstructed; wherein, the monocular image to be reconstructed is a side-scan sonar image; Based on a preset gradient descent algorithm and a pre-constructed cost function, the acoustic intensity, reflectivity, and surface height values corresponding to each pixel in the side-scan sonar image are iteratively optimized to obtain the optimized target acoustic intensity, target reflectivity, and target surface height values. The image depth data of the monocular image to be reconstructed is obtained, and the three-dimensional reconstruction of the monocular image to be reconstructed is performed based on the target acoustic intensity, target reflectivity, target height value and the image depth data; The pre-constructed cost function is expressed by the formula: ;in, denoted as weighting coefficient; I represents the input monocular image to be reconstructed; R represents the reflectance map corresponding to the monocular image to be reconstructed. The partial derivative of I represents the first change of the monocular image to be reconstructed at point X+1 relative to point x. ; is expressed as the partial derivative of R, representing the second change of the monocular image to be reconstructed at point y+1 relative to point y; This is represented as the third change in the reflection pattern at point X+1 relative to point x; This is represented as the fourth change in the reflection pattern at point y+1 relative to point y; It is expressed as a partial derivative in the x-direction; This represents the partial derivative in the y-direction; and Characterized as a surface height gradient, ; ; in, Indicates brightness constraint; This is represented as a brightness gradient constraint; This indicates a surface smoothing constraint.
2. The method according to claim 1, characterized in that, The step of extracting each pixel value from the monocular image to be reconstructed includes: The monocular image to be reconstructed is read using OpenCV, converted into a grayscale image, and each pixel is extracted from the grayscale image. The pixels form a pixel matrix; each pixel in the pixel matrix corresponds to a grayscale value; the grayscale value is stored in variable I for preservation.
3. The method according to claim 1, characterized in that, The construction of the cost function includes: Define the Langber model; wherein the Langber model is expressed by the formula: ;in, Represented as a point on the surface of an object The intensity of reflection and the intensity of light; Represented as rays and points The angle along the vertical direction; Reflectivity; It is represented as the incident direction vector of the light wave; Given the following assumptions: the surface normal vector of the object at any point in three-dimensional space and the incident direction vector of the light wave; where the surface normal vector is expressed by the formula: The incident direction vector of the light wave is the light wave intensity, which can be expressed by the formula: ; Calculate the cosine angle between the surface normal of the object and the incident direction vector of the light wave; wherein, the cosine angle is expressed by the formula: ;in, Expressed as light wave intensity; Represented as the surface normal vector of the object; Substituting the cosine angle into the Langber model yields the objective function; wherein the objective function is expressed by the formula: ; I represents the input monocular image to be reconstructed. Represented as reflectivity, Represented as light wave intensity, Represented as surface height value; The objective function is converted into a cost function, thus completing the construction of the cost function.
4. The method according to claim 1, characterized in that, The method iteratively optimizes the acoustic intensity, reflectivity, and height values corresponding to each pixel in the side-scan sonar image based on a preset gradient descent algorithm and a pre-constructed cost function to obtain optimized target acoustic intensity, target reflectivity, and target height values, including: Initialize the sound wave intensity, reflectivity, and surface height values; wherein the surface height value characterizes the surface height of the object; Randomly select a pixel value from the pixels as the current pixel, determine the height and width corresponding to the current pixel, and obtain the sound wave intensity, reflectivity, and surface height values corresponding to the current pixel through the cost function. Then, update the sound wave intensity, reflectivity, and surface height values respectively according to a preset update formula to obtain updated new sound wave intensity, reflectivity, and height values, and save the updated values. The preset update formula includes: the sound wave intensity update formula. The reflectivity update formula and the surface height value update formula ; Select the next pixel and use it as the current pixel. Return to the step of determining the height and width corresponding to the current pixel. Continue until the number of iterations reaches the preset number of iterations, or until the new sound wave intensity, new reflectivity and new height values reach the preset thresholds respectively, to obtain the target sound wave intensity, target reflectivity and target height values.
5. The method according to claim 4, characterized in that, The initialization of the sound wave intensity, the reflectivity, and the surface height values includes: The reflectivity is initialized within the range of 0 to 1; The initialization of the height value is as follows: normalize the depth map acquired by the preset depth acquisition device to obtain the normalized parameter value, and use the parameter value as the initial value; The initialization of the sound wave intensity is as follows: the pixel value of the monocular image to be reconstructed is used as the initial value of the sound wave intensity.
6. The method according to claim 1, characterized in that, The step of performing three-dimensional reconstruction of the monocular image to be reconstructed based on the target acoustic wave intensity, target reflectivity, target height value, and the image depth data includes: The image depth data is multiplied by the target acoustic intensity, target reflectivity, and target height to obtain the reconstructed data information; wherein, the image depth data includes the actual size of the object in the image, or the size required for reconstruction; Based on the reconstructed data information, the monocular image to be reconstructed is reconstructed in three dimensions.
7. A monocular image three-dimensional reconstruction device, characterized in that, include: An extraction module is used to acquire a monocular image to be reconstructed and extract each pixel in the monocular image to be reconstructed; wherein, the monocular image to be reconstructed is a side-scan sonar image; The determination module is used to iteratively optimize the acoustic intensity, reflectivity, and surface height values corresponding to each pixel in the side-scan sonar image based on a preset gradient descent algorithm and a pre-constructed cost function, so as to obtain the optimized target acoustic intensity, target reflectivity, and target height values. The reconstruction module is used to acquire the image depth data of the monocular image to be reconstructed, and to perform three-dimensional reconstruction of the monocular image to be reconstructed based on the target acoustic intensity, target reflectivity, target height value and the image depth data; The pre-constructed cost function is expressed by the formula: ;in, denoted as weighting coefficient; I represents the input monocular image to be reconstructed; R represents the reflectance map corresponding to the monocular image to be reconstructed. The partial derivative of I represents the first change of the monocular image to be reconstructed at point X+1 relative to point x. ; is expressed as the partial derivative of R, representing the second change of the monocular image to be reconstructed at point y+1 relative to point y; This is represented as the third change in the reflection pattern at point X+1 relative to point x; This is represented as the fourth change in the reflection pattern at point y+1 relative to point y; It is expressed as a partial derivative in the x-direction; This represents the partial derivative in the y-direction; and Characterized as a surface height gradient, ; ; in, Indicates brightness constraint; This is represented as a brightness gradient constraint; This indicates a surface smoothing constraint.
8. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the monocular image three-dimensional reconstruction method according to any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the monocular image three-dimensional reconstruction method according to any one of claims 1-6.
Citation Information
Patent Citations
Non-inductive three-dimensional face reconstruction method and acquisition reconstruction system
CN112308963A
Window self-detection
US20210121049A1
