A hole filling method for virtual view synthesis images based on context feature fusion
The virtual viewpoint synthesis method through contextual feature fusion uses canny edge detection and 3D-warping technology, combined with the attention generation mechanism of the generative adversarial network, to solve the hole problem in virtual viewpoint synthesis and achieve higher quality image generation and textures. consistency.
Patent Information
- Application Number
- CN202210963297.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-11
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2042-08-11
AI Technical Summary
Among the existing virtual viewpoint synthesis technologies, the depth map-based rendering technology DIBR causes a large number of holes in the virtual view when dealing with foreground occlusion and edge image loss in the reference view. The traditional block matching algorithm results in a lack of texture consistency in the image and is time-consuming. longer.
A virtual viewpoint synthesis method using contextual feature fusion is used to identify the foreground edge of the depth map through canny edge detection, perform foreground diffusion, and use 3D-warping technology to draw the virtual viewpoint image. Combined with the attention generation mechanism in the generative adversarial network, the fusion language The pixels in the hole area are reconstructed using environmental features.
Effectively generate pixels in the hole area, reduce foreground information interference, improve the texture consistency and visual effects of the image, and significantly improve the image quality of virtual viewpoint synthesis.
Smart Images

Figure CN115297316B
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of image processing technology, in particular to the field of virtual viewpoint synthesis technology, and relates to a method for filling holes in virtual viewpoint synthesis images by fusing context features. Background Art
[0002] With the development of virtual reality, holographic projection and 3D video in our lives, people have more and more demands for realistic 3D video images. At present, the rendering and display technology of 3D video is not perfect. Due to the quality of the video, people will feel visual discomfort when watching low-quality 3D images and videos for a long time. The rendering technology of 3D video mainly uses the depth image based rendering technology (DIBR). DIBR has become the most important technology in virtual viewpoint synthesis due to its fast speed, free transformation of multiple viewpoints and small network bandwidth. In 3D video rendering technology, the depth map is an important part of drawing virtual viewpoints. The depth can guide the position information of pixels in the virtual viewpoint and improve the position accuracy after pixel transformation. However, the key problem of DIBR is that the foreground occlusion and edge image loss of the reference view will cause a large number of holes in the drawn virtual view. The traditional hole filling algorithm uses block matching to repair the holes, but it will cause the image to lack texture consistency and take a long time.
[0003] In recent years, the research and development of deep learning has demonstrated excellent performance in many fields. Among them, the development of generative adversarial networks provides a new idea for improving the image quality of virtual viewpoint synthesis. A significant advantage of these methods is that they can generate reasonable visual effects by learning image features from a large amount of data, especially on static data sets. In addition, for images drawn from virtual viewpoints, the foreground information of the movement should also be taken into account, that is, the hole areas in different frames are close to the foreground and change accordingly. Summary of the invention
[0004] The purpose of the present invention is to provide a method for generating holes in virtual view synthesis images by combining context feature fusion in order to solve the problem that the research on virtual view synthesis technology is still immature. The method of the present invention can not only effectively generate pixels in the hole area, but also fuse the context features of the same hole area, thereby reducing the interference of foreground information.
[0005] The method of the invention first detects the foreground information of the depth map and performs foreground diffusion based on the reference view, reference depth map and camera information, then draws a virtual viewpoint image according to the 3D transformation and reference information, and finally adds attention with context feature fusion to the generative adversarial network to generate pixels in the hole area.
[0006] The specific steps of the method of the present invention are as follows:
[0007] Step (1) identifies the foreground edge contour of the depth map by using the Canny edge detection method to obtain an edge contour map; and performs edge diffusion on the foreground object of the depth map according to the edge contour map to obtain a foreground diffusion map of the depth map.
[0008] (1-1) First, the canny edge detection method is used to detect the foreground edge of the depth map D of the reference sequence to obtain the edge contour map F of the depth map; among them, the canny operator is a mature existing technology for detecting the foreground edge.
[0009] (1-2) Filter the edge contour map and set the non-continuous and closed-loop edge pixels to 0; use whether the pixel value E(i, j) of a certain pixel point in the edge contour map is equal to 255 as the boundary condition. If E(i, j) = 255, then the pixel point (i, j) is the center pixel point, and the pixels on both sides of the center pixel point are diffused outward by 2 pixels in the horizontal direction to obtain the foreground diffusion map of the depth map.
[0010] Step (2) obtains a virtual viewpoint image based on the 3D-warping technology in the reference view, the foreground diffusion map of the depth map and the camera information.
[0011] 3D-warping technology involves four coordinate systems: pixel coordinate system (u, v), image coordinate system (x, y), camera coordinate system (Cam-X c ,Y c ,Z c ), World Coordinate System (OW x ,W y ,W z ). 3D-warping is to perform rigid body motion from the world coordinate system to the camera coordinate system, and then project the camera coordinate system to the pixel coordinate system on the camera imaging plane according to the trigonometric relationship through the focal length. Since the pixel coordinate system only represents the rows and columns in the image, it needs to be converted to the image coordinate system to represent the specific physical position.
[0012] Let M = [X, Y, Z, 1] T is the world coordinate of a pixel in three-dimensional space, m = [u, v, 1] T is the pixel coordinate of the camera coordinate system P in the homogeneous coordinate system, and the conversion formula is sm=PM; where s is the normalization factor, T represents the transpose, and P=K[R|t] is the camera extrinsic parameter matrix obtained by the camera intrinsic parameter matrix K, the camera rotation matrix R and the camera translation matrix t.
[0013] The coordinate information of the image in the world coordinate system M is obtained by referring to the known information of the viewpoint. The conversion formula is: The subscript r indicates that the matrix information comes from the camera of the reference viewpoint, and the superscript -1 indicates that the inverse matrix is calculated.
[0014] According to the camera extrinsic matrix information P of the virtual viewpoint v =K v [R v |t v ] and the coordinate information in the world coordinate system M to obtain the pixel information of the virtual viewpoint, and the conversion formula is s v [x,y,1] T =K v R v [X,Y,Z,1] T +K v t v ; The subscript v indicates that the matrix information comes from the camera of the virtual viewpoint.
[0015] According to the obtained image coordinate information and the pixel information under the image coordinates corresponding to the reference viewpoint, a virtual viewpoint image with holes and cracks can be obtained. For the cracks in the virtual viewpoint image, a median filter is used to process it to obtain a virtual viewpoint image V with only holes. The rendering technology based on the depth map is used, which is a mature existing technology.
[0016] Step (3) extracts the convolutional features of the image by generating adversarial network training.
[0017] (3-1) The Microsoft 3DVideos-distrib dataset is used as the training set and test set of the network model. The network model consists of a two-stage generative adversarial network. The input images of the network model are segmented into images with a resolution of 256×256, and the corresponding hole mask MASK uses a free-form mask. The network in the previous stage generates rough texture information in the hole area through a simple encoding and decoding layer. The network in the latter stage uses the output of the previous stage and the same hole mask MASK as input combined with dilated convolution and attention layers for further network training. After multiple layers of convolution encoding and decoding, the pixel features of the image are learned.
[0018] (3-2) The masks used in network training are all free-form masks. Compared with conventional centered matrix masks, they can reduce the training of foreground objects during training and better generate pixels in the background area. Considering the large amount of computation required for the convolutional layer, a large number of network parameters will be trained for the virtual viewpoint dataset with a resolution of 1024×768. In the later stage, the convolutional layer is integrated into the input and output parts of the network's encoding route combined with the attention mechanism and the encoding route combined with the dilated convolution to reduce the amount of computation and network parameters and speed up the model training time.
[0019] (3-3) Use two loss functions to obtain more realistic pixel information.
[0020] Add a pixel-level loss function L in the two-stage decoding part 2 =|Φ n (I gt )-Φ n (I pre )| 2 , I gt and I pre They are the real image and the image generated in this stage respectively.
[0021] In the later stage of encoding, a perceptual loss function is also added The prediction features of this stage are generated by the pre-trained VGG-16 network model in the Keras library; where Φ n Indicates the image features in the nth layer of the pre-trained network, H n , W n and C n They respectively represent the height, weight, and number of channels of the nth convolutional layer features in the VGG-16 network model, and N represents the number of convolutional layers in the VGG-16 network model.
[0022] Step (4) uses the attention mechanism with context feature fusion to reconstruct the features of the hole area.
[0023] (4-1) Globally match the features of the hole area:
[0024] After convolutional coding to obtain convolutional features, the cosine similarity of different regions and hole regions is measured:
[0025] <·> indicates cosine similarity calculation;
[0026] The obtained cosine similarity value is normalized by softmax to obtain the attention score:
[0027] Among them, b x,y and f x′,y′ They represent the non-hole area features and hole area features of the input convolutional layer respectively, x and y represent the specific position coordinates of the non-hole area feature matrix, x′ and y′ represent the specific position coordinates of the hole area feature matrix, m represents the number of cosine similarity function values, and softmax represents the normalization of all cosine similarity function values.
[0028] In order to enhance the continuity of features after hole generation in the same region, the best attention score of the first feature is directly taken as the maximum attention score. max, the best attention scores of all other features are selected by linking them with the previous adjacent attention scores: first, the maximum attention score of the current hole feature is obtained and the minimum attention score Get the current attention score cur =score max -score min , then score cur The attention score of the hole feature adjacent to the previous one pre Add the weights to get the best attention score opt =w 1 score pre +w 2 score cur , weight 0.2≤w 1 ,w 2 ≤0.8. After obtaining the attention score, according to the score opt The best attention matching feature block is selected to reconstruct the resolution and texture information of the virtual viewpoint image through deconvolution.
[0029] The method of the present invention proposes a virtual viewpoint hole generation technology with context feature fusion in the field of virtual viewpoint synthesis research. According to convolution feature extraction and cosine similarity, the existing attention mechanism is improved, and the connection between the attention scores of different hole feature blocks in the hole area of the same area is strengthened, so that the generated hole area can show consistency in texture and reduce the interference of foreground information. The present invention fuses different feature blocks in the virtual viewpoint hole area, eliminates single feature calculation to avoid matching foreground information of different frame information, so that the generated image presents better visual effects. The model can be directly applied to the fields of hole filling of 3D video, video and image restoration, etc. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 It is the main flow chart of the method of the present invention;
[0031] Figure 2 It is the original depth map and canny foreground contour map;
[0032] Figure 3 is the foreground diffusion map of the reference image and depth map;
[0033] Figure 4 It is a virtual view synthesized before and after the depth map diffusion;
[0034] Figure 5 are the virtual depth map and virtual view after median filtering;
[0035] Figure 6 is a schematic diagram of the network repair model;
[0036] Figure 7 It is a schematic diagram of context feature fusion attention;
[0037] Figure 8 It is a virtual view after the network model is repaired;
[0038] Fig. 9 are other virtual viewpoint images. DETAILED DESCRIPTION
[0039] like Figure 1 As shown, the method of the present invention takes the reference view and depth map as units. Before 3D-warping, the depth map needs to be preprocessed, and the virtual viewpoint image is calculated according to the 3D transformation formula and camera information. Finally, the GAN network with the attention mechanism combined with the context feature is used to generate pixels for the hole area.
[0040] Step (1) identifies the foreground edge contour of the depth map through the Canny edge detection algorithm, and diffuses the foreground object of the depth map according to the edge contour map.
[0041] (1-1) First, the canny edge detection algorithm is used to perform foreground edge detection on the depth map D of the reference sequence to obtain the edge contour map F. Figure 2 The right image is the edge contour map of the first frame depth of the 5th viewpoint of the ballet sequence.
[0042] (1-2) Guided by the edge contour map F, diffuse the edge of the foreground object of the reference viewpoint to both sides by 2 pixels at equal pixels. Since the virtual viewpoint drawing is a transformation of different viewpoints in the horizontal direction, the diffusion of the foreground object only involves the left and right directions. Before diffusion, a filtering operation is performed on the edge contour map, and non-continuous and closed-loop edge pixels are set to 0. In this way, the range can be limited to the foreground when processing the depth map. Whether E(i,j) is equal to 255 is used as the boundary condition to judge whether it is the left and right boundaries of the foreground object in the depth map. And the two consecutive pixel values on both sides are modified to the value of D(i,j) at the (i,j) position. In this way, the foreground diffusion map of the depth map is obtained. By Figure 3 The depth map on the right and Figure 2 As can be seen from the depth map on the left, the edge contour of the foreground diffusion map of the depth map is not smooth, but this does not have any impact on the foreground transformation in 3D-warping. It only makes the hole information around the foreground 1 to 2 pixels away from the foreground pixels.
[0043] D(i,j-1)=D(i,j-2)=D(i,j), if(E(i,j)==255&&D(i,j-1)<D(i,j));
[0044] D(i,j+1)=D(i,j+2)=D(i,j), if(E(i,j)==255&&D(i,j+1)<D(i,j)).
[0045] Step (2) obtains a virtual viewpoint image based on 3D-warping in the reference view, the foreground diffusion map of the depth map and the camera information.
[0046] (2-1) 3D-warping involves four coordinate systems: pixel coordinate system (u, v), image coordinate system (x, y), camera coordinate system (Cam-X c ,Y c ,Z c ), World Coordinate System (OW x ,W y ,W z ). 3D-warping is to perform rigid body motion from the world coordinate system to the camera coordinate system, and then project the camera coordinate system to the image coordinate system on the camera imaging plane according to the trigonometric relationship through the focal length. The image coordinate system can then be converted to the pixel coordinate system.
[0047] (2-2) Let M = [X, Y, Z, 1] T is the world coordinate of a pixel in three-dimensional space, m = [u, v, 1] T is the pixel coordinate of the camera coordinate system P in the homogeneous coordinate system. The conversion formula between them is sm=PM. Where s is the normalization factor, and P=K[R|t] is the camera external parameter matrix. Expanding P=K[R|t] gives s[u,v,1] T =K[R|t][X,Y,Z,1] T and s[u,v,1] T =KR[X,Y,Z,1] T +Kt. In the above formula, s, [u, v, 1] T and K[R|t] can be obtained based on known conditions, and then the world coordinate system information [X, Y, Z, 1] under the current coordinates can be obtained. T After obtaining the world coordinate system M through the reference viewpoint, the pixel coordinate system information s of the virtual viewpoint can be inferred v [x,y,1] T =K v R v [X,Y,Z,1] T +K v t v . Figure 4 The virtual viewpoint image with holes and cracks is shown. The crack information in the virtual viewpoint is processed by median filtering. The effect of median filtering is shown in the figure below. Figure 5 To avoid over-smoothing the source region in the virtual viewpoint, the filter kernel size is set to 3×3.
[0048] Step (3) extracts the convolutional features of the image by generating adversarial network training.
[0049] (3-1) Figure 6 The network model structure is shown. The hole mask M of the virtual viewpoint image V is extracted, and the free-form mask and the existing data set are used as the training set and test set in the generative adversarial network training. The architecture of the network model consists of a two-stage generative adversarial network. The network in the first stage generates rough texture information in the hole area through simple learning. The network in the second stage uses the results of the previous stage and the same mask map as input to combine the dilated convolution and attention layer for further network training. After multiple layers of convolutional encoding and decoding, the pixel features of the image are learned.
[0050] (3-2) The input of the network model is all cropped images, and their size is 256×256 resolution. The mask images used in network training are all free-form masks. Compared with the conventional centered matrix mask, they can reduce the training of foreground objects during training and better generate pixels in the background area. Considering the large amount of computation of the convolution layer, a large number of network parameters will be trained for the virtual viewpoint dataset with a resolution of 1024×768. In the later stage, the parallel encoding part of the network integrates part of the convolution layer to reduce the amount of computation and speed up the model training time.
[0051] (3-3) Use two loss functions to obtain more realistic pixel information. Add a pixel-level loss function L in the two-stage decoding part 2 =|Φ n (I gt )-Φ n (I pre )| 2 , I gt and I pre They are the real image and the image generated in this stage. In the later stage of encoding, a perceptual loss function is also added The prediction features of this stage are generated through the VGG-16 network model. Among them, Φ n Indicates the image features in the nth layer of the pre-trained network, H n , W n and C n They respectively represent the height, weight, and number of channels of the nth convolutional layer features in the VGG-16 network model, and N represents the number of convolutional layers in the VGG-16 network model.
[0052] Step (4) uses the attention mechanism with context feature fusion to reconstruct the features of the hole area.
[0053] (4-1) Figure 7 The diagram of the attention mechanism is shown. The attention mechanism aims to perform a global match on the features of the hole region. After obtaining the convolution features through convolutional coding, the cosine similarity of different regions and the hole region is measured:
[0054]
[0055] The obtained cosine similarity value is normalized by softmax to obtain the attention score:
[0056]
[0057] In the Microsoft 3DVideos-distrib dataset, due to the rapid movement of foreground objects, the conventional attention mechanism may mistakenly match the moving foreground objects in the hole area, causing visual distortion. In order to avoid the influence of the foreground object, the best attention score of the first feature is directly taken as the maximum attention score. max , the best attention scores of all other features are selected by linking them with the previous adjacent attention scores: first, the maximum attention score of the current hole feature is obtained and the minimum attention score Get the current attention score cur =score max -score min , then score cur The attention score of the hole feature adjacent to the previous one pre Add the weights to get the best attention score opt =w 1 score pre +w 2 score cur ; Among them, the weight w 1 and w 2 are 0.4 and 0.6 respectively. After obtaining the attention score, according to the score opt The best attention matching feature block is selected to reconstruct the resolution and texture information of the virtual viewpoint image through deconvolution.
[0058] The network model with convolutional coding feature learning, improved attention mechanism and parallel dilated convolution can learn the background information of the image well, so that the generated hole area has good visual consistency. Figure 3The original image on the left, Figure 5 The virtual viewpoint image on the right and Figure 8 The generated images show that the model can achieve satisfactory results in repairing holes in virtual viewpoint images. Fig. 9 Comparison graphs of results from different viewpoints and different sequences are shown.
Claims
1. A method for filling holes in virtual viewpoint synthesis images by integrating context features, characterized in that: First, the foreground information of the depth map is detected and foreground diffusion is performed based on the reference view, reference depth map and camera information. Then, a virtual viewpoint image is drawn based on the 3D transformation and reference information. Finally, attention with context feature fusion is added to the generative adversarial network to generate pixels in the hole area. The steps are as follows: Step (1) identifying the foreground edge contour of the depth map by using the Canny edge detection method to obtain an edge contour map; performing edge diffusion on the foreground object of the depth map according to the edge contour map to obtain a foreground diffusion map of the depth map; Step (2) obtaining a virtual viewpoint image based on the reference view, the foreground diffusion map of the depth map and the camera information based on the 3D-warping technology; Step (3) extracting convolutional features of the image by training the generative adversarial network; Specifically: (3-1) The Microsoft 3DVideos-distrib dataset is used as the training set and test set of the network model; the network model consists of a two-stage generative adversarial network, the input images of the network model are segmented into images with a resolution of 256×256, and the corresponding hole mask map MASK uses a free-form mask; The network in the previous stage generates rough texture information in the hole area through a simple encoding and decoding layer. The network in the later stage uses the output of the previous stage and the same hole mask MASK as input, and combines the dilated convolution and attention layer for further network training. After multiple layers of convolution encoding and decoding, the pixel features of the image are learned; (3-2) In the later stage of the network, the convolutional layer is integrated into the input and output parts of the encoding route combined with the attention mechanism and the encoding route combined with the dilated convolution; (3-3) Add the pixel-level loss function L2 = |Φ in the two-stage decoding part n (I gt )-Φ n (I pre )| 2 , I gt and I pre They are the real image and the image generated in this stage; In the later stage of encoding, a perceptual loss function is also added The prediction features of this stage are generated by the pre-trained VGG-16 network model in the Keras library; where Φ n Indicates the image features in the nth layer of the pre-trained network, H n , W n and C n They represent the height, weight, and number of channels of the nth convolutional layer feature in the VGG-16 network model, respectively. N represents the number of convolutional layers in the VGG-16 network model. Step (4) uses the attention mechanism with context feature fusion to reconstruct the features of the hole area; specifically: (4-1) After obtaining the convolution features through convolution coding, measure the cosine similarity of different regions and hole regions: <·> indicates cosine similarity calculation; The obtained cosine similarity value is normalized by softmax to obtain the attention score: Among them, b x,y and f x′,y′ They represent the non-hole region features and hole region features of the input convolutional layer respectively, x and y represent the specific position coordinates of the non-hole region feature matrix, x′ and y′ represent the specific position coordinates of the hole region feature matrix, m represents the number of cosine similarity function values, and softmax represents the normalization of all cosine similarity function values; The best attention score of the first feature is directly taken as the maximum attention score max , the best attention scores of all other features are selected by linking them with the previous adjacent attention scores: first, the maximum attention score of the current hole feature is obtained and the minimum attention score Get the current attention score cur =score max -score min , then score cur The attention score of the hole feature adjacent to the previous one pre Add the weights to get the best attention score opt =w1·score pre +w2·score cur ; w1, w2 are weights; After obtaining the attention score, according to the score opt The best attention matching feature block is selected to reconstruct the resolution and texture information of the virtual viewpoint image through deconvolution.
2. The method for filling holes in virtual viewpoint synthesis images by integrating context features as claimed in claim 1, characterized in that: Step (1) specifically includes: (1-1) First, the canny edge detection method is used to detect the foreground edge of the depth map D of the reference sequence to obtain the edge contour map F of the depth map; (1-2) Filter the edge contour map and set the non-continuous and closed-loop edge pixels to 0; use whether the pixel value E(i, j) of a certain pixel point in the edge contour map is equal to 255 as the boundary condition. If E(i, j) = 255, then the pixel point (i, j) is the center pixel point, and the pixels on both sides of the center pixel point are diffused outward by 2 pixels in the horizontal direction to obtain the foreground diffusion map of the depth map.
3. The method for filling holes in virtual viewpoint synthesis images by integrating context features as claimed in claim 2, characterized in that: The 3D-warping technology described in step (2) involves four coordinate systems: pixel coordinate system (u, v), image coordinate system (x, y), camera coordinate system (Cam-X c ,Y c ,Z c ), World Coordinate System (OW x ,W y ,W z ); Let M = [X, Y, Z, 1] T is the world coordinate of a pixel in three-dimensional space, m = [u, v, 1] T is the pixel coordinate of the camera coordinate system P in the homogeneous coordinate system, and the conversion formula is sm=PM; where s is the normalization factor, T represents the transpose, and P=K[R|t] is the camera extrinsic parameter matrix obtained by the camera intrinsic parameter matrix K, the camera rotation matrix R and the camera translation matrix t; The coordinate information of the image in the world coordinate system M is obtained by referring to the known information of the viewpoint. The conversion formula is [X, Y, Z, 1] T =R- r 1K- r 1 [u,v,1] T -R- r 1 t r ; The subscript r indicates that the matrix information comes from the camera of the reference viewpoint, and the superscript -1 indicates that the matrix is inverted; According to the camera extrinsic matrix information P of the virtual viewpoint v =K v [R v |t v ] and the coordinate information in the world coordinate system M to obtain the pixel information of the virtual viewpoint, and the conversion formula is s v [x,y,1] T =K v R v [X,Y,Z,1] T +K v t v ; Wherein, the subscript v indicates that the matrix information comes from the camera of the virtual viewpoint; A virtual viewpoint image with holes and cracks can be obtained based on the obtained image coordinate information and the pixel information under the image coordinates corresponding to the reference viewpoint; the cracks in the virtual viewpoint image are processed using median filtering to obtain a virtual viewpoint image V with only holes.
