Method, device, electronic device and readable storage medium for three-dimensional reconstruction of object
By screening images with high similarity and adjusting network parameters in the 3D reconstruction method, the problem of low 3D model quality under complex lighting conditions is solved, and the quality of 3D model and texture map generation is improved.
Patent Information
- Application Number
- CN202410304498.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-18
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2044-03-18
AI Technical Summary
Existing 3D reconstruction methods based on neural rendering lead to large color differences in image data taken from different angles under complex lighting conditions, resulting in low quality of the generated 3D model.
By obtaining multiple captured images, mask images and internal and external parameter data, calculate the image similarity area to determine the similarity coefficient of the target image, screen out images with higher similarity for training, and use the loss function to adjust the 3D reconstruction network and texture network. Generate high-quality 3D models and texture maps.
It improves the quality of 3D models and texture maps, reduces training errors due to color differences in image data, and enhances the accuracy of 3D reconstruction networks and texture networks.
Smart Images

Figure CN118154780B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of image processing technology, and specifically relates to a three-dimensional reconstruction method, device, electronic device and readable storage medium of an object. Background Art
[0002] Three-dimensional reconstruction refers to a technology that creates a model of three-dimensional objects that is suitable for computer representation and processing.
[0003] The 3D reconstruction method based on neural rendering uses a deep learning network to extract the 3D features of an object from its image data, predict the 3D representation of the object, and achieve 3D reconstruction of the object. For objects under complex lighting, the quality of the 3D model constructed using existing technology is low due to the large color difference between the image data taken from different angles. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a method, device, electronic device and readable storage medium for three-dimensional reconstruction of an object, which can solve the problem of low quality of three-dimensional models obtained by existing three-dimensional reconstruction technology.
[0005] In a first aspect, an embodiment of the present application provides a method for three-dimensional reconstruction of an object, the method comprising:
[0006] Acquire N captured images of the target object, as well as a mask image, internal and external parameter data, and sparse point cloud data of the target object, wherein the N captured images have different shooting angles, and N is an integer greater than 60 and less than 400;
[0007] Based on the mask image, the internal and external parameter data and the sparse point cloud data, by calculating the image similarity region, determining N-1 similarity coefficients of the first target image relative to the N-1 captured images respectively, wherein the first target image is any image of the N captured images, and the N-1 captured images are images of the N captured images other than the first target image;
[0008] Based on the N-1 similarity coefficients of the first target image and a preset similarity coefficient, selecting at least one second target image from the N-1 captured images, wherein the similarity coefficient corresponding to the at least one second target image is greater than the preset similarity coefficient;
[0009] Based on the first target image, at least one second target image corresponding to the first target image, the mask image and the internal and external parameter data, a preset object 3D reconstruction network is trained by a first loss function, and a 3D model of the target object is generated based on the trained preset object 3D reconstruction network;
[0010] Based on the first target image, the mask image, the internal and external parameter data and the three-dimensional model, a preset texture network is trained by a second loss function, and a texture map of the three-dimensional model of the target object is generated based on the trained preset texture network;
[0011] The first loss function is determined based on the color features of the pixels of the first target image and the first rendered image, the image features of the similarity region of the second target image and the first rendered image corresponding to the first target image, and the image structure similarity SSIM, wherein the first rendered image is the output data generated by the preset object 3D reconstruction network based on the input data;
[0012] The second loss function is determined based on pixel color features of the first target image and the second rendered image, wherein the consistency between the three-dimensional model and the texture is associated with the pixel color features, and the second rendered image is output data generated by the preset texture network based on the input data.
[0013] In a second aspect, an embodiment of the present application provides a three-dimensional reconstruction device for an object, the device comprising:
[0014] An acquisition module, used to acquire N captured images of the target object, as well as a mask image, internal and external parameter data, and sparse point cloud data of the target object, wherein the N captured images have different shooting angles, and N is an integer greater than 60 and less than 400;
[0015] a first determination module, configured to determine N-1 similarity coefficients of a first target image relative to N-1 captured images respectively by calculating image similarity regions based on the mask image, the internal and external parameter data, and the sparse point cloud data, wherein the first target image is any one of the N captured images, and the N-1 captured images are images of the N captured images other than the first target image;
[0016] A second determination module is configured to select at least one second target image from the N-1 captured images based on the N-1 similarity coefficients of the first target image and a preset similarity coefficient, wherein the similarity coefficient corresponding to the at least one second target image is greater than the preset similarity coefficient;
[0017] A first generating module is used to train a preset object 3D reconstruction network through a first loss function based on the first target image, at least one second target image corresponding to the first target image, the mask image and the internal and external parameter data, and generate a 3D model of the target object based on the trained preset object 3D reconstruction network;
[0018] A second generating module is used to train a preset texture network based on the first target image, the mask image, the internal and external parameter data and the three-dimensional model through a second loss function, and generate a texture map of the three-dimensional model of the target object based on the trained preset texture network;
[0019] The first loss function is determined based on the color features of the pixels of the first target image and the first rendered image, the image features of the similarity region of the second target image and the first rendered image corresponding to the first target image, and the image structure similarity SSIM, wherein the first rendered image is the output data generated by the preset object 3D reconstruction network based on the input data;
[0020] The second loss function is determined based on pixel color features of the first target image and the second rendered image, wherein the consistency between the three-dimensional model and the texture is associated with the pixel color features, and the second rendered image is output data generated by the preset texture network based on the input data.
[0021] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the program or instructions are executed by the processor, the steps of the three-dimensional reconstruction method of the object as described in the first aspect are implemented.
[0022] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of the three-dimensional reconstruction method of the object as described in the first aspect are implemented.
[0023] In a fifth aspect, an embodiment of the present application provides a computer program product, comprising computer instructions, which, when executed by a processor, implement the steps of the method for three-dimensional reconstruction of an object as described in the first aspect.
[0024] In the embodiment of the present application, the mask image is used to determine the N-1 similarity coefficients of the first target image relative to the N-1 captured images, and then the second target image is selected according to the preset similarity coefficient. The preset object 3D reconstruction network is trained based on the first target image and the second target image with a higher similarity to the first target image among the N-1 captured images, and the 3D model of the target object can be generated based on the trained preset object 3D reconstruction network. Since the similarity coefficient between the second target image and the first target image is high, that is, the shooting illumination condition of the second target image is similar to the shooting illumination condition of the first target image, that is, the color difference between the second target image and the first target image is small, therefore, the problem that the image data used in the model generation process has a large color difference between some images is solved, and the accuracy of the trained preset object 3D reconstruction network is improved, thereby improving the quality of the generated 3D model. In addition, by adjusting the preset object 3D reconstruction network through the illumination loss and color loss represented by the first loss function, the accuracy of the trained preset object 3D reconstruction network can be improved, thereby improving the quality of the generated 3D model of the target object; by combining the color loss of the pose consistency of the 3D model and the texture represented by the second loss function, the accuracy of the trained preset texture network can be improved, thereby improving the quality of the subsequently generated texture map. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 A schematic diagram of a flow chart of a method for three-dimensional reconstruction of an object provided in an embodiment of the present application;
[0026] Figure 2 A schematic diagram of the structure of a three-dimensional reconstruction device for an object provided in an embodiment of the present application;
[0027] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0028] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0029] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0030] The method provided in the embodiment of the present application is described in detail below through specific embodiments and their application scenarios in conjunction with the accompanying drawings.
[0031] Figure 1 A schematic flow chart of a method for three-dimensional reconstruction of an object provided in an embodiment of the present application includes the following steps:
[0032] Step 101, obtaining N images of the target object, as well as a mask image, internal and external parameter data, and sparse point cloud data of the target object, wherein the N images have different shooting angles, and N is an integer greater than 60 and less than 400.
[0033] By performing surround shooting of the target object, N images with different shooting angles can be obtained.
[0034] By using the object segmentation network to process the captured image, a mask image can be obtained. The mask image is a single-channel image with the same resolution as the captured image. The mask image is a binary image, and the pixel value of each pixel on the mask image can only be 0 or 1. When the pixel value of a pixel on the mask image is 1, it means that the pixel belongs to the point on the target object. When the pixel value of a pixel on the mask image is 0, it means that the pixel does not belong to the point on the target object and is a background point. The sparse point cloud of the target object can be obtained by processing N captured images based on the Colmap method in the Structure from Motion (SFM).
[0035] Internal and external parameter data are related to the geometric properties and posture of the camera used to shoot the target object, including internal parameters and external parameters. Among them, internal parameters are parameters that describe the internal properties of the camera, including focal length, principal point coordinates, distortion coefficients, etc. Internal parameters are usually determined during camera calibration and usually remain unchanged during use. External parameters are parameters that describe the position and posture of the camera in the world coordinate system, usually including rotation matrices and translation vectors. External parameters may change at different camera positions or shooting times.
[0036] Step 102, based on the mask image, the internal and external parameter data and the sparse point cloud data, by calculating the image similarity region, determining N-1 similarity coefficients of the first target image relative to the N-1 captured images respectively, wherein the first target image is any image of the N captured images, and the N-1 captured images are images of the N captured images other than the target image.
[0037] According to the mask image, it can be determined whether any pixel point on the corresponding captured image is a point on the target object. For example, when determining the similarity coefficient of the first target image relative to a captured image among N-1 captured images, all object points on the first target image can be determined according to the points with a pixel value of 1 in the mask image corresponding to the first target image; at the same time, all object points on the captured image can be determined according to the points with a pixel value of 1 in the mask image corresponding to the above captured image. All object points on the first target image are matched one by one with all object points on the captured image, and compared in combination with internal and external reference data, the pixel features of the object points are compared, and the similarity area between the first target image and the captured image is determined based on the comparison results of the pixel features of all object points, and then the similarity coefficient is determined according to the similarity area. Between two images, the higher the similarity coefficient, the more similar the two images are. In the scenario of the embodiment of the present application, the first target image and the N-1 captured images are all images obtained by shooting the target object, and the difference lies in the different shooting angles. If the similarity between the two captured images is high, it can be said that the shooting lighting conditions corresponding to the two captured images are similar.
[0038] Step 103: based on the N-1 similarity coefficients of the first target image and a preset similarity coefficient, selecting at least one second target image from the N-1 captured images, wherein the similarity coefficient corresponding to the at least one second target image is greater than the preset similarity coefficient.
[0039] The N-1 similarity coefficients correspond to the N-1 captured images one by one, and the N-1 captured images are screened according to the preset similarity coefficients, and the images whose corresponding similarity coefficients are greater than the preset similarity coefficients are determined as the second target images. It can be understood that the second target image has a high similarity with the first target image, that is, the color of the pixel corresponding to the same point on the target object in the first target image is close to the color of the pixel corresponding to the second target image, which means that the shooting lighting conditions corresponding to the first target image and the second target image are similar.
[0040] It should be noted that the number of the second target images is generally multiple, and the multiple second target images form an image similarity sequence of the first target image.
[0041] Step 104: Based on the first target image, at least one second target image corresponding to the first target image, the mask image and the internal and external parameter data, a preset object three-dimensional reconstruction network is trained through a first loss function, and a three-dimensional model of the target object is generated based on the trained preset object three-dimensional reconstruction network.
[0042] Based on the first target image and the second target image with a high similarity to the first target image among the N-1 captured images, as well as the internal and external parameter data and the mask image of the target object, the preset object 3D reconstruction network is trained, and the network parameters of the preset object 3D reconstruction network are adjusted by the first loss function, and the 3D model of the target object can be generated based on the trained preset object 3D reconstruction network. Since the similarity coefficient between the second target image and the first target image is high, that is, the shooting illumination condition of the second target image is similar to the shooting illumination condition of the first target image, that is, the color difference between the second target image and the first target image is small, therefore, the problem that the image data used in the model generation process has a large color difference between some images is solved, and the accuracy of the trained preset object 3D reconstruction network is improved, thereby improving the quality of the generated 3D model.
[0043] Step 105: Based on the first target image, the mask image, the internal and external parameter data and the three-dimensional model, the preset texture network is trained through a second loss function, and a texture map of the three-dimensional model of the target object is generated based on the trained preset texture network.
[0044] In this embodiment, the three-dimensional model of the target object is a three-dimensional model generated based on a trained three-dimensional reconstruction network of a preset object. Since the quality of the three-dimensional model is relatively high, the preset texture network is trained based on the three-dimensional model, the internal and external parameter data of the target object, the first target image, and the mask image. The preset texture network is adjusted through the second loss function, so that the accuracy of the trained preset texture network can be higher, the quality of the generated texture map is higher, and the color is more accurate.
[0045] Among them, the first loss function is determined based on the pixel color features of the first target image and the first rendered image, the image features of the second target image similarity area and the first rendered image similarity area corresponding to the first target image, and the image structure similarity SSIM, wherein the first rendered image is the output data generated by the preset object three-dimensional reconstruction network based on the input data.
[0046] In this embodiment, the preset object 3D reconstruction network is trained using the internal and external parameter data of the target object, the first target image and at least one second target image. The preset object 3D reconstruction network outputs a first rendered image based on the input data, and a loss value can be determined according to the first rendered image, the first target image, the second target image and the first loss function, and the preset object 3D reconstruction network is adjusted.
[0047] Among them, the first loss function can be:
[0048]
[0049] Among them, λ f , s is the preset coefficient value. N1 represents the number of images of the second target image, h ok U represents the similarity coefficient between the first target image and the second target image. o represents the similarity region corresponding to the first rendered image of the first target image, U k represents the corresponding similarity region on the second target image. feat () represents the image features extracted from the image using a multi-layer convolutional feature network. Fs() represents the image structural similarity SSIM. o Indicates the length of the image similarity region between the first target image and the second target image, N c Represents the number of image channels of the first training image.
[0050] The three-dimensional reconstruction network of the preset object is trained based on the above-mentioned first loss function, which takes into account the illumination loss and color loss caused by different shooting angles between images. The accuracy of the trained three-dimensional reconstruction network of the preset object can be improved, thereby improving the quality of the three-dimensional model of the target object generated subsequently.
[0051] The second loss function is determined based on the pixel color features of the first target image and the second rendered image, wherein the consistency between the three-dimensional model and the texture is associated with the pixel color features, and the second rendered image is the output data generated by the preset texture network based on the second training image.
[0052] In this embodiment, the preset texture network is trained based on the 3D model generated by the preset object 3D reconstruction network, the internal and external parameter data of the target object, the first target image, and the mask image. The preset texture network generates a second rendered image based on the input data, and the loss value can be determined according to the second rendered image, the first target image, and the second loss function, and the preset texture network is adjusted.
[0053] Among them, the second loss function can be:
[0054]
[0055] Among them, λ rgb is the preset coefficient value. N represents the number of pixels of the first target image. p Indicates the color value of a pixel on the first target image. off is the 3D vertex offset parameter of the 3D model of the target object, x p F is the 3D vertex of the 3D model of the target object. rgb (x p +x off ) is the color value of the pixel of the second rendered image. The parameters to be trained of the preset texture network include x off .
[0056] The preset texture network is trained based on the above-mentioned second loss function, which takes into account the color loss of the pose consistency between the three-dimensional model and the texture, and can improve the accuracy of the trained preset texture network, thereby improving the quality of the subsequently generated texture map.
[0057] It should be noted that the method of the present application requires re-training of the preset object 3D reconstruction network and the preset texture network for different target objects, so as to generate accurate 3D models and texture maps.
[0058] Optionally, step 102, based on the mask image, the internal and external parameter data and the sparse point cloud data, by calculating the image similarity region, determines N-1 similarity coefficients of the first target image with respect to the N-1 captured images respectively, including:
[0059] Acquire a third target image and a target point to be analyzed, wherein the third target image is any one of the N-1 captured images, and the target point to be analyzed is the nearest common three-dimensional vertex corresponding to the pixel point projections of the first target image and the third target image on the sparse point cloud data of the target object;
[0060] Determine a cosine value of an angle between the first target image and the third target image at the target point to be analyzed;
[0061] Based on the cosine value of the angle, the mask image, and the distance from the target point to be analyzed to the target image, a similarity coefficient of the first target image relative to the third target image is determined, wherein the distance from the target point to be analyzed to the target image is associated with the internal and external parameter data.
[0062] In this embodiment, some pixel points on the first target image can be projected on the sparse point cloud data to find corresponding three-dimensional vertices. Similarly, some pixel points on the third target image can also be projected on the sparse point cloud data to find corresponding three-dimensional vertices. When the three-dimensional vertex projected by the first target image and the three-dimensional vertex projected by the third target image are the same and are closest to the first target image and the third target image, the three-dimensional vertex is determined as the target point to be analyzed.
[0063] After determining the cosine value of the angle between the target point to be analyzed and the first target image and the third target image, the similarity coefficient between the first target image and the third target image is determined by combining the mask image and the distance between the target point to be analyzed and the first target image and the distance between the target point to be analyzed and the second target image.
[0064] Since there is a corresponding relationship between the target point to be analyzed and the pixel points on the first target image and the third target image, the cosine value of the angle between the target point to be analyzed and the first target image and the third target image can be associated with the similarity between the first target image and the third target image. All three-dimensional vertices of the sparse point cloud of the target object are analyzed accordingly, and the similarity coefficient of the first target image and the third target image can be finally obtained.
[0065] Optionally, determining the cosine value of the angle between the first target image and the third target image of the target point to be analyzed includes:
[0066] Acquire a first center point and a second center point, wherein the first center point is a camera center point corresponding to the first target image, and the second center point is a camera center point corresponding to the third target image;
[0067] The cosine value of the angle is determined based on a vector between the target point to be analyzed and the first center point and a vector between the target point to be analyzed and the second center point.
[0068] It should be noted that the pixel point corresponding to the target point to be analyzed on the first target image (referred to as the first pixel point for short) and the pixel point corresponding to the target point to be analyzed on the third target image (referred to as the second pixel point for short) are:
[0069]
[0070] Among them, C en (I o ) is the first center point, C en (I i ) is the second center point, x represents the target point to be analyzed, C en (Io )-x represents the vector from the target point to be analyzed to the first center point, C en (I i )-x represents the vector from the target point to be analyzed to the second center point.
[0071] In this embodiment, due to the association between the target point to be analyzed and the first pixel point, the first center point, the second pixel point, and the second center point, the cosine value of the vector angle between the target point to be analyzed and the first center point and the second center point can be used to characterize the similarity between the first pixel point and the second pixel point. The larger the cosine value of the angle, the more similar the parameter values of the first pixel point and the second pixel point.
[0072] Optionally, determining a similarity coefficient of the first target image relative to the third target image based on the cosine value of the angle, the distance from the target point to be analyzed to the target image, and the mask image includes:
[0073] Determine a similarity region between a first pixel and a second pixel based on the cosine value of the angle, the distance between the target point to be analyzed and the target image, and the first mask pixel value and the second mask pixel value, wherein the point corresponding to the target point to be analyzed on the first target image is a first pixel, and the pixel value of the point corresponding to the first pixel on the mask image is the first mask pixel value, and the point corresponding to the target point to be analyzed on the third target image is a second pixel, and the pixel value of the point corresponding to the second pixel on the mask image is the second mask pixel value;
[0074] A similarity coefficient of the first target image relative to the third target image is determined based on the sum of similarity areas between all first pixel points on the first target image and all corresponding second pixel points on the third target image.
[0075] Among them, the target point to be analyzed is the nearest common three-dimensional vertex corresponding to the pixel projection of the first target image and the third target image on the sparse point cloud data of the target object. It can be understood that due to the correspondence between the first pixel point, the second pixel point and the target point to be analyzed, although the first pixel point and the second pixel point are in the two images respectively, they actually correspond to the same point on the sparse point cloud data. It is also necessary to consider that the three-dimensional vertex on the sparse point cloud data may be a background point or a point on the target object, so the first pixel point and the second pixel point may also be a point on the target object or a background point. Based on the first mask pixel value and the second mask pixel value, it can be determined whether the first pixel point and the second pixel point are points on the target object. In this embodiment, only the similarity area between the first pixel point and the second pixel point belonging to the target object is determined, and the interference of the background points is eliminated, thereby improving the accuracy of the similarity coefficient of the first target image relative to the third target image.
[0076] In addition, there may be multiple target points to be analyzed. Then, for each first pixel point and second pixel point corresponding to the target point to be analyzed, the corresponding similarity region can be obtained. The similarity regions corresponding to all first pixel points and second pixel points are added together. The sum of the obtained similarity regions is the similarity region between the first target image and the third target image. Similarly, the similarity region of the first target image relative to the N-1 captured images can be determined in the same way. The similarity coefficient of the first target image relative to the third target image can be further determined based on the above parameters:
[0077]
[0078] Among them, Sum(U oi (I i )) represents the sum of the similarity areas between all first pixels on the first target image and all corresponding second pixels on the third target image, that is, the similarity area between the first target image and the third target image, Max(U o (I o )) represents the similarity region of the image with the largest sum of similarity regions among the N-1 third target images of the first target image. oi The larger the value is, the higher the similarity between the first target image and the third target image is.
[0079] By means of the above method, N-1 similarity coefficients of the first target image relative to the other N-1 captured images may be determined.
[0080] It should be noted that when Max(U o (I o)) is less than a preset minimum threshold, it is considered that the first target image cannot find a second target image with a higher similarity among the N-1 captured images.
[0081] Optionally, determining the similarity region between the first pixel point and the second pixel point based on the cosine value of the angle, the distance between the target point to be analyzed and the target image, and the first mask pixel value and the second mask pixel value includes:
[0082] When the first mask pixel value and the second mask pixel value are both greater than 0, and the cosine value of the angle is greater than a preset cosine threshold, the similarity area between the first pixel point and the second pixel point is determined based on the cosine value of the angle, the distance from the target point to be analyzed to the target image, and the preset cosine threshold.
[0083] In this embodiment, the similarity area between the first pixel point and the second pixel point may be determined in the following manner:
[0084]
[0085]
[0086] Among them, λ u Can be any odd value greater than 3 and less than 12. o , L i Respectively represent the distances from the target point to be analyzed to the first center point and the second center point, that is, the distance from the target point to be analyzed to the first target image and the distance from the target point to be analyzed to the second target image. max() represents the maximum value, and min() represents the minimum value. u () indicates rounding down to odd values. S m is the preset cosine threshold, S L is the preset distance ratio threshold, S L It can be any value greater than 0 and less than 1. o (x)·M o is the first mask pixel value, I i (x)·M i is the second mask pixel value. cosθ is the cosine value of the angle. u is the length of the similarity region.
[0087] In this embodiment, the three-dimensional vertices corresponding to the first pixel point and the second pixel point are determined as points on the target object through the first mask pixel value and the second mask pixel value, which is effective for the analysis thereof.
[0088] After determining the length u of the similarity region, a similarity region with a length of u can be determined with the first pixel or the second pixel as the center. If u is less than 3, it is considered that there is no similarity region.
[0089] like Figure 2 As shown, the embodiment of the present application further provides a three-dimensional reconstruction device 200 for an object, and the three-dimensional reconstruction device 200 for an object includes:
[0090] An acquisition module 201 is used to acquire N captured images of a target object, as well as a mask image, internal and external parameter data, and sparse point cloud data of the target object, wherein the N captured images have different shooting angles, and N is an integer greater than 60 and less than 400;
[0091] A first determination module 202 is configured to determine N-1 similarity coefficients of a first target image relative to N-1 captured images respectively by calculating image similarity regions based on the mask image, the internal and external parameter data, and the sparse point cloud data, wherein the first target image is any image of the N captured images, and the N-1 captured images are images of the N captured images other than the first target image;
[0092] A second determination module 203 is configured to select at least one second target image from the N-1 captured images based on the N-1 similarity coefficients of the first target image and a preset similarity coefficient, wherein the similarity coefficient corresponding to the at least one second target image is greater than the preset similarity coefficient;
[0093] A first generating module 204 is used to train a preset object 3D reconstruction network through a first loss function based on the first target image, at least one second target image corresponding to the first target image, the mask image and the internal and external parameter data, and generate a 3D model of the target object based on the trained preset object 3D reconstruction network;
[0094] A second generating module 205 is used to train a preset texture network based on the first target image, the mask image, the internal and external parameter data and the three-dimensional model through a second loss function, and generate a texture map of the three-dimensional model of the target object based on the trained preset texture network;
[0095] The first loss function is determined based on the color features of the pixels of the first target image and the first rendered image, the image features of the similarity region of the second target image and the first rendered image corresponding to the first target image, and the image structure similarity SSIM, wherein the first rendered image is the output data generated by the preset object 3D reconstruction network based on the input data;
[0096] The second loss function is determined based on pixel color features of the first target image and the second rendered image, wherein the consistency between the three-dimensional model and the texture is associated with the pixel color features, and the second rendered image is output data generated by the preset texture network based on the input data.
[0097] Optionally, the first determining module 202 includes:
[0098] A first acquisition submodule is used to acquire a third target image and a target point to be analyzed, wherein the third target image is any one of the N-1 captured images, and the target point to be analyzed is the nearest common three-dimensional vertex corresponding to the pixel point projection of the first target image and the third target image on the sparse point cloud data of the target object;
[0099] A first determination submodule, used to determine a cosine value of an angle between the first target image and the third target image of the target point to be analyzed;
[0100] The second determination submodule is used to determine the similarity coefficient of the first target image relative to the third target image based on the cosine value of the angle, the mask image, and the distance from the target point to be analyzed to the target image, wherein the distance from the target point to be analyzed to the target image is associated with the internal and external parameter data.
[0101] Optionally, the first determining submodule is further used for:
[0102] Acquire a first center point and a second center point, wherein the first center point is a camera center point corresponding to the first target image, and the second center point is a camera center point corresponding to the third target image;
[0103] The cosine value of the angle is determined based on a vector between the target point to be analyzed and the first center point and a vector between the target point to be analyzed and the second center point.
[0104] Optionally, the second determining submodule is further used for:
[0105] Determine a similarity region between a first pixel and a second pixel based on the cosine value of the angle, the distance between the target point to be analyzed and the target image, and the first mask pixel value and the second mask pixel value, wherein the point corresponding to the target point to be analyzed on the first target image is a first pixel, and the pixel value of the point corresponding to the first pixel on the mask image is the first mask pixel value, and the point corresponding to the target point to be analyzed on the third target image is a second pixel, and the pixel value of the point corresponding to the second pixel on the mask image is the second mask pixel value;
[0106] A similarity coefficient of the first target image relative to the third target image is determined based on the sum of similarity areas between all first pixel points on the first target image and all corresponding second pixel points on the third target image.
[0107] Optionally, the second determining submodule is further used for:
[0108] When the first mask pixel value and the second mask pixel value are both greater than 0, and the cosine value of the angle is greater than a preset cosine threshold, the similarity area between the first pixel point and the second pixel point is determined based on the cosine value of the angle, the distance from the target point to be analyzed to the target image, and the preset cosine threshold.
[0109] It should be noted that the three-dimensional reconstruction device 200 provided in the embodiment of the present application can achieve the following Figure 1 The entire technical process of the three-dimensional reconstruction method of the object shown in the embodiment achieves the same technical effect, and will not be repeated here to avoid repetition.
[0110] The device in the embodiment of the present application can be an electronic device, or a component in an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal, or it can be other devices other than a terminal. Exemplarily, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted electronic device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (augmented reality, AR) / virtual reality (virtual reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and the non-mobile electronic device can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
[0111] Alternatively, if Figure 3 As shown, an embodiment of the present application further provides an electronic device 300, including a processor 301 and a memory 302, wherein the memory 302 stores programs or instructions that can be executed on the processor 301, and when the program or instructions are executed by the processor 301, the various steps of the embodiment of the three-dimensional reconstruction method of the above-mentioned object are implemented, and the same technical effect can be achieved. To avoid repetition, they are not described here.
[0112] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.
[0113] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned three-dimensional reconstruction method embodiment of the object is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0114] The present application also provides a computer program product, including computer instructions, which, when executed by a processor, implement the above Figure 1 The various processes of the embodiment of the three-dimensional reconstruction method of the object shown can achieve the same technical effect, and will not be described again here to avoid repetition.
[0115] The processor is a processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0116] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0117] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0118] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A method for three-dimensional reconstruction of an object, characterized in that: The method comprises: Acquire N captured images of the target object, as well as a mask image, internal and external parameter data, and sparse point cloud data of the target object, wherein the N captured images have different shooting angles, and N is an integer greater than 60 and less than 400; Based on the mask image, the internal and external parameter data and the sparse point cloud data, by calculating the image similarity region, determining N-1 similarity coefficients of the first target image relative to the N-1 captured images respectively, wherein the first target image is any image of the N captured images, and the N-1 captured images are images of the N captured images other than the first target image; Based on the N-1 similarity coefficients of the first target image and a preset similarity coefficient, selecting at least one second target image from the N-1 captured images, wherein the similarity coefficient corresponding to the at least one second target image is greater than the preset similarity coefficient; Based on the first target image, at least one second target image corresponding to the first target image, the mask image and the internal and external parameter data, a preset object 3D reconstruction network is trained by a first loss function, and a 3D model of the target object is generated based on the trained preset object 3D reconstruction network; Based on the first target image, the mask image, the internal and external parameter data and the three-dimensional model, a preset texture network is trained by a second loss function, and a texture map of the three-dimensional model of the target object is generated based on the trained preset texture network; The first loss function is determined based on the color features of the pixels of the first target image and the first rendered image, the image features of the similarity region of the second target image and the first rendered image corresponding to the first target image, and the image structure similarity SSIM, wherein the first rendered image is the output data generated by the preset object 3D reconstruction network based on the input data; The second loss function is determined based on pixel color features of the first target image and the second rendered image, wherein the consistency between the three-dimensional model and the texture is associated with the pixel color features, and the second rendered image is output data generated by the preset texture network based on input data; The determining, based on the mask image, the internal and external parameter data and the sparse point cloud data, N-1 similarity coefficients of the first target image with respect to the N-1 captured images respectively by calculating the image similarity region includes: Acquire a third target image and a target point to be analyzed, wherein the third target image is any one of the N-1 captured images, and the target point to be analyzed is the nearest common three-dimensional vertex corresponding to the pixel point projections of the first target image and the third target image on the sparse point cloud data of the target object; Determine a cosine value of an angle between the first target image and the third target image at the target point to be analyzed; Based on the cosine value of the angle, the mask image, and the distance from the target point to be analyzed to the target image, a similarity coefficient of the first target image relative to the third target image is determined, wherein the distance from the target point to be analyzed to the target image is associated with the internal and external parameter data.
2. The method according to claim 1, characterized in that The determining the cosine value of the angle between the first target image and the third target image of the target point to be analyzed includes: Acquire a first center point and a second center point, wherein the first center point is a camera center point corresponding to the first target image, and the second center point is a camera center point corresponding to the third target image; The cosine value of the angle is determined based on a vector between the target point to be analyzed and the first center point and a vector between the target point to be analyzed and the second center point.
3. The method according to claim 1, characterized in that The determining, based on the cosine value of the angle, the distance from the target point to be analyzed to the target image, and the mask image, a similarity coefficient of the first target image relative to the third target image comprises: Determine a similarity region between a first pixel and a second pixel based on the cosine value of the angle, the distance between the target point to be analyzed and the target image, and the first mask pixel value and the second mask pixel value, wherein the point corresponding to the target point to be analyzed on the first target image is a first pixel, and the pixel value of the point corresponding to the first pixel on the mask image is the first mask pixel value, and the point corresponding to the target point to be analyzed on the third target image is a second pixel, and the pixel value of the point corresponding to the second pixel on the mask image is the second mask pixel value; A similarity coefficient of the first target image relative to the third target image is determined based on the sum of similarity areas between all first pixel points on the first target image and all corresponding second pixel points on the third target image.
4. The method according to claim 3, characterized in that The determining of the similarity region between the first pixel point and the second pixel point based on the cosine value of the angle, the distance between the target point to be analyzed and the target image, the first mask pixel value, and the second mask pixel value comprises: When the first mask pixel value and the second mask pixel value are both greater than 0, and the cosine value of the angle is greater than a preset cosine threshold, the similarity area between the first pixel point and the second pixel point is determined based on the cosine value of the angle, the distance from the target point to be analyzed to the target image, and the preset cosine threshold.
5. A three-dimensional reconstruction device for an object, characterized in that: The device comprises: An acquisition module, used to acquire N captured images of the target object, as well as a mask image, internal and external parameter data, and sparse point cloud data of the target object, wherein the N captured images have different shooting angles, and N is an integer greater than 60 and less than 400; a first determination module, configured to determine N-1 similarity coefficients of a first target image relative to N-1 captured images respectively by calculating image similarity regions based on the mask image, the internal and external parameter data, and the sparse point cloud data, wherein the first target image is any one of the N captured images, and the N-1 captured images are images of the N captured images other than the first target image; A second determination module is configured to select at least one second target image from the N-1 captured images based on the N-1 similarity coefficients of the first target image and a preset similarity coefficient, wherein the similarity coefficient corresponding to the at least one second target image is greater than the preset similarity coefficient; A first generating module is used to train a preset object 3D reconstruction network through a first loss function based on the first target image, at least one second target image corresponding to the first target image, the mask image and the internal and external parameter data, and generate a 3D model of the target object based on the trained preset object 3D reconstruction network; A second generating module is used to train a preset texture network based on the first target image, the mask image, the internal and external parameter data and the three-dimensional model through a second loss function, and generate a texture map of the three-dimensional model of the target object based on the trained preset texture network; The first loss function is determined based on the color features of the pixels of the first target image and the first rendered image, the image features of the similarity region of the second target image and the first rendered image corresponding to the first target image, and the image structure similarity SSIM, wherein the first rendered image is the output data generated by the preset object 3D reconstruction network based on the input data; The second loss function is determined based on pixel color features of the first target image and the second rendered image, wherein the consistency between the three-dimensional model and the texture is associated with the pixel color features, and the second rendered image is output data generated by the preset texture network based on input data; The first determining module comprises: A first acquisition submodule is used to acquire a third target image and a target point to be analyzed, wherein the third target image is any one of the N-1 captured images, and the target point to be analyzed is the nearest common three-dimensional vertex corresponding to the pixel point projections of the first target image and the third target image on the sparse point cloud of the target object; A first determination submodule, used to determine a cosine value of an angle between the first target image and the third target image of the target point to be analyzed; The second determination submodule is used to determine the similarity coefficient of the first target image relative to the third target image based on the cosine value of the angle, the mask image, and the distance from the target point to be analyzed to the target image, wherein the distance from the target point to be analyzed to the target image is associated with the internal and external parameter data.
6. An electronic device, characterized in that: The electronic device includes a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the programs or instructions are executed by the processor, the steps of the three-dimensional reconstruction method of an object as described in any one of claims 1 to 4 are implemented.
7. A readable storage medium, characterized in that: The readable storage medium stores a program or an instruction, and when the program or the instruction is executed by a processor, the steps of the three-dimensional reconstruction method of an object as described in any one of claims 1 to 4 are implemented.
8. A computer program product, characterized in that The method comprises computer instructions, which, when executed by a processor, implement the steps of the method for three-dimensional reconstruction of an object as claimed in any one of claims 1 to 4.
Citation Information
Patent Citations
Image processing method, deep learning model training method and device
CN117152352A
Depth estimation model training method and device, electronic equipment and storage medium
CN117237431A
