CN111010606A - Video processing method and device - Google Patents
Video processing method and device Download PDFInfo
- Publication number
- CN111010606A CN111010606A CN201911275794.1A CN201911275794A CN111010606A CN 111010606 A CN111010606 A CN 111010606A CN 201911275794 A CN201911275794 A CN 201911275794A CN 111010606 A CN111010606 A CN 111010606A
- Authority
- CN
- China
- Prior art keywords
- frame
- index
- target
- segment
- elimination
- 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
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 22
- 238000003379 elimination reaction Methods 0.000 claims abstract description 175
- 230000008030 elimination Effects 0.000 claims abstract description 171
- 238000012545 processing Methods 0.000 claims abstract description 107
- 238000000034 method Methods 0.000 claims abstract description 41
- 238000011156 evaluation Methods 0.000 claims description 18
- 230000007246 mechanism Effects 0.000 claims description 18
- 230000008859 change Effects 0.000 claims description 14
- 230000008569 process Effects 0.000 claims description 10
- 238000001514 detection method Methods 0.000 claims description 8
- 238000004364 calculation method Methods 0.000 claims description 7
- 238000012216 screening Methods 0.000 claims description 5
- 238000006243 chemical reaction Methods 0.000 claims description 4
- 238000010586 diagram Methods 0.000 description 18
- 238000004891 communication Methods 0.000 description 13
- 230000000694 effects Effects 0.000 description 8
- 239000012634 fragment Substances 0.000 description 7
- 230000006870 function Effects 0.000 description 7
- 238000005516 engineering process Methods 0.000 description 5
- 230000005540 biological transmission Effects 0.000 description 4
- 238000002474 experimental method Methods 0.000 description 2
- 239000000835 fiber Substances 0.000 description 2
- 239000003550 marker Substances 0.000 description 2
- 239000000463 material Substances 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000001902 propagating effect Effects 0.000 description 2
- RYGMFSIKBFXOCR-UHFFFAOYSA-N Copper Chemical compound [Cu] RYGMFSIKBFXOCR-UHFFFAOYSA-N 0.000 description 1
- 238000004422 calculation algorithm Methods 0.000 description 1
- 229910052802 copper Inorganic materials 0.000 description 1
- 239000010949 copper Substances 0.000 description 1
- 238000013135 deep learning Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000001914 filtration Methods 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 238000004088 simulation Methods 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
- H04N21/44—Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
- H04N21/44008—Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving operations for analysing video streams, e.g. detecting features or characteristics in the video stream
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/45—Management operations performed by the client for facilitating the reception of or the interaction with the content or administrating data related to the end-user or to the client device itself, e.g. learning user preferences for recommending movies, resolving scheduling conflicts
- H04N21/454—Content or additional data filtering, e.g. blocking advertisements
- H04N21/4545—Input to filtering algorithms, e.g. filtering a region of the image
- H04N21/45455—Input to filtering algorithms, e.g. filtering a region of the image applied to a region of the image
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Databases & Information Systems (AREA)
- Image Analysis (AREA)
Abstract
The embodiment of the invention discloses a video processing method and a video processing device. The method comprises the following steps: acquiring a mark set to be eliminated; dividing a frame segment corresponding to the logo in the video when a frame picture containing the logo exists in the video; calculating to obtain the elimination index of the frame segment according to a preset K first indexes; selecting a target frame segment from all the frame segments according to the elimination indexes of the frame segments; and eliminating the target mark of the target frame segment of the video.
Description
Technical Field
The present specification relates to a video processing technology, and more particularly, to a video processing method and a video processing apparatus.
Background
At present, in a video program, the program content often contains marks which do not meet the requirements of a broadcaster or do not meet the legal requirements, and the marks in the video need to be processed, for example, brand marks embedded with advertisements may need to be processed.
The existing mark replacement technology mainly adopts manual replacement as a main technology, and the treatment efficiency is low.
Disclosure of Invention
Embodiments disclosed herein provide an efficient video processing scheme.
According to a first aspect of the present disclosure, there is provided a video processing method, including the steps of:
acquiring a mark set to be eliminated, wherein the mark set to be eliminated comprises at least one mark;
dividing a frame segment corresponding to the logo in the video in the case that a frame picture containing the logo exists in the video, wherein the frame segment comprises one frame picture containing the logo or a plurality of continuous frame pictures containing the logo;
calculating to obtain an elimination index of the frame segment according to a preset K first indexes, wherein the elimination index of the frame segment is an index related to elimination of a target mark in the frame segment, the target mark is a mark corresponding to the frame segment, K is an integer and is more than or equal to 1;
selecting a target frame segment from all the frame segments according to the elimination indexes of the frame segments;
and eliminating the target mark of the target frame segment of the video.
Optionally, the logo is a brand logo of the brand to be eliminated.
Optionally, when the frame segment includes a plurality of frame pictures, the intersection ratio of the target areas of any two adjacent frame pictures is greater than a preset threshold, and the target area is an area occupied by the target mark in the frame pictures.
Optionally, the target frame segment is subjected to the target mark elimination processing by any one of the following methods:
carrying out fuzzy processing on a target area of a frame picture in the target frame segment;
carrying out shielding treatment on a target area of a frame picture in the target frame segment;
replacing the image of the target area of the frame picture in the target frame segment;
wherein, the target area is the area occupied by the target mark in the frame picture.
Optionally, the calculating, according to a preset K first indexes, an elimination index of the frame segment includes:
calculating the score of each first index of the frame segment according to the evaluation mechanism corresponding to each first index;
and calculating to obtain the elimination index of the frame segment according to the score of the K first indexes of the frame segment.
Optionally, the calculating the score of each first indicator of the frame segment according to the evaluation mechanism corresponding to each first indicator includes:
calculating to obtain the score of the kth first index of each frame picture of the frame segment according to an evaluation mechanism corresponding to the kth first index, wherein K is an integer and is more than or equal to 1 and less than or equal to K;
and calculating to obtain the average value of the scores of the kth item first indexes of all the frame pictures of the frame segment, and taking the average value as the score of the kth item first index of the frame segment.
Optionally, the calculating, according to the scores of the K first indexes of the frame segment, an elimination index of the frame segment includes:
determining the elimination index of the frame segment to be zero under the condition that the score of at least one first index in the K first indexes of the frame segment is smaller than the index threshold corresponding to the first index;
in other cases, the scores of the K first indexes of the frame segment are weighted and summed according to the weight of each first index to obtain a first sum value, and the first sum value is used as the elimination index of the frame segment.
Optionally, the number of the framed segments divided in the video is M, M is an integer and M ≧ 2;
adjusting the score of each first index of the frame segment before weighted summation of the scores of the K first indexes of the frame segment;
the adjusting the score of each first index of the frame segment comprises:
calculating to obtain a first ratio, wherein the first ratio is the ratio of the score of the kth first index of the mth frame segment to a first parameter, the first parameter is the largest score in the scores of the kth first indexes of the M frame segments, K is an integer and is greater than or equal to 1 and less than or equal to K;
and taking the first ratio as the score of the kth item first index of the mth frame segment, wherein M is an integer and is more than or equal to 1 and less than or equal to M.
Optionally, the K first indicators at least include one selected from the following indicators:
the size of the target area;
a center coordinate of the target area;
the approximation of the shape of the target area to a rectangle;
the degree to which the target region is occluded by the foreground;
a degree of blur of an image of the target region;
a color contrast of an image of the target region;
a brightness of an image of the target area;
the number of frames of the frame segment;
the degree of change in the area of the target region between the frame and the previous or subsequent frame;
the degree of change of the center coordinates of the target area of the frame picture and the previous frame picture or the next frame picture;
a degree of conversion of brightness of an image of a target region of the frame picture and a previous frame picture or a subsequent frame picture;
wherein the target area is an area occupied by the target mark in the frame picture.
Optionally, in a case that the target frame segment includes a plurality of frame pictures, performing target flag elimination processing on the target frame segment, including:
calculating to obtain an elimination index of each frame picture in the target frame segment according to a preset P second index, wherein the elimination index of the frame picture is an index related to elimination of a target mark in the frame picture, P is an integer and is more than or equal to 1;
determining the frame picture with the highest elimination index in the target frame segment as a starting frame picture;
eliminating the target mark of the initial frame picture;
starting from the previous frame of the starting frame to the first frame of the target frame segment, carrying out target mark elimination processing frame by frame, wherein the processing result of the next frame of the current frame is utilized to process the current frame;
and carrying out target mark elimination processing frame by frame from the frame after the starting frame to the last frame of the target frame segment, wherein the current frame is processed by using the processing result of the frame before the current frame.
Optionally, the calculating, according to a preset P second index, an elimination index of each frame picture in the target frame segment includes:
calculating the score of each second index of the frame picture according to the evaluation mechanism corresponding to each second index;
determining the elimination index of the frame picture to be zero when the score of at least one second index in the P second indexes of the frame picture is smaller than the index threshold corresponding to the second index;
in other cases, the scores of the P second indexes of the frame picture are weighted and summed according to the weight of each second index to obtain a second sum value, and the second sum value is used as the elimination index of the frame picture.
Optionally, the target frame segment includes N frame pictures in total, where N is an integer and N is greater than or equal to 2;
adjusting the score of each item of second index of the frame picture before weighted summing the scores of the P items of second index of the frame picture;
the adjusting the score of each second index of the frame picture comprises:
calculating to obtain a second ratio, wherein the second ratio is the ratio of the score of the pth second index of the nth frame picture to a second parameter, and the second parameter is the largest score in the scores of the pth second indexes of the N frame pictures;
and taking the second ratio as the score of the pth second index of the nth frame picture, wherein N is an integer and is more than or equal to 1 and less than or equal to N.
Optionally, the P second indicators at least include one selected from the following indicators:
the size of the target area;
a center coordinate of the target area;
the approximation of the shape of the target area to a rectangle;
the degree to which the target region is occluded by the foreground;
a degree of blur of an image of the target region;
a color contrast of an image of the target region;
a brightness of an image of the target area;
wherein, the target area is the area occupied by the target mark in the frame picture.
According to a second aspect of the disclosure, a video processing apparatus is provided, which includes a detection module, a calculation module, a screening module, and an elimination module;
the detection module is used for acquiring a set of marks to be eliminated, wherein the set of marks to be eliminated comprises at least one mark; dividing a frame segment corresponding to the logo in the video in the case that a frame picture containing the logo exists in the video, wherein the frame segment comprises one frame picture containing the logo or a plurality of continuous frame pictures containing the logo;
the calculating module is used for calculating and obtaining the elimination index of the frame segment according to a preset K first indexes, the elimination index of the frame segment is an index related to the elimination of a target mark in the frame segment, the target mark is a mark corresponding to the frame segment, K is an integer and is more than or equal to 1;
the screening module is used for selecting a target frame segment from all the frame segments according to the elimination indexes of the frame segments;
and the elimination module is used for eliminating the target mark of the target frame segment of the video.
Optionally, the logo is a brand logo of the brand to be eliminated.
Optionally, when the frame segment includes a plurality of frame pictures, the intersection ratio of the target areas of any two adjacent frame pictures is greater than a preset threshold, and the target area is an area occupied by the target mark in the frame pictures.
Optionally, the eliminating module is configured to perform target mark elimination processing on the target frame segment by using any one of the following methods:
carrying out fuzzy processing on a target area of a frame picture in the target frame segment;
carrying out shielding treatment on a target area of a frame picture in the target frame segment;
replacing the image of the target area of the frame picture in the target frame segment;
wherein, the target area is the area occupied by the target mark in the frame picture.
Optionally, the calculating module is configured to calculate, according to an evaluation mechanism corresponding to each first index, a score of each first index of the frame segment; and calculating to obtain the elimination index of the frame segment according to the score of the K first indexes of the frame segment.
Optionally, the calculating module is configured to calculate, according to an evaluation mechanism corresponding to the kth first index, a score of the kth first index of each frame picture of the frame segment, where K is an integer and is greater than or equal to 1 and less than or equal to K; and calculating to obtain the average value of the scores of the kth item first indexes of all the frame pictures of the frame segment, and taking the average value as the score of the kth item first index of the frame segment.
Optionally, the calculating module is configured to determine that the elimination index of the frame segment is zero when at least one score of one first index in the K first indexes of the frame segment is smaller than an index threshold corresponding to the first index; in other cases, the scores of the K first indexes of the frame segment are weighted and summed according to the weight of each first index to obtain a first sum value, and the first sum value is used as the elimination index of the frame segment.
Optionally, the number of the framed segments divided in the video is M, M is an integer and M ≧ 2; the calculating module is used for adjusting the score of each item of first index of the frame segment before weighted summation of the scores of the K items of first indexes of the frame segment; the adjusting the score of each first index of the frame segment comprises: calculating to obtain a first ratio, wherein the first ratio is the ratio of the score of the kth first index of the mth frame segment to a first parameter, the first parameter is the largest score in the scores of the kth first indexes of the M frame segments, K is an integer and is greater than or equal to 1 and less than or equal to K; and taking the first ratio as the score of the kth item first index of the mth frame segment, wherein M is an integer and is more than or equal to 1 and less than or equal to M.
Optionally, the K first indicators at least include one selected from the following indicators:
the size of the target area;
a center coordinate of the target area;
the approximation of the shape of the target area to a rectangle;
the degree to which the target region is occluded by the foreground;
a degree of blur of an image of the target region;
a color contrast of an image of the target region;
a brightness of an image of the target area;
the number of frames of the frame segment;
the degree of change in the area of the target region between the frame and the previous or subsequent frame;
the degree of change of the center coordinates of the target area of the frame picture and the previous frame picture or the next frame picture;
a degree of conversion of brightness of an image of a target region of the frame picture and a previous frame picture or a subsequent frame picture;
wherein the target area is an area occupied by the target mark in the frame picture.
Optionally, the eliminating module is configured to, when the target frame segment includes a plurality of frame pictures, perform elimination processing of a target flag on the target frame segment, and includes: calculating to obtain an elimination index of each frame picture in the target frame segment according to a preset P second index, wherein the elimination index of the frame picture is an index related to elimination of a target mark in the frame picture, P is an integer and is more than or equal to 1; determining the frame picture with the highest elimination index in the target frame segment as a starting frame picture; eliminating the target mark of the initial frame picture; starting from the previous frame of the starting frame to the first frame of the target frame segment, carrying out target mark elimination processing frame by frame, wherein the processing result of the next frame of the current frame is utilized to process the current frame; and carrying out target mark elimination processing frame by frame from the frame after the starting frame to the last frame of the target frame segment, wherein the current frame is processed by using the processing result of the frame before the current frame.
Optionally, the eliminating module is configured to calculate, according to an evaluation mechanism corresponding to each second index, a score of each second index of the frame picture; determining the elimination index of the frame picture to be zero when the score of at least one second index in the P second indexes of the frame picture is smaller than the index threshold corresponding to the second index; in other cases, the scores of the P second indexes of the frame picture are weighted and summed according to the weight of each second index to obtain a second sum value, and the second sum value is used as the elimination index of the frame picture.
Optionally, the target frame segment includes N frame pictures in total, where N is an integer and N is greater than or equal to 2; the elimination module is used for adjusting the score of each second index of the frame picture before weighted summation of the scores of the P second indexes of the frame picture; the adjusting the score of each second index of the frame picture comprises: calculating to obtain a second ratio, wherein the second ratio is the ratio of the score of the pth second index of the nth frame picture to a second parameter, and the second parameter is the largest score in the scores of the pth second indexes of the N frame pictures; and taking the second ratio as the score of the pth second index of the nth frame picture, wherein N is an integer and is more than or equal to 1 and less than or equal to N.
Optionally, the P second indicators at least include one selected from the following indicators:
the size of the target area;
a center coordinate of the target area;
the approximation of the shape of the target area to a rectangle;
the degree to which the target region is occluded by the foreground;
a degree of blur of an image of the target region;
a color contrast of an image of the target region;
a brightness of an image of the target area;
wherein, the target area is the area occupied by the target mark in the frame picture.
According to a third aspect of the present disclosure, there is provided a video processing apparatus comprising a processor and a memory, the memory having stored therein computer instructions, which when executed by the processor, perform the video processing method of any one of the preceding claims.
According to a fourth aspect of the present disclosure, there is provided a computer readable storage medium having stored thereon computer instructions which, when executed by a processor, perform the video processing method of any one of the preceding claims.
According to the video processing method provided by the embodiment of the invention, the mark to be eliminated is eliminated by using a computer technology, so that the labor cost is saved and the processing efficiency is improved.
Features of embodiments of the present specification and advantages thereof will become apparent from the following detailed description of exemplary embodiments thereof, which proceeds with reference to the accompanying drawings.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments of the specification and together with the description, serve to explain the principles of the embodiments of the specification.
FIG. 1 is a block diagram of a video processing system provided by one embodiment of the present description;
fig. 2 is a schematic flow chart of a video processing method according to an embodiment of the present disclosure;
FIG. 3 is a diagram of a frame picture provided in one embodiment of the present specification;
FIG. 4 is a block diagram of a video processing device provided by one embodiment of the present specification;
fig. 5 is a block diagram of a video processing device provided in one embodiment of the present specification.
Detailed Description
Various exemplary embodiments of the present specification will now be described in detail with reference to the accompanying drawings.
The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the embodiments, their application, or uses.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, further discussion thereof is not required in subsequent figures.
< video processing apparatus >
Fig. 1 is a block diagram of a video processing system provided by one embodiment of the present specification. As shown in fig. 1, the video processing system includes a video processing apparatus 101 that provides video processing and a video library 103. The video processing apparatus 101 and the video library 103 may be communicatively connected via a network 102.
The video processing apparatus 101 may be a server for providing video processing, and the configuration of the server may include, but is not limited to: processor 1011, memory 1012, interface 1013, communication device 1014, input device 1015, output device 1016. The processor 1011 may include, but is not limited to, a central processing unit CPU, a microprocessor MCU, or the like. The processor 1011 may also include an image processor gpu (graphics Processing unit), or the like. The memory 1012 may include, but is not limited to, a ROM (read only memory), a RAM (random access memory), a nonvolatile memory such as a hard disk, and the like. Interface device 1013 may include, but is not limited to, a USB interface, a serial interface, a parallel interface, and the like. The communication device 1014 can perform wired communication or wireless communication, and specifically can include WiFi communication, bluetooth communication, 2G/3G/4G/5G communication, and the like. Input devices 1015 may include, but are not limited to, a keyboard, a mouse, and the like. Output device 1016 may include, but is not limited to, a display screen or the like. The server may be configured to include only some of the above devices.
The video processing apparatus 101 may also be a terminal device for providing video processing, and the terminal device may be an electronic device installed with an intelligent operating system (e.g., android, IOS, Windows, Linux, etc.), including but not limited to a laptop, a desktop, a mobile phone, a tablet, etc. Configurations of the terminal device include, but are not limited to: a processor, a memory, an interface device, a communication device, an input device, an output device, a speaker, a microphone, and a camera. The processor may include, but is not limited to, a central processing unit CPU, a microprocessor MCU, or the like. The processor may also include an image processor GPU or the like. The memory may include, but is not limited to, ROM, RAM, non-volatile memory such as a hard disk, and the like. The interface means may include, but is not limited to, a USB interface, a serial interface, a parallel interface, etc. The communication means is capable of wired or wireless communication, for example, and may specifically include WiFi communication, bluetooth communication, 2G/3G/4G/5G communication, and the like. Input devices may include, but are not limited to, a keyboard, a mouse, a touch screen, and the like. The output device may include, but is not limited to, a display screen, which may be, for example, a liquid crystal screen, a touch screen, or the like. The terminal may be configured to include only some of the above devices.
In one embodiment applied to the present specification, the video processing apparatus 101 is configured to process videos in the video library 103. The video processing system shown in fig. 1 is merely illustrative and is in no way intended to suggest any limitation as to the embodiments of the description, their application, or uses. It should be understood by those skilled in the art that although a plurality of devices of the video processing device 101 are described above, the embodiments of the present specification may refer to only some of the devices. Those skilled in the art can design instructions according to the schemes disclosed in the embodiments of this specification, and how the instructions control the operation of the processor is well known in the art, so that the detailed description is omitted here.
< video processing method >
Fig. 2 is a schematic diagram of a video processing method provided in an embodiment of the present specification. The video processing method provided by this embodiment is implemented by computer technology, and can be implemented by the video processing apparatus described in fig. 1.
The video processing method provided by the embodiment comprises the steps S202-S210.
S202, acquiring a mark set to be eliminated.
The mark set to be eliminated includes one or more marks to be eliminated, and the marks can be marks which do not conform to the requirements of a video broadcaster, marks which do not conform to legal regulations, and the like, for example, marks (such as trademarks) of brands to be eliminated, and the like.
In one embodiment, the set of to-be-eliminated flags includes flag a, flag B, flag C, and flag D.
And S204, under the condition that the frame picture containing the mark exists in the video, dividing the frame segment corresponding to the mark in the video.
Video is composed of a plurality of continuous frame images, and one frame image is a frame picture. In the video, the divided frame segment includes one frame picture including the flag or includes a plurality of consecutive frame pictures including the flag. That is, in the embodiment of the present invention, the "frame segment" may be a frame segment composed of a single frame, or may be a frame segment composed of a plurality of consecutive frames.
In one embodiment, the video may be detected frame by a deep learning algorithm or the like, and it is determined whether each frame of the video contains a flag in the set of flags to be eliminated and the area occupied by the flag in the frame is determined. The embodiment of the present invention is not limited to this, and other methods may be adopted to perform frame-by-frame detection on the video.
Taking fig. 3 as an example for illustration, fig. 3 shows the detection results of consecutive 5 frames from the jth frame to the j +4 th frame of the video, where j is an integer and j ≧ 1. The flag a is detected in the frame picture of the j-th frame, and the area occupied by the flag a in the frame picture of the j-th frame is the area a 1. A flag B and a flag C are detected in a frame picture of a (j + 1) th frame, an area occupied by the flag B in the frame picture of the (j + 1) th frame is an area B1, and an area occupied by the flag C in the frame picture of the (j + 1) th frame is an area C1. A flag B and a flag C are detected in a frame picture of a (j + 2) th frame, the area occupied by the flag B in the frame picture of the (j + 2) th frame is an area B2, and the area occupied by the flag C in the frame picture of the (j + 2) th frame is an area C2. A flag B, a flag C and a flag D are detected in a frame picture of a (j + 3) th frame, the area occupied by the flag B in the frame picture of the (j + 3) th frame is an area B3, the area occupied by the flag C in the frame picture of the (j + 3) th frame is an area C3, and the area occupied by the flag D in the frame picture of the (j + 3) th frame is an area D1. In the frame picture of the (j + 4) th frame, the mark in the mark set to be eliminated is not detected.
For any of the flags, when a frame picture including the flag exists in a video, a frame segment corresponding to the flag is divided in the video. For example: if a frame picture containing a mark A, a frame picture containing a mark B and a frame picture containing a mark C exist in the video, but a frame picture containing a mark D does not exist, a frame segment corresponding to the mark A is divided for the mark A, a frame segment corresponding to the mark B is divided for the mark B, and a frame segment corresponding to the mark C is divided for the mark C.
In the following, taking fig. 3 as an example, assuming that j is 1, the jth frame is the 1 st frame of the video, and the frame segment corresponding to the flag can be divided in the following two ways.
< first mode >
If the two adjacent frames contain a certain mark, the two frames are divided into the same frame segment corresponding to the mark.
According to fig. 3, 4 frame segments are obtained in a first way: the jth frame itself constitutes a frame fragment corresponding to the flag a. The (j + 1) th frame, the (j + 2) th frame and the (j + 3) th frame form a frame segment corresponding to the mark B. The (j + 1) th frame, the (j + 2) th frame and the (j + 3) th frame form a frame segment corresponding to the mark C. The j +3 th frame itself constitutes a frame segment corresponding to the flag D.
< second mode >
If two adjacent frames contain a certain mark and the intersection ratio of the areas occupied by the mark in the frame pictures of the two frames is larger than a preset threshold value, the two frames are divided into the same frame segment corresponding to the mark. If two adjacent frames contain a certain mark and the intersection ratio of the areas occupied by the mark in the frame pictures of the two frames is less than or equal to a preset threshold value, the former frame is divided into a frame segment corresponding to the mark, and the latter frame is divided into another frame segment corresponding to the mark. The intersection ratio of the two regions is the ratio of the intersection of the two regions to the union of the two regions, and the larger the intersection ratio is, the higher the coincidence degree of the two regions is, and the lower the intersection ratio is, the lower the coincidence degree of the two regions is.
According to fig. 3, 5 frame segments are obtained in a second way: the jth frame itself constitutes a frame fragment corresponding to the flag a. The intersection ratio of the region B1 and the region B2 is greater than a preset threshold, the intersection ratio of the region B2 and the region B3 is greater than a preset threshold, and three continuous frames of the j +1 th frame, the j +2 th frame and the j +3 th frame form a frame segment corresponding to the mark B. The intersection ratio of the region C1 and the region C2 is greater than a preset threshold, the intersection ratio of the region C2 and the region C3 is less than or equal to the preset threshold, the j +1 th frame and the j +2 th frame form a frame segment corresponding to the mark C, and the j +2 th frame and the j +3 th frame form another frame segment corresponding to the mark C. The j +3 th frame itself constitutes a frame segment corresponding to the flag D.
In the embodiment of the present invention, the mark corresponding to the frame segment is referred to as a target mark of the frame segment, and the area occupied by the target mark in the frame picture is referred to as a target area. The frame fragments obtained in the second way are:
frame segment 1 (jth frame): the target indicia is indicia a and the target area comprises area a 1.
Frame segment 2 (j +1 th frame, j +2 th frame, j +3 th frame): the target mark is mark B, and the target areas comprise area B1, area B2 and area B3.
Frame segment 3 (j +1 th frame, j +2 th frame): the target mark is mark C, and the target areas comprise area C1 and area C2.
Frame segment 4 (j +2 th frame, j +3 th frame): the target mark is mark C, and the target areas comprise area C2 and area C3.
Frame segment 5 (j +3 th frame): the target indicia is indicia D and the target area comprises area D1.
When the frame segment obtained according to the second method includes a plurality of frame pictures, the intersection ratio of the target areas of any two adjacent frame pictures is greater than a preset threshold value.
And S206, calculating to obtain the elimination index of the frame segment according to the preset K first indexes.
The erasure index of a frame segment is an index that is related to the erasure of a target flag in that frame segment, i.e., the erasure index of a frame segment is independent of other flags that may be contained in that frame segment. K is an integer and K.gtoreq.1.
In one embodiment, the K first indicators include at least one indicator selected from the following 11 indicators:
(1) the size of the target area. The larger the target area is, the more obvious the target mark is in the frame picture, and the target mark is more to be eliminated.
(2) The center coordinates of the target area. The closer the center coordinates of the target area are to the center of the frame, the more obvious the target mark is in the frame and the more the target mark should be eliminated.
(3) The approximation of the shape of the target area to a rectangle. In the embodiment of the invention, the elimination of the target mark can be realized by carrying out elimination processing on the target area, and the more the shape of the target area is similar to a rectangle, the easier the target area is eliminated, and the more the target area is eliminated.
(4) The degree to which the target marker is occluded by the foreground. The less the target mark is occluded by the foreground, the more obvious the target mark is in the frame picture, and the more the target mark should be eliminated.
(5) Degree of blurring of the image of the target area. The lower the degree of blurring of the image of the target area, i.e. the higher the degree of sharpness of the image of the target area, the more obvious the target mark is in the frame picture, and the more the target mark should be eliminated.
(6) Color contrast of the image of the target area. The higher the color contrast of the image of the target area, the more obvious the target mark is in the frame picture, and the more the target mark should be eliminated.
(7) Brightness of the image of the target area. The larger the difference between the brightness of the image of the target area and the average brightness of the frame picture is, the more obvious the target mark is in the frame picture, and the target mark should be eliminated.
(8) The number of frames of the frame segment. The larger the number of frames of a frame segment, the more the object flag in the frame segment should be eliminated.
(9) The degree of change in the area of the target region between the current frame and the previous or subsequent frame. In the embodiment of the present invention, the current frame may be eliminated by using the elimination result of the previous frame or the next frame, and the smaller the change degree of the area of the target region between the current frame and the previous frame or the next frame is, the easier the elimination of the current frame is, the smaller the calculation amount is, the more the current frame should be eliminated, and the more the elimination of the current frame should be performed.
(10) The change degree of the center coordinates of the target area between the current frame and the previous frame or the next frame. In the embodiment of the present invention, the current frame may be eliminated by using the elimination result of the previous frame or the next frame, and the smaller the change degree of the center coordinates of the target area between the current frame and the previous frame or the next frame is, the easier the elimination processing of the current frame is, the smaller the calculation amount is, and the more the elimination processing of the current frame should be performed.
(11) The degree of change in brightness of the image of the target area between the current frame and the previous or subsequent frame. In the embodiment of the present invention, the current frame may be eliminated by using the elimination result of the previous frame or the next frame, and the smaller the change degree of the brightness of the target area between the current frame and the previous frame or the next frame is, the easier the elimination processing of the current frame is, the smaller the calculation amount is, and the more the elimination processing of the current frame should be performed.
Assume that after step S204, there are M frame segments divided in the video, and the number of frames in the mth frame segment is N, i.e. there are N frame pictures in the mth frame segment, where M is an integer and M ≧ 2, M is an integer and 1 ≦ M, and N is an integer and N ≧ 1.
Taking the mth frame segment as an example, how to calculate the elimination index of the mth frame segment according to the preset K first indexes will be described in detail below, including steps S302 and S304.
S302, calculating the score of each first index of the mth frame segment according to the evaluation mechanism corresponding to each first index.
In a specific example, first, a score of the kth item first index of each frame picture of the mth frame segment is calculated according to an evaluation mechanism corresponding to the kth item first index, where K is an integer and is greater than or equal to 1 and less than or equal to K. Then, an average value of the scores of the kth item first index of all the N frame pictures of the mth frame segment is calculated, and the average value is used as the score of the kth item first index of the mth frame segment. Specifically, the score of the kth term first index of the mth frame segment is calculated according to the formula (1).
In formula (1), M represents the mth frame segment, M is an integer and 1. ltoreq. m.ltoreq.M. i represents the ith frame picture in the mth frame segment, i is an integer and is more than or equal to 1 and less than or equal to N. K represents the first index of the kth item, K is an integer and is more than or equal to 1 and less than or equal to K.Is the score of the kth item first index of the ith frame picture of the mth frame segment.Is the score of the kth first index of the mth frame segment.
S304, according to the scores of the K first indexes of the mth frame segment, calculating to obtain the elimination index of the mth frame segment. Specifically, the following three modes can be adopted:
< first mode >
And according to the weight of each first index, carrying out weighted summation on the scores of the K first indexes of the mth frame segment to obtain a first sum value, and taking the first sum value as the elimination index of the mth frame segment. Specifically, the elimination index of the mth frame segment can be calculated according to the formula (2).
In formula (2), M represents the mth frame segment, M is an integer and 1. ltoreq. m.ltoreq.M. K represents the first index of the kth item, K is an integer and is more than or equal to 1 and less than or equal to K.Is the score of the kth first index of the mth frame segment. WkIs the weight of the kth first index. QmIs the erasure index for the mth frame segment.
< second mode >
And in the scores of the K first indexes of the mth frame segment, setting the elimination index of the mth frame segment to be zero as long as the score of one first index is smaller than the index threshold corresponding to the first index. For example, of the scores of the K first indexes of the m-th frame segment, the score of the K first indexLess than the index threshold T corresponding to the kth first indexkSegmenting the m-th frameEliminating the index QmIs set to zero.
In other cases, that is, when all the scores of the K first indexes of the mth frame segment are greater than or equal to the corresponding index threshold, the scores of the K first indexes of the mth frame segment are weighted and summed according to the weight of each first index to obtain a first sum, and the first sum is used as the elimination index of the mth frame segment. Specifically, the elimination index of the mth frame segment can be calculated according to the formula (2).
< third mode >
And in the scores of the K first indexes of the mth frame segment, setting the elimination index of the mth frame segment to be zero as long as the score of one first index is smaller than the index threshold corresponding to the first index. For example, of the scores of the K first indexes of the m-th frame segment, the score of the K first indexLess than the index threshold T corresponding to the kth first indexkThe cancellation index Q of the mth frame segmentmIs set to zero.
In other cases, that is, when all the scores of the K first indexes of the mth frame segment are greater than or equal to the corresponding index threshold, the score of each first index of the mth frame segment is adjusted, then the scores of the K first indexes of the mth frame segment are weighted and summed according to the weight of each first index to obtain a first sum, and the first sum is used as the elimination index of the mth frame segment. Specifically, the elimination index of the mth frame segment may be calculated according to formula (3).
Adjusting the score of the kth first index of the mth frame segment, including: and calculating to obtain a first ratio, wherein the first ratio is the ratio of the score of the kth item first index of the mth frame segment to a first parameter, and the first parameter is the largest score in the scores of the kth item first indexes of all the M frame segments.
Specifically, in other cases, that is, in the case that all the scores of the K first indexes of the mth frame segment are greater than or equal to the corresponding index threshold, the elimination index of the mth frame segment is calculated according to the formula (3).
In formula (3), M represents the mth frame segment, M is an integer and 1. ltoreq. m.ltoreq.M. K represents the first index of the kth item, K is an integer and is more than or equal to 1 and less than or equal to K.The scores of the kth first index of the 1 st frame segment, the score of the kth first index of the 2 nd frame segment, … and the score of the kth first index of the M frame segment are respectively.The index is the largest one of the scores of the kth first index of all the M frame segments, and the largest score is taken as a first parameter.Is the score of the kth first index of the mth frame segment. WkIs the weight of the kth first index. QmIs the erasure index for the mth frame segment.
And S208, selecting a target frame segment from all the frame segments according to the elimination indexes of the frame segments.
In one embodiment, all the M frame segments are sorted from high to low according to the elimination index, and the frame segment with the highest elimination index is selected as the target segment.
In one embodiment, a frame segment with an erasure index greater than a preset erasure index threshold is selected from the M frame segments as a target frame segment. If no frame segment with the elimination index larger than the preset elimination index threshold value exists in the M frame segments, the video does not have a more obvious mark to be eliminated, and the elimination is not needed. The elimination index threshold value may be determined according to simulation tests and engineering experience, which is not limited in the embodiments of the present invention.
S210, eliminating the target mark of the target frame segment of the video.
In one embodiment, the elimination process is implemented by performing a blurring process or an occlusion process on a target region of a frame picture in a target frame segment. The elimination process is realized, for example, by replacing the image of the target area with a picture of a logo permitted by the video presenter. The elimination processing is realized, for example, by performing mosaic processing on the target area. In one embodiment, the elimination process is accomplished by replacing the image of the target area of the frame picture in the target frame segment, for example, by replacing the image of the target area with an image containing a logo that is licensed by the video presenter. Wherein, the target area is the area occupied by the target mark in the frame picture.
In one embodiment, if the target frame segment includes a plurality of frame pictures, the target frame segment is subjected to the elimination process of the target mark according to steps S402-S410:
s402, according to the preset P second indexes, calculating to obtain the elimination index of each frame picture in the target frame segment.
S404, determining the frame picture with the highest elimination index in the target frame segment as a starting frame picture.
S406, the target mark is eliminated for the initial frame picture.
S408, starting from the previous frame of the starting frame to the first frame of the target frame segment, carrying out the elimination processing of the target mark frame by frame, wherein the current frame is processed by using the processing result of the next frame of the current frame.
And S410, starting from the frame next to the initial frame to the last frame of the target frame segment, carrying out target mark elimination processing frame by frame, wherein the current frame is processed by using the processing result of the frame previous to the current frame.
The elimination index of a frame picture is an index related to elimination of a target flag in the frame picture, that is, the elimination index of a frame picture is independent of other flags that may be contained in the frame picture. P is an integer and P.gtoreq.1.
In one embodiment, the P second indicators include at least one indicator selected from the following 7 indicators:
(1) the size of the target area. The larger the target area is, the more obvious the target mark is in the frame picture, and the target mark is more to be eliminated.
(2) The center coordinates of the target area. The closer the center coordinates of the target area are to the center of the frame, the more obvious the target mark is in the frame and the more the target mark should be eliminated.
(3) The approximation of the shape of the target area to a rectangle. In the embodiment of the invention, the elimination of the target mark can be realized by carrying out elimination processing on the target area, and the more the shape of the target area is similar to a rectangle, the easier the target area is eliminated, and the more the target area is eliminated.
(4) The degree to which the target marker is occluded by the foreground. The less the target mark is occluded by the foreground, the more obvious the target mark is in the frame picture, and the more the target mark should be eliminated.
(5) Degree of blurring of the image of the target area. The lower the degree of blurring of the image of the target area, i.e. the higher the degree of sharpness of the image of the target area, the more obvious the target mark is in the frame picture, and the more the target mark should be eliminated.
(6) Color contrast of the image of the target area. The higher the color contrast of the image of the target area, the more obvious the target mark is in the frame picture, and the more the target mark should be eliminated.
(7) Brightness of the image of the target area. The larger the difference between the brightness of the image of the target area and the average brightness of the frame picture is, the more obvious the target mark is in the frame picture, and the target mark should be eliminated.
In one embodiment, a first indicator and a second indicator may be the same indicator, with the same evaluation mechanism and indicator threshold.
Next, taking the mth frame segment as the target frame segment as an example, how to calculate the elimination index of each frame picture in the mth frame segment according to the preset P second indexes is described in detail, including steps S502 and S504.
S502, according to an evaluation mechanism corresponding to each second index, calculating to obtain the score of each second index of the ith frame picture of the mth frame segment, wherein i is an integer and is more than or equal to 1 and less than or equal to N.
S504, according to the score of the P second indexes of the ith frame picture of the mth frame slice, the elimination index of the ith frame picture of the mth frame slice is obtained through calculation.
Next, continuing to take the mth frame segment as an example, how to calculate the elimination index of the ith frame picture of the mth frame segment according to the score of the P second indexes of the ith frame picture of the mth frame segment is described in detail, specifically, the following three ways may be adopted:
< first mode >
And according to the weight of each second index, carrying out weighted summation on the scores of the P second indexes of the ith frame picture of the mth frame segment to obtain a second sum value, and taking the second sum value as the elimination index of the ith frame picture of the mth frame segment. Specifically, the elimination index of the ith frame picture of the mth frame segment can be calculated according to the formula (4).
In formula (4), i represents the ith frame picture in the mth frame segment, i is an integer and 1 ≦ i ≦ N. P represents the second index of the pth term, P is an integer and is more than or equal to 1 and less than or equal to P.And the score of the p item of the second index of the ith frame picture of the mth frame segment is characterized. WpIs the weight of the pth second index. SiIs the elimination index of the ith frame picture of the mth frame segment.
< second mode >
In the scores of the P second indexes of the ith frame picture of the mth frame segment, as long as the score of one second index is smaller than the index threshold corresponding to the second index, the elimination index of the ith frame picture of the mth frame segment is set to be zero. For example, of the scores of the P-th second indexes of the ith frame picture of the mth frame slice, the P-th second indexTarget scoreLess than the index threshold L corresponding to the second index of the pthpRemoving index S of ith frame picture of mth frame segmentiIs set to zero.
In other cases, that is, when all the scores of the P second indexes of the i-th frame picture of the m-th frame slice are greater than or equal to the corresponding index threshold, the scores of the P second indexes of the i-th frame picture of the m-th frame slice are weighted and summed according to the weight of each second index to obtain a second sum value, and the second sum value is used as the elimination index of the i-th frame picture of the m-th frame slice. Specifically, the elimination index of the ith frame picture of the mth frame segment can be calculated according to the formula (4).
< third mode >
In the scores of the P second indexes of the ith frame picture of the mth frame segment, as long as the score of one second index is smaller than the index threshold corresponding to the second index, the elimination index of the ith frame picture of the mth frame segment is set to be zero. For example, of the scores of the P second indexes of the ith frame picture of the mth frame slice, the score of the P second indexLess than the index threshold L corresponding to the second index of the pthpRemoving index S of ith frame picture of mth frame segmentiIs set to zero.
In other cases, that is, when all the scores of the P second indexes of the i-th frame picture of the m-th frame slice are greater than or equal to the corresponding index threshold, the score of each second index of the i-th frame picture of the m-th frame slice is adjusted, then the scores of the P second indexes of the i-th frame picture of the m-th frame slice are weighted and summed according to the weight of each second index to obtain a second sum value, and the second sum value is used as the elimination index of the i-th frame picture of the m-th frame slice.
The adjusting of the score of the pth item second index of the ith frame picture of the mth frame segment includes: and calculating to obtain a second ratio, wherein the second ratio is the ratio of the score of the pth second index of the ith frame picture of the mth frame segment to a second parameter, and the second parameter is the largest score in the scores of the pth second indexes of all the N frame pictures of the mth frame segment.
Specifically, in other cases, that is, in the case where all the scores of the P items of the second index of the i-th frame picture of the m-th frame slice are greater than or equal to the corresponding index threshold, the elimination index of the m-th frame slice is calculated according to the formula (5).
In formula (5), i represents the ith frame picture in the mth frame segment, i is an integer and 1 ≦ i ≦ N. P represents the second index of the pth term, P is an integer and is more than or equal to 1 and less than or equal to P.The scores of the pth second index of the 1 st frame picture, the score of the pth second index of the 2 nd frame picture, … and the score of the pth second index of the nth frame picture are respectively.The score of the pth second index of all the N frame pictures of the mth frame segment is the largest one, and the largest score is used as the second parameter.Is the score of the pth item second index of the ith frame picture of the mth frame segment. L ispIs the weight of the pth second index. SiIs the elimination index of the ith frame picture of the mth frame segment.
The existing sign replacement scheme has high requirements on manpower and has slow processing speed. In the current art video or the television play video, the frame rate is usually 30 frames/second or even higher, the video with the processing duration of 1 minute needs to process at least 1800 frames of images, and the use of the existing mark replacement scheme is particularly labor-consuming and time-consuming. The video processing method provided by the embodiment of the invention can automatically select the fragments to be processed from the video and eliminate the fragments, so that the manpower and material resources are saved, and the processing efficiency is improved.
The video processing method provided by the embodiment of the invention utilizes the intersection ratio of the target areas of the adjacent frames when dividing the frame segments, so that the target mark areas of any two adjacent frames of the frame segments are relatively similar, and when the target mark elimination processing is carried out on the current frame, the processing result of the adjacent frames can be fully utilized, thereby reducing the operation amount and improving the processing efficiency.
According to the video processing method provided by the embodiment of the invention, the elimination index of each frame segment is evaluated by using one or more first indexes, the elimination index of the frame segment can integrally express the elimination effect and/or elimination easiness of the target mark elimination of the frame segment, and only the frame segment with higher elimination index can be subjected to the elimination processing of the target mark. Compared with the method for eliminating each frame of the video, the selective eliminating method provided by the embodiment of the invention has the advantages that the eliminating effect is not greatly different, but a large amount of time can be saved, and the eliminating effect, the operation amount and the eliminating time are balanced.
The video processing method provided by the embodiment of the invention evaluates the elimination index of each frame picture in the target frame segment by using one or more second indexes, the elimination index of the frame picture can integrally express the elimination effect and/or elimination easiness of the target mark elimination of the frame picture, the frame picture with the highest elimination index is selected as the initial frame, the elimination processing is carried out frame by frame from the initial frame forward, and the elimination processing is carried out frame by frame from the initial frame backward, so that the processing result of the initial frame can be fully utilized, the operation amount is further reduced, and the processing efficiency is improved.
Compared with a large number of engineering experiments of the inventor, the video processing method provided by the embodiment of the invention is verified, and the experimental result shows that the probability of the situation that the replaced mark has the problems of jitter, deformation and the like is lower.
< video processing apparatus >
Fig. 4 is a schematic diagram of a video processing apparatus provided in an embodiment of the present specification.
The video processing apparatus provided by this embodiment includes a detection module 11, a calculation module 12, a filtering module 13, and an elimination module 14.
The detection module 11 is configured to obtain a set of to-be-eliminated marks, where the set of to-be-eliminated marks includes at least one mark. In the case where a frame picture containing a flag exists in a video, a frame segment corresponding to the flag is divided in the video, the frame segment including one frame picture containing the flag or including a plurality of consecutive frame pictures containing the flag.
The calculating module 12 is configured to calculate, according to a preset K first index, an elimination index of the frame segment, where the elimination index of the frame segment is an index related to an object flag in the elimination frame segment, the object flag is a flag corresponding to the frame segment, K is an integer and K is greater than or equal to 1.
And the screening module 13 is configured to select a target frame segment from all the frame segments according to the elimination index of the frame segment.
And the elimination module 14 is used for eliminating the target mark of the target frame segment of the video.
In one specific example, the logo is a brand logo of the brand to be eliminated.
In a specific example, when the frame segment includes a plurality of frame pictures, the intersection ratio of the target areas of any two adjacent frame pictures is greater than a preset threshold, and the target area is an area occupied by the target mark in the frame pictures.
In a specific example, the elimination module 14 is configured to perform the elimination processing of the target mark on the target frame segment by using any one of the following methods:
carrying out fuzzy processing on a target area of a frame picture in the target frame segment;
carrying out shielding treatment on a target area of a frame picture in the target frame segment;
replacing the image of the target area of the frame picture in the target frame segment;
wherein, the target area is the area occupied by the target mark in the frame picture.
In a specific example, the calculating module 12 is configured to calculate a score of each first indicator of the frame segment according to an evaluation mechanism corresponding to each first indicator; and calculating to obtain the elimination index of the frame segment according to the score of the K first indexes of the frame segment.
In a specific example, the calculating module 12 is configured to calculate, according to an evaluation mechanism corresponding to a kth item of first index, a score of the kth item of first index of each frame picture of the frame segment, where K is an integer and is greater than or equal to 1 and less than or equal to K; and calculating to obtain the average value of the scores of the kth item first indexes of all the frame pictures of the frame segment, and taking the average value as the score of the kth item first index of the frame segment.
In a specific example, the calculating module 12 is configured to determine that the elimination index of the frame segment is zero when the score of at least one first index in the K first indexes of the frame segment is smaller than an index threshold corresponding to the first index; in other cases, the scores of the K first indexes of the frame segment are weighted and summed according to the weight of each first index to obtain a first sum value, and the first sum value is used as the elimination index of the frame segment.
In a specific example, the number of the framed segments divided in the video is M, M is an integer and M ≧ 2; a calculating module 12, configured to adjust the score of each first indicator of the frame segment before performing weighted summation on the scores of the K first indicators of the frame segment; the adjusting the score of each first index of the frame segment comprises: calculating to obtain a first ratio, wherein the first ratio is the ratio of the score of the kth first index of the mth frame segment to a first parameter, the first parameter is the largest score in the scores of the kth first indexes of the M frame segments, K is an integer and is greater than or equal to 1 and less than or equal to K; and taking the first ratio as the score of the kth item first index of the mth frame segment, wherein M is an integer and is more than or equal to 1 and less than or equal to M.
In a specific example, the K first indicators include at least one indicator selected from the following indicators:
the size of the target area;
a center coordinate of the target area;
the approximation of the shape of the target area to a rectangle;
the degree to which the target region is occluded by the foreground;
a degree of blur of an image of the target region;
a color contrast of an image of the target region;
a brightness of an image of the target area;
the number of frames of the frame segment;
the degree of change in the area of the target region between the frame and the previous or subsequent frame;
the degree of change of the center coordinates of the target area of the frame picture and the previous frame picture or the next frame picture;
a degree of conversion of brightness of an image of a target region of the frame picture and a previous frame picture or a subsequent frame picture;
wherein the target area is an area occupied by the target mark in the frame picture.
In a specific example, the eliminating module 14 is configured to, in a case that the target frame segment includes a plurality of frame pictures, perform elimination processing of a target flag on the target frame segment, and includes: calculating to obtain an elimination index of each frame picture in the target frame segment according to a preset P second index, wherein the elimination index of the frame picture is an index related to elimination of a target mark in the frame picture, P is an integer and is more than or equal to 1; determining the frame picture with the highest elimination index in the target frame segment as a starting frame picture; eliminating the target mark of the initial frame picture; starting from the previous frame of the starting frame to the first frame of the target frame segment, carrying out target mark elimination processing frame by frame, wherein the processing result of the next frame of the current frame is utilized to process the current frame; and carrying out target mark elimination processing frame by frame from the frame after the starting frame to the last frame of the target frame segment, wherein the current frame is processed by using the processing result of the frame before the current frame.
In a specific example, the eliminating module 14 is configured to calculate a score of each second index of the frame picture according to an evaluation mechanism corresponding to each second index; determining the elimination index of the frame picture to be zero when the score of at least one second index in the P second indexes of the frame picture is smaller than the index threshold corresponding to the second index; in other cases, the scores of the P second indexes of the frame picture are weighted and summed according to the weight of each second index to obtain a second sum value, and the second sum value is used as the elimination index of the frame picture.
In a specific example, the target frame segment comprises a total of N frame pictures, N is an integer and N ≧ 2; a removing module 14, configured to adjust the score of each second index of the frame picture before weighted summation of the scores of the P second indexes of the frame picture; the adjusting the score of each second index of the frame picture comprises: calculating to obtain a second ratio, wherein the second ratio is the ratio of the score of the pth second index of the nth frame picture to a second parameter, and the second parameter is the largest score in the scores of the pth second indexes of the N frame pictures; and taking the second ratio as the score of the pth second index of the nth frame picture, wherein N is an integer and is more than or equal to 1 and less than or equal to N.
In a specific example, the P second indicators include at least one selected from the following indicators:
the size of the target area;
a center coordinate of the target area;
the approximation of the shape of the target area to a rectangle;
the degree to which the target region is occluded by the foreground;
a degree of blur of an image of the target region;
a color contrast of an image of the target region;
a brightness of an image of the target area;
wherein, the target area is the area occupied by the target mark in the frame picture.
< video processing apparatus >
Fig. 5 is a schematic diagram of a video processing apparatus provided in an embodiment of the present specification.
The video processing apparatus 20 provided in this embodiment includes a processor 22 and a memory 21, where the memory 21 stores therein computer instructions, and the computer instructions are executed by the processor 22 to perform the video processing method according to any one of the foregoing embodiments.
The video processing device provided by the embodiment of the invention can automatically select the fragments to be processed from the video and eliminate the fragments, so that manpower and material resources are saved, and the processing efficiency is improved.
The video processing device provided by the embodiment of the invention utilizes the intersection ratio of the target areas of the adjacent frames when dividing the frame segments, so that the target mark areas of any two adjacent frames of the frame segments are relatively approximate, and when the target mark elimination processing is carried out on the current frame, the processing result of the adjacent frames can be fully utilized, thereby reducing the operation amount and improving the processing efficiency.
The video processing apparatus provided in the embodiment of the present invention evaluates the elimination index of each frame segment by using one or more first indexes, where the elimination index of a frame segment can integrally express an elimination effect and/or an elimination easiness degree of eliminating a target mark for the frame segment, and only a frame segment with a higher elimination index can be subjected to elimination processing of a target mark. Compared with the method for eliminating each frame of the video, the selective eliminating method provided by the embodiment of the invention has the advantages that the eliminating effect is not greatly different, but a large amount of time can be saved, and the eliminating effect, the operation amount and the eliminating time are balanced.
The video processing apparatus provided in the embodiment of the present invention evaluates the elimination index of each frame in the target frame segment by using one or more second indexes, where the elimination index of a frame can integrally express the elimination effect and/or elimination easiness of the target mark elimination on the frame, selects the frame with the highest elimination index as the starting frame, and performs elimination processing frame by frame from the starting frame forward and performs elimination processing frame by frame from the starting frame backward, so that the processing result of the starting frame can be fully utilized, the computation amount is further reduced, and the processing efficiency is improved.
Compared with a large number of engineering experiments of the inventor, the video processing device provided by the embodiment of the invention has the advantages that the experimental result shows that the probability of the situation that the replaced mark has the problems of jitter, deformation and the like is lower in the video processing method provided by the embodiment of the invention.
< computer-readable storage Medium >
The present specification further provides a computer readable storage medium, on which computer instructions are stored, and when executed by a processor, the computer instructions perform the video processing method of any one of the foregoing embodiments.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the device and apparatus embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference may be made to some descriptions of the method embodiments for relevant points.
The foregoing description has been directed to specific embodiments of this disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
Embodiments of the present description may be a system, method and/or computer instruction product. The computer instruction product may include a computer readable storage medium having computer readable program instructions embodied thereon for causing a processor to implement aspects of embodiments of the specification.
The computer readable storage medium may be a tangible device that can hold and store the instructions for use by the instruction execution device. The computer readable storage medium may be, for example, but not limited to, an electronic memory device, a magnetic memory device, an optical memory device, an electromagnetic memory device, a semiconductor memory device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a Static Random Access Memory (SRAM), a portable compact disc read-only memory (CD-ROM), a Digital Versatile Disc (DVD), a memory stick, a floppy disk, a mechanical coding device, such as punch cards or in-groove projection structures having instructions stored thereon, and any suitable combination of the foregoing. Computer-readable storage media as used herein is not to be construed as transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission medium (e.g., optical pulses through a fiber optic cable), or electrical signals transmitted through electrical wires.
The computer-readable program instructions described herein may be downloaded from a computer-readable storage medium to a respective computing/processing device, or to an external computer or external storage device via a network, such as the internet, a local area network, a wide area network, and/or a wireless network. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers and/or edge servers. The network adapter card or network interface in each computing/processing device receives computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in the respective computing/processing device.
The computer instruction instructions for carrying out operations for embodiments of the present description may be assembly instructions, Instruction Set Architecture (ISA) instructions, machine related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including an object oriented programming language such as Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider). In some embodiments, an electronic circuit, such as a programmable logic circuit, a Field Programmable Gate Array (FPGA), or a Programmable Logic Array (PLA), can execute computer-readable program instructions to implement various aspects of embodiments of the present specification by utilizing state information of the computer-readable program instructions to personalize the electronic circuit.
Aspects of embodiments of the present specification are described herein with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer instruction products according to embodiments of the specification. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer-readable program instructions.
These computer-readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks. These computer-readable program instructions may also be stored in a computer-readable storage medium that can direct a computer, programmable data processing apparatus, and/or other devices to function in a particular manner, such that the computer-readable medium storing the instructions comprises an article of manufacture including instructions which implement the function/act specified in the flowchart and/or block diagram block or blocks.
The computer readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other devices to cause a series of operational steps to be performed on the computer, other programmable apparatus or other devices to produce a computer implemented process such that the instructions which execute on the computer, other programmable apparatus or other devices implement the functions/acts specified in the flowchart and/or block diagram block or blocks.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer instruction products according to various embodiments of the present description. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions. It is well known to those skilled in the art that implementation by hardware, by software, and by a combination of software and hardware are equivalent.
The foregoing description of the embodiments of the present specification has been presented for purposes of illustration and description, but is not intended to be exhaustive or limited to the embodiments disclosed. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope of the described embodiments. The terms used herein were chosen in order to best explain the principles of the embodiments, the practical application, or technical improvements to the techniques in the marketplace, or to enable others of ordinary skill in the art to understand the embodiments disclosed herein.
Claims (16)
1. A video processing method, comprising the steps of:
acquiring a mark set to be eliminated, wherein the mark set to be eliminated comprises at least one mark;
dividing a frame segment corresponding to the logo in the video in the case that a frame picture containing the logo exists in the video, wherein the frame segment comprises one frame picture containing the logo or a plurality of continuous frame pictures containing the logo;
calculating to obtain an elimination index of the frame segment according to a preset K first indexes, wherein the elimination index of the frame segment is an index related to elimination of a target mark in the frame segment, the target mark is a mark corresponding to the frame segment, K is an integer and is more than or equal to 1;
selecting a target frame segment from all the frame segments according to the elimination indexes of the frame segments;
and eliminating the target mark of the target frame segment of the video.
2. The method of claim 1, the logo being a brand logo of a brand to be eliminated.
3. The method according to claim 1, wherein when the frame segment comprises a plurality of frame pictures, the intersection ratio of the target areas of any two adjacent frame pictures is greater than a preset threshold, and the target area is the area occupied by the target mark in the frame pictures.
4. The method of claim 1, wherein the target frame segment is eliminated by any one of the following methods:
carrying out fuzzy processing on a target area of a frame picture in the target frame segment;
carrying out shielding treatment on a target area of a frame picture in the target frame segment;
replacing the image of the target area of the frame picture in the target frame segment;
wherein, the target area is the area occupied by the target mark in the frame picture.
5. The method according to claim 1, wherein the calculating the elimination index of the frame segment according to a preset K first indexes comprises:
calculating the score of each first index of the frame segment according to the evaluation mechanism corresponding to each first index;
and calculating to obtain the elimination index of the frame segment according to the score of the K first indexes of the frame segment.
6. The method according to claim 5, wherein the calculating a score of each first indicator of the frame segment according to the evaluation mechanism corresponding to each first indicator includes:
calculating to obtain the score of the kth first index of each frame picture of the frame segment according to an evaluation mechanism corresponding to the kth first index, wherein K is an integer and is more than or equal to 1 and less than or equal to K;
and calculating to obtain the average value of the scores of the kth item first indexes of all the frame pictures of the frame segment, and taking the average value as the score of the kth item first index of the frame segment.
7. The method according to claim 5, wherein the calculating the elimination index of the frame segment according to the score of the K first indexes of the frame segment comprises:
determining the elimination index of the frame segment to be zero under the condition that the score of at least one first index in the K first indexes of the frame segment is smaller than the index threshold corresponding to the first index;
in other cases, the scores of the K first indexes of the frame segment are weighted and summed according to the weight of each first index to obtain a first sum value, and the first sum value is used as the elimination index of the frame segment.
8. The method of claim 7, wherein the number of the segments divided in the video is M, M is an integer and M ≧ 2;
adjusting the score of each first index of the frame segment before weighted summation of the scores of the K first indexes of the frame segment;
the adjusting the score of each first index of the frame segment comprises:
calculating to obtain a first ratio, wherein the first ratio is the ratio of the score of the kth first index of the mth frame segment to a first parameter, the first parameter is the largest score in the scores of the kth first indexes of the M frame segments, K is an integer and is greater than or equal to 1 and less than or equal to K;
and taking the first ratio as the score of the kth item first index of the mth frame segment, wherein M is an integer and is more than or equal to 1 and less than or equal to M.
9. The method of claim 1, wherein the K first indicators comprise at least one indicator selected from the following:
the size of the target area;
a center coordinate of the target area;
the approximation of the shape of the target area to a rectangle;
the degree to which the target region is occluded by the foreground;
a degree of blur of an image of the target region;
a color contrast of an image of the target region;
a brightness of an image of the target area;
the number of frames of the frame segment;
the degree of change in the area of the target region between the frame and the previous or subsequent frame;
the degree of change of the center coordinates of the target area of the frame picture and the previous frame picture or the next frame picture;
a degree of conversion of brightness of an image of a target region of the frame picture and a previous frame picture or a subsequent frame picture;
wherein the target area is an area occupied by the target mark in the frame picture.
10. The method according to claim 1, wherein in the case that the target frame segment includes a plurality of frame pictures, performing target flag elimination processing on the target frame segment includes:
calculating to obtain an elimination index of each frame picture in the target frame segment according to a preset P second index, wherein the elimination index of the frame picture is an index related to elimination of a target mark in the frame picture, P is an integer and is more than or equal to 1;
determining the frame picture with the highest elimination index in the target frame segment as a starting frame picture;
eliminating the target mark of the initial frame picture;
starting from the previous frame of the starting frame to the first frame of the target frame segment, carrying out target mark elimination processing frame by frame, wherein the processing result of the next frame of the current frame is utilized to process the current frame;
and carrying out target mark elimination processing frame by frame from the frame after the starting frame to the last frame of the target frame segment, wherein the current frame is processed by using the processing result of the frame before the current frame.
11. The method according to claim 10, wherein the calculating, according to the preset P second indexes, an elimination index of each frame picture in the target frame segment includes:
calculating the score of each second index of the frame picture according to the evaluation mechanism corresponding to each second index;
determining the elimination index of the frame picture to be zero when the score of at least one second index in the P second indexes of the frame picture is smaller than the index threshold corresponding to the second index;
in other cases, the scores of the P second indexes of the frame picture are weighted and summed according to the weight of each second index to obtain a second sum value, and the second sum value is used as the elimination index of the frame picture.
12. The method of claim 11, wherein the target frame segment comprises a total of N frame pictures, N being an integer and N ≧ 2;
adjusting the score of each item of second index of the frame picture before weighted summing the scores of the P items of second index of the frame picture;
the adjusting the score of each second index of the frame picture comprises:
calculating to obtain a second ratio, wherein the second ratio is the ratio of the score of the pth second index of the nth frame picture to a second parameter, and the second parameter is the largest score in the scores of the pth second indexes of the N frame pictures;
and taking the second ratio as the score of the pth second index of the nth frame picture, wherein N is an integer and is more than or equal to 1 and less than or equal to N.
13. The method of claim 10, wherein the P second indicators comprise at least one indicator selected from the following:
the size of the target area;
a center coordinate of the target area;
the approximation of the shape of the target area to a rectangle;
the degree to which the target region is occluded by the foreground;
a degree of blur of an image of the target region;
a color contrast of an image of the target region;
a brightness of an image of the target area;
wherein, the target area is the area occupied by the target mark in the frame picture.
14. A video processing device comprises a detection module, a calculation module, a screening module and an elimination module;
the detection module is used for acquiring a set of marks to be eliminated, wherein the set of marks to be eliminated comprises at least one mark; dividing a frame segment corresponding to the logo in the video in the case that a frame picture containing the logo exists in the video, wherein the frame segment comprises one frame picture containing the logo or a plurality of continuous frame pictures containing the logo;
the calculating module is used for calculating and obtaining the elimination index of the frame segment according to a preset K first indexes, the elimination index of the frame segment is an index related to the elimination of a target mark in the frame segment, the target mark is a mark corresponding to the frame segment, K is an integer and is more than or equal to 1;
the screening module is used for selecting a target frame segment from all the frame segments according to the elimination indexes of the frame segments;
and the elimination module is used for eliminating the target mark of the target frame segment of the video.
15. A video processing apparatus comprising a processor and a memory, the memory having stored therein computer instructions which, when executed by the processor, perform the method of any of claims 1-13.
16. A computer readable storage medium having stored thereon computer instructions which, when executed by a processor, perform the method of any of claims 1-13.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911275794.1A CN111010606B (en) | 2019-12-12 | 2019-12-12 | Video processing method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911275794.1A CN111010606B (en) | 2019-12-12 | 2019-12-12 | Video processing method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111010606A true CN111010606A (en) | 2020-04-14 |
CN111010606B CN111010606B (en) | 2022-02-15 |
Family
ID=70115590
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201911275794.1A Active CN111010606B (en) | 2019-12-12 | 2019-12-12 | Video processing method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111010606B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111985419A (en) * | 2020-08-25 | 2020-11-24 | 腾讯科技(深圳)有限公司 | Video processing method and related equipment |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090049484A1 (en) * | 2007-08-15 | 2009-02-19 | At&T Knowledge Ventures, L.P. | Method and system for image alteration |
CN103336954A (en) * | 2013-07-08 | 2013-10-02 | 北京捷成世纪科技股份有限公司 | Identification method and device of station caption in video |
CN103761527A (en) * | 2012-09-17 | 2014-04-30 | 汤姆逊许可公司 | Device and method for detecting the presence of a logo in a picture |
CN104918107A (en) * | 2015-05-29 | 2015-09-16 | 小米科技有限责任公司 | Video file identification processing method and device |
CN105025361A (en) * | 2015-07-29 | 2015-11-04 | 西安交通大学 | Real-time station caption eliminating method |
CN105611373A (en) * | 2015-12-23 | 2016-05-25 | 小米科技有限责任公司 | Video picture processing method and device |
CN106792153A (en) * | 2016-12-01 | 2017-05-31 | 腾讯科技(深圳)有限公司 | A kind of video labeling processing method and processing device |
-
2019
- 2019-12-12 CN CN201911275794.1A patent/CN111010606B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090049484A1 (en) * | 2007-08-15 | 2009-02-19 | At&T Knowledge Ventures, L.P. | Method and system for image alteration |
CN103761527A (en) * | 2012-09-17 | 2014-04-30 | 汤姆逊许可公司 | Device and method for detecting the presence of a logo in a picture |
CN103336954A (en) * | 2013-07-08 | 2013-10-02 | 北京捷成世纪科技股份有限公司 | Identification method and device of station caption in video |
CN104918107A (en) * | 2015-05-29 | 2015-09-16 | 小米科技有限责任公司 | Video file identification processing method and device |
CN105025361A (en) * | 2015-07-29 | 2015-11-04 | 西安交通大学 | Real-time station caption eliminating method |
CN105611373A (en) * | 2015-12-23 | 2016-05-25 | 小米科技有限责任公司 | Video picture processing method and device |
CN106792153A (en) * | 2016-12-01 | 2017-05-31 | 腾讯科技(深圳)有限公司 | A kind of video labeling processing method and processing device |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111985419A (en) * | 2020-08-25 | 2020-11-24 | 腾讯科技(深圳)有限公司 | Video processing method and related equipment |
Also Published As
Publication number | Publication date |
---|---|
CN111010606B (en) | 2022-02-15 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR102593020B1 (en) | Image processing methods and devices, electronic devices and storage media | |
CN109688463B (en) | Clip video generation method and device, terminal equipment and storage medium | |
EP3737083A1 (en) | Learning-based sampling for image matting | |
US11443438B2 (en) | Network module and distribution method and apparatus, electronic device, and storage medium | |
CN110177295B (en) | Subtitle out-of-range processing method and device and electronic equipment | |
CN109145970B (en) | Image-based question and answer processing method and device, electronic equipment and storage medium | |
CN110363753B (en) | Image quality evaluation method and device and electronic equipment | |
CN109697387B (en) | Motion direction prediction method and device, electronic equipment and storage medium | |
CN110070551B (en) | Video image rendering method and device and electronic equipment | |
CN110264545A (en) | Picture Generation Method, device, electronic equipment and storage medium | |
JP2015532988A (en) | Method and apparatus for identifying object in image | |
CN111192190B (en) | Method and device for eliminating image watermark and electronic equipment | |
US10810462B2 (en) | Object detection with adaptive channel features | |
CN111179159B (en) | Method and device for eliminating target image in video, electronic equipment and storage medium | |
CN110543849B (en) | Detector configuration method and device, electronic equipment and storage medium | |
CN110222726A (en) | Image processing method, device and electronic equipment | |
WO2023160617A1 (en) | Video frame interpolation processing method, video frame interpolation processing device, and readable storage medium | |
CN108986117B (en) | Video image segmentation method and device | |
CN108665769B (en) | Network teaching method and device based on convolutional neural network | |
CN112752158A (en) | Video display method and device, electronic equipment and storage medium | |
CN111010606B (en) | Video processing method and device | |
CN114444653A (en) | Method and system for evaluating influence of data augmentation on deep learning model performance | |
CN112036517B (en) | Image defect classification method and device and electronic equipment | |
CN111626922B (en) | Picture generation method and device, electronic equipment and computer readable storage medium | |
CN111126372B (en) | Logo region marking method and device in video and electronic equipment |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |