CN114598902A - Video frame processing method and device and electronic equipment - Google Patents

Video frame processing method and device and electronic equipment Download PDF

Info

Publication number
CN114598902A
CN114598902A CN202210224376.5A CN202210224376A CN114598902A CN 114598902 A CN114598902 A CN 114598902A CN 202210224376 A CN202210224376 A CN 202210224376A CN 114598902 A CN114598902 A CN 114598902A
Authority
CN
China
Prior art keywords
video frame
sub
target
edge
transparency
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202210224376.5A
Other languages
Chinese (zh)
Other versions
CN114598902B (en
Inventor
彭泽波
宋向阳
朱玉荣
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Anhui Wenxiang Technology Co ltd
Original Assignee
Anhui Wenxiang Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Anhui Wenxiang Technology Co ltd filed Critical Anhui Wenxiang Technology Co ltd
Priority to CN202210224376.5A priority Critical patent/CN114598902B/en
Publication of CN114598902A publication Critical patent/CN114598902A/en
Application granted granted Critical
Publication of CN114598902B publication Critical patent/CN114598902B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/234Processing of video elementary streams, e.g. splicing of video streams, manipulating MPEG-4 scene graphs
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N5/00Details of television systems
    • H04N5/222Studio circuitry; Studio devices; Studio equipment
    • H04N5/262Studio circuits, e.g. for mixing, switching-over, change of character of image, other special effects ; Cameras specially adapted for the electronic generation of special effects
    • H04N5/2621Cameras specially adapted for the electronic generation of special effects during image pickup, e.g. digital cameras, camcorders, video cameras having integrated special effects capability

Abstract

The invention provides a video frame processing method, a video frame processing device and electronic equipment, wherein a video frame needing filter adding operation in a target video is obtained, the video frame is converted into a target video frame in a preset format, the target video frame is blocked to obtain a plurality of sub video frames, the gray value of the edge of each sub video frame is dynamically set as a corresponding target gray value according to the arrangement sequence of the plurality of sub video frames, and the transparency of the edge of each sub video frame is set as a corresponding target transparency. In the invention, the filter is dynamically added to the sub-video frame obtained by splitting one video frame, so that the filter effect is increased, the video special effect is improved, the video synthesis quality is improved, and the filter requirement of a user is met. In addition, the invention converts the video frame into the target video frame with the preset format, and can ensure that the lossless filter processing effect is realized when the filter effect is added. In addition, the invention has higher efficiency of adding the filter and can edit the video special effect output effect.

Description

Video frame processing method and device and electronic equipment
Technical Field
The present invention relates to the field of video processing, and in particular, to a method and an apparatus for processing video frames, and an electronic device.
Background
With the rapid development of the short video industry, the demand of users for beauty is no longer limited to photos, and more demands are reflected in videos. Many video-like platforms or video clips now require the use of a filter effect. If the filter effect is accessed, the tone style of the video can be improved, the content in the lens is changed into a more tone and the requirement of the visual effect of a user is met.
At present, when a video is subjected to filter effect addition, filter addition is performed by taking a video frame as a unit, and when a filter is added, the whole video frame is uniformly processed, that is, the same filter effect is added to the whole video frame.
The filter adding mode can only add one filter effect, the filter effect is single, the video special effect is poor, the video synthesis quality is reduced, and the filter requirements of users cannot be met.
Disclosure of Invention
In view of this, the present invention provides a video frame processing method, a video frame processing device, and an electronic device, so as to solve the problems that when a filter effect is added to a video frame, the entire video frame is processed uniformly, the filter effect is single, the video special effect is poor, the video synthesis quality is reduced, and the filter requirements of users cannot be met.
In order to solve the technical problems, the invention adopts the following technical scheme:
a video frame processing method, comprising:
acquiring a video frame needing filter adding operation in a target video, and converting the video frame into a target video frame in a preset format;
partitioning the target video frame to obtain a plurality of sub video frames;
and according to the arrangement sequence of the plurality of sub-video frames, dynamically setting the gray value of the edge of the sub-video frame as a corresponding target gray value, and setting the transparency of the edge of the sub-video frame as a corresponding target transparency.
Optionally, after converting the video frame into a target video frame in a preset format, the method further includes:
extracting a channel value of a preset channel of a pixel in the target video frame, and performing correction operation on the channel value to obtain a corrected channel value;
calculating a linear correction value of the pixel according to the corrected channel value;
and determining a gray value corresponding to the linear correction value, and taking the gray value as the gray value of the pixel.
Optionally, after determining the gray value corresponding to the linear correction value and taking the gray value as the gray value of the pixel, before blocking the target video frame to obtain a plurality of sub-video frames, the method further includes:
and carrying out filtering operation on the target video frame.
Optionally, blocking the target video frame to obtain a plurality of sub-video frames, including:
splitting the target video frame into a plurality of rectangular pictures with the side length being a preset length, and taking each rectangular picture as a sub-video frame;
and setting the pixel value of the side length of the sub video frame based on the preset length.
Optionally, dynamically setting the gray-level value of the edge of the sub-video frame as a corresponding target gray-level value and the transparency of the edge of the sub-video frame as a corresponding target transparency according to the arrangement order of the plurality of sub-video frames, includes:
determining a target gray value and a target transparency of the edge of the sub video frame;
according to the arrangement sequence of the sub video frames, in different filter adding time, setting the gray value of the edge of the sub video frame corresponding to the filter adding time as the target gray value, and setting the transparency of the edge of the sub video frame as the target transparency.
Optionally, determining the target gray value and the target transparency of the edge of the sub-video frame includes:
performing edge detection processing on the sub-video frame to determine the edge of the sub-video frame;
acquiring the gray value of the pixel in the preset range of the edge;
correcting the gray value of the edge based on the gray value of the pixel in the preset range of the edge to obtain a target gray value of the edge of the sub-video frame;
acquiring the transparency of the edge of the sub video frame and a transparency coefficient of a transparency interval where the transparency is located;
and calculating the target transparency of the edge of the sub-video frame according to a preset maximum transparency value, the transparency of the edge of the sub-video frame and the transparency coefficient.
Optionally, according to the arrangement order of the plurality of sub-video frames, in different filter adding times, setting the gray scale value of the edge of the sub-video frame corresponding to the filter adding time as the target gray scale value, and setting the transparency of the edge of the sub-video frame as the target transparency, includes:
acquiring the total filter adding time of the target video frame, and calculating the filter adding time of the sub video frame according to the total filter adding time and the number of the sub video frames;
determining the sub-video frame corresponding to the adding time of each filter according to the arrangement sequence of the plurality of sub-video frames;
and in different filter adding time, setting the gray value of the edge of the sub video frame corresponding to the filter adding time as the target gray value, and setting the transparency of the edge of the sub video frame as the target transparency.
A video frame processing apparatus comprising:
the video frame conversion module is used for acquiring a video frame needing filter adding operation in a target video and converting the video frame into a target video frame in a preset format;
the video frame processing module is used for blocking the target video frame to obtain a plurality of sub video frames;
and the filter processing module is used for dynamically setting the gray value of the edge of the sub-video frame as a corresponding target gray value and the transparency of the edge of the sub-video frame as a corresponding target transparency according to the arrangement sequence of the plurality of sub-video frames.
Optionally, the method further comprises:
the channel value processing module is used for extracting the channel value of a preset channel of the pixel in the target video frame and correcting the channel value to obtain a corrected channel value;
the correction module is used for calculating a linear correction value of the pixel according to the corrected channel value;
and the gray value determining module is used for determining the gray value corresponding to the linear correction value and taking the gray value as the gray value of the pixel.
Optionally, the method further comprises:
and the filter module is used for carrying out filtering operation on the target video frame.
Optionally, the video frame processing module is specifically configured to:
splitting the target video frame into a plurality of rectangular pictures with the side length of a preset length, taking each rectangular picture as a sub video frame, and setting the pixel value of the side length of the sub video frame based on the preset length.
Optionally, the filter processing module comprises:
the data determination submodule is used for determining a target gray value and a target transparency of the edge of the sub video frame;
and the filter adding sub-module is used for setting the gray value of the edge of the sub-video frame corresponding to the filter adding time as the target gray value and setting the transparency of the edge of the sub-video frame as the target transparency within different filter adding times according to the arrangement sequence of the plurality of sub-video frames.
An electronic device, comprising: a memory and a processor;
wherein the memory is used for storing programs;
the processor calls a program and is used to perform the video frame processing method described above.
Compared with the prior art, the invention has the following beneficial effects:
the invention provides a video frame processing method, a video frame processing device and electronic equipment, wherein a video frame needing to be subjected to filter adding operation in a target video is obtained, the video frame is converted into a target video frame in a preset format, the target video frame is blocked to obtain a plurality of sub video frames, the gray value of the edge of each sub video frame is dynamically set to be a corresponding target gray value according to the arrangement sequence of the plurality of sub video frames, and the transparency of the edge of each sub video frame is set to be a corresponding target transparency. In the invention, the filter is dynamically added to the sub-video frame obtained by splitting one video frame, so that the filter effect is increased, the video special effect is improved, the video synthesis quality is improved, and the filter requirements of users are met. In addition, the video frame is converted into the target video frame in the preset format, so that the lossless filter processing effect can be realized when the filter effect is added.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of a method for processing video frames according to an embodiment of the present invention;
FIG. 2 is a flow chart of another method for processing video frames according to an embodiment of the present invention;
fig. 3 is a flowchart of a method of processing a video frame according to another embodiment of the present invention;
fig. 4 is a schematic structural diagram of a video frame processing apparatus according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
At present, when a filter effect is added to a video frame, the whole video frame is processed in a unified way, the filter effect is single, the special effect display is poor, diversified requirements in contents are difficult to adapt, and the filter requirements of users cannot be met.
In order to solve the technical problem, the inventor finds that the video frame can be subjected to blocking processing, filters are dynamically added to blocked sub-video frames, the filter effect is increased, the special effect is improved, diversified requirements are met, and the filter requirements of users are met.
Specifically, the embodiment of the invention provides a video frame processing method, a video frame processing device and electronic equipment, wherein a video frame in a target video, which needs to be subjected to filter adding operation, is obtained, the video frame is converted into a target video frame in a preset format, the target video frame is blocked to obtain a plurality of sub video frames, and according to the arrangement sequence of the plurality of sub video frames, the gray value of the edge of each sub video frame is dynamically set as a corresponding target gray value, and the transparency of the edge of each sub video frame is set as a corresponding target transparency. In the invention, the filter is dynamically added to the sub-video frame obtained by splitting one video frame, so that the filter effect is increased, the video special effect is improved, the video synthesis quality is improved, and the filter requirements of users are met. In addition, the video frame is converted into the target video frame in the preset format, so that the lossless filter processing effect can be realized when the filter effect is added.
On the basis of the above, another embodiment of the present invention provides a video frame processing method, and with reference to fig. 1, the method may include:
and S11, acquiring a video frame which needs to be subjected to filter adding operation in the target video, and converting the video frame into a target video frame in a preset format.
Wherein the predetermined format is a predetermined PGM format.
In this embodiment, a filter operation may be sequentially added to video frames in a video, which is referred to as a target video in this embodiment.
And converting the video frame into a target video frame in a preset PGM format aiming at the video frame needing filter adding operation in the target video.
Here, PGM (one of simple file formats for storing and exchanging image data) is composed of two parts of data, a header part and a pixel data part.
The first row in the header part identifies the picture format with a "Magic Number" which is a pattern of P1, P2, P3, P4, P5, P6, etc. Wherein the reading of P1-P3 mode uses the reading supporting Ascii code format, and PIL only supports the reading of P4-P6 mode of binary format.
The second row is the picture width, picture height.
The third row is the maximum value of this picture data.
The pixel data is stored in row by row in a row-major order. Under default conditions. The length of each line cannot exceed 70 characters, and it is safe to store one pixel per line.
In this embodiment, the format of the video frame is converted into the preset PGM format because the values of some pixels are inevitably damaged as long as the existing jgp, png, bmp, yuv and other format files are processed, and the value of each pixel of the PGM file is vector, so that a lossless filter can be achieved. The filter effect adopts a pgm format, visual preview can be carried out on the pgm format in the early stage, the filter effect can be obtained visually, and the filter effect can be set for the processed video in the later stage and then the lossless filter processing effect can be achieved.
It should be noted that a filter effect picture may be preset, and the mode of the filter effect picture may be the above-mentioned modes P1, P2, P3, P4, P5, P6, etc., and the preset PGM format in this embodiment is the mode of the filter effect picture, such as P2.
After the video frame is converted into a target video frame in a preset format, the gray value of a pixel in the target video frame can be determined.
In practical applications, for each pixel in the target video frame, its corresponding gray value is determined.
Specifically, determining the gray value of the pixel in the target video frame may include:
1) and extracting a channel value of a preset channel of a pixel in the target video frame, and performing correction operation on the channel value to obtain a corrected channel value.
Specifically, for a pixel in the target video frame, a channel value of a preset channel thereof may be extracted. Wherein the preset channel may be R, G, B channels. An RGBA channel map of the pixel may be taken and R, G, B values extracted therefrom. And then, correcting the channel value to obtain a corrected channel value.
Wherein, the corrected channel value is:
Rlinear=pow(R,1/Gamma)
Glinear=pow(G,1/Gamma)
Blinear=pow(B,1/Gamma);
wherein Rlinear, Glinear and Blinear are in the range of [0,1], Rlinear is the R value after correction, Glinear is the G value after correction, and Blinear is the B value after correction. Gamma is a fixed value, such as 2.2.
2) And calculating the linear correction value of the pixel according to the corrected channel value.
Specifically, the linear correction value clearear of the pixel is:
Clinear=0.2126Rlinear+0.7152Glinear+0.0722Blinear。
3) and determining a gray value corresponding to the linear correction value, and taking the gray value as the gray value of the pixel.
Specifically, the linear correction value obtained by linear transformation calculation is corrected according to a linear Gamma correction formula to obtain a gray value Csrgb corresponding to the linear correction value, which specifically is:
csrgb 12.92 clear, when clear 0.0031308;
Csrgb=1.055*Clinear1/2.4-0.055, when clear>0.0031308
Through the step, the gray level image gray level value with the pixel value corresponding to each pixel point equal to the PGM input can be obtained.
In this embodiment, determining the gray value corresponding to the linear correction value is to perform graying processing on the image.
It should be noted that, after determining the gray value of the pixel in the target video frame (specifically, after determining the gray value corresponding to the linear correction value and taking the gray value as the gray value of the pixel), before performing step S12, a filtering operation may be performed on the target video frame.
When filtering, gaussian filtering can be adopted, and interference can be avoided through filtering.
And S12, blocking the target video frame to obtain a plurality of sub video frames.
Specifically, the target video frame is split into a plurality of rectangular pictures with the side length being a preset length, each rectangular picture is used as a sub-video frame, and the pixel value of the side length of the sub-video frame is set based on the preset length.
For example, reading a target video frame which is a gray image into a pixel array, partitioning, dividing a PGM full map into squares with the side length of m (preset length), and generating sub-maps according to the column sequence, wherein each sub-map is a sub-video frame.
And (4) setting the pixel p of the area corresponding to the side length of the sub video frame as m/the resolution of the original image.
And the number of the sub-video frames in the row and column directions is equal to the resolution size of the original image/the pixel (p) corresponding to the side length of the sub-image.
The sub-block numbers are arranged according to 1, 2, 3 and 4.
And S13, according to the arrangement sequence of the plurality of sub-video frames, dynamically setting the gray value of the edge of the sub-video frame as a corresponding target gray value, and setting the transparency of the edge of the sub-video frame as a corresponding target transparency.
In practical application, when the gray value and the transparency of the edge of the sub-video frame are dynamically set, the target gray value and the target transparency of the edge of the sub-video frame need to be determined, and then the dynamic filter adding operation is performed.
Namely, step S13 includes:
1) determining a target gray value and a target transparency of the edge of the sub video frame;
2) according to the arrangement sequence of the sub video frames, in different filter adding time, setting the gray value of the edge of the sub video frame corresponding to the filter adding time as the target gray value, and setting the transparency of the edge of the sub video frame as the target transparency.
The implementation process of determining the target gray value and the target transparency of the edge of the sub-video frame is as follows:
in this embodiment, when the filter is added, the gray scale value and the transparency of the edge of the sub-video frame are adjusted, but the gray scale value and the transparency value of the non-edge area of the sub-video frame are kept unchanged.
Referring to fig. 2, determining the target gray value and the target transparency of the edge of the sub video frame may include:
and S21, carrying out edge detection processing on the sub-video frame to determine the edge of the sub-video frame.
In this embodiment, the canny operator may be used to perform edge detection on the sub-video frame, so as to obtain the edge of the sub-video frame.
And S22, acquiring the gray value of the pixel in the preset range of the edge.
Specifically, in order to ensure that the gray value of the pixel changes naturally when the filter effect is added, the gray value of the edge may be corrected using the gray value of the pixel near the edge, so that the gray value of the edge changes naturally.
The pixels within the preset range in the present embodiment may be four pixels above, below, to the left, and to the right of the pixels at the edge. Then, the gradation values of the four pixels are acquired.
And S23, correcting the gray value of the edge based on the gray value of the pixel in the preset range of the edge to obtain the target gray value of the edge of the sub-video frame.
Specifically, the edge may be used as a boundary, and the weight of the gray-scale values of the four pixels around the edge is preset for the pixel at the edge, and then the product of the gray-scale value of the pixel and the weight may be used as the target gray-scale value of the edge of the sub-video frame.
The gray values of the pixels inside and outside the edge are consistent with the gray values of the corresponding positions of the sub video frames.
And S24, acquiring the transparency of the edge of the sub video frame and the transparency coefficient of the transparency interval where the transparency is located.
Specifically, transparency intervals are preset, and different transparency intervals correspond to different transparency coefficient intervals, such as [ under, over ]. Wherein, under is the minimum value of the transparency coefficient of the interval, and over is the maximum value of the transparency coefficient of the interval.
In this embodiment, the transparency of the edge of the sub video frame is obtained, then the transparency interval where the transparency is located is determined, and then transparency coefficients under and over corresponding to the transparency interval are determined.
And S25, calculating the target transparency of the edge of the sub-video frame according to the preset maximum transparency value, the transparency of the edge of the sub-video frame and the transparency coefficient.
Specifically, the target transparency of the edge of the sub-video frame is:
under*(1-(alpha/alpha_maxval))+over*(alpha/alpha_maxval)
wherein, alpha _ maxval is a preset maximum transparency value, alpha is the transparency of the edge of the sub-video frame, under is the minimum value of the transparency coefficient, and over is the maximum value of the transparency coefficient.
In another implementation manner of the present invention, according to the arrangement order of the plurality of sub-video frames, in different filter adding times, setting the gray value of the edge of the sub-video frame corresponding to the filter adding time as the target gray value, and setting the transparency of the edge of the sub-video frame as the target transparency, are implemented as follows:
in this embodiment, the filter adding operation is not performed on the entire target video frame in a unified manner, but may be performed on different sub video frames within different filter adding time for the sub video frames in the target video frame.
In this embodiment, referring to fig. 3, "setting, according to the arrangement order of the plurality of sub-video frames, the gray-level value of the edge of the sub-video frame corresponding to the filter adding time as the target gray-level value and the transparency of the edge of the sub-video frame as the target transparency in different filter adding times" specifically includes:
s31, acquiring the total filter adding time of the target video frame, and calculating the filter adding time of the sub-video frame according to the total filter adding time and the number of the sub-video frames.
Specifically, the filter adding time is equal to the total filter adding time/the number of sub video frames.
And S32, determining the sub video frame corresponding to each filter adding time according to the arrangement sequence of the plurality of sub video frames.
In this embodiment, in each filter adding time, which sub-video frame is subjected to the filter operation may be preset, for example, the sub-video frames may be sequentially arranged in columns or rows.
S33, in different filter adding time, setting the gray value of the edge of the sub video frame corresponding to the filter adding time as the target gray value, and setting the transparency of the edge of the sub video frame as the target transparency.
For example, if 30 sub-video frames are subjected to the filter adding operation within 1s, then the filter operation may be performed on the first sub-video frame in column order within 1/30 s. Then, in 2/30s, a second sub-video frame may be subjected to a filter operation … …, and so on, until 30/30s, a thirty-th sub-video frame is subjected to a filter operation.
In addition, at least one sub-video frame may be subjected to a simultaneous filter addition operation, e.g., in 1/30s, a first sub-video frame may be subjected to a filter operation, and in 2/30s, second and third sub-video frames may be subjected to a filter operation … … simultaneously. When the filter operation is carried out on the second sub video frame and the third sub video frame at the same time, the parallel filter adding operation can be adopted, the processing speed is improved, and the time consumption is reduced.
Adding the filter refers to setting the gray value of the edge of the sub video frame as the target gray value and setting the transparency of the edge of the sub video frame as the target transparency.
Namely, the gradient change of the video frame picture color is changed through the change of the PGM pixel value, and the effect of a video track filter is further achieved. If yes, the preset PGM format is changed, and finally displayed filter effects are different.
After filter addition is performed on the present video frame, filter addition may be performed on the next video frame, and so on, until the last video frame.
In this embodiment, a video frame in a target video, which needs to be subjected to a filter adding operation, is obtained, the video frame is converted into a target video frame in a preset format, the target video frame is blocked to obtain a plurality of sub-video frames, and according to an arrangement sequence of the plurality of sub-video frames, a gray value of an edge of each sub-video frame is dynamically set as a corresponding target gray value, and a transparency of the edge of each sub-video frame is set as a corresponding target transparency. In the invention, the filter is dynamically added to the sub-video frame obtained by splitting one video frame, so that the filter effect is increased, the video special effect is improved, the video synthesis quality is improved, and the filter requirements of users are met. In addition, in the invention, the video frame is converted into the target video frame in the preset format, so that the lossless filter processing effect can be realized when the filter effect is added.
In addition, the filter is added in the embodiment, the efficiency is high, the video special effect output effect can be edited, the design and research and development cost of the special effect can be reduced, the video special effect is richer and diversified, the final synthesis quality is ensured, and the editing efficiency is improved. In addition, the operation is simple and convenient, and the study and the use are easy.
In addition, when the filter is added, the filter can be added in a parallel mode, so that the efficiency is improved, and the time consumption is reduced.
Optionally, on the basis of the above embodiment of the video frame processing method, another embodiment of the present invention provides a video frame processing apparatus, and with reference to fig. 4, the video frame processing apparatus may include:
the video frame conversion module 11 is configured to acquire a video frame in a target video, which needs to be subjected to filter adding operation, and convert the video frame into a target video frame in a preset format;
the video frame processing module 12 is configured to block the target video frame to obtain a plurality of sub-video frames;
and a filter processing module 13, configured to dynamically set, according to the arrangement order of the multiple sub-video frames, a gray value of an edge of each sub-video frame as a corresponding target gray value, and a transparency of the edge of each sub-video frame as a corresponding target transparency.
Further, still include:
the channel value processing module is used for extracting the channel value of a preset channel of the pixel in the target video frame and correcting the channel value to obtain a corrected channel value;
the correction module is used for calculating a linear correction value of the pixel according to the corrected channel value;
and the gray value determining module is used for determining the gray value corresponding to the linear correction value and taking the gray value as the gray value of the pixel.
Further, still include:
and the filter module is used for carrying out filtering operation on the target video frame.
Further, the video frame processing module is specifically configured to:
splitting the target video frame into a plurality of rectangular pictures with the side length of a preset length, taking each rectangular picture as a sub video frame, and setting the pixel value of the side length of the sub video frame based on the preset length.
Further, the filter processing module 13 includes:
the data determination submodule is used for determining a target gray value and a target transparency of the edge of the sub video frame;
and the filter adding sub-module is used for setting the gray value of the edge of the sub-video frame corresponding to the filter adding time as the target gray value and setting the transparency of the edge of the sub-video frame as the target transparency within different filter adding times according to the arrangement sequence of the plurality of sub-video frames.
Further, the data determination sub-module includes:
performing edge detection processing on the sub-video frame to determine the edge of the sub-video frame;
a gray value acquisition unit for acquiring a gray value of a pixel within a preset range of the edge;
the correction unit is used for correcting the gray value of the edge based on the gray value of the pixel in the preset range of the edge to obtain a target gray value of the edge of the sub-video frame;
the transparency processing unit is used for acquiring the transparency of the edge of the sub video frame and the transparency coefficient of the transparency interval where the transparency is located;
and the transparency calculating unit is used for calculating the target transparency of the edge of the sub video frame according to a preset maximum transparency value, the transparency of the edge of the sub video frame and the transparency coefficient.
Further, the filter adding sub-module includes:
the time processing unit is used for acquiring the total filter adding time of the video and calculating the filter adding time of the sub-video frames according to the total filter adding time and the number of the sub-video frames;
the video frame determining unit is used for determining the sub-video frame corresponding to the adding time of each filter according to the arrangement sequence of the plurality of sub-video frames;
and the filter adding unit is used for setting the gray value of the edge of the sub video frame corresponding to the filter adding time as the target gray value and setting the transparency of the edge of the sub video frame as the target transparency within different filter adding times.
In this embodiment, a video frame in a target video, which needs to be subjected to a filter adding operation, is obtained, the video frame is converted into a target video frame in a preset format, the target video frame is blocked to obtain a plurality of sub-video frames, and according to an arrangement sequence of the plurality of sub-video frames, a gray value of an edge of each sub-video frame is dynamically set as a corresponding target gray value, and a transparency of the edge of each sub-video frame is set as a corresponding target transparency. In the invention, the filter is dynamically added to the sub-video frame obtained by splitting one video frame, so that the filter effect is increased, the video special effect is improved, the video synthesis quality is improved, and the filter requirements of users are met. In addition, the video frame is converted into the target video frame in the preset format, so that the lossless filter processing effect can be realized when the filter effect is added.
In addition, the filter is added in the embodiment, the efficiency is high, the video special effect output effect can be edited, the design and research and development cost of the special effect can be reduced, the video special effect is richer and diversified, the final synthesis quality is ensured, and the editing efficiency is improved. In addition, the operation is simple and convenient, and the study and the use are easy.
In addition, when the filter is added, the filter can be added in a parallel mode, so that the efficiency is improved, and the time consumption is reduced.
It should be noted that, for the working processes of each module, sub-module, and unit in this embodiment, please refer to the corresponding description in the above embodiments, which is not described herein again.
Optionally, on the basis of the above embodiments of the video frame processing method and apparatus, another embodiment of the present invention provides an electronic device, including: a memory and a processor;
wherein the memory is used for storing programs;
the processor calls a program and is used to perform the video frame processing method described above.
In this embodiment, a video frame in a target video, which needs to be subjected to a filter adding operation, is obtained, the video frame is converted into a target video frame in a preset format, the target video frame is blocked to obtain a plurality of sub-video frames, and according to an arrangement sequence of the plurality of sub-video frames, a gray value of an edge of each sub-video frame is dynamically set as a corresponding target gray value, and a transparency of the edge of each sub-video frame is set as a corresponding target transparency. In the invention, the filter is dynamically added to the sub-video frame obtained by splitting one video frame, so that the filter effect is increased, the video special effect is improved, the video synthesis quality is improved, and the filter requirements of users are met. In addition, the video frame is converted into the target video frame in the preset format, so that the lossless filter processing effect can be realized when the filter effect is added.
In addition, the filter is added in the embodiment, the efficiency is high, the video special effect output effect can be edited, the design and research and development cost of the special effect can be reduced, the video special effect is richer and diversified, the final synthesis quality is ensured, and the editing efficiency is improved. In addition, the operation is simple and convenient, and the study and the use are easy.
In addition, when the filter is added, the filter can be added in a parallel mode, so that the efficiency is improved, and the time consumption is reduced.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (13)

1. A method for processing video frames, comprising:
acquiring a video frame needing filter adding operation in a target video, and converting the video frame into a target video frame in a preset format;
partitioning the target video frame to obtain a plurality of sub video frames;
and according to the arrangement sequence of the plurality of sub-video frames, dynamically setting the gray value of the edge of the sub-video frame as a corresponding target gray value, and setting the transparency of the edge of the sub-video frame as a corresponding target transparency.
2. The method of claim 1, further comprising, after converting the video frame into a target video frame of a preset format:
extracting a channel value of a preset channel of a pixel in the target video frame, and performing correction operation on the channel value to obtain a corrected channel value;
calculating a linear correction value of the pixel according to the corrected channel value;
and determining a gray value corresponding to the linear correction value, and taking the gray value as the gray value of the pixel.
3. The method of claim 2, wherein before determining the gray value corresponding to the linear correction value and serving as the gray value of the pixel, and blocking the target video frame to obtain a plurality of sub-video frames, the method further comprises:
and carrying out filtering operation on the target video frame.
4. The method of claim 1, wherein the blocking the target video frame to obtain a plurality of sub-video frames comprises:
splitting the target video frame into a plurality of rectangular pictures with the side length being a preset length, and taking each rectangular picture as a sub-video frame;
and setting the pixel value of the side length of the sub video frame based on the preset length.
5. The method of claim 1, wherein dynamically setting the gray-level value of the edge of the sub-video frame as the corresponding target gray-level value and the transparency of the edge of the sub-video frame as the corresponding target transparency according to the arrangement order of the plurality of sub-video frames comprises:
determining a target gray value and a target transparency of the edge of the sub video frame;
according to the arrangement sequence of the sub video frames, in different filter adding time, setting the gray value of the edge of the sub video frame corresponding to the filter adding time as the target gray value, and setting the transparency of the edge of the sub video frame as the target transparency.
6. The method of claim 5, wherein determining the target gray value and the target transparency of the edge of the sub-video frame comprises:
performing edge detection processing on the sub-video frame to determine the edge of the sub-video frame;
acquiring the gray value of the pixel in the preset range of the edge;
correcting the gray value of the edge based on the gray value of the pixel in the preset range of the edge to obtain a target gray value of the edge of the sub-video frame;
acquiring the transparency of the edge of the sub video frame and the transparency coefficient of the transparency interval where the transparency is located;
and calculating the target transparency of the edge of the sub-video frame according to a preset maximum transparency value, the transparency of the edge of the sub-video frame and the transparency coefficient.
7. The method of claim 5, wherein the setting, in accordance with the arrangement order of the sub-video frames, the gray-level value of the edge of the sub-video frame corresponding to the filter adding time as the target gray-level value and the transparency of the edge of the sub-video frame as the target transparency in different filter adding times comprises:
acquiring total filter adding time of the target video frame, and calculating the filter adding time of the sub video frame according to the total filter adding time and the number of the sub video frames;
determining the sub-video frame corresponding to the adding time of each filter according to the arrangement sequence of the plurality of sub-video frames;
and in different filter adding time, setting the gray value of the edge of the sub video frame corresponding to the filter adding time as the target gray value, and setting the transparency of the edge of the sub video frame as the target transparency.
8. A video frame processing apparatus, comprising:
the video frame conversion module is used for acquiring a video frame needing filter adding operation in a target video and converting the video frame into a target video frame in a preset format;
the video frame processing module is used for blocking the target video frame to obtain a plurality of sub video frames;
and the filter processing module is used for dynamically setting the gray value of the edge of the sub-video frame as a corresponding target gray value and the transparency of the edge of the sub-video frame as a corresponding target transparency according to the arrangement sequence of the plurality of sub-video frames.
9. The video frame processing apparatus of claim 8, further comprising:
the channel value processing module is used for extracting the channel value of a preset channel of the pixel in the target video frame and correcting the channel value to obtain a corrected channel value;
the correction module is used for calculating a linear correction value of the pixel according to the corrected channel value;
and the gray value determining module is used for determining the gray value corresponding to the linear correction value and taking the gray value as the gray value of the pixel.
10. The video frame processing apparatus of claim 9, further comprising:
and the filter module is used for carrying out filtering operation on the target video frame.
11. The video frame processing apparatus of claim 8, wherein the video frame processing module is specifically configured to:
splitting the target video frame into a plurality of rectangular pictures with the side length of a preset length, taking each rectangular picture as a sub video frame, and setting the pixel value of the side length of the sub video frame based on the preset length.
12. The video frame processing device of claim 8, wherein the filter processing module comprises:
the data determination submodule is used for determining a target gray value and a target transparency of the edge of the sub video frame;
and the filter adding sub-module is used for setting the gray value of the edge of the sub-video frame corresponding to the filter adding time as the target gray value and setting the transparency of the edge of the sub-video frame as the target transparency within different filter adding times according to the arrangement sequence of the plurality of sub-video frames.
13. An electronic device, comprising: a memory and a processor;
wherein the memory is used for storing programs;
a processor calls a program and is arranged to perform the video frame processing method according to any of claims 1-7.
CN202210224376.5A 2022-03-09 2022-03-09 Video frame processing method and device and electronic equipment Active CN114598902B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210224376.5A CN114598902B (en) 2022-03-09 2022-03-09 Video frame processing method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210224376.5A CN114598902B (en) 2022-03-09 2022-03-09 Video frame processing method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN114598902A true CN114598902A (en) 2022-06-07
CN114598902B CN114598902B (en) 2023-12-22

Family

ID=81807805

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210224376.5A Active CN114598902B (en) 2022-03-09 2022-03-09 Video frame processing method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN114598902B (en)

Citations (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060002475A1 (en) * 2004-07-02 2006-01-05 Fuchs Robert J Caching data for video edge filtering
US20080055309A1 (en) * 2004-09-06 2008-03-06 Yudai Ishibashi Image Generation Device and Image Generation Method
US20120213293A1 (en) * 2011-02-23 2012-08-23 Qualcomm Incorporated Multi-metric filtering
CN105338403A (en) * 2014-08-06 2016-02-17 腾讯科技(北京)有限公司 Filter processing method and device as well as electronic equipment
CN106550244A (en) * 2015-09-16 2017-03-29 广州市动景计算机科技有限公司 The picture quality enhancement method and device of video image
CN106921840A (en) * 2015-12-25 2017-07-04 掌赢信息科技(上海)有限公司 Method for beautifying faces, equipment and system in a kind of instant video
CN106920211A (en) * 2017-03-09 2017-07-04 广州四三九九信息科技有限公司 U.S. face processing method, device and terminal device
CN106971165A (en) * 2017-03-29 2017-07-21 武汉斗鱼网络科技有限公司 The implementation method and device of a kind of filter
CN107592475A (en) * 2017-09-20 2018-01-16 北京奇虎科技有限公司 Video data handling procedure and device, computing device
CN110062252A (en) * 2019-04-30 2019-07-26 广州酷狗计算机科技有限公司 Live broadcasting method, device, terminal and storage medium
US20200335136A1 (en) * 2019-07-02 2020-10-22 Beijing Dajia Internet Information Technology Co., Ltd. Method and device for processing video
CN112019762A (en) * 2020-07-23 2020-12-01 北京迈格威科技有限公司 Video processing method and device, storage medium and electronic equipment
CN112954459A (en) * 2021-03-04 2021-06-11 网易(杭州)网络有限公司 Video data processing method and device
CN113055712A (en) * 2021-03-08 2021-06-29 快媒数字科技有限公司 Multi-screen splicing display method and system
US20210281771A1 (en) * 2018-11-27 2021-09-09 Guangdong Oppo Mobile Telecommunications Corp., Ltd. Video processing method, electronic device and non-transitory computer readable medium
US20210337136A1 (en) * 2020-04-27 2021-10-28 Beijing Xiaomi Pinecone Electronics Co., Lid. Method and apparatus for processing video, and storage medium
CN114025105A (en) * 2021-12-15 2022-02-08 北京达佳互联信息技术有限公司 Video processing method and device, electronic equipment and storage medium

Patent Citations (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060002475A1 (en) * 2004-07-02 2006-01-05 Fuchs Robert J Caching data for video edge filtering
US20080055309A1 (en) * 2004-09-06 2008-03-06 Yudai Ishibashi Image Generation Device and Image Generation Method
US20120213293A1 (en) * 2011-02-23 2012-08-23 Qualcomm Incorporated Multi-metric filtering
CN105338403A (en) * 2014-08-06 2016-02-17 腾讯科技(北京)有限公司 Filter processing method and device as well as electronic equipment
CN106550244A (en) * 2015-09-16 2017-03-29 广州市动景计算机科技有限公司 The picture quality enhancement method and device of video image
CN106921840A (en) * 2015-12-25 2017-07-04 掌赢信息科技(上海)有限公司 Method for beautifying faces, equipment and system in a kind of instant video
CN106920211A (en) * 2017-03-09 2017-07-04 广州四三九九信息科技有限公司 U.S. face processing method, device and terminal device
CN106971165A (en) * 2017-03-29 2017-07-21 武汉斗鱼网络科技有限公司 The implementation method and device of a kind of filter
CN107592475A (en) * 2017-09-20 2018-01-16 北京奇虎科技有限公司 Video data handling procedure and device, computing device
US20210281771A1 (en) * 2018-11-27 2021-09-09 Guangdong Oppo Mobile Telecommunications Corp., Ltd. Video processing method, electronic device and non-transitory computer readable medium
CN110062252A (en) * 2019-04-30 2019-07-26 广州酷狗计算机科技有限公司 Live broadcasting method, device, terminal and storage medium
US20200335136A1 (en) * 2019-07-02 2020-10-22 Beijing Dajia Internet Information Technology Co., Ltd. Method and device for processing video
US20210337136A1 (en) * 2020-04-27 2021-10-28 Beijing Xiaomi Pinecone Electronics Co., Lid. Method and apparatus for processing video, and storage medium
CN112019762A (en) * 2020-07-23 2020-12-01 北京迈格威科技有限公司 Video processing method and device, storage medium and electronic equipment
CN112954459A (en) * 2021-03-04 2021-06-11 网易(杭州)网络有限公司 Video data processing method and device
CN113055712A (en) * 2021-03-08 2021-06-29 快媒数字科技有限公司 Multi-screen splicing display method and system
CN114025105A (en) * 2021-12-15 2022-02-08 北京达佳互联信息技术有限公司 Video processing method and device, electronic equipment and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
梅元乔;姜忠鼎;: "一种面向多投影显示的全景视频分块编码方法", 计算机应用与软件, no. 03 *
赵元元;: "浅谈会声会影视频滤镜效果及编辑技巧", 数码世界, no. 12 *

Also Published As

Publication number Publication date
CN114598902B (en) 2023-12-22

Similar Documents

Publication Publication Date Title
EP0826195B1 (en) Image noise reduction system using a wiener variant filter in a pyramid image representation
US8248494B2 (en) Image dynamic range compression method, apparatus, and digital camera
US4982294A (en) Apparatus for enhancing and thresholding scanned microfilm images and methods for use therein
CN1906632B (en) Image processing apparatus and image processing method
US20110134291A1 (en) Image-processing device for color image data and method for the image processing of color image data
US6067088A (en) Image processing method and apparatus thereof
CN1168289C (en) Contour correction device
CN103067671A (en) Method and device of image display
US4855943A (en) Method and apparatus for deaveraging a stream of averaged data
US4853795A (en) Forward look ahead techniques for tracking background and noise levels in scanned video images
KR20070031805A (en) Image processing apparatus and method for image resizing matching data supply speed
EP1027662A1 (en) Image noise reduction system using a dct pyramid
CN109118436A (en) Picture tone adaptation method and corresponding electronic equipment and storage medium
WO2014008329A1 (en) System and method to enhance and process a digital image
US20110311156A1 (en) Method and system for correcting lens shading
US7184087B2 (en) On-screen device for subject of interest in portable electronic device, and method of controlling same
KR100513273B1 (en) Apparatus and method for real-time brightness control of moving images
CN114598902B (en) Video frame processing method and device and electronic equipment
US10178359B2 (en) Macropixel processing system, method and article
US20110157465A1 (en) Look up table update method
CN111105356B (en) Image processing method, device and computer readable storage medium
US9898831B2 (en) Macropixel processing system, method and article
JPH07107273A (en) Device and method for image processor
US10068342B2 (en) Macropixel processing system, method and article
CN113450737B (en) Image drawing method, display device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: 247100 intersection of Fengming Avenue and Hanjiang Road, Jiangnan industrial concentration area, Chizhou City, Anhui Province

Applicant after: Anhui Wenxiang Technology Co.,Ltd.

Address before: 247100 intersection of Fengming Avenue and Hanjiang Road, Jiangnan industrial concentration area, Chizhou City, Anhui Province

Applicant before: Anhui Wenxiang Technology Co.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant
PE01 Entry into force of the registration of the contract for pledge of patent right

Denomination of invention: A video frame processing method, device, and electronic device

Granted publication date: 20231222

Pledgee: Anhui Jiangnan Industrial Concentration Zone Construction Investment Development (Group) Co.,Ltd.

Pledgor: Anhui Wenxiang Technology Co.,Ltd.

Registration number: Y2024980010811