A video specific area rendering system and rendering method based on auxiliary grid
Through a video-specific area rendering system based on auxiliary grid, the problems of low modeling accuracy and slow rendering speed in the existing technology are solved, resource saving and stability of rendering effects are achieved, and can be deployed on mobile and web pages. Keep pattern details.
Patent Information
- Application Number
- CN202210292439.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-24
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2042-03-24
AI Technical Summary
The existing video rendering technology has problems such as low modeling accuracy, poor video frame continuity, large resource consumption, and unstable rendering effects and slow speed, making it difficult to preserve pattern details.
Adopt a video-specific area rendering system based on auxiliary grids, including video template shooting module, video modeling module, video optimization module, data storage module and video rendering module, and build grid detection, key point detection, de-grid and texture Light and shadow extraction model, time series smoothing processing and data compression storage, and stable rendering of patterns is achieved.
It has achieved low resource usage, fast rendering speed and stable effect, can be deployed on mobile and web pages, and retained pattern details, reducing usage requirements.
Smart Images

Figure CN114782600B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of picture rendering and machine vision, and in particular relates to a video specific area rendering system and rendering method based on an auxiliary grid. Background Art
[0002] Video rendering technology is a technology that renders designed textures, materials, light and shadow parameters to a specified area in a video. Compared with image rendering in a static environment, video rendering can provide users with more dynamic and richer information. Against the backdrop of the rapid rise of short videos, video rendering technology can effectively empower the short video field, providing users with richer special effects and a more realistic visual experience. At present, video rendering technology is mainly divided into two types: one is video-based 3D modeling, which builds a 3D model of the target area of each frame and performs UV mapping rendering frame by frame. However, this solution has the disadvantages of low modeling accuracy, poor continuity of video frames, and high resource consumption; the other is a video generation solution based on deep learning methods, which feeds the pattern to be rendered and the video frame into the generation model frame by frame and generates rendered video frames. However, this solution has problems such as unstable rendering effect and slow rendering speed, and it is difficult to retain the details of the pattern. Summary of the invention
[0003] The present invention aims to solve the above technical problems and provides a video specific area rendering system and rendering method based on auxiliary grid.
[0004] In order to achieve the above object, the present invention adopts the following technical solution:
[0005] A video specific area rendering system based on auxiliary grids comprises: a video template shooting module based on auxiliary grids, a video modeling module, a video optimization module, a data storage module and a video rendering module; the video template shooting module based on auxiliary grids is used to shoot an object as a rendering template, and a specific area of the object is printed with a designed grid; the video modeling module is used to decompose the video frame by frame, construct a grid detection model to obtain the position information of the specific area, construct a key point detection model to obtain the key point information of the grid, construct a grid removal model to obtain the image of the video frame after the grid is removed, and construct a texture and light and shadow effect extraction model to obtain the texture and light and shadow information of the video frame; the video optimization module is used to smooth the key point information and the grid-removed image and texture and light and shadow information on the time series of the modeling data; the data storage module is used to store and extract video parameters, and the data storage module supports data compression storage and multi-process and multi-queue extraction; the video rendering module is used to align the input pattern with the set pattern template, calculate the deformation parameters according to the key point parameters obtained by the video optimization module and distort the pattern, then perform a multi-film overlay operation on it with the light and shadow and texture information, and finally replace the grid area corresponding to the original image with the pattern.
[0006] A method for rendering a specific area of a video based on an auxiliary grid comprises the following steps:
[0007] S1: Design an auxiliary grid, print the auxiliary grid on the designated area of the object to be rendered, and shoot the finished product into a video template to be rendered;
[0008] S2: Build a video modeling module, decompose the video frame by frame, build a grid detection model to obtain the location information of a specific area, build a key point detection model to obtain the key point information of the grid, build a grid removal model to obtain the image of the video frame after degridding, and build a texture and light and shadow effect extraction model to obtain the texture and light and shadow information of the video frame;
[0009] S3: construct a video optimization module to smooth the key point information obtained by S2 in time series to reduce the jitter of deformation;
[0010] Only video frame information is used as input, the result of the grid removal model is used as output, the grid removal model is fine-tuned, and the grid removal image is re-predicted to achieve smoothing of the grid removal image;
[0011] The degrid image is used as input, and the image result obtained by the texture and light and shadow extraction model is used as output. The texture and light and shadow extraction model is fine-tuned, and the texture and light and shadow images are re-predicted to smooth the result.
[0012] S4: Build a data storage module for fast data storage and call, store all images after lossless compression, and use multiple queues and multiple processes to store and call data;
[0013] S5: Construct a video rendering module to distort the pattern frame by frame according to the modeled key point information, add light and shadow and texture, and template fusion, and merge the rendered video frames into video output.
[0014] Preferably, in S2, constructing a grid detection model includes the following steps: obtaining grid detection samples based on manual annotation; obtaining grid detection samples based on image synthesis; preprocessing the grid detection samples, scaling them to a fixed size, and using them as training samples, whose corresponding labels are the coordinates of the center point and width and height of the rectangular position of the grid on the image, and the coordinates of the four vertices and the default width and height; conducting training after setting the training conditions, and saving the grid detection model after the training is completed.
[0015] Preferably, in S2, constructing a key point detection model includes the following steps: obtaining grid line segmentation mask samples based on image synthesis; preprocessing the RGB grid image samples and scaling them to a fixed size, whose corresponding labels are the grid line segmentation masks; performing training after setting training conditions, and saving the key point detection model after the training is completed.
[0016] Preferably, in S2, constructing the grid removal model includes the following steps: obtaining grid removal samples based on image synthesis; preprocessing the RGB grid image samples, scaling them to a fixed size, and the corresponding label is a grid-free RGB image; training is performed after setting training conditions, and the grid removal model is saved after the training is completed.
[0017] Preferably, in S2, constructing a texture and light and shadow effect extraction model includes the following steps: the texture and light and shadow effect extraction model is manually annotated through pictures; the RGB grid picture samples are preprocessed and scaled to a fixed size, and the corresponding label is a 4-channel RGBA picture, which contains the texture and light and shadow information of the picture; training is performed after setting the training conditions, and the texture and light and shadow effect extraction model is saved after the training is completed.
[0018] Preferably, in S3, a key point algorithm Savitzky-Golay is used to smooth the key point data of the time series.
[0019] Preferably, in S3, a pre-trained mesh removal model and a texture light and shadow effect extraction model are used to perform fine-tuning on the video data so that the model parameters overfit the data distribution of the video.
[0020] Preferably, in S5, the optimized thin plate matching algorithm TPS accelerated by GPU is used to distort the pattern according to the coordinates of the key points, and multi-process is used to accelerate the rendering of the video frames.
[0021] After adopting the above technical solution, the present invention has the following advantages:
[0022] The 3D specific area video rendering technology developed by the present invention based on deep learning and computer vision technology can realize the rendering of specific areas of the video. The video model constructed by this scheme has the advantages of occupying fewer resources, fast rendering speed, and less resource consumption. It can be deployed on mobile phones and web pages, greatly reducing the usage requirements. Compared with the video generation algorithm, the effect is more stable and faster, the rendering effect will not change with the change of the rendering pattern, and the details of the pattern can be retained. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 A flowchart of a video specific region rendering system based on an auxiliary grid;
[0024] Figure 2 Grid images for design;
[0025] Figure 3 Modeling a flow chart for the video;
[0026] Figure 4 Render a flow chart for the video. DETAILED DESCRIPTION
[0027] The present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments.
[0028] like Figure 1 As shown, a video specific area rendering system based on an auxiliary grid includes: a video template shooting module based on an auxiliary grid, a video modeling module, a video optimization module, a data storage module, and a video rendering module.
[0029] The auxiliary grid-based video template shooting module is used to shoot objects as rendering templates, and a designed grid is printed on a specific area of the object.
[0030] The video modeling module is used to decompose the video frame by frame, build a grid detection model to obtain the location information of a specific area, build a key point detection model to obtain the key point information of the grid, build a grid removal model to obtain the image of the video frame after degridding, and build a texture and light and shadow effect extraction model to obtain the texture and light and shadow information of the video frame.
[0031] The video optimization module is used to smooth key point information and remove grid images and texture, light and shadow information in the time series of modeling data.
[0032] The data storage module is used for storing and extracting video modeling parameters, and the data storage module supports compressed storage of data and multi-process and multi-queue extraction.
[0033] The video rendering module is used to align the input pattern with the set pattern template, calculate the deformation parameters according to the key point parameters obtained by the video optimization module and distort the pattern, then overlay it with the light and texture information, and finally replace the grid area corresponding to the original image with the pattern.
[0034] A method for rendering a specific area of a video based on an auxiliary grid comprises the following steps:
[0035] S1: Design the auxiliary grid. The production center prints the auxiliary grid designed by the developer on the designated area of the object to be rendered, and delivers the finished product to a professional photographer to shoot it into a video template to be rendered.
[0036] like Figure 2As shown, the designed grid ensures that the colors of each adjacent grid line are different, the color of the center grid line is blue, and the line width of the positive direction of the horizontal and vertical axes of the center grid line is twice the standard line width.
[0037] When shooting, try to ensure that the grid is facing the lens, without large-scale obstruction or distortion.
[0038] S2: Figure 3 As shown, a video modeling module is constructed to decompose the video frame by frame, a grid detection model is constructed to obtain the location information of a specific area, a key point detection model is constructed to obtain the key point information of the grid, a grid removal model is constructed to obtain the image of the video frame after degridding, and a texture and light and shadow effect extraction model is constructed to obtain the texture and light and shadow information of the video frame.
[0039] Building a grid detection model includes the following steps: obtaining grid detection samples based on manual annotation; obtaining grid detection samples based on image synthesis; preprocessing the grid detection samples, scaling them to a fixed size, and using them as training samples, whose corresponding labels are the coordinates and width and height of the center point of the rectangular position of the grid on the image, and the coordinates and default width and height of the four vertices; training is performed after setting the training conditions, and the grid detection model is saved after the training is completed.
[0040] Mesh object detection is to obtain the minimum enclosing rectangle of a specified object by inputting an image. By inputting an image with an auxiliary mesh into the mesh object detection model, the minimum enclosing rectangle of the mesh and the coordinates of the four vertices are obtained.
[0041] Building a key point detection model includes the following steps: obtaining grid line segmentation mask samples based on image synthesis; preprocessing the RGB grid image samples and scaling them to a fixed size, whose corresponding labels are the grid line segmentation masks; setting training conditions and conducting training, and saving the key point detection model after training.
[0042] Object segmentation is the output obtained by inputting the target area image of the object into the object segmentation model. It is used to locate the precise position of the object in the image at the pixel level, that is, the binary image of the segmentation mask. The key point detection model is constructed by obtaining the minimum enclosing rectangle of the grid, cutting out the grid in the image, and feeding it into the segmentation model to obtain the segmentation mask of each grid line. The center point coordinates of the overlapping area of the grid line mask are used as the intersection coordinates of the grid lines. The number of intersections is consistent with the number of intersections of the grid designed by the developer and corresponds one to one.
[0043] Building a grid removal model includes the following steps: obtaining grid removal samples based on image synthesis; preprocessing RGB grid image samples and scaling them to a fixed size, whose corresponding labels are RGB images without grids; training after setting training conditions, and saving the grid removal model after training.
[0044] The grid removal model is constructed by obtaining the minimum enclosing rectangle of the grid, cutting out the grid in the image, and sending it to the image generation model to obtain a grid-free image.
[0045] Building a texture and light and shadow effect extraction model includes the following steps: the texture and light and shadow effect extraction model is manually annotated through pictures; the RGB grid picture samples are preprocessed and scaled to a fixed size, and the corresponding label is a 4-channel RGBA picture, which stores the texture and light and shadow information of the picture; training is performed after setting the training conditions, and the texture and light and shadow effect extraction model is saved after the training is completed.
[0046] S3: Build a video optimization module, perform Savitzky-Golay smoothing on the key point information obtained in S2 in time series to reduce the jitter of deformation, fine-tune the time series mesh removal model and texture and light and shadow effect extraction model on the video dataset, and then re-predict the mesh-free images and texture and light and shadow images.
[0047] Since the format of key point data is SxNx2, where S is the number of frames in the video, N is the number of key points in each picture, and 2 refers to the horizontal and vertical coordinates. Smooth the positions and coordinates in the picture one by one, that is, it is necessary to smooth Nx2 one-bit curves with a dimension of S. First, calculate the difference between the corresponding key points of two adjacent frames. When the scene changes, the value will change suddenly. Use the frames with a difference greater than 300 as the segmentation points to divide the video frames into multiple groups. Use the Savitzky-Golay algorithm to smooth each group separately, with a window size of 11 and a dimension of 2.
[0048] The mesh removal model and texture and lighting effect extraction model for time series are fine-tuned on the video dataset including:
[0049] 1. Use only the video frame information as input, take the result of the grid removal model as output, fine-tune the grid removal model, and re-predict the grid removal image to achieve smoothness of the grid removal image. Specifically, according to the minimum bounding rectangle of the obtained grid, cut out the grid in the video frame as input, take the result predicted by the grid removal model as output, and build a training set. Retrain the pre-trained grid removal model, use Adam as the optimizer, the learning rate is 0.00005, the loss function is the mean square error, and the number of training steps is 200. Use the trained model to re-predict the input. Finally, reset the grid removal model weights.
[0050] 2. Take the de-grid image as input, take the image result obtained by the texture and light and shadow extraction model as output, fine-tune the texture and light and shadow extraction model, and re-predict the texture and light and shadow image to smooth the result. Specifically, take the de-grid image obtained as input, take the result of de-texturing and light and shadow effect prediction as output, and build a training set. Retrain the pre-trained texture and light and shadow effect extraction model, use Adam as the optimizer, the learning rate is 0.00005, the loss function is mean square error and perceptual loss, and the number of training steps is 400. Use the trained model to re-predict the input. Finally, reset the weights of the texture and light and shadow effect extraction model.
[0051] S4: Build a data storage module for fast data storage and call, store all images after lossless compression, and use multiple queues and multiple processes to store and call data.
[0052] S5: Construct a video rendering module, distort the pattern frame by frame according to the modeled key point information, add light and shadow and texture, and finally merge it with the de-grid image, and merge the rendered video frames into video output.
[0053] like Figure 4 As shown, specifically including:
[0054] S501, scaling the pattern to the size of the grid template and aligning it;
[0055] S502, using a thin plate matching algorithm TPS to calculate deformation parameters according to the key point positions of the grid template and the key point positions of each frame detected in the key point detection model, and using the parameters to distort the aligned pattern to be rendered;
[0056] S503, performing a multiply fusion method on the distorted pattern to be rendered and the texture and light and shadow pictures extracted from each frame, wherein if the rendered pattern is an RGB picture, the alpha channel is automatically filled, and the value of the channel is 255;
[0057] S504: Replace the corresponding area of the blank image obtained by the grid removal model with the fused image area to obtain the rendered image of each frame
[0058] S505: Merge the rendering results into a video.
[0059] In addition to the above preferred embodiments, the present invention has other implementation modes. Those skilled in the art may make various changes and modifications based on the present invention. As long as they do not depart from the spirit of the present invention, they should all fall within the scope defined by the claims attached to the present invention.
Claims
1. A method for rendering a specific area of a video based on an auxiliary grid, characterized in that: The following steps are involved: S1: Design an auxiliary grid, print the auxiliary grid on the designated area of the object to be rendered, and shoot the finished product into a video template to be rendered; S2: Build a video modeling module, decompose the video frame by frame, build a grid detection model to obtain the location information of a specific area, build a key point detection model to obtain the key point information of the grid, build a grid removal model to obtain the image of the video frame after degridding, and build a texture and light and shadow effect extraction model to obtain the texture and light and shadow information of the video frame; Building a grid detection model includes the following steps: obtaining grid detection samples based on manual annotation; obtaining grid detection samples based on image synthesis; preprocessing the grid detection samples based on manual annotation and the grid detection samples based on image synthesis, scaling them to a fixed size, and using them as training samples, wherein the labels of the grid detection training samples based on manual annotation are the coordinates of the center point of the rectangular position of the grid on the image and the width and height, and the labels of the grid detection training samples based on image synthesis are the coordinates of the four vertices of the grid and the default width and height; training is performed after setting the training conditions, and the grid detection model is saved after the training is completed; Building a key point detection model includes the following steps: obtaining grid line segmentation mask samples based on image synthesis; preprocessing RGB grid image samples, scaling them to a fixed size, and their corresponding labels are grid line segmentation masks; training after setting training conditions, and saving the key point detection model after training; Building a grid removal model includes the following steps: obtaining grid removal samples based on image synthesis; preprocessing RGB grid image samples, scaling them to a fixed size, and their corresponding labels are RGB images without grids; training after setting training conditions, and saving the grid removal model after training; Building a texture and light and shadow effect extraction model includes the following steps: the texture and light and shadow effect extraction model is manually annotated through pictures; the RGB grid picture samples are preprocessed and scaled to a fixed size, and the corresponding label is a 4-channel RGBA picture, which contains the texture and light and shadow information of the picture; training is performed after setting the training conditions, and the texture and light and shadow effect extraction model is saved after the training is completed; S3: construct a video optimization module to smooth the key point information obtained by S2 in time series to reduce the jitter of deformation; Only video frame information is used as input, the result of the grid removal model is used as output, the grid removal model is fine-tuned, and the grid removal image is re-predicted to achieve smoothing of the grid removal image; The degrid image is used as input, and the image result obtained by the texture and light and shadow extraction model is used as output. The texture and light and shadow extraction model is fine-tuned, and the texture and light and shadow images are re-predicted to smooth the result. S4: Build a data storage module for fast data storage and call, store all images after lossless compression, and use multiple queues and multiple processes to store and call data; S5: Construct a video rendering module to distort the pattern frame by frame according to the modeled key point information, add light and shadow and texture, merge with the de-grid image, and merge the rendered video frames into video output.
2. The method for rendering a specific area of a video based on an auxiliary grid according to claim 1, characterized in that: In S3, the key point algorithm Savitzky-Golay is used to smooth the key point data of the time series.
3. The method for rendering a specific area of a video based on an auxiliary grid according to claim 1, characterized in that: In S3, the pre-trained mesh removal model and texture light and shadow effect extraction model are fine-tuned on the video data to make the model parameters overfit the data distribution of the video.
4. The method for rendering a specific area of a video based on an auxiliary grid according to claim 1, characterized in that: In S5, the optimized thin plate matching algorithm TPS accelerated by GPU is used to distort the pattern according to the coordinates of key points, and multi-process is used to accelerate the rendering of video frames.
5. A video specific area rendering system based on auxiliary grid, used to implement the method of claim 1, characterized in that include: Auxiliary grid-based video template shooting module, video modeling module, video optimization module, data storage module, and video rendering module; The auxiliary grid-based video template shooting module is used to shoot objects as rendering templates, and a designed grid is printed on a specific area of the object; the video modeling module is used to decompose the video frame by frame, build a grid detection model to obtain the location information of a specific area, build a key point detection model to obtain the key point information of the grid, build a grid removal model to obtain the image of the video frame after degridding, and build a texture and light and shadow effect extraction model to obtain the texture and light and shadow information of the video frame; the video optimization module is used to smooth the key point information in the time series of the modeling data, to smooth the degrid image, and to smooth the texture and light and shadow information; the data storage module is used to store and extract video parameters, and the data storage module supports compressed storage of data and multi-process and multi-queue extraction; the video rendering module is used to align the input pattern with the set pattern template, calculate the deformation parameters according to the key point parameters obtained by the video optimization module and distort the pattern, and then perform a multi-film overlay operation on it with the light and shadow and texture information, and finally replace the grid area corresponding to the original image with the pattern.
Citation Information
Cited By
Real-time dynamic light and shadow rendering optimization method based on deep learning
CN121095418A
