A method for image 3D conversion based on image restoration

Through a method based on image restoration, combined with depth extraction and image restoration models, the problem of insufficient complex scene processing capabilities and light occlusion in the existing technology is solved, and more robust image 3D processing and efficient depth map generation are achieved.

CN115063303BActive Publication Date: 2024-09-13DALIAN UNIV OF TECH +1
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202210551793.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-18
Publication Date
2024-09-13
Estimated Expiration
2042-05-18

AI Technical Summary

Technical Problem

Existing image 3D methods have insufficient processing capabilities when dealing with complex scenes. Lightweight algorithms cannot cope with complex scenes, resulting in distorted results. The redundant algorithm of sub-modules is difficult to promote and apply on mobile phones, and there are light occlusion problems that are difficult to solve.

Method used

Using a method based on image repair, the image depth is obtained through a pre-trained depth extraction model, combined with the depth edge value to divide the foreground and background, the image repair model is used to generate a repaired background image, and combined with the foreground image to output a 3D effect, using a variety of Deep post-processing methods and image segmentation networks are used for deep and refined adjustments, and hardware acceleration algorithms are combined to accelerate the entire process.

Benefits of technology

It achieves more robust 3D image processing in complex scenes, can effectively reduce image distortion, adapt to a variety of practical application scenarios, improves processing efficiency through hardware acceleration, and expands the conversion effect of 2D to 3D images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115063303B
    Figure CN115063303B
Patent Text Reader

Abstract

The present invention provides a method for converting images into 3D images based on image restoration, comprising: obtaining an image to be processed, obtaining image depth through a pre-trained depth extraction model; obtaining a primary background edge map based on a preset depth edge value, and then filtering and connecting domain detection processing the primary background edge image to obtain a precise background edge map; determining the image range to be restored in the precise background edge map according to a preset 3D effect, and obtaining content materials used for restoration processing from the image to be processed; inputting the image to be processed, the precise background edge map, the background image range to be restored, and the content materials into a pre-trained image restoration model to generate a restored background image; combining the foreground image with the restored background image, and outputting a converted video according to a preset 3D effect. The present invention can be more widely applied to actual scenes, has strong robustness, and can also achieve good processing effects on images with complex foreground and background.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular to a method and device for converting an image into 3D images based on image restoration. Background Art

[0002] 3D image technology is to capture the world with a camera and synthesize new perspectives using image-based rendering technology. This image can provide a more immersive experience than 2D images. However, classic image-based reconstruction and rendering techniques require complex capture settings involving multiple images or the use of special hardware. With the continuous improvement of mobile phone camera performance, it has become possible to use mobile phone images to generate 3D images. By processing the images obtained by dual-lens mobile phones, RGB-D (color and depth) input images can be obtained, and new views are generated through RGB-D images, thereby rendering and generating 3D images.

[0003] Most traditional image 3D methods focus on the interpolation setting, performing light field rendering through interpolation, or reconstructing scene geometry from sparse views. Although these methods can also generate high-quality new views, they mainly do so by synthesizing corresponding input pixels and usually require multiple valid input views.

[0004] At present, the application of deep learning technology for view synthesis is also a hot spot for image 3D processing. View synthesis is regarded as a learning problem. By capturing a large number of scenes in the image, each scene is taken as the true value, the model is trained, and one or more other views are predicted. Recent work has explored many deep network architectures, scene representations, and application scenarios for learning view synthesis. In 2018, Zhou et al. used a fronto-parallel multi-plane representation (MPI) image structure in the SIGGRAPH conference'Stereo Magnification: Learning view synthesis using multiplane images', which is synthesized from a small baseline dual-camera stereo input. However, MPI has problems on tilted surfaces. In addition, excessive redundancy in multi-plane representation makes it inefficient in memory and storage and expensive to render. Facebook also proposed an algorithm for 3D photos in 2018, using a layered depth image (LDI) representation, which is more compact due to sparsity and can be converted to a lightweight mesh representation for rendering. Color and depth synthesis in occluded areas uses heuristics to optimize fast running mobile devices. However, it uses an isotropic diffusion algorithm to fill colors, which produces overly smooth results and fails to infer texture and structure.

[0005] Although existing image 3D conversion methods have achieved certain results, they still lack processing capabilities in the face of complex situations in practical applications. Lightweight algorithms tend to have end-to-end structures, but they cannot cope with complex scenes and the final results are obviously distorted. Modular algorithms are too redundant and difficult to promote and apply in lightweight systems such as mobile phones. Summary of the invention

[0006] The present invention provides a 3D image conversion method based on image restoration, which can cope with various complex scenes and has a low degree of image distortion.

[0007] The technical means adopted by the present invention are as follows:

[0008] A method for converting an image into 3D images based on image restoration, comprising:

[0009] S1. Acquire an image to be processed, and perform depth extraction on the image to be processed using a pre-trained depth extraction model to acquire image depth, wherein the image to be processed is a binocular image;

[0010] S2, dividing the image to be processed into foreground and background based on a preset depth edge value, thereby obtaining a primary background edge map, and then performing image post-processing based on filtering and connected domain detection on the primary background edge image, thereby obtaining an accurate background edge map;

[0011] S3, determining the image range to be repaired in the precise background edge map according to a preset 3D effect, and obtaining content materials used for repair processing from the image to be processed, wherein the 3D effect is set to be represented by the relative position between the foreground image and the background image;

[0012] S4, inputting the image to be processed, the precise background edge map, the background image range to be repaired, and the content material into a pre-trained image repair model, thereby generating a repaired background image;

[0013] S5. Combining the foreground image with the repaired background image, and outputting the converted video according to a preset 3D effect.

[0014] Further, performing depth extraction on the image to be processed by a pre-trained depth estimation neural network includes:

[0015] Match the left and right views of the binocular image based on the depth estimation neural network to obtain the matching disparity map;

[0016] The depth map is obtained based on the following calculation:

[0017]

[0018] Among them, f represents the focal length, b represents the baseline distance, ps represents the pixel distance, and disp represents the matching disparity map.

[0019] Furthermore, when the depth estimation neural network is trained, data enhancement processing is performed by performing random small-amplitude rotation, brightness and contrast adjustment, and input image segmentation on the training data, and then the processed training data is used to retrain the depth estimation neural network.

[0020] Furthermore, the image restoration model includes an edge completion network and an image restoration network; the edge completion network and the image restoration network both adopt a generative adversarial network with the same structure, and the generative adversarial network includes a generator and a discriminator; the generator includes three downsamplings, an intermediate layer, and three upsamplings symmetrical to the three downsamplings, and the intermediate layer includes 8 residual block structures with void convolutions; the discriminator includes five convolutional layers.

[0021] Further, the foreground image is combined with the repaired background image, and the converted video is output according to the preset 3D effect, including:

[0022] Performing noise reduction processing on the depth map to distinguish objects at different depths through accurate depth edges;

[0023] Pixels at different depth layers are divided into different graph connected domains, and the image is segmented into a combination of different target areas based on the semantic segmentation algorithm;

[0024] Repair missing background based on image restoration network;

[0025] The image foreground and the repaired image background are synthesized into a video through image rendering.

[0026] Compared with the prior art, the present invention has the following advantages:

[0027] The present invention can be more widely used in practical scenes, has stronger robustness, and can also handle some images with complex foreground and background well. For a pair of binocular images, this paper predicts their depth values ​​through a depth estimation network with a better structure. Due to targeted training and the use of neural network structure search, the network can adapt to many complex practical application scenarios. In order to deal with some more complex scenes with light occlusion problems, this paper adopts a variety of depth post-processing methods, uses a variety of image processing methods, and combines image segmentation networks to make fine adjustments to the depth of different scenes. After obtaining a depth map with excellent performance, this network uses a dedicated image restoration network to restore 2D images to 3D scenes according to scene classification, and generates video effects, which are expanded into camera special effects. This patent also introduces a hardware acceleration algorithm that can accelerate the entire algorithm process, and the patent is rich in practical application value. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0029] Figure 1 This is a flow chart of the image 3D conversion method based on image restoration according to the present invention.

[0030] Figure 2 Schematic diagram of the network architecture of the depth estimation module of the present invention.

[0031] Figure 3 Schematic diagram of the cell composition of NAS of the present invention.

[0032] Figure 4 FIG. 4 is a schematic diagram of the network search space of the NAS of the present invention.

[0033] Figure 5 This is a diagram of the edge completion network architecture of the present invention.

[0034] Figure 6 This is a diagram of the image restoration network architecture of the present invention.

[0035] Figure 7 Schematic diagram of the structure of the residual block of the present invention.

[0036] Figure 8 Schematic diagram of the generation process of the training mask of the present invention.

[0037] Fig. 9 This is the training of the image restoration network of the present invention. From left to right, they are: the original image, the retained part and the covered area, the completed image edge information, the image restoration network output image, and the final output image.

[0038] Fig.10 This is a processing flow chart of deep noise reduction of the present invention.

[0039] Fig.11 This is the DeeplabV3+ network architecture diagram in the present invention.

[0040] Fig.12 This is a schematic diagram of the method for hierarchically constructing a deep image structure using a semantic segmentation method in the present invention.

[0041] Fig.13 Schematic diagram of the complete image restoration algorithm of the present invention.

[0042] Fig.14This is a schematic diagram of the changes in the camera on the x-axis in the three camera movement modes: swing-x, dolly-zoom-in, and circle.

[0043] Fig.15 This is a plane display of the mesh graph. DETAILED DESCRIPTION

[0044] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0045] The technical solution of the present invention is based on an observed conclusion: the area with large depth difference in the image is often the critical area of ​​the image background. If the foreground moves, there will be a gap near the critical area. After filling this part, it can simulate the effect of foreground movement and slight background change, and can also make different changes according to the specific desired 3D effect. The method of the present invention is different from other methods. On the one hand, it is a step-by-step process, which makes the method more interpretable. On the other hand, more optimization processing is done at each step, making the method more adaptable to practical problems.

[0046] like Figure 1 As shown, the present invention discloses a method for 3D image conversion based on image restoration, which mainly includes the following steps:

[0047] S1. Obtain an image to be processed, and perform depth extraction on the image to be processed using a pre-trained depth extraction model to obtain image depth, wherein the image to be processed is a binocular image.

[0048] Specifically, depth map is widely used in many fields of image processing as an important image information, such as 3D reconstruction, image understanding, etc. Depth map can provide depth information in the scene. As the fourth dimension of image information, it is the key to converting 2D to 3D. The present invention uses a neural network to predict the depth of the image. The binocular depth network is mainly through the matching of the left and right views. Since the disparity of different depth points is different, the matching disparity map (disp) of the left and right views is obtained, and the depth map (Depth) can be obtained:

[0049]

[0050] Wherein, f represents focal length, b represents baseline distance, and ps represents pixel distance. In common use, the inverse of the disparity map can be directly taken as the depth map to be used.

[0051] The stereo depth network relies on the ability of neural networks to extract image feature information. The stereo network needs to match the left and right features to obtain a 3D loss block, also known as a loss volume, which is then decoded to obtain a depth map of one of the images. This method predicts the depth map of the left image by default.

[0052] S2. Divide the image to be processed into foreground and background based on a preset depth edge value, thereby obtaining a primary background edge map, and then perform image post-processing based on filtering and connected domain detection on the primary background edge image, thereby obtaining an accurate background edge map.

[0053] S3. Determine the image range that needs to be repaired in the precise background edge map according to a preset 3D effect, and obtain content materials used for repair processing from the image to be processed. The 3D effect is set to be represented by the relative position between the foreground image and the background image.

[0054] S4: input the image to be processed, the precise background edge map, the background image range to be repaired, and the content material into a pre-trained image repair model, thereby generating a repaired background image.

[0055] Specifically, image inpainting is a task of synthesizing alternative content in missing areas so that the modification is visually realistic and semantically correct. It allows the removal of distracting objects or the modification of unwanted areas in photos. It can also be extended to include cropping, rotation, splicing, repositioning, resynthesis, compression, super-resolution, coordination and many other functions. In the research, the main focus is on repairing and reconstructing damaged images while ensuring the effect of the image after inpainting. Traditional methods use Gaussian filtering or texture synthesis methods for inpainting. The former only considers the image color values ​​around the edge of the damaged area, so the damaged area that can be processed is small, and the latter gradually repairs the image from the outside to the inside, so the efficiency is very poor. The deep learning-based method mainly uses GAN (Generative Adversarial Network) to first repair the missing features and then restore the features to the repaired image. Image inpainting networks are different from deep networks. Since the missing parts in actual problems are unknown, random image masks (i.e., masks) are needed when training the network to enhance the robustness of the network.

[0056] The specific method is to first use the canny operator to extract the edges of the input image, convert it and the mask into a grayscale image input, and complete the edges covered by the mask. After that, the completed edges, together with the input image and mask, are used as the input of the inpainting network to complete the mask area. When used specifically, f refers to the repair network, and the network input is: RGB original image, binary mask image, edge obtained by depth map, and local image content (context) for repair. The input is cascaded in the order of RGB, context, mask, and edge, and the whole is used as the input of the repair network. The network output result takes the mask area and adds it to the RGB original image as the final output:

[0057] Output=RGB+mask×f(RGB,context,mask,edge) (2)

[0058] S5. Combining the foreground image with the repaired background image, and outputting the converted video according to a preset 3D effect.

[0059] Specifically, before 3D processing, the depth must be post-processed. This method mainly adds various image filtering methods for processing, including edge-preserving filtering, connected domain detection, etc., which are mainly used for the conversion from depth map to edge map. Considering that there may be unexpected errors in post-processing, it is also necessary to judge the local faults and then interpolate to maintain the continuity of the edges. At the same time, in order to simplify the complexity of the background in the actual scene, this method selects more than 20 common categories in practice and trains a pixel-level image segmentation network, which can provide additional foreground and background discrimination information. After obtaining the image foreground and the repaired image background, the video is synthesized by image rendering. Since the input and output of the entire network will be converted into a graph structure, rendering can be performed using a grid representation.

[0060] The scheme and effect of the present invention are further described below through a specific application example.

[0061] This embodiment discloses a method for converting an image into 3D images based on image restoration, which mainly includes an image depth estimation step, an image restoration step, and a 3D processing step.

[0062] (1) Image Depth Estimation

[0063] This algorithm is based on the neural network structure search technology, and finds a more efficient binocular depth estimation network structure through network structure search. For the searched network structure, we first pre-train it on a public dataset, then train it on real image scene data and public data at the same time, and then add a variety of different training strategies to make the trained model more robust and able to adapt to depth completion tasks in a variety of different scenes. The network diagram of the depth estimation module is shown in the figure below. Figure 2 shown.

[0064] The training phase is divided into two parts. First, a search for a depth completion model is performed on a specific public dataset to determine the structure of the feature extraction network and the matching network. In the search phase, the binocular image is input, the loss is output, and the intermediate structure selection is optimized. Based on this, the selection coefficients of each candidate network structure are adjusted. After the search, the regular network training phase begins. After the network structure is determined, the binocular image is also used as input to optimize the parameters of each module, and then the binocular depth estimation network used in the end is trained.

[0065] In the test phase, the feature extraction network is used to extract more representative semantic features in the input image, and then the matching network is used to perform cost matching to obtain a 3D cost volume. The cost volume is used for binocular image matching in the binocular depth estimation task. The disparity of the left and right eye input images of the binocular image is calculated, and the obtained disparity is used through a series of optimizations, and finally regression is used to obtain the final binocular depth map.

[0066] The basic unit of neural network search can be called a cell, which is composed of Figure 3 As shown in the figure. Each cell is a fully connected directed acyclic graph (DAG) with N nodes. Each cell contains two input nodes, one output node and three intermediate nodes. The alternative operations of the feature network are 3x3 2D convolution and skip layer connection, and the alternative operations of the matching network are 3x3 3D ​​convolution and skip layer connection. In the search phase of the neural network, all alternative operations are considered simultaneously through the parameter matrix, and all alternative operations are quantized into probabilities for selection through the softmax function.

[0067] At the network level, since each cell does not change the input resolution, we need to consider the up and down sampling problems in conventional networks, that is, the change in image resolution. Since the feature with an input size of 1 / 24 of the original image size is widely used in many binocular algorithms, the minimum resolution here is also set to 1 / 24 of the original image. In actual use, it is directly sampled to 1 / 3, and then there are 3 steps of allowable resolution changes, so the inter-layer downsampling ratio can be set to 1 / 3, 1 / 2, 1 / 2. Of course, there can also be upsampling ratios of 3, 2, 2. Another parameter is the number of network layers, which is empirically set to 6 layers for the feature network and 12 layers for the matching network. The specific search space is as follows: Figure 4 shown.

[0068] After the network searches and determines the two parts, the final neural network structure can be obtained.

[0069] Since various depth completion issues in actual situations need to be considered, it is impossible to ensure that the binocular data baseline is completely consistent in terms of flatness, brightness, contrast, etc. For actual images, in theory, there are only horizontally offset corrected images, and there are also optical flow predictions in the vertical direction. Therefore, the prediction results of the network trained only with the standard dataset have poor performance.

[0070] In order to solve the problem of inconsistent data baselines, a variety of data enhancement strategies were adopted to further increase the number of training images based on the original data set. The following three methods were adopted to solve the problem:

[0071] First, the image is randomly rotated by a small amount to simulate the different vertical and horizontal offsets during the image capture process.

[0072] Second, changes in brightness and contrast are made to make the network robust to differentiated data.

[0073] Third, the input image is divided into blocks for training, which increases the amount of data used for training and can simulate more potential problem combinations.

[0074] (2) Image restoration

[0075] The whole process of image restoration training is divided into two parts: edge completion and image restoration. The specific implementation of these two parts will be introduced in turn below. In the overall process of image restoration, the image to be restored, the mask of the area to be restored, and the edge information of the image are first input into the network. After merging the image to be restored with the mask indicating the restoration area, the channel is merged with the edge information and used as the network input. The network finally outputs a three-channel RGB image, which is the restored image.

[0076] The main structure of the edge completion network is a generative adversarial network, which consists of a generator and a discriminator. The generator is mainly composed of symmetrical three-fold downsampling and upsampling, and an intermediate layer consisting of 8 residual block structures with dilated convolutions in the middle, such as Figure 5 As shown in the figure. The discriminator is used to compete with the generator network during the training process. It consists of five convolutional layers and ultimately determines whether the input image conforms to the known data set distribution. The input of the discriminator is the final output of the generator. Although the discriminator does not participate in the subsequent generation, the adversarial loss obtained by the discriminator is crucial for the training of the generative adversarial network. The discriminator is also an adversarial factor in the generative adversarial network, which enables the generator to obtain more effective results.

[0077] In the subsequent image restoration network, the edges output by the network are combined with the edges generated by the original image into complete image edge information, which is used as the input of the image restoration network together with the input image and the mask of the area to be restored to complete the area to be restored.

[0078] When training the network, the input image is first converted to a grayscale image, and the image edge information is generated using the grayscale image and the Canny operator. The edge area of ​​the mask is removed from the extracted edge to obtain the complete edge of the image to be repaired. After that, the image to be repaired is converted to a grayscale image, and it is combined with the edge generated in the above process and the mask image representing the repair area as the image input of the edge completion network. The network output is the image edge of the area covered by the mask.

[0079] When training the edge completion network, the loss functions used are L1 loss, adversarial loss, and feature matching loss. Adversarial loss is a loss function unique to the generative adversarial network that introduces the discriminator. It aims to use the discriminator to determine whether the generated information belongs to the content in the known data set, and to strengthen the generator's generation ability in an adversarial manner. Similar adversarial losses are also used in the training of image restoration networks. Feature matching loss mainly matches the feature results generated by the discriminator layer. Since the simple image-level L1 loss may not reflect the differences in features in the image content, the feature map in the discriminator is used to determine whether the edge information generated by the generator is different from the true value at the feature level, thereby enhancing the generator's ability to generate features.

[0080] The configuration of the edge completion network loss function is as follows:

[0081] L=L context +10L FM +0.1L adv (3)

[0082] Where, L context is the L1 loss, L FM is the feature matching loss, L advTo combat losses.

[0083] The image restoration network inputs the image to be restored, the restoration area mask, and all the edges of the image completed by the edge completion network into the image restoration network for image restoration.

[0084] The image restoration network also uses a generative adversarial network structure similar to the edge completion network, as shown in Figure 6. The generator is still an encoder-decoder structure. It first downsamples the input image three times to extract the deep features of the image and shrinks the feature map of the image to facilitate the subsequent filling operation of the area to be repaired in the image. The middle layer of the network uses 8 residual blocks. The structure of the residual block is as follows: Figure 7 As shown in the figure, using the unique residual structure of the residual block, the network can learn the original image features and the features after convolution at the same time during one training, which greatly increases the accumulation of image features during the convolution process. Finally, the decoder uses the same structure as the encoder, but in contrast to the encoder, it performs upsampling to restore the input image to its original size to obtain the final decoder output. The decoder output takes the masked area and adds it to the remaining part of the original image to obtain the final repaired image.

[0085] The discriminator network structure is the same as the edge completion network structure mentioned above, which also improves the stability of the generator and makes its generated results more realistic.

[0086] In the training process of the image restoration network, unlike the traditional image restoration network training process, we modified the dataset used for training to target the image restoration content in 3D photography. In the overall training process of the image restoration network, we used the saliency detection annotation data of the public dataset MS-COCO, and first generated the binary image mask of the salient objects in the dataset as the basis for generating the mask required for training. Based on the mask, a 7x7 all-1 convolution kernel was used to dilate and erode the above mask, and then the dilated and eroded image was bitwise ANDed with the original binary image mask to obtain two adjacent sets of ring masks, namely the context mask and the image restoration mask. The two sets of ring masks were added together to obtain the mask of the image area that was finally retained during training. Both sets of ring masks can be used as cover masks in training. Figure 8 That is, a schematic diagram of the generation process of the training mask.

[0087] During training, first mask the background area of ​​the training image, and then use the context mask and repair mask generated above for training. The context mask retains the image information, and the image repair mask represents the area to be repaired. It is input into the image repair network together with the image and the completed edges for image repair training.

[0088] During the training process, if a narrower mask is used as the mask for the retained image area and a wider mask is used as the cover mask, the network's generation ability can be greatly improved; if the above mask settings are swapped, a more stable image restoration model will be obtained. In the actual training process, we first use a narrower mask as the mask for the area to be restored and a wider mask as the mask for the retained image area for preliminary training. When the network gradually converges, the two types of masks are swapped to further improve the network's generation ability. Fig. 9 This is the training of the image restoration network, where from left to right they are: the original image, the retained part and the masked area, the completed image edge information, the image restoration network output image, and the final output image.

[0089] In addition to the specially generated image mask data, the RGB color images used for training are selected from the MS-COCO dataset.

[0090] In the selection of image restoration network training, in addition to the same L1 loss and adversarial loss as the edge completion network, perceptual loss and style loss are also introduced at the image feature level. Perceptual loss is to pass the image through a specified feature extraction network. In this solution, the feature extraction network uses VGG19 to obtain the image features, and then compare the obtained features with L1 loss. The style loss is also calculated using the Gram matrix after extracting features from the image through the VGG19 network. Both of the above losses are calculated at the feature level, which can effectively reduce the image checkerboard effect caused by the deepening of the network.

[0091] The configuration of the image restoration network loss function is as follows:

[0092] L=L context +0.1L preceptual +250L style +0.1L adv (4)

[0093] Where, L context is the L1 loss, L perceytual is the perceptual loss, L styie is the style loss, L adv To combat losses.

[0094] (4) 3D processing

[0095] The first step of 3D processing is to further reduce the noise of depth. Different processing combinations are performed according to the depth characteristics of different images. Fig.10 This is the processing flow of deep noise reduction.

[0096] First, nonlinear mapping is performed on all image depths to convert the obtained depths into a close-range relative depth map, and the converted depth map is subjected to noise reduction. The process of nonlinear mapping is as follows:

[0097]

[0098] Nonlinear mapping mainly involves nonlinearly scaling the original depth according to the above formula. In the formula, k is the background depth scaling factor, which is mainly used to adjust the depth of field of the new depth. The whole process will be carried out multiple times, and each time it includes a new round of processing using the scaled new depth, including some image detection methods such as average depth determination and connected domain detection to adjust the noise of the depth map.

[0099] Secondly, 3D photography uses a fast edge-preserving filtering algorithm to sharpen edges and distinguish objects of different depths. The fast edge-preserving filtering algorithm uses a local effect to perform median filtering only on areas with larger depths near the edges in the depth map, while retaining the original depth of areas with smaller depths. This method greatly reduces the complexity of median filtering while retaining the complete edges of shallower depth objects (generally foreground objects that need to be moved in 3D photography). Unlike the conventional full-image median filtering algorithm, the proposed local edge-preserving filtering algorithm first calculates the edge of the rough preliminary processing depth. Only in the corresponding edge area in the depth map, median filters with different window sizes are used to filter the blurred edge depth pixels. In order to improve the sharpening effect, the median filter used only assigns the median value of the pixels with relatively larger depths in the pixel window area to each pixel in the edge area to achieve the effect of shrinking and sharpening the edge.

[0100] Third, in order to repair the prediction error problem of the depth algorithm in some areas of strong exposure and weak texture images, the 3D photography solution designed a hole repair algorithm to optimize the depth hole areas in the depth map. The algorithm uses a depth threshold to obtain connected domains of different depths, and through the size of the connected domain, it screens the areas in the depth map that are obviously correlated with the depth of surrounding objects but have a large difference in average depth. For the problem of local area depth distortion caused by weak texture, strong exposure and other problems, the algorithm screens and separates according to the size of the local area. According to empirical conclusions, the area with small surface passes is defined as a hole area with prediction errors. The algorithm extracts edges and uses an erosion and expansion strategy to gradually cover the depth values ​​in the hole area.

[0101] Finally, for image scenes with many small targets, the solution also uses cropping to further process the depth map. Since small targets are not the main objects of the overall 3D motion scene, the discontinuity and distortion of their depth will reduce the overall visual effect. In the face of relatively complex scenes, the algorithm uses thresholds to obtain boundary conditions between targets of different depths. Through connected domain analysis, for local non-main small targets with obvious depth changes in the scene, the algorithm uses multiple local mean filtering algorithms to artificially smooth the depth of small targets and surrounding scenes to reduce the computational overhead of the overall 3D photography algorithm on non-important targets.

[0102] The optimized relative depth map can distinguish objects at different depths through accurate depth edges. Therefore, the 3D photography solution constructs a hierarchical graph structure system for the image scene, dividing pixels at different depth layers into different graph connected domains. In order to reduce the depth level of irrelevant objects, this solution uses a semantic segmentation algorithm to assist in the construction of the graph network. The semantic segmentation model of DeeplabV3+ based on deep learning was trained on the public dataset Pascal-VOC. The trained model achieved a high prediction accuracy in 19 categories of common life objects.

[0103] The DeeplabV3+ semantic segmentation network used in this solution is obtained by improving the network structure based on DeeplabV3. Fig.11 As shown in the figure. In order to solve the problem of multi-scale object segmentation, DeeplabV3 network uses dilated convolution on the convolution layer to prevent the problem of low image resolution caused by downsampling. Then, dilated convolution with different expansion rates is used to concatenate the features obtained by multi-scale convolution, and then 1x1 convolution is used to reduce the dimension to obtain the result of semantic segmentation.

[0104] Based on DeeplabV3, DeeplabV3+ changes the network structure to an encoder-decoder structure, where the encoder structure is based on DeeplabV3, and the decoder structure is divided into two layers of input. One layer of input is the result of upsampling the encoder output by 4 times, and the other layer of input is the feature map of the original image after sampling through the ResNet network. After the two are connected in series, they are passed through a 3x3 convolution kernel and finally upsampled four times to obtain the final semantic segmentation result.

[0105] During the training process of DeeplabV3+, ResNet101 is used as the basic network, and the loss function uses cross entropy. During training, there are 19 categories of semantic segmentation pixel classification, and the network is trained on Pascal-VOC.

[0106] Semantic segmentation algorithms divide images into combinations of different target regions, such as Fig.12As shown in the figure, this scheme divides different layers according to the priority of the segmentation targets. Since the preset scene of this scheme is portrait photography, this scheme takes the people in the scene as the first main target, and cooperates with the target area obtained by the semantic segmentation algorithm. The graph structure belonging to the portrait area is taken as the shallow foreground layer of the first layer, and the other target graph structures in the scene are divided into the other target layers of the second layer. Finally, the remaining background is divided into the background layer of the third layer. This method greatly simplifies the execution times of the image restoration algorithm.

[0107] Then the background is repaired through the image repair network described above. The overall repair network is as follows Fig.13 After obtaining the image foreground and the repaired image background, we synthesize the video by rendering the image.

[0108] In order to reduce the complexity of the scene and reduce the unstable effect of the restoration algorithm prediction, this method adds an adaptive camera movement algorithm based on the above image semantic segmentation algorithm. This algorithm uses the semantic segmentation model to predict the target category of the image, and divides the scene according to the object category in the segmentation result. When the semantic segmentation results show that there are objects that obviously only appear in indoor scenes (such as sofas, TVs, dining tables, etc.), we define the scene of the input image as an indoor scene; when there are objects that obviously only appear in outdoor scenes (such as airplanes, bicycles, boats, etc.), we define the scene as an outdoor scene; when some objects (such as potted plants, cats, people, etc.) appear in the scene, and there are no other obvious landmark objects of indoor and outdoor scenes, the scene is defined as an uncertain scene.

[0109] To achieve a better viewing experience, this solution performs swing-x camera movement for indoor scenes with relatively clear details and depth, to highlight the effect of the algorithm on the completion task and enhance the 3D viewing experience of the video. For outdoor scenes, this solution sets the dolly-zoom-in camera movement to reduce the inaccurate depth values ​​of the depth image due to outdoor scenes, which may lead to problems such as foreground boundary breakage and affect the final video generation effect. For uncertain scenes, we will set the corresponding camera movement according to different scenes. For example, when there are many potted plants, the circle camera movement brings the best 3D effect. Fig.14 There are three types of camera movements on the x-axis.

[0110] In the depth dimension, the camera maintains a movement from shallow to deep and then back to shallow. The first two movement modes assume that the camera's field of view remains unchanged, while dolly-zoom-in assumes that the field of view changes continuously with the depth, thereby achieving a slow gradual effect.

[0111] 3D photography is rendered using the Vispy library based on OpenGL. This Python library uses the relative depth information between points to convert the completed scene into a mesh map, and uses the color information of the three vertices of each triangle in the mesh map to determine the color of the surface. After that, the mesh map under different perspectives is quickly rendered through a predefined camera movement route to obtain the corresponding pictures, and finally the rendered pictures are connected as a video for output to obtain the final 3D photography video.

[0112] Therefore, the 3D photography algorithm mainly uses mesh structure to store and update images. The algorithm first converts the original image into a graph form, and first constructs the mesh structure of the original image in a three-dimensional coordinate method. For each pixel in the original image, the node key is defined by (X, Y, Z), where (X, Y) is the two-dimensional coordinate of the pixel and Z is the depth. Each node is composed of attributes such as pixel color, pixel distance, and whether the pixel is synthesized, as the mesh structure of the initial image. Secondly, according to the distance between each defined node and the pixel depth in its four neighborhoods, the connection relationship between the edges of the pixels is defined with a certain threshold. The nodes with a depth difference greater than the threshold are in a non-connected state, which means that the two nodes are the edges of the foreground and background respectively. In this way, the algorithm initially establishes a scene graph structure system based on the depth of the original image.

[0113] During the scene movement, the new nodes generated under different perspectives will be updated to the mesh structure of the original image according to their key attributes (X, Y, Z), and connected to their corresponding neighborhood background nodes. Under the complete movement, all new nodes will be updated to the mesh structure synchronously to improve all possible corresponding position pixel information, and finally generate a complete scene graph network. Through this process, the mesh graph can be well layered and differentiated in depth, such as Fig.15 shown.

[0114] The proposed algorithm finally calls the corresponding renderer at different perspectives based on the complete mesh graph to complete the rendering of all camera images and generate the final 3D camera video.

[0115] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for converting an image into 3D images based on image restoration, characterized in that: include: S1. Acquire an image to be processed, and perform depth extraction on the image to be processed by a pre-trained depth estimation neural network to acquire image depth, wherein the image to be processed is a binocular image; S2, dividing the image to be processed into foreground and background based on a preset depth edge threshold, thereby obtaining a primary background edge map, and then performing image post-processing based on filtering and connected domain detection on the primary background edge image, thereby obtaining an accurate background edge map; S3, determining the image range to be repaired in the precise background edge map according to a preset 3D effect, and obtaining content materials used for repair processing from the image to be processed, wherein the 3D effect is set to be represented by the relative position between the foreground image and the background image; S4, inputting the image to be processed, the precise background edge map, the background image range to be repaired, and the content material into a pre-trained image repair model, thereby generating a repaired background image; S5. Combining the foreground image with the repaired background image, and outputting the converted video according to a preset 3D effect.

2. The method for converting an image into 3D image based on image restoration according to claim 1, characterized in that: Performing depth extraction on the image to be processed by a pre-trained depth estimation neural network, including: Match the left and right views of the binocular image based on the depth estimation neural network to obtain the matching disparity map; The depth map is obtained based on the following calculation: Among them, f represents the focal length, b represents the baseline distance, ps represents the pixel distance, and disp represents the matching disparity map.

3. The method for converting an image into 3D image based on image restoration according to claim 2, characterized in that: When the depth estimation neural network is trained, data enhancement processing is performed by performing random small-amplitude rotation, brightness and contrast adjustment, and input image block division on the training data, and then the processed training data is used to retrain the depth estimation neural network.

4. The method for converting an image into 3D image based on image restoration according to claim 1, characterized in that: The image restoration model includes an edge completion network and an image restoration network; the edge completion network and the image restoration network both adopt a generative adversarial network with the same structure, and the generative adversarial network includes a generator and a discriminator; the generator includes three downsamplings, an intermediate layer, and three upsamplings symmetrical to the three downsamplings, and the intermediate layer includes 8 residual block structures with void convolutions; the discriminator includes five convolutional layers.

5. The method for converting an image into 3D image based on image restoration according to claim 1, characterized in that: Combine the foreground image with the repaired background image and output the converted video according to the preset 3D effect, including: Performing noise reduction processing on the depth map to distinguish objects at different depths through accurate depth edges; Pixels at different depth layers are divided into different graph connected domains, and the image is segmented into a combination of different target areas based on the semantic segmentation algorithm; Repair missing background based on image restoration network; The image foreground and the repaired background image are synthesized into a video through image rendering.

Citation Information

Patent Citations

  • Method for inpainting and restoring processing of vacancy of DIBR (Depth Image Based Rendering) target image

    CN103369342A

  • Multi-view 3D video synthetic method

    CN103634584A

  • Depth-based cavity repairing method in viewpoint synthesis

    CN104780355A

  • Depth image enhancement processing method and device

    CN113223070A

  • Indoor scene three-dimensional reconstruction method and system based on depth restoration

    CN113538658A