CN114598902B - 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
CN114598902B
CN114598902B CN202210224376.5A CN202210224376A CN114598902B CN 114598902 B CN114598902 B CN 114598902B CN 202210224376 A CN202210224376 A CN 202210224376A CN 114598902 B CN114598902 B CN 114598902B
Authority
CN
China
Prior art keywords
video frame
sub
target
transparency
edge
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.)
Active
Application number
CN202210224376.5A
Other languages
Chinese (zh)
Other versions
CN114598902A (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

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, which are used for acquiring a video frame which needs filter adding operation in a target video, converting the video frame into a target video frame with a preset format, partitioning the target video frame to obtain a plurality of sub-video frames, and 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. In the invention, the filter is dynamically added to the sub-video frames obtained by splitting one video frame, so that the filter effect is increased, the video special effect is further improved, the video synthesis quality is improved, and the filter requirement of a user is met. In addition, the video frame is converted into the target video frame with the preset format, so that the lossless filter processing effect can be 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 video frame processing method, apparatus and electronic device.
Background
With the rapid development of the short video industry, the user's demand for beauty is no longer limited to photos, and more demands are embodied in videos. Many video-like platforms or video clips now require the use of filter effects. If the filter effect is accessed, the video tone style is improved, the content in the lens is changed into more trim, and the visual effect requirement of a user is met.
At present, when adding a filter effect to a video, the filter is added in units of video frames, and when adding a filter, the filter effect is added to the whole Zhang Shipin frames, that is, to the whole Zhang Shipin frames.
The filter adding mode can only add one filter effect, and the filter effect is single, so that the video special effect is poor, the video synthesis quality is reduced, and the filter requirement of a user cannot be met.
Disclosure of Invention
In view of this, the invention provides a video frame processing method, a device and an electronic device, so as to solve the problems that when a filter effect is added to a video frame, the filter effect is single, the video special effect is poor, the video synthesis quality is reduced, and the filter requirement of a user cannot be met by uniformly processing the whole Zhang Shipin frame.
In order to solve the technical problems, the invention adopts the following technical scheme:
a video frame processing method, comprising:
acquiring a video frame which needs 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 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, after converting the video frame into a target video frame in a preset format, the method further includes:
extracting channel values of preset channels of pixels in the target video frame, and correcting the channel values to obtain corrected channel values;
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 serving as the gray value of the pixel, the method further includes, before performing blocking on the target video frame to obtain a plurality of sub video frames:
and filtering the target video frame.
Optionally, the target video frame is segmented to obtain a plurality of sub video frames, including:
splitting the target video frame into a plurality of rectangular pictures with side lengths of 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 value of the edge of the sub-video frame to be a corresponding target gray value and the transparency of the edge of the sub-video frame to be a corresponding target transparency according to the arrangement sequence of the plurality of sub-video frames, including:
determining a target gray value and a target transparency of the edge of the sub-video frame;
according to the arrangement sequence of the plurality of sub-video frames, setting 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 setting the transparency of the edge of the sub-video frame as the target transparency in different filter adding times.
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 frames to determine edges of the sub-video frames;
acquiring a gray value of a pixel in a 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 the target gray value of the edge of the sub-video frame;
acquiring transparency of the edge of the sub-video frame and a transparency coefficient of a transparency interval in which the transparency is located;
and 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.
Optionally, in accordance with the arrangement sequence of the plurality of sub-video frames, setting, in different filter adding times, a gray value of an edge of the sub-video frame corresponding to the filter adding time to the target gray value, and setting a transparency of the edge of the sub-video frame to 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 a sub-video frame corresponding to each filter adding time according to the arrangement sequence of the plurality of sub-video frames;
and 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 in different filter adding times.
A video frame processing apparatus comprising:
the video frame conversion module is used for acquiring a video frame which needs filter adding operation in the 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;
the filter processing module is used for dynamically setting the gray value of the edge of the sub-video frame to be a corresponding target gray value and the transparency of the edge of the sub-video frame to be 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 the 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 the linear correction value of the pixel according to the corrected channel value;
and the gray value determining module is used for determining a 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 side lengths of a preset length, taking each rectangular picture as a sub video frame, and setting pixel values of the side lengths of the sub video frame based on the preset length.
Optionally, the filter processing module includes:
the data determining 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 in 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 invokes a program and is configured 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, which are used for acquiring a video frame which needs filter adding operation in a target video, converting the video frame into a target video frame with a preset format, partitioning the target video frame to obtain a plurality of sub-video frames, and 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. In the invention, the filter is dynamically added to the sub-video frames obtained by splitting one video frame, so that the filter effect is increased, the video special effect is further improved, the video synthesis quality is improved, and the filter requirement of a user is met. In addition, in the invention, the video frame is converted into the target video frame with 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 that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present invention, and that other drawings can be obtained according to the provided drawings without inventive effort for a person skilled in the art.
Fig. 1 is a method flowchart of a video frame processing method according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating another video frame processing method according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating a method for processing video frames 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 following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
At present, when a filter effect is added to a video frame, the filter effect is uniformly processed on the whole Zhang Shipin frame, the filter effect is single, the special effect is poor in display, the filter effect is difficult to adapt to the diversified requirements in the content, and the filter requirement of a user cannot be met.
In order to solve the technical problem, the inventor finds that the video frame can be subjected to blocking treatment, and the filter is dynamically added to the blocked sub-video frame, so that the filter effect is improved, the special effect is improved, the diversified requirements are met, and further the filter requirement of a user is met.
Specifically, the embodiment of the invention provides a video frame processing method, a video frame processing device and electronic equipment, which are used for acquiring a video frame which needs filter adding operation in a target video, converting the video frame into a target video frame with a preset format, partitioning the target video frame to obtain a plurality of sub-video frames, and 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. In the invention, the filter is dynamically added to the sub-video frames obtained by splitting one video frame, so that the filter effect is increased, the video special effect is further improved, the video synthesis quality is improved, and the filter requirement of a user is met. In addition, in the invention, the video frame is converted into the target video frame with the preset format, so that the lossless filter processing effect can be realized when the filter effect is added.
Based on the foregoing, another embodiment of the present invention provides a video frame processing method, referring to fig. 1, which may include:
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 preset format is a preset PGM format.
In this embodiment, a filter operation may be sequentially added to video frames in the video, which is referred to as a target video in this embodiment.
And converting the video frames which need to be subjected to filter adding operation in the target video into target video frames in a preset PGM format.
Among them, PGM (one of simple file formats for storing and exchanging image data) is composed of two parts of data, a file header part and a pixel data part, respectively.
The first line in the header section identifies the picture format in a "Magic Number" which is a pattern of P1, P2, P3, P4, P5, P6, etc. Wherein the P1-P3 mode reading uses a mode supporting the Ascii code format reading, and the PIL only supports the binary format P4-P6 mode reading.
The second row is picture width, picture height.
The third line is the maximum value of this picture data.
The pixel data is stored in rows in a "row-major order". Default condition. Each line cannot be longer than 70 characters, and it is safe to store one pixel per line.
In this embodiment, the video frame format is converted into the preset PGM format, because the existing jgp, png, bmp, yuv format files are only processed, so that there is necessarily a phenomenon that the values of some pixels are damaged, and the value of each pixel of the PGM file is vector, so that the lossless filter can be achieved. The filter effect adopts a pgm format, visual preview can be realized in the earlier stage of the pgm format, the visual preview can be realized, and the filter effect is set for the processed video in the later stage, and then the effect of lossless filter processing is achieved.
It should be noted that, the filter effect picture may be set in advance, and the modes of the filter effect picture may be modes of P1, P2, P3, P4, P5, P6, etc. in this embodiment, the preset PGM format is the mode of the filter effect picture, such as P2.
After converting the video frame into a target video frame in a preset format, gray values of pixels in the target video frame may also 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) Extracting channel values of preset channels of pixels in the target video frame, and correcting the channel values to obtain corrected channel values.
Specifically, for a pixel in a target video frame, a channel value of a preset channel thereof may be extracted. The preset channel may be a R, G, B channel. An RGBA channel map of the pixel can be obtained and R, G, B values extracted therefrom. And then carrying out correction operation on 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, rline, glline, bliner is in [0,1] range, rline is corrected R value, glline is corrected G value, bliner is corrected B value. 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 clear 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 is corrected according to a linear Gamma correction formula to obtain a gray value Csrgb corresponding to the linear correction value, specifically:
csrgb=12.92 x clear, when clear < = 0.0031308;
Csrgb=1.055*Clinear 1/2.4 -0.055, when clear>0.0031308
Through the step, the gray value of the gray image input by PGM can be obtained by the pixel value corresponding to each pixel point.
In this embodiment, the gray value corresponding to the linear correction value is determined, that is, the image is subjected to the graying process.
It should be noted that, after the gray value of the pixel in the target video frame is determined (specifically, after the gray value corresponding to the linearity correction value is determined and the gray value of the pixel is used), the filtering operation may also be performed on the target video frame before step S12 is performed.
In the filtering, gaussian filtering can be adopted, and interference can be avoided through filtering.
S12, the target video frames are segmented, and a plurality of sub video frames are obtained.
Specifically, the target video frame is split into a plurality of rectangular pictures with side lengths of a preset length, each rectangular picture is used as a sub video frame, and pixel values of the side lengths of the sub video frames are set based on the preset length.
For example, a target video frame, which is a gray image, is read into a pixel array, and is partitioned, the PGM full image is divided into squares with a side length of m (a preset length), and sub-images are generated in a column order, and each sub-image is a sub-video frame.
The regional pixel p=m/original resolution size corresponding to the side length of the sub-video frame.
The number of sub-video frames in the row and column directions = original resolution size/pixel (p) corresponding to the sub-picture side length.
The sub-tile sequence numbers are arranged in 1, 2, 3, 4, … ….
S13, dynamically setting the gray value of the edge of the sub-video frame to be a corresponding target gray value according to the arrangement sequence of the plurality of sub-video frames, and setting the transparency of the edge of the sub-video frame to be a corresponding target transparency.
In practical application, when dynamically setting the gray value and transparency of the edge of the sub-video frame, determining the target gray value and target transparency of the edge of the sub-video frame, and then performing the dynamic filter adding operation.
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 plurality of sub-video frames, setting 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 setting the transparency of the edge of the sub-video frame as the target transparency in different filter adding times.
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 value and the transparency of the edge of the sub-video frame are adjusted, but the gray value and the transparency value of the non-edge area of the sub-video frame remain unchanged.
Referring to fig. 2, determining a target gray value and a target transparency of an edge of the sub-video frame may include:
s21, carrying out edge detection processing on the sub-video frames to determine edges of the sub-video frames.
In this embodiment, a canny operator may be used to detect an edge of a sub-video frame, so as to obtain an edge of the sub-video frame.
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 can be corrected by 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 up, down, left, and right of the pixel at the edge. Then, gradation values of the four pixels are acquired.
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 boundary line may be an edge, and weights of gray values of four pixels around the boundary line may be preset for pixels located at the edge, and then a product of the gray values of the pixels and the weights may be used as a target gray 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 of the corresponding position of the sub-video frame.
S24, acquiring transparency of the edge of the sub-video frame and transparency coefficients of a 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 transparency coefficient minimum value of the interval, and over is the transparency coefficient maximum value of the interval.
In this embodiment, the transparency of the edge of the sub-video frame is obtained, then a transparency interval where the transparency is located is determined, and then transparency coefficients under and over corresponding to the transparency interval are determined.
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 a transparency coefficient minimum value, and over is a transparency coefficient maximum value.
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, the implementation process of setting the gray value of the edge of the sub-video frame corresponding to the filter adding time to the target gray value and setting the transparency of the edge of the sub-video frame to the target transparency is as follows:
in this embodiment, the filter adding operation is not performed uniformly on the entire target video frame, but may be performed on different sub-video frames within different filter adding times for the sub-video frames in the target video frame.
In this embodiment, referring to fig. 3, "according to the arrangement order of the plurality of sub-video frames, setting the gray value of the edge of the sub-video frame corresponding to the filter addition time to the target gray value in different filter addition times, and setting the transparency of the edge of the sub-video frame to the target transparency" 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, filter addition time=filter addition total time/number of sub-video frames.
S32, determining the sub-video frames corresponding to the adding time of each filter according to the arrangement sequence of the plurality of sub-video frames.
In this embodiment, in the time of adding each filter, the filter operation is performed on which sub-video frame may be preset, for example, may be set in the order of columns or rows according to the sub-video frames.
S33, 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 in different filter adding times.
For example, if the filter adding operation is performed on 30 sub-video frames within 1s, the filter operation may be performed on the first sub-video frame in the column order within 1/30 s. Then within 2/30s, a filter operation … … may be performed on the second sub-video frame, and so on, until within 30/30s, a filter operation may be performed on the thirty-th sub-video frame.
In addition, a filter operation may be performed on at least one sub-video frame at the same time, for example, a filter operation may be performed on a first sub-video frame within 1/30s, and a filter operation … … may be performed on a second and third sub-video frames at the same time within 2/30 s. When the filter operation is performed on the second sub-video frame and the third sub-video frame simultaneously, the parallel filter adding operation can be adopted, so that the processing speed is improved, and the time consumption is reduced.
Wherein adding a filter means setting a gray value of an edge of a sub-video frame to the target gray value and setting a transparency of the edge of the sub-video frame to the target transparency.
Namely, the gradient change of the picture color of the video frame is changed through the change of the PGM pixel value, and the effect of the video 'track' filter is further achieved. If so, the preset PGM format is changed, and the final displayed filter effect is different.
After the filter addition is performed on the present video frame, the 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, in which a filter adding operation is required, is acquired, the video frame is converted into a target video frame in a preset format, the target video frame is segmented to obtain a plurality of sub video frames, and according to the arrangement sequence of the plurality of sub video frames, the gray level value of the edge of the sub video frame is dynamically set to be a corresponding target gray level value, and the transparency of the edge of the sub video frame is set to be a corresponding target transparency. In the invention, the filter is dynamically added to the sub-video frames obtained by splitting one video frame, so that the filter effect is increased, the video special effect is further improved, the video synthesis quality is improved, and the filter requirement of a user is met. In addition, in the invention, the video frame is converted into the target video frame with 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, so that the efficiency is higher, the video special effect output effect can be edited, the design and research cost of the special effect can be reduced, the video special effect is more abundant and diversified, the final synthesis quality is ensured, and the editing efficiency is improved. In addition, the operation is simple and convenient, and easy to learn and use.
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 embodiment of the video frame processing method, another embodiment of the present invention provides a video frame processing apparatus, referring to fig. 4, may include:
the video frame conversion module 11 is configured to obtain a video frame in the target video, where the video frame 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;
the filter processing module 13 is configured to dynamically set the gray value of the edge of the sub-video frame to a corresponding target gray value and the transparency of the edge of the sub-video frame to a corresponding target transparency according to the arrangement sequence of the plurality of sub-video frames.
Further, the method further comprises the following steps:
the channel value processing module is used for extracting the channel value of the 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 the linear correction value of the pixel according to the corrected channel value;
and the gray value determining module is used for determining a gray value corresponding to the linear correction value and taking the gray value as the gray value of the pixel.
Further, the method further comprises the following steps:
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 side lengths of a preset length, taking each rectangular picture as a sub video frame, and setting pixel values of the side lengths of the sub video frame based on the preset length.
Further, the filter processing module 13 includes:
the data determining 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 in different filter adding times according to the arrangement sequence of the plurality of sub-video frames.
Further, the data determination submodule includes:
performing edge detection processing on the sub-video frames to determine edges of the sub-video frames;
a gray value obtaining unit, configured to obtain a gray value of a pixel within a preset range of the edge;
the correcting 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 the 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 calculation 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 submodule includes:
the time processing unit is used for obtaining 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 frames 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 in different filter adding times.
In this embodiment, a video frame in a target video, in which a filter adding operation is required, is acquired, the video frame is converted into a target video frame in a preset format, the target video frame is segmented to obtain a plurality of sub video frames, and according to the arrangement sequence of the plurality of sub video frames, the gray level value of the edge of the sub video frame is dynamically set to be a corresponding target gray level value, and the transparency of the edge of the sub video frame is set to be a corresponding target transparency. In the invention, the filter is dynamically added to the sub-video frames obtained by splitting one video frame, so that the filter effect is increased, the video special effect is further improved, the video synthesis quality is improved, and the filter requirement of a user is met. In addition, in the invention, the video frame is converted into the target video frame with 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, so that the efficiency is higher, the video special effect output effect can be edited, the design and research cost of the special effect can be reduced, the video special effect is more abundant and diversified, the final synthesis quality is ensured, and the editing efficiency is improved. In addition, the operation is simple and convenient, and easy to learn and use.
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, in the working process of each module, sub-module and unit in this embodiment, please refer to the corresponding description in the above embodiment, and the description is omitted here.
Optionally, on the basis of the 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 invokes a program and is configured to perform the video frame processing method described above.
In this embodiment, a video frame in a target video, in which a filter adding operation is required, is acquired, the video frame is converted into a target video frame in a preset format, the target video frame is segmented to obtain a plurality of sub video frames, and according to the arrangement sequence of the plurality of sub video frames, the gray level value of the edge of the sub video frame is dynamically set to be a corresponding target gray level value, and the transparency of the edge of the sub video frame is set to be a corresponding target transparency. In the invention, the filter is dynamically added to the sub-video frames obtained by splitting one video frame, so that the filter effect is increased, the video special effect is further improved, the video synthesis quality is improved, and the filter requirement of a user is met. In addition, in the invention, the video frame is converted into the target video frame with 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, so that the efficiency is higher, the video special effect output effect can be edited, the design and research cost of the special effect can be reduced, the video special effect is more abundant and diversified, the final synthesis quality is ensured, and the editing efficiency is improved. In addition, the operation is simple and convenient, and easy to learn and use.
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 (10)

1. A method of video frame processing, comprising:
acquiring a video frame needing filter adding operation in a target video, and converting the video frame into a target video frame with a preset format, wherein the preset format is a preset PGM format;
partitioning the target video frame to obtain a plurality of sub video frames;
dynamically setting the gray value of the edge of the sub-video frame to be a corresponding target gray value and the transparency of the edge of the sub-video frame to be a corresponding target transparency according to the arrangement sequence of the plurality of sub-video frames;
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 to be a corresponding target gray value and the transparency of the edge of the sub-video frame to be a corresponding target transparency, including:
determining a target gray value and a target transparency of the edge of the sub-video frame;
setting a gray value of an edge of the sub-video frame corresponding to the filter adding time as the target gray value and setting a transparency of the edge of the sub-video frame as the target transparency in different filter adding times according to the arrangement sequence of the plurality of sub-video frames;
wherein the 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 frames to determine edges of the sub-video frames;
acquiring a gray value of a pixel in a preset range of the edge;
acquiring weights of gray values of four pixels around the pixel in a preset range of the edge;
multiplying the gray value of the pixel in the preset range of the edge with the weight to obtain a target gray value of the edge of the sub-video frame;
acquiring transparency of the edge of the sub-video frame and a transparency coefficient of a transparency interval in which the transparency is located;
and 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.
2. The video frame processing method according to claim 1, further comprising, after converting the video frame into a target video frame of a preset format:
extracting channel values of preset channels of pixels in the target video frame, and correcting the channel values to obtain corrected channel values;
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 video frame processing method according to claim 2, wherein after determining the gradation value corresponding to the linear correction value and as the gradation value of the pixel, the video frame is segmented to obtain a plurality of sub-video frames, further comprising:
and filtering the target video frame.
4. The video frame processing method according to claim 1, wherein the partitioning the target video frame to obtain a plurality of sub video frames includes:
splitting the target video frame into a plurality of rectangular pictures with side lengths of 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 video frame processing method according to claim 1, wherein setting a gradation value of an edge of the sub-video frame corresponding to the filter addition time to the target gradation value and setting a transparency of the edge of the sub-video frame to the target transparency in different filter addition times in an arrangement order of the plurality of sub-video frames, comprises:
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 a sub-video frame corresponding to each filter adding time according to the arrangement sequence of the plurality of sub-video frames;
and 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 in different filter adding times.
6. A video frame processing apparatus, comprising:
the video frame conversion module is used for acquiring a video frame which needs filter adding operation in the target video, and converting the video frame into a target video frame with a preset format, wherein the preset format is a preset PGM format;
the video frame processing module is used for blocking the target video frame to obtain a plurality of sub video frames;
the filter processing module is used for dynamically setting the gray value of the edge of the sub-video frame to be a corresponding target gray value and the transparency of the edge of the sub-video frame to be a corresponding target transparency according to the arrangement sequence of the plurality of sub-video frames;
wherein, the filter processing module includes:
the data determining submodule is used for determining a target gray value and a target transparency of the edge of the sub-video frame;
a filter adding sub-module, configured to set, according to an arrangement order of the plurality of sub-video frames, a gray value of an edge of the sub-video frame corresponding to a filter adding time to the target gray value and set a transparency of the edge of the sub-video frame to the target transparency in different filter adding times;
the data determining submodule is specifically configured to:
performing edge detection processing on the sub-video frames to determine edges of the sub-video frames;
acquiring a gray value of a pixel in a preset range of the edge;
acquiring weights of gray values of four pixels around the pixel in a preset range of the edge;
multiplying the gray value of the pixel in the preset range of the edge with the weight to obtain a target gray value of the edge of the sub-video frame;
acquiring transparency of the edge of the sub-video frame and a transparency coefficient of a transparency interval in which the transparency is located;
and 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.
7. The video frame processing apparatus of claim 6, further comprising:
the channel value processing module is used for extracting the channel value of the 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 the linear correction value of the pixel according to the corrected channel value;
and the gray value determining module is used for determining a gray value corresponding to the linear correction value and taking the gray value as the gray value of the pixel.
8. The video frame processing apparatus of claim 7, further comprising:
and the filter module is used for carrying out filtering operation on the target video frame.
9. The video frame processing apparatus of claim 6, wherein the video frame processing module is specifically configured to:
splitting the target video frame into a plurality of rectangular pictures with side lengths of a preset length, taking each rectangular picture as a sub video frame, and setting pixel values of the side lengths of the sub video frame based on the preset length.
10. An electronic device, comprising: a memory and a processor;
wherein the memory is used for storing programs;
a processor calling a program and being adapted to perform the video frame processing method according to any of claims 1-5.
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 CN114598902A (en) 2022-06-07
CN114598902B true 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 (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
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

Family Cites Families (6)

* 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
WO2006028093A1 (en) * 2004-09-06 2006-03-16 Matsushita Electric Industrial Co., Ltd. Video generation device and video generation method
US8964853B2 (en) * 2011-02-23 2015-02-24 Qualcomm Incorporated Multi-metric filtering
CN109379625B (en) * 2018-11-27 2020-05-19 Oppo广东移动通信有限公司 Video processing method, video processing device, electronic equipment and computer readable medium
CN110675310B (en) * 2019-07-02 2020-10-02 北京达佳互联信息技术有限公司 Video processing method and device, electronic equipment and storage medium
CN111601033A (en) * 2020-04-27 2020-08-28 北京小米松果电子有限公司 Video processing method, device and storage medium

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
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
一种面向多投影显示的全景视频分块编码方法;梅元乔;姜忠鼎;;计算机应用与软件(03);全文 *
浅谈会声会影视频滤镜效果及编辑技巧;赵元元;;数码世界(12);全文 *

Also Published As

Publication number Publication date
CN114598902A (en) 2022-06-07

Similar Documents

Publication Publication Date Title
CN1906632B (en) Image processing apparatus and image processing method
CN1168289C (en) Contour correction device
US20110134291A1 (en) Image-processing device for color image data and method for the image processing of color image data
JPS62118676A (en) Picture processing system
CN102291531A (en) Image processing apparatus, image processing method, and program
CN103067671A (en) Method and device of image display
US5887084A (en) Structuring a digital image into a DCT pyramid image representation
WO2014008329A1 (en) System and method to enhance and process a digital image
US7184087B2 (en) On-screen device for subject of interest in portable electronic device, and method of controlling same
CN114598902B (en) Video frame processing method and device and electronic equipment
CN111083366B (en) Image processing method, device and system based on data segmentation
KR100513273B1 (en) Apparatus and method for real-time brightness control of moving images
US10178359B2 (en) Macropixel processing system, method and article
CN111105356B (en) Image processing method, device and computer readable storage medium
JP2001127999A (en) Device and method for processing image
JPH07107273A (en) Device and method for image processor
US9898831B2 (en) Macropixel processing system, method and article
JPS6223353B2 (en)
JP2015138417A (en) Image processing device and image processing method
JP6381219B2 (en) Image processing apparatus, image processing method, and program
JP3783815B2 (en) Image processing device
CN113450737B (en) Image drawing method, display device and storage medium
US10068342B2 (en) Macropixel processing system, method and article
KR100974685B1 (en) Hand quake correction method for camera of mobile communication terminal
US9811920B2 (en) Macropixel processing system, method and article

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
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.

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