[go: up one dir, main page]

CN113453017B - Video processing method, device, equipment and computer program product - Google Patents

Video processing method, device, equipment and computer program product Download PDF

Info

Publication number
CN113453017B
CN113453017B CN202110715548.4A CN202110715548A CN113453017B CN 113453017 B CN113453017 B CN 113453017B CN 202110715548 A CN202110715548 A CN 202110715548A CN 113453017 B CN113453017 B CN 113453017B
Authority
CN
China
Prior art keywords
frame
color
processed
video
image
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110715548.4A
Other languages
Chinese (zh)
Other versions
CN113453017A (en
Inventor
张健
李立锋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Mobile Communications Group Co Ltd
MIGU Culture Technology Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
MIGU Culture Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Mobile Communications Group Co Ltd, MIGU Culture Technology Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN202110715548.4A priority Critical patent/CN113453017B/en
Publication of CN113453017A publication Critical patent/CN113453017A/en
Application granted granted Critical
Publication of CN113453017B publication Critical patent/CN113453017B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/50Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding
    • H04N19/593Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding involving spatial prediction techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/22Matching criteria, e.g. proximity measures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T9/00Image coding
    • G06T9/004Predictors, e.g. intraframe, interframe coding
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • H04N19/172Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a picture, frame or field

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Multimedia (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Signal Processing (AREA)
  • Evolutionary Computation (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Computational Linguistics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Health & Medical Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Evolutionary Biology (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Image Processing (AREA)
  • Image Analysis (AREA)
  • Processing Of Color Television Signals (AREA)

Abstract

The invention discloses a video processing method, which comprises the following steps: performing lens segmentation operation on a key frame of a video to be processed to obtain a plurality of image groups; acquiring color difference, and respectively determining each reference frame and a frame to be processed based on the first frame; respectively acquiring color value corresponding relations between the part areas of the frames to be processed in each image group and the color value ranges; and acquiring a first low color gamut image frame corresponding to each frame to be processed, and determining a compressed video corresponding to the video to be processed based on the color difference, the first low color gamut image frame, the color value corresponding relation and the reference frame. The invention also discloses a video processing device, equipment and a computer program product. According to the method, the structure of the key frame is disassembled, the color value ranges of different part areas are compressed, the compression ratio of intraframe compression is improved, the selection of the reference frame is carried out according to the similarity of each frame in each lens, and the accuracy of the reference frame is improved.

Description

视频处理方法、装置、设备及计算机程序产品Video processing method, apparatus, apparatus and computer program product

技术领域technical field

本发明涉及视频处理领域,尤其涉及一种视频处理方法、装置、设备及计算机程序产品。The present invention relates to the field of video processing, and in particular, to a video processing method, apparatus, device and computer program product.

背景技术Background technique

随着智能手机、平板电脑和电子阅读器之类的移动设备的发展,多媒体数据在移动终端上的使用也越来越广泛。由于移动终端所处的网络环境易变且复杂,使得可用带宽容易受到限制,所以在移动终端需要下载或上传数据量较大的视频文件至网络侧时,通常都需要对视频文件进行压缩。With the development of mobile devices such as smart phones, tablet computers, and e-readers, multimedia data is widely used on mobile terminals. Since the network environment where the mobile terminal is located is volatile and complex, the available bandwidth is easily limited. Therefore, when the mobile terminal needs to download or upload a video file with a large amount of data to the network side, the video file usually needs to be compressed.

通常,视频压缩包括帧内压缩及帧间压缩。帧内压缩技术压缩单独的帧,常称为I-帧或关键帧。帧间压缩技术参考以前帧或后续帧压缩帧,它们通常称为预计帧、P-帧、或B-帧。现有的视频压缩,采用的是GOP(Group of Pictures,画面组)内关键帧帧内压缩,以及利用图像残差的帧间预测的方式进行视频压缩。但是,现有的帧内压缩方式,并未对同镜头内的关键帧的不同区域进行处理,导致帧内压缩的压缩比较低。Generally, video compression includes intra-frame compression and inter-frame compression. Intra-frame compression techniques compress individual frames, often referred to as I-frames or keyframes. Interframe compression techniques compress frames with reference to previous or subsequent frames, which are commonly referred to as predicted frames, P-frames, or B-frames. Existing video compression adopts intra-frame compression of key frames in a GOP (Group of Pictures, group of pictures), and video compression is performed by means of inter-frame prediction of image residuals. However, the existing intra-frame compression methods do not process different regions of key frames in the same shot, resulting in low compression of intra-frame compression.

上述内容仅用于辅助理解本发明的技术方案,并不代表承认上述内容是现有技术。The above content is only used to assist the understanding of the technical solutions of the present invention, and does not mean that the above content is the prior art.

发明内容SUMMARY OF THE INVENTION

本发明的主要目的在于提供一种视频处理方法、装置、设备及计算机程序产品,旨在解决现有的视频压缩中关键帧帧内压缩的压缩比较低的技术问题。The main purpose of the present invention is to provide a video processing method, device, equipment and computer program product, aiming at solving the technical problem of low compression ratio of key frame intra-frame compression in the existing video compression.

为实现上述目的,本发明提供一种视频处理方法,所述视频处理方法包括以下步骤:In order to achieve the above object, the present invention provides a video processing method, and the video processing method includes the following steps:

对待处理视频的关键帧进行镜头分割操作,以获得多个图像组,其中,所述图像组中的各帧属于同一镜头;Performing a shot segmentation operation on the key frames of the video to be processed to obtain multiple image groups, wherein each frame in the image group belongs to the same shot;

获取各个图像组中人物以及物体的颜色差,分别基于图像组中相邻量两帧之间的相似度确定各帧的目标相似度,分别确定各个图像组中目标相似度大于或等于预设阈值的第一帧,基于所述第一帧分别确定各个的参考帧以及待处理帧;Obtain the color difference of people and objects in each image group, determine the target similarity of each frame based on the similarity between two adjacent frames in the image group, respectively determine that the target similarity in each image group is greater than or equal to a preset threshold The first frame, based on the first frame to determine the respective reference frame and the frame to be processed;

对所述待处理帧进行结构拆解操作,以分别获得待处理帧中的部位区域对应的色值范围,分别获取各个图像组中待处理帧的部位区域与色值范围之间的色值对应关系;Perform a structural disassembly operation on the to-be-processed frame to obtain the color value range corresponding to the part area in the to-be-processed frame respectively, and obtain the color value correspondence between the part area of the to-be-processed frame and the color value range in each image group respectively relation;

获取各个所述待处理帧对应的第一低色域图像帧,基于所述颜色差、所述第一低色域图像帧、所述色值对应关系以及所述参考帧,确定所述待处理视频对应的压缩视频。Acquire a first low-color gamut image frame corresponding to each of the frames to be processed, and determine the to-be-processed image frame based on the color difference, the first low-color gamut image frame, the color value correspondence, and the reference frame The compressed video corresponding to the video.

进一步地,所述对所述待处理帧进行结构拆解操作,以分别获得待处理帧中的部位区域对应的色值范围的步骤包括:Further, the step of performing a structure disassembly operation on the to-be-processed frame to obtain the color value ranges corresponding to the part regions in the to-be-processed frame respectively includes:

基于预设rgb颜色分区分别对所述待处理帧映射,以获得映射后的待处理帧,获取映射后的待处理帧对应的第二低色域图像帧,基于色值连续性规则确定各个第二低色域图像帧中的分界线,并基于所述分界线分别确定待处理帧中的部位区域,基于所述待处理帧获取各个部位区域对应的色值范围;或者,Based on the preset rgb color partitions, the to-be-processed frames are respectively mapped, to obtain the mapped to-be-processed frames, to obtain the second low-color gamut image frames corresponding to the mapped to-be-processed frames, and to determine each first image frame based on the color value continuity rule. A dividing line in a low-color gamut image frame, and based on the dividing line, respectively determine the part regions in the frame to be processed, and obtain the color value range corresponding to each part region based on the to-be-processed frame; or,

对所述待处理帧图像识别操作,以获得待处理帧中的部位区域,基于所述待处理帧获取各个部位区域对应的色值范围,其中,所述部位区域包括待处理帧中人物或物体的不同部位。Recognize the image of the frame to be processed to obtain the part area in the frame to be processed, and obtain the color value range corresponding to each part area based on the frame to be processed, wherein the part area includes a person or object in the frame to be processed different parts of.

进一步地,所述获取各个所述待处理帧对应的第一低色域图像帧的步骤包括:Further, the step of acquiring the first low color gamut image frame corresponding to each of the to-be-processed frames includes:

将所述述待处理帧转换为黑白图像帧或者线框图像帧,以获得所述第一低色域图像帧;或者,Convert the frame to be processed into a black and white image frame or a wireframe image frame to obtain the first low color gamut image frame; or,

基于图像边缘检测算法,确定各个待处理帧中的物体轮廓,对所述物体轮廓的轮廓坐标进行傅里叶变换操作,以获得所述第一低色域图像帧。Based on an image edge detection algorithm, the outline of the object in each frame to be processed is determined, and a Fourier transform operation is performed on the outline coordinates of the outline of the object to obtain the first low-color gamut image frame.

进一步地,所述分别基于图像组中相邻量两帧之间的相似度确定各帧的目标相似度的步骤包括:Further, the steps of determining the target similarity of each frame based on the similarity between two adjacent frames in the image group respectively include:

基于预设rgb颜色分区,分别对所述各个图像组中的图像帧进行映射,以获得映射后的图像组;Based on the preset rgb color partition, map the image frames in the respective image groups to obtain the mapped image groups;

获取映射后的图像组中各个图像帧的颜色直方图向量,基于所述颜色直方图向量确定各个图像组中相邻量两帧之间的相似度,基于所述确定各帧的目标相似度;或者,Obtaining the color histogram vector of each image frame in the image group after mapping, determining the similarity between two adjacent frames in each image group based on the color histogram vector, and determining the target similarity of each frame based on the description; or,

对映射后的图像组进行归一化操作,以获得归一化后的图像组,获取归一化后的图像组中相邻两个图像帧之间的差异化像素点对应的像素对,并确定各个像素对之间的像素相似度;基于所述像素相似度,确定各个图像组中相邻量两帧之间的相似度,基于所述相似度确定各帧的目标相似度。Perform a normalization operation on the mapped image group to obtain a normalized image group, obtain the pixel pairs corresponding to the differentiated pixel points between two adjacent image frames in the normalized image group, and Determine the pixel similarity between each pixel pair; based on the pixel similarity, determine the similarity between two adjacent frames in each image group, and determine the target similarity of each frame based on the similarity.

进一步地,所述基于所述颜色差、所述第一低色域图像帧、所述色值对应关系以及所述参考帧,确定所述待处理视频对应的压缩视频的步骤包括:Further, the step of determining the compressed video corresponding to the to-be-processed video based on the color difference, the first low color gamut image frame, the color value correspondence and the reference frame includes:

获取各个所述待处理帧对应的低色域图片以及包括UV分量的彩色图片,将所述低色域图片作为待训练GAN模型的输入,将所述彩色图片作为待训练GAN模型的输出进行模型训练,以获得预训练的GAN模型,其中,所述待训练GAN模型为所述待处理视频的风格对应的模型GAN;Obtain the low color gamut picture corresponding to each of the frames to be processed and the color picture including the UV component, use the low color gamut picture as the input of the GAN model to be trained, and use the color picture as the output of the GAN model to be trained. training to obtain a pre-trained GAN model, wherein the GAN model to be trained is a model GAN corresponding to the style of the video to be processed;

若各个图像组存在目标相似度小于预设阈值的第二帧,则基于所述颜色差、预训练的GAN模型、所述低色域图片、第二帧、所述色值对应关系以及所述参考帧,确定所述待处理视频对应的压缩视频;If each image group has a second frame whose target similarity is less than the preset threshold, then based on the color difference, the pre-trained GAN model, the low color gamut picture, the second frame, the color value correspondence, and the reference frame, determine the compressed video corresponding to the to-be-processed video;

若各个图像组不存在目标相似度小于预设阈值的第二帧,则基于所述颜色差、预训练的GAN模型、所述低色域图片、所述色值对应关系以及所述参考帧,确定所述待处理视频对应的压缩视频。If each image group does not have a second frame whose target similarity is less than the preset threshold, then based on the color difference, the pre-trained GAN model, the low color gamut picture, the color value correspondence, and the reference frame, Determine the compressed video corresponding to the video to be processed.

进一步地,所述基于所述颜色差、所述第一低色域图像帧、所述色值对应关系以及所述参考帧,确定所述待处理视频对应的压缩视频的步骤之后,所述视频处理方法还包括:Further, after the step of determining the compressed video corresponding to the to-be-processed video based on the color difference, the first low color gamut image frame, the color value correspondence and the reference frame, the video Processing methods also include:

获取压缩视频对应的预训练的GAN模型,将所述压缩视频中的视频帧输入预训练的GAN模型进行模型训练,以获得训练后的视频帧;Obtain the pre-trained GAN model corresponding to the compressed video, and input the video frame in the compressed video into the pre-trained GAN model for model training to obtain the video frame after training;

基于所述压缩视频的各个图像组中参考帧的Y值,对训练后的视频帧中各个图像组进行处理,以获得处理后的视频帧;Based on the Y value of the reference frame in each image group of the compressed video, each image group in the trained video frame is processed to obtain a processed video frame;

基于压缩视频中的颜色差以及色值对应关系,确定处理后的视频帧对应的各个图像组是否存在颜色差异图像组;Determine whether each image group corresponding to the processed video frame has a color difference image group based on the color difference and the color value correspondence in the compressed video;

若不存在,则将处理后的视频帧作为解码后的目标视频。If it does not exist, the processed video frame is used as the decoded target video.

进一步地,所述确定处理后的视频帧的各个图像组是否存在颜色差异图像组的步骤之后,还包括:Further, after the step of determining whether each image group of the processed video frame has a color difference image group, it also includes:

若存在,则获取颜色差异图像组中的差异图像帧对应的第一色彩分布,以及差异图像组中的参考帧对应的第二色彩分布;If there is, acquiring the first color distribution corresponding to the difference image frame in the color difference image group, and the second color distribution corresponding to the reference frame in the difference image group;

基于所述第二色彩分布对所述第一色彩分布进行匹配处理,以获得处理后的差异图像帧,并采用处理后的差异图像帧替换颜色差异图像组中的差异图像帧,得到处理后的颜色差异图像组;Matching processing is performed on the first color distribution based on the second color distribution to obtain the processed difference image frame, and the processed difference image frame is used to replace the difference image frame in the color difference image group, and the processed difference image frame is obtained. Color difference image group;

基于处理后的颜色差异图像组以及处理后的视频帧中的正常图像组,确定所述目标视频。The target video is determined based on the processed group of color difference pictures and the group of normal pictures in the processed video frame.

此外,为实现上述目的,本发明还提供一种视频处理装置,所述视频处理装置包括:In addition, in order to achieve the above object, the present invention also provides a video processing device, the video processing device comprising:

分割模块,用于对待处理视频的关键帧进行镜头分割操作,以获得多个图像组,其中,所述图像组中的各帧属于同一镜头;a segmentation module, configured to perform a shot segmentation operation on the key frames of the video to be processed to obtain multiple image groups, wherein each frame in the image group belongs to the same shot;

第一获取模块,用于获取各个图像组中人物以及物体的颜色差,分别基于图像组中相邻量两帧之间的相似度确定各帧的目标相似度,分别确定各个图像组中目标相似度大于或等于预设阈值的第一帧,基于所述第一帧分别确定各个的参考帧以及待处理帧;The first acquisition module is used to acquire the color difference of the characters and objects in each image group, determine the target similarity of each frame based on the similarity between two adjacent frames in the image group, respectively determine the target similarity in each image group a first frame whose degree is greater than or equal to a preset threshold, and each reference frame and a frame to be processed are respectively determined based on the first frame;

拆解模块,用于对所述待处理帧进行结构拆解操作,以分别获得待处理帧中的部位区域对应的色值范围,分别获取各个图像组中待处理帧的部位区域与色值范围之间的色值对应关系;A dismantling module, configured to perform a structural dismantling operation on the to-be-processed frame, so as to obtain the color value range corresponding to the part area in the to-be-processed frame, respectively, and to obtain the part area and color value range of the to-be-processed frame in each image group respectively The color value correspondence between;

第二获取模块,用于获取各个所述待处理帧对应的第一低色域图像帧,基于所述颜色差、所述第一低色域图像帧、所述色值对应关系以及所述参考帧,确定所述待处理视频对应的压缩视频。The second acquisition module is configured to acquire the first low color gamut image frame corresponding to each of the frames to be processed, based on the color difference, the first low color gamut image frame, the color value correspondence and the reference frame, and determine the compressed video corresponding to the video to be processed.

此外,为实现上述目的,本发明还提供一种视频处理设备,所述视频处理设备包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的视频处理程序,所述视频处理程序被所述处理器执行时实现前述的视频处理方法的步骤。In addition, in order to achieve the above object, the present invention also provides a video processing device, the video processing device includes: a memory, a processor, and a video processing program stored in the memory and running on the processor. When the video processing program is executed by the processor, the steps of the aforementioned video processing method are implemented.

此外,为实现上述目的,本发明还提供一种计算机程序产品,包括计算机程序,所述计算机程序被处理器执行时实现前述的视频处理方法的步骤。In addition, in order to achieve the above object, the present invention also provides a computer program product, including a computer program, which implements the steps of the aforementioned video processing method when the computer program is executed by a processor.

本发明通过对待处理视频的关键帧进行镜头分割操作,以获得多个图像组,接着获取各个图像组中人物以及物体的颜色差,分别基于图像组中相邻量两帧之间的相似度确定各帧的目标相似度,分别确定各个图像组中目标相似度大于或等于预设阈值的第一帧,基于所述第一帧分别确定各个的参考帧以及待处理帧;而后对所述待处理帧进行结构拆解操作,以分别获得待处理帧中的部位区域对应的色值范围,分别获取各个图像组中待处理帧的部位区域与色值范围之间的色值对应关系;然后获取各个所述待处理帧对应的第一低色域图像帧,基于所述颜色差、所述第一低色域图像帧、所述色值对应关系以及所述参考帧,确定所述待处理视频对应的压缩视频,通过对关键帧进行结构拆解,针对不同的部位区域的色值范围进行压缩,提高了帧内压缩的压缩比。同时,根据各个镜头中各帧的相似度进行参考帧的选择,提高了参考帧的准确性。The present invention obtains a plurality of image groups by performing lens segmentation on the key frames of the video to be processed, and then obtains the color difference of the characters and objects in each image group, and determines the difference based on the similarity between two adjacent frames in the image group respectively. For the target similarity of each frame, determine the first frame of each image group whose target similarity is greater than or equal to a preset threshold, and determine each reference frame and to-be-processed frame based on the first frame; and then determine the to-be-processed frame. The frame is subjected to a structural disassembly operation to obtain the color value range corresponding to the part area in the frame to be processed, and obtain the color value correspondence between the part area of the frame to be processed and the color value range in each image group; then obtain each image group. The first low color gamut image frame corresponding to the to-be-processed frame, based on the color difference, the first low-color gamut image frame, the color value correspondence, and the reference frame, determine that the to-be-processed video corresponds to Compressed video, by dismantling the structure of key frames, compressing the color value range of different parts and regions, and improving the compression ratio of intra-frame compression. At the same time, the reference frame is selected according to the similarity of each frame in each shot, which improves the accuracy of the reference frame.

附图说明Description of drawings

图1是本发明实施例方案涉及的硬件运行环境中视频处理设备的结构示意图;1 is a schematic structural diagram of a video processing device in a hardware operating environment involved in an embodiment of the present invention;

图2为本发明视频处理方法第一实施例的流程示意图;2 is a schematic flowchart of a first embodiment of a video processing method according to the present invention;

图3为本发明视频处理方法一实施例中对待处理帧进行结构拆解的示意图;3 is a schematic diagram of disassembling the structure of a frame to be processed in an embodiment of the video processing method of the present invention;

图4为本发明视频处理装置一实施例的功能模块示意图。FIG. 4 is a schematic diagram of functional modules of an embodiment of a video processing apparatus according to the present invention.

本发明目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。The realization, functional characteristics and advantages of the present invention will be further described with reference to the accompanying drawings in conjunction with the embodiments.

具体实施方式Detailed ways

应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。It should be understood that the specific embodiments described herein are only used to explain the present invention, but not to limit the present invention.

如图1所示,图1是本发明实施例方案涉及的硬件运行环境中视频处理设备的结构示意图。As shown in FIG. 1 , FIG. 1 is a schematic structural diagram of a video processing device in a hardware operating environment involved in an embodiment of the present invention.

本发明实施例视频处理设备可以是PC,也可以是智能手机、平板电脑、电子书阅读器、MP3(Moving Picture Experts Group Audio Layer III,动态影像专家压缩标准音频层面3)播放器、MP4(Moving Picture Experts Group Audio Layer IV,动态影像专家压缩标准音频层面4)播放器、便携计算机等具有显示功能的可移动式终端设备。The video processing device in the embodiment of the present invention may be a PC, or a smart phone, a tablet computer, an e-book reader, an MP3 (Moving Picture Experts Group Audio Layer III) player, an MP4 (Moving Picture Experts Group Audio Layer III) player, and an MP4 (Moving Picture Experts Group Audio Layer III). Picture Experts Group Audio Layer IV, moving image expert compression standard audio layer 4) Players, portable computers and other portable terminal devices with display functions.

如图1所示,该视频处理设备可以包括:处理器1001,例如CPU,网络接口1004,用户接口1003,存储器1005,通信总线1002。其中,通信总线1002用于实现这些组件之间的连接通信。用户接口1003可以包括显示屏(Display)、输入单元比如键盘(Keyboard),可选用户接口1003还可以包括标准的有线接口、无线接口。网络接口1004可选的可以包括标准的有线接口、无线接口(如WI-FI接口)。存储器1005可以是高速RAM存储器,也可以是稳定的存储器(non-volatile memory),例如磁盘存储器。存储器1005可选的还可以是独立于前述处理器1001的存储装置。As shown in FIG. 1 , the video processing device may include: a processor 1001 , such as a CPU, a network interface 1004 , a user interface 1003 , a memory 1005 , and a communication bus 1002 . Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. Optionally, the network interface 1004 may include a standard wired interface and a wireless interface (eg, a WI-FI interface). The memory 1005 may be high-speed RAM memory, or may be non-volatile memory, such as disk memory. Optionally, the memory 1005 may also be a storage device independent of the aforementioned processor 1001 .

可选地,视频处理设备还可以包括摄像头、RF(Radio Frequency,射频)电路,传感器、音频电路、WiFi模块等等。其中,传感器比如光传感器、运动传感器以及其他传感器。具体地,光传感器可包括环境光传感器及接近传感器,其中,环境光传感器可根据环境光线的明暗来调节显示屏的亮度,接近传感器可在视频处理设备移动到耳边时,关闭显示屏和/或背光。作为运动传感器的一种,重力加速度传感器可检测各个方向上(一般为三轴)加速度的大小,静止时可检测出重力的大小及方向,可用于识别移动终端姿态的应用(比如横竖屏切换、相关游戏、磁力计姿态校准)、振动识别相关功能(比如计步器、敲击)等;当然,视频处理设备还可配置陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器,在此不再赘述。Optionally, the video processing device may further include a camera, an RF (Radio Frequency, radio frequency) circuit, a sensor, an audio circuit, a WiFi module, and the like. Among them, sensors such as light sensors, motion sensors and other sensors. Specifically, the light sensor can include an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display screen according to the brightness of the ambient light, and the proximity sensor can turn off the display screen and/or when the video processing device is moved to the ear. or backlight. As a kind of motion sensor, the gravitational acceleration sensor can detect the magnitude of acceleration in all directions (generally three axes), and can detect the magnitude and direction of gravity when stationary, and can be used for applications that recognize the posture of mobile terminals (such as horizontal and vertical screen switching, related games, magnetometer attitude calibration), vibration recognition related functions (such as pedometer, tapping), etc.; of course, video processing equipment can also be equipped with gyroscopes, barometers, hygrometers, thermometers, infrared sensors and other sensors. This will not be repeated here.

本领域技术人员可以理解,图1中示出的终端结构并不构成对视频处理设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。Those skilled in the art can understand that the terminal structure shown in FIG. 1 does not constitute a limitation on the video processing device, and may include more or less components than the one shown, or combine some components, or arrange different components.

如图1所示,作为一种计算机存储介质的存储器1005中可以包括操作系统、网络通信模块、用户接口模块以及视频处理程序。As shown in FIG. 1 , the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module and a video processing program.

在图1所示的终端中,网络接口1004主要用于连接后台服务器,与后台服务器进行数据通信;用户接口1003主要用于连接客户端(用户端),与客户端进行数据通信;而处理器1001可以用于调用存储器1005中存储的视频处理程序。In the terminal shown in FIG. 1 , the network interface 1004 is mainly used to connect to the background server and perform data communication with the background server; the user interface 1003 is mainly used to connect to the client (client) and perform data communication with the client; and the processor 1001 can be used to call a video processing program stored in memory 1005 .

在本实施例中,视频处理设备包括:存储器1005、处理器1001及存储在所述存储器1005上并可在所述处理器1001上运行的视频处理程序,其中,处理器1001调用存储器1005中存储的视频处理程序时,并执行以下各个实施例中视频处理方法的步骤。In this embodiment, the video processing device includes: a memory 1005, a processor 1001, and a video processing program stored on the memory 1005 and running on the processor 1001, wherein the processor 1001 calls the memory 1005 to store the When the video processing program is created, the steps of the video processing methods in the following embodiments are executed.

本发明还提供一种视频处理方法,参照图2,图2为本发明视频处理方法第一实施例的流程示意图。The present invention also provides a video processing method. Referring to FIG. 2 , FIG. 2 is a schematic flowchart of the first embodiment of the video processing method of the present invention.

在本实施例中,该视频处理方法包括以下步骤:In this embodiment, the video processing method includes the following steps:

步骤S101,对待处理视频的关键帧进行镜头分割操作,以获得多个图像组,其中,所述图像组中的各帧属于同一镜头;Step S101, performing a shot segmentation operation on the key frame of the video to be processed to obtain a plurality of image groups, wherein each frame in the image group belongs to the same shot;

本实施例中,在获取到待处理视频时,采用镜头分割技术,对待处理视频的关键帧进行镜头分割操作,以获得多个图像组,以使每一个图像组中的各帧属于同一镜头,具体地,可以采用现有的特征比对、像素比较等镜头分割技术,当关键帧中前后两帧的图像差异大于预设差异值时,认为镜头存在变化,进而将前后两帧作为图像组的分割帧,前后两帧分别属于两个图像组,即将前帧以及之前一个分割帧的后帧之间的所有帧作为一个图像组,该图像组包括前帧以及之前一个分割帧的后帧。In this embodiment, when the video to be processed is acquired, the shot segmentation technology is used to perform shot segmentation on the key frames of the video to be processed, so as to obtain multiple image groups, so that each frame in each image group belongs to the same shot, Specifically, existing lens segmentation techniques such as feature comparison and pixel comparison can be used. When the image difference between the two frames before and after the key frame is greater than the preset difference value, it is considered that there is a change in the lens, and then the two frames before and after are regarded as the image group. For the divided frame, the two frames before and after belong to two image groups respectively, that is, all frames between the previous frame and the following frame of the previous divided frame are regarded as an image group, and the image group includes the previous frame and the latter frame of the previous divided frame.

步骤S102,获取各个图像组中人物以及物体的颜色差,基于图像组中相邻量两帧之间的相似度确定各帧的目标相似度,分别确定各个图像组中目标相似度大于或等于预设阈值的第一帧,基于所述第一帧分别确定各个的参考帧以及待处理帧;Step S102, obtain the color difference of the characters and objects in each image group, determine the target similarity of each frame based on the similarity between two adjacent frames in the image group, and determine that the target similarity in each image group is greater than or equal to the predetermined value. The first frame of the threshold is set, and each reference frame and the frame to be processed are respectively determined based on the first frame;

本实施例中,先采用图像识别算法,对各个图像组的各帧进行图像识别,以确定每一个图像组的帧中的人物以及物体,并获取各个图像组中人物的最大面积、人物的最小面积、物体的最大面积、物体的最小面积,其中,人物的最大面积以及最小面积包括图像组的关键帧中每一个人物的最大面积以及最小面积,物体的最大面积以及最小面积包括图像组的关键帧中每一个物体的最大面积以及最小面积,对于每一个图像组,分别获取各个人物的最大面积所属的人物最大帧以及最小面积所属的人物最小帧,物体的最大面积所属的物体最大帧以及最小面积所属的物体最小帧。而后基于人物最大帧中人物对应区域的像素值以及人物最小帧人物对应区域的像素值,计算人物颜色差,基于物体最大帧中物体对应区域的像素值以及物体最小帧对应区域的像素值,计算物体颜色差,并将人物颜色差以及物体颜色差作为颜色差。In this embodiment, an image recognition algorithm is first used to perform image recognition on each frame of each image group to determine the person and object in the frame of each image group, and to obtain the maximum area of the person and the minimum size of the person in each image group. Area, the maximum area of the object, and the minimum area of the object, where the maximum and minimum areas of the characters include the maximum and minimum areas of each character in the key frame of the image group, and the maximum and minimum areas of the object include the key of the image group. The maximum area and the minimum area of each object in the frame. For each image group, obtain the maximum frame of the character to which the maximum area of each character belongs and the minimum frame of the character to which the minimum area belongs, and the maximum frame and minimum frame of the object to which the maximum area of the object belongs. The minimum frame of the object to which the area belongs. Then, based on the pixel value of the area corresponding to the person in the largest frame of the person and the pixel value of the area corresponding to the person in the smallest frame of the person, the color difference of the person is calculated. The object color difference, and the character color difference and the object color difference are regarded as the color difference.

接着,获取图像组中相邻量两帧之间的相似度,具体可采用现有的相似度,并基于该相似度确定图像组中各帧的目标相似度,例如,若某一帧为图像组的起始帧或者尾帧,则将该起始帧与下一帧的相似度作为起始帧的目标相似度,将尾帧与上一帧的相似度作为尾帧的目标相似度,对于中间帧,则根据该帧与下一帧的相似度以及与上一帧的相似度确定目标相似度,例如目标相似度为与下一帧的相似度以及与上一帧的相似度的均值。Next, the similarity between two adjacent frames in the image group is obtained. Specifically, the existing similarity may be used, and the target similarity of each frame in the image group is determined based on the similarity. For example, if a certain frame is an image If the start frame or end frame of the group, the similarity between the start frame and the next frame is used as the target similarity of the start frame, and the similarity between the end frame and the previous frame is used as the target similarity of the end frame. For an intermediate frame, the target similarity is determined according to the similarity between the frame and the next frame and the similarity with the previous frame. For example, the target similarity is the average of the similarity with the next frame and the similarity with the previous frame.

在获取到各帧的目标相似度时,分别确定各个图像组中目标相似度大于或等于预设阈值的第一帧,具体地,对于每一个图像组,分别判断其各帧的目标相似度是否大于或等于预设阈值,将目标相似度大于或等于预设阈值的帧作为第一帧,并基于第一帧分别确定各个的参考帧以及待处理帧,其中,可以选取第一帧中的任一帧作为参考帧,或者,将第一帧中目标相似度最大的帧作为参考帧,将第一帧中除参考帧之外的其他帧作为待处理帧。When the target similarity of each frame is obtained, determine the first frame of each image group whose target similarity is greater than or equal to the preset threshold. Specifically, for each image group, determine whether the target similarity of each frame is Greater than or equal to the preset threshold, take the frame with the target similarity greater than or equal to the preset threshold as the first frame, and determine each reference frame and the frame to be processed based on the first frame, wherein, any one of the first frames can be selected. One frame is used as the reference frame, or the frame with the highest target similarity in the first frame is used as the reference frame, and other frames in the first frame except the reference frame are used as the frames to be processed.

需要说明的时,对于同一个镜头的图像组中的各帧,若该帧的目标相似度大于或等于预设阈值,则与上一帧以及下一帧相比,该帧中的物体或人物的颜色只是因为环境、光线等原因产生变化,属于正常范围,因此将该帧作为第一帧。当然,该帧的目标相似度小于预设阈值,则帧中的物体或人物因自身原因变化了颜色,例如,红绿灯的灯光颜色发生变换,在压缩该帧的时候,不要针对该帧进行压缩处理。It should be noted that, for each frame in the image group of the same shot, if the target similarity of the frame is greater than or equal to the preset threshold, then compared with the previous frame and the next frame, the object or person in the frame is The color of the frame is only changed due to the environment, light, etc., which belongs to the normal range, so this frame is regarded as the first frame. Of course, if the target similarity of the frame is less than the preset threshold, the object or character in the frame changes color due to its own reasons. For example, the light color of the traffic light changes. When compressing the frame, do not compress the frame. .

步骤S103,对所述待处理帧进行结构拆解操作,以分别获得待处理帧中的部位区域对应的色值范围,分别获取各个图像组中待处理帧的部位区域与色值范围之间的色值对应关系;Step S103, performing a structural disassembly operation on the frame to be processed, to obtain the color value range corresponding to the part area in the frame to be processed, respectively, and to obtain the part area and the color value range of the frame to be processed in each image group. Correspondence of color value;

本实施例中,在获取到各个图像组的待处理帧之后,对各个图像组的待处理帧进行结构拆解操作,对所述待处理帧进行结构拆解操作,以分别获得待处理帧中的部位区域对应的色值范围,其中,待处理帧中的部位区域包括人物以及物体的各个部位或者色值不连续的多个区域,而后,基于各个部位区域中像素点的rgb值确定色值范围,色值范围可以为部位区域中像素点的rgb最小值~部位区域中像素点的rgb最大值,并记录各个图像组中待处理帧的部位区域与色值范围之间的色值对应关系。In this embodiment, after the to-be-processed frames of each image group are acquired, a structure disassembly operation is performed on the to-be-processed frames of each image group, and a structure disassembly operation is performed on the to-be-processed frames, so as to obtain the The color value range corresponding to the part area of in which the part area in the frame to be processed includes various parts of the person and the object or multiple areas with discontinuous color values, and then the color value is determined based on the rgb value of the pixel in each part area. Range, the color value range can be the minimum rgb value of the pixel in the part area to the rgb maximum value of the pixel in the part area, and record the color value correspondence between the part area of the frame to be processed and the color value range in each image group .

步骤S104,获取各个所述待处理帧对应的第一低色域图像帧,基于所述颜色差、所述第一低色域图像帧、所述色值对应关系以及所述参考帧,确定所述待处理视频对应的压缩视频。Step S104: Obtain the first low color gamut image frame corresponding to each of the frames to be processed, and determine the color difference based on the color difference, the first low color gamut image frame, the color value correspondence, and the reference frame. The compressed video corresponding to the video to be processed.

本实施例中,在确定色值对应关系之后,获取各个所述待处理帧对应的第一低色域图像帧,例如,将各个待处理帧转换成黑白图片或者线框图得到各个待处理帧所对应的第一低色域图像帧,并根据颜色差、所述第一低色域图像帧、所述色值对应关系以及所述参考帧,确定所述待处理视频对应的压缩视频,即将颜色差、所述第一低色域图像帧、所述色值对应关系以及所述参考帧,按照图像组的顺序进行视频封装,得到压缩视频,In this embodiment, after the color value correspondence is determined, the first low color gamut image frame corresponding to each of the to-be-processed frames is obtained, for example, each to-be-processed frame is converted into a black and white picture or a wireframe to obtain the The corresponding first low color gamut image frame, and according to the color difference, the first low color gamut image frame, the color value correspondence and the reference frame, determine the compressed video corresponding to the to-be-processed video, that is, the color difference, the first low-color gamut image frame, the color value correspondence, and the reference frame, and perform video encapsulation in the order of the image groups to obtain a compressed video,

其中,色值对应关系可以封装至压缩视频的视频格式中,例如,若压缩视频仅用于本地使用,则可以将色值对应关系封装在视频头部,若压缩视频用于网络传输,则可根据色值对应关系得到各个图像组中待处理帧的色值对应关系,并将图像组中待处理帧的色值对应关系封装在该图像组之前。The color value correspondence can be encapsulated in the video format of the compressed video. For example, if the compressed video is only used locally, the color value correspondence can be encapsulated in the video header. If the compressed video is used for network transmission, it can be The color value corresponding relationship of the frame to be processed in each image group is obtained according to the color value corresponding relationship, and the color value corresponding relationship of the to-be-processed frame in the image group is encapsulated before the image group.

本实施例提出的视频处理方法,通过对待处理视频的关键帧进行镜头分割操作,以获得多个图像组,接着获取各个图像组中人物以及物体的颜色差,分别基于图像组中相邻量两帧之间的相似度确定各帧的目标相似度,分别确定各个图像组中目标相似度大于或等于预设阈值的第一帧,基于所述第一帧分别确定各个的参考帧以及待处理帧;而后对所述待处理帧进行结构拆解操作,以分别获得待处理帧中的部位区域对应的色值范围,分别获取各个图像组中待处理帧的部位区域与色值范围之间的色值对应关系;然后获取各个所述待处理帧对应的第一低色域图像帧,基于所述颜色差、所述第一低色域图像帧、所述色值对应关系以及所述参考帧,确定所述待处理视频对应的压缩视频,通过对关键帧进行结构拆解,针对不同的部位区域的色值范围进行压缩,提高了帧内压缩的压缩比。同时,根据各个镜头中各帧的相似度进行参考帧的选择,提高了参考帧的准确性。The video processing method proposed in this embodiment obtains multiple image groups by performing lens segmentation on the key frames of the video to be processed, and then acquires the color differences of the characters and objects in each image group, based on the two adjacent quantities in the image groups. The similarity between the frames determines the target similarity of each frame, respectively determines the first frame whose target similarity is greater than or equal to a preset threshold in each image group, and determines each reference frame and to-be-processed frame based on the first frame. Then carry out the structure disassembly operation to the frame to be processed, to obtain the color value range corresponding to the part area in the frame to be processed, respectively, to obtain the color value range between the part area of the frame to be processed and the color value range in each image group. value correspondence; then obtain the first low color gamut image frame corresponding to each of the to-be-processed frames, based on the color difference, the first low color gamut image frame, the color value correspondence and the reference frame, Determine the compressed video corresponding to the to-be-processed video, and compress the color value ranges of different parts and regions by disassembling the key frame structure, thereby improving the compression ratio of the intra-frame compression. At the same time, the reference frame is selected according to the similarity of each frame in each shot, which improves the accuracy of the reference frame.

基于第一实施例,提出本发明视频处理方法的第二实施例,在本实施例中,步骤S103包括:Based on the first embodiment, a second embodiment of the video processing method of the present invention is proposed. In this embodiment, step S103 includes:

步骤S201,基于预设rgb颜色分区分别对所述待处理帧映射,以获得映射后的待处理帧,获取映射后的待处理帧对应的第二低色域图像帧,基于色值连续性规则确定各个第二低色域图像帧中的分界线,并基于所述分界线分别确定待处理帧中的部位区域,基于所述待处理帧获取各个部位区域对应的色值范围;或者,Step S201, respectively map the to-be-processed frame based on the preset rgb color partition to obtain the mapped to-be-processed frame, obtain the second low-gamut image frame corresponding to the mapped to-be-processed frame, based on the color value continuity rule Determining a dividing line in each of the second low color gamut image frames, and respectively determining a part area in a frame to be processed based on the dividing line, and obtaining a color value range corresponding to each part area based on the frame to be processed; or,

步骤S202,对所述待处理帧图像识别操作,以获得待处理帧中的部位区域,基于所述待处理帧获取各个部位区域对应的色值范围,其中,所述部位区域包括待处理帧中人物或物体的不同部位。Step S202, perform an image recognition operation on the to-be-processed frame to obtain the part area in the to-be-processed frame, and obtain the color value range corresponding to each part area based on the to-be-processed frame, wherein the part area includes the part area in the to-be-processed frame. different parts of a person or object.

一种方式中,为减小计算量,基于预设rgb颜色分区分别对所述各个图像组中的图像帧进行映射,以获得映射后的图像组,例如,预设rgb颜色分区可以设置8个或16个分区,当然也可以设置更多的分区,在预设rgb颜色分区包括8个分区时,其r、g、b的色值范围,分别是:0~31、32~63、64~95、95~127、128~159、160~191、192~223、224~255。In one way, in order to reduce the amount of calculation, the image frames in the respective image groups are mapped based on the preset rgb color partitions to obtain the mapped image groups. For example, the preset rgb color partitions can be set to 8. Or 16 partitions, of course, more partitions can be set. When the preset rgb color partition includes 8 partitions, the color value ranges of r, g, and b are: 0~31, 32~63, 64~ 95, 95~127, 128~159, 160~191, 192~223, 224~255.

而后,获取映射后的待处理帧对应的第二低色域图像帧,即将映射后的待处理帧转换成黑白图(或者灰度图),基于色值连续性规则确定各个第二低色域图像帧中的分界线,并基于所述分界线分别确定待处理帧中的部位区域,根据色值连续性规则,确定第二低色域图像帧中相邻像素点的差异化较大且差异化颜色呈现连续性时,则认为该连续像素为不同部分的分界线。具体地,可计算各个第二低色域图像帧中相邻像素点之间的像素相似度,相邻像素点之间的像素相似度小于预设像素相似度时,确定该相邻像素点之间差值化较大,将该相邻像素点作为差异化像素点,或者,将当前像素点与其他相邻像素点的像素相似度的均值作为该当前像素点的当前相似度,将第二低色域图像帧中当前相似度小于预设像素相似度的像素点作为差异化像素点,若差异化像素点呈现连续性,则将连续的差异化像素点之间的连线作为对应的第二低色域图像帧中的分界线。而后基于所述分界线分别确定待处理帧中的部位区域,该部位区域为第二低色域图像帧中中分界线围成的各个区域,并基于待处理帧获取各个部位区域对应的色值范围。Then, obtain the second low color gamut image frame corresponding to the mapped frame to be processed, that is, convert the mapped frame to be processed into a black and white image (or grayscale image), and determine each second low color gamut based on the color value continuity rule The dividing line in the image frame, and based on the dividing line, the part regions in the frame to be processed are respectively determined, and according to the color value continuity rule, it is determined that the difference between adjacent pixels in the second low color gamut image frame is large and different When the chromatized color is continuous, the continuous pixels are considered to be the dividing lines of different parts. Specifically, the pixel similarity between adjacent pixels in each second low-color gamut image frame can be calculated, and when the pixel similarity between adjacent pixels is less than the preset pixel similarity, determine the difference between the adjacent pixels. The difference between the two is larger, and the adjacent pixel is regarded as a differentiated pixel, or the average of the pixel similarity between the current pixel and other adjacent pixels is used as the current similarity of the current pixel, and the second pixel is regarded as the difference. In the low color gamut image frame, the pixels whose current similarity is less than the preset pixel similarity are regarded as differentiated pixels. If the differentiated pixels show continuity, the connection between the consecutive differentiated pixels is regarded as the corresponding first pixel. The dividing line in a low-gamut image frame. Then, based on the demarcation line, the part area in the frame to be processed is respectively determined, and the part area is each area enclosed by the demarcation line in the second low color gamut image frame, and the color value corresponding to each part area is obtained based on the frame to be processed scope.

参照图3,图3中,有4个色值,其中3个比较颜色,其差值比较小,而另1种颜色与其它3种差异化较大,进而可以认为,上、左、右三个色值形成了分界线。Referring to Fig. 3, in Fig. 3, there are 4 color values, among which 3 colors are compared, and the difference is relatively small, while the other 1 color is more differentiated from the other 3, and it can be considered that the upper, left and right three The color values form the dividing line.

另一种方式中,对所述待处理帧图像识别操作,以获得待处理帧中的部位区域,部位区域包括待处理帧中人物或物体的不同部位,例如,对于待处理帧中的人物,部位区域包括人物的五官、头发、衣服、鞋子、装饰等。而后基于所述待处理帧获取各个部位区域对应的色值范围。In another way, the image recognition operation is performed on the frame to be processed to obtain the part area in the frame to be processed, and the part area includes different parts of the person or object in the frame to be processed, for example, for the person in the frame to be processed, The parts area includes the facial features, hair, clothes, shoes, decorations, etc. of the characters. Then, based on the to-be-processed frame, the color value range corresponding to each part region is acquired.

本实施例提出的视频处理方法,通过基于预设rgb颜色分区,分别对所述各个图像组中的图像帧进行映射,以获得映射后的图像组,获取映射后的图像组中各帧对应的第二低色域图像帧,基于色值连续性规则,确定各个第二低色域图像帧中的分界线,并基于所述分界线分别确定待处理帧中的部位区域,基于所述待处理帧获取各个部位区域对应的色值范围;或者,对各个图像组的待处理帧图像识别操作,以获得待处理帧中的部位区域,基于所述待处理帧获取各个部位区域对应的色值范围,其中,所述部位区域包括待处理帧中人物或物体的不同部位,通过根据第二低色域图像帧或者对待处理帧进行图像识别的方式,能够准确获得待处理帧中的部位区域,实现对待处理帧进行准确的结构拆解操作,进而针对不同的部位区域的色值范围进行压缩,提高了帧内压缩的压缩比。In the video processing method proposed in this embodiment, the image frames in the image groups are respectively mapped based on the preset rgb color partitions to obtain the mapped image groups, and the corresponding frames in the mapped image groups are obtained. For the second low color gamut image frame, based on the color value continuity rule, determine the dividing line in each second low color gamut image frame, and determine the part area in the frame to be processed based on the dividing line. Frame acquisition of the color value range corresponding to each part area; or, performing an image recognition operation on the to-be-processed frame image of each image group to obtain the part area in the to-be-processed frame, and based on the to-be-processed frame to acquire the color value range corresponding to each part area , wherein the part area includes different parts of the person or object in the frame to be processed, and by performing image recognition according to the second low-gamut image frame or the frame to be processed, the part area in the frame to be processed can be accurately obtained. The frame to be processed is accurately disassembled, and then the color value ranges of different parts and regions are compressed, which improves the compression ratio of intra-frame compression.

基于第一实施例,提出本发明视频处理方法的第三实施例,在本实施例中,步骤S104包括:Based on the first embodiment, a third embodiment of the video processing method of the present invention is proposed. In this embodiment, step S104 includes:

步骤S301,将所述述待处理帧转换为黑白图像帧或者线框图像帧,以获得所述第一低色域图像帧;或者,Step S301, converting the frame to be processed into a black and white image frame or a wireframe image frame to obtain the first low color gamut image frame; or,

步骤S302,基于图像边缘检测算法,确定各个待处理帧中的物体轮廓,对所述物体轮廓的轮廓坐标进行傅里叶变换操作,以获得所述第一低色域图像帧。Step S302 , determine the contour of the object in each frame to be processed based on the image edge detection algorithm, and perform Fourier transform operation on the contour coordinates of the contour of the object to obtain the first low color gamut image frame.

本实施例中,可以直接将待处理帧转换为黑白图像帧或者线框图像帧,以获得所述第一低色域图像帧,其中,黑白图像帧可以为二值图,也可以上一实施例中的灰度图。In this embodiment, the frame to be processed may be directly converted into a black-and-white image frame or a wireframe image frame to obtain the first low-color gamut image frame, wherein the black-and-white image frame may be a binary image, or the previous implementation Grayscale image in the example.

或者,基于图像边缘检测算法,确定各个待处理帧中的物体轮廓,具体采用现有的图像边缘检测算法检测各个待处理帧中的物体轮廓,而后将物体轮廓拆分为多个点,获取各个点的坐标得到物体轮廓的轮廓坐标,并对轮廓坐标进行傅里叶变换操作,以获得所述第一低色域图像帧。Or, based on the image edge detection algorithm, determine the contour of the object in each frame to be processed, specifically use the existing image edge detection algorithm to detect the contour of the object in each frame to be processed, and then split the contour of the object into multiple points to obtain each The coordinates of the points are used to obtain the contour coordinates of the contour of the object, and a Fourier transform operation is performed on the contour coordinates to obtain the first low color gamut image frame.

本实施例提出的视频处理方法,通过将所述述待处理帧转换为黑白图像帧或者线框图像帧,以获得所述第一低色域图像帧;或者,基于图像边缘检测算法,确定各个待处理帧中的物体轮廓,对所述物体轮廓的轮廓坐标进行傅里叶变换操作,以获得所述第一低色域图像帧,能够准确得到第一低色域图像帧,通过低色域图像帧进一步提高帧内压缩的压缩比。In the video processing method proposed in this embodiment, the first low-color gamut image frame is obtained by converting the frame to be processed into a black-and-white image frame or a wireframe image frame; or, based on an image edge detection algorithm, each For the contour of the object in the frame to be processed, Fourier transform is performed on the contour coordinates of the contour of the object to obtain the first low-color gamut image frame, and the first low-color gamut image frame can be accurately obtained. Image frames further improve the compression ratio of intra-frame compression.

基于第一实施例,提出本发明视频处理方法的第四实施例,在本实施例中,步骤S102包括:Based on the first embodiment, a fourth embodiment of the video processing method of the present invention is proposed. In this embodiment, step S102 includes:

步骤S401,基于预设rgb颜色分区,分别对所述各个图像组中的图像帧进行映射,以获得映射后的图像组;Step S401, based on the preset rgb color partition, map the image frames in the respective image groups to obtain the mapped image groups;

步骤S402,获取映射后的图像组中各个图像帧的颜色直方图向量,基于所述颜色直方图向量确定各个图像组中相邻量两帧之间的相似度,基于所述确定各帧的目标相似度;或者,Step S402, obtaining the color histogram vector of each image frame in the mapped image group, determining the similarity between two adjacent frames in each image group based on the color histogram vector, and determining the target of each frame based on the described color histogram vector. similarity; or,

步骤S403,对映射后的图像组进行归一化操作,以获得归一化后的图像组,获取归一化后的图像组中相邻两个图像帧之间的差异化像素点对应的像素对,并确定各个像素对之间的像素相似度;基于所述像素相似度确定各个图像组中相邻量两帧之间的相似度,基于所述确定各帧的目标相似度。Step S403, perform a normalization operation on the mapped image group to obtain a normalized image group, and obtain the pixels corresponding to the differentiated pixel points between two adjacent image frames in the normalized image group pair, and determine the pixel similarity between each pixel pair; determine the similarity between two adjacent frames in each image group based on the pixel similarity, and determine the target similarity of each frame based on the pixel similarity.

本实施例中,为减小计算量,基于预设rgb颜色分区分别对所述各个图像组中的图像帧进行映射,以获得映射后的图像组,例如,预设rgb颜色分区可以设置8个或16个分区,当然也可以设置更多的分区,在预设rgb颜色分区包括8个分区时,其r、g、b的色值范围,分别是:0~31、32~63、64~95、95~127、128~159、160~191、192~223、224~255。In this embodiment, in order to reduce the amount of calculation, the image frames in the respective image groups are mapped based on the preset rgb color partitions, so as to obtain the mapped image groups. For example, the preset rgb color partitions can be set to 8 Or 16 partitions, of course, more partitions can be set. When the preset rgb color partition includes 8 partitions, the color value ranges of r, g, and b are: 0~31, 32~63, 64~ 95, 95~127, 128~159, 160~191, 192~223, 224~255.

一实施方式中,获取映射后的图像组中各个图像帧的颜色直方图向量,即采用现有的颜色直方图向量算法,获取颜色直方图向量,并基于所述颜色直方图向量确定各个图像组中相邻量两帧之间的相似度,具体将相邻两帧对应的颜色直方图向量的余弦值作为其相似度。In one embodiment, the color histogram vector of each image frame in the mapped image group is obtained, that is, an existing color histogram vector algorithm is used to obtain the color histogram vector, and each image group is determined based on the color histogram vector The similarity between two adjacent frames in the middle, specifically, the cosine value of the color histogram vector corresponding to the two adjacent frames is used as the similarity.

另一种实施方式中,对映射后的图像组进行归一化操作,以获得归一化后的图像组,获取归一化后的图像组中相邻两个图像帧之间的差异化像素点对应的像素对,确定各个像素对之间的像素相似度,具体地,获取相邻两个图像帧的颜色分区列表,按照统一排序,找到差异化的像素点(rgb值不同的像素点),得到差异化像素点对应的像素对,再通过rgb空间向量的余弦计算各个像素对之间的像素相似度。而后,基于像素相似度确定各个图像组中相邻量两帧之间的相似度,具体地,该相似度=(像素相似度+差异化像素点的个数*1)/像素点的总数。In another embodiment, a normalization operation is performed on the mapped image group to obtain a normalized image group, and the differentiated pixels between two adjacent image frames in the normalized image group are obtained Point the corresponding pixel pair, determine the pixel similarity between each pixel pair, specifically, obtain the color partition list of two adjacent image frames, and find the differentiated pixels (pixels with different rgb values) according to the uniform sorting. , to obtain the pixel pairs corresponding to the differentiated pixel points, and then calculate the pixel similarity between each pixel pair through the cosine of the rgb space vector. Then, the similarity between two adjacent frames in each image group is determined based on the pixel similarity, specifically, the similarity=(pixel similarity+number of differentiated pixels*1)/total number of pixels.

本实施例提出的视频处理方法,通过获取映射后的图像组中各个图像帧的颜色直方图向量,基于所述颜色直方图向量,确定各个图像组中相邻量两帧之间的相似度,基于所述确定各帧的目标相似度;或者,对映射后的图像组进行归一化操作,以获得归一化后的图像组,获取归一化后的图像组中相邻两个图像帧之间的差异化像素点对应的像素对,并确定各个像素对之间的像素相似度;基于所述像素相似度,确定各个图像组中相邻量两帧之间的相似度,基于所述确定各帧的目标相似度,能够根据颜色直方图向量或者差异化像素点对应的像素对准确得到目标相似度,进而提升第一帧的准确性,进一步提高视频压缩比。The video processing method proposed in this embodiment obtains the color histogram vector of each image frame in the mapped image group, and determines the similarity between two adjacent frames in each image group based on the color histogram vector, Determine the target similarity of each frame based on the above; or, perform a normalization operation on the mapped image group to obtain a normalized image group, and obtain two adjacent image frames in the normalized image group The pixel pairs corresponding to the differentiated pixel points between them are determined, and the pixel similarity between each pixel pair is determined; based on the pixel similarity, the similarity between two adjacent frames in each image group is determined, based on the pixel similarity. Determining the target similarity of each frame can accurately obtain the target similarity according to the color histogram vector or the pixel pairs corresponding to the differentiated pixel points, thereby improving the accuracy of the first frame and further improving the video compression ratio.

基于上述各个实施例,提出本发明视频处理方法的第五实施例,在本实施例中,步骤S104包括:Based on the foregoing embodiments, a fifth embodiment of the video processing method of the present invention is proposed. In this embodiment, step S104 includes:

步骤S501,获取各个所述待处理帧对应的低色域图片以及包括UV分量的彩色图片,将所述低色域图片作为待训练GAN模型的输入,将所述彩色图片作为待训练GAN模型的输出进行模型训练,以获得预训练的GAN模型,其中,所述待训练GAN模型为所述待处理视频的风格对应的模型GAN;Step S501, obtain the low color gamut picture corresponding to each frame to be processed and the color picture including the UV component, use the low color gamut picture as the input of the GAN model to be trained, and use the color picture as the input of the GAN model to be trained. The output carries out model training to obtain a pre-trained GAN model, wherein the to-be-trained GAN model is the model GAN corresponding to the style of the to-be-processed video;

步骤S502,若各个图像组存在目标相似度小于预设阈值的第二帧,则基于所述颜色差、预训练的GAN模型、所述低色域图片、第二帧、所述色值对应关系以及所述参考帧,确定所述待处理视频对应的压缩视频;Step S502, if each image group has a second frame whose target similarity is less than a preset threshold, then based on the color difference, the pre-trained GAN model, the low color gamut picture, the second frame, and the color value corresponding relationship and the reference frame, to determine the compressed video corresponding to the video to be processed;

步骤S503,若各个图像组不存在目标相似度小于预设阈值的第二帧,则基于所述颜色差、预训练的GAN模型、所述低色域图片、所述色值对应关系以及所述参考帧,确定所述待处理视频对应的压缩视频。Step S503, if each image group does not have a second frame whose target similarity is less than a preset threshold, then based on the color difference, the pre-trained GAN model, the low color gamut picture, the color value correspondence and the With reference to the frame, the compressed video corresponding to the video to be processed is determined.

本实施例中,在获取到第一低色域图像帧之后,根据待处理视频的风格确定对应的待训练GAN模型,并获取各个所述待处理帧对应的低色域图片以及包括UV分量的彩色图片,具体地,采用现有算法将待处理帧的RGB转为色彩空间YUV(其中Y表示明亮度,也就是灰度值,U和V表示色度)。而后,将低色域图片作为待训练GAN模型的输入,将彩色图片作为待训练GAN模型的输出进行模型训练,以获得预训练的GAN模型。In this embodiment, after the first low-color gamut image frame is acquired, the corresponding GAN model to be trained is determined according to the style of the video to be processed, and the low-color gamut image corresponding to each of the to-be-processed frames and the image including the UV component are acquired. For color pictures, specifically, the RGB of the frame to be processed is converted into the color space YUV (wherein Y represents the brightness, that is, the gray value, and U and V represent the chromaticity) by using the existing algorithm. Then, the low color gamut image is used as the input of the GAN model to be trained, and the color image is used as the output of the GAN model to be trained for model training to obtain a pre-trained GAN model.

接着,判断各个图像组是否存在目标相似度小于预设阈值的第二帧,若存在,则将第二帧作为保留帧,不对该第二帧进行编码,并基于颜色差、预训练的GAN模型、低色域图片、第二帧、色值对应关系以及参考帧,确定压缩视频;即将颜色差、预训练的GAN模型、低色域图片、第二帧、色值对应关系以及参考帧,按照图像组的顺序进行视频封装,得到压缩视频。Next, determine whether each image group has a second frame whose target similarity is less than the preset threshold. If there is, the second frame is used as a reserved frame, the second frame is not encoded, and the GAN model based on color difference and pre-training is used. , low color gamut picture, second frame, color value correspondence and reference frame, determine the compressed video; that is, color difference, pre-trained GAN model, low color gamut picture, second frame, color value correspondence and reference frame, according to Video encapsulation is performed in the sequence of GOPs to obtain compressed video.

若不存在,则将颜色差、预训练的GAN模型、低色域图片、色值对应关系以及参考帧,按照图像组的顺序进行视频封装,得到压缩视频。If it does not exist, the color difference, the pre-trained GAN model, the low color gamut picture, the color value correspondence and the reference frame are encapsulated in the order of the image group to obtain the compressed video.

本实施例中,若该压缩视频为本地使用,则在进行视频封装时,仅封装该预训练的GAN模型对应的模型编号,否则可直接封装该预训练的GAN模型。In this embodiment, if the compressed video is used locally, only the model number corresponding to the pre-trained GAN model is encapsulated during video encapsulation, otherwise the pre-trained GAN model can be directly encapsulated.

本实施例提出的视频处理方法,通过获取各个所述待处理帧对应的低色域图片以及包括UV分量的彩色图片,将所述低色域图片作为待训练GAN模型的输入,将所述彩色图片作为待训练GAN模型的输出进行模型训练,以获得预训练的GAN模型,其中,所述待训练GAN模型为所述待处理视频的风格对应的模型GAN;接着若各个图像组存在目标相似度小于预设阈值的第二帧,则基于所述颜色差、预训练的GAN模型、所述低色域图片、第二帧、所述色值对应关系以及所述参考帧,确定所述待处理视频对应的压缩视频;若各个图像组不存在目标相似度小于预设阈值的第二帧,则基于所述颜色差、预训练的GAN模型、所述低色域图片、所述色值对应关系以及所述参考帧,确定所述待处理视频对应的压缩视频,通过将预训练的GAN模型的信息封装至压缩视频中,便于后续对压缩视频进行解码上色,同时通过将第二帧保留以确保第二帧的真实性,避免对第二帧进行编码而使解码后的图像严重失真。In the video processing method proposed in this embodiment, the low-color gamut pictures corresponding to the frames to be processed and the color pictures including UV components are obtained, the low-color gamut pictures are used as the input of the GAN model to be trained, and the color pictures are used as the input of the GAN model to be trained. The picture is used as the output of the GAN model to be trained, and model training is performed to obtain a pre-trained GAN model, wherein the GAN model to be trained is the model GAN corresponding to the style of the video to be processed; then if each image group has a target similarity For the second frame smaller than the preset threshold, the to-be-processed frame is determined based on the color difference, the pre-trained GAN model, the low color gamut picture, the second frame, the color value correspondence, and the reference frame The compressed video corresponding to the video; if there is no second frame whose target similarity is less than the preset threshold in each image group, based on the color difference, the pre-trained GAN model, the low color gamut picture, and the color value correspondence and the reference frame, determine the compressed video corresponding to the to-be-processed video, and encapsulate the information of the pre-trained GAN model into the compressed video, so as to facilitate subsequent decoding and coloring of the compressed video, and at the same time by retaining the second frame to To ensure the authenticity of the second frame, to avoid serious distortion of the decoded image by encoding the second frame.

基于第五实施例,提出本发明视频处理方法的第六实施例,在本实施例中,步骤S104之后,该视频处理方法还包括:Based on the fifth embodiment, a sixth embodiment of the video processing method of the present invention is proposed. In this embodiment, after step S104, the video processing method further includes:

步骤S601,获取压缩视频对应的预训练的GAN模型,将所述压缩视频中的视频帧输入预训练的GAN模型进行模型训练,以获得训练后的视频帧;Step S601, obtaining a pre-trained GAN model corresponding to the compressed video, and inputting the video frame in the compressed video into the pre-trained GAN model for model training to obtain a trained video frame;

步骤S602,基于所述压缩视频的各个图像组中参考帧的Y值,对训练后的视频帧中各个图像组进行处理,以获得处理后的视频帧;Step S602, processing each image group in the video frame after training based on the Y value of the reference frame in each image group of the compressed video to obtain a processed video frame;

步骤S603,基于压缩视频中的颜色差以及色值对应关系,确定处理后的视频帧对应的各个图像组是否存在颜色差异图像组;Step S603, based on the color difference in the compressed video and the color value correspondence, determine whether each image group corresponding to the processed video frame has a color difference image group;

步骤S604,若不存在,则将处理后的视频帧作为解码后的目标视频。Step S604, if it does not exist, use the processed video frame as the decoded target video.

本实施例中,在需要对压缩视频进行解码时,先获取压缩视频对应的预训练的GAN模型,例如通过压缩视频中的模型编号在本地获取预训练的GAN模型,或者在压缩视频中获取该预训练的GAN模型。并将压缩视频中的视频帧输入预训练的GAN模型进行模型训练,以获得训练后的视频帧。其中,参考帧以及第二帧无需进行模型训练。In this embodiment, when the compressed video needs to be decoded, first obtain the pre-trained GAN model corresponding to the compressed video, for example, obtain the pre-trained GAN model locally by using the model number in the compressed video, or obtain the pre-trained GAN model in the compressed video Pretrained GAN model. And input the video frames in the compressed video into the pre-trained GAN model for model training to obtain the trained video frames. Among them, the reference frame and the second frame do not need model training.

接着,获取压缩视频的各个图像组中参考帧,并得到各个参考帧的Y值(明亮度值),基于各个Y值,分别对训练后的视频帧中各个图像组进行处理,以获得处理后的视频帧,对于训练后的视频帧中任一训练后的图像组,将训练后的图像组中视频帧的Y值替换为其对应的参考帧的Y值,得到训练后的视频帧。Next, obtain reference frames in each image group of the compressed video, and obtain the Y value (brightness value) of each reference frame, and process each image group in the trained video frame based on each Y value to obtain the processed For any trained image group in the trained video frame, replace the Y value of the video frame in the trained image group with the Y value of the corresponding reference frame to obtain the trained video frame.

然后,基于压缩视频中的颜色差以及色值对应关系,确定处理后的视频帧对应的各个图像组是否存在颜色差异图像组;基于与压缩视频中的颜色差相同的处理方式,获取处理后的视频帧对应的各个图像组中人物以及物体的当前颜色差,而后分别确定各个人物以及物体当前颜色差与颜色差之间的差值是否小于预设颜色差值,若差值大于或等于预设颜色差值,则基于色值对应关系确定处理后的视频帧的部位区域的色值是否处于对应的色值范围内,若是,则确定处理后的视频帧对应的各个图像组是否存在颜色差异图像组,进而将处理后的视频帧作为解码后的目标视频。Then, based on the color difference and color value correspondence in the compressed video, determine whether each image group corresponding to the processed video frame has a color difference image group; based on the same processing method as the color difference in the compressed video, obtain the processed image The current color difference of the characters and objects in each image group corresponding to the video frame, and then determine whether the difference between the current color difference and the color difference of each character and object is less than the preset color difference value, if the difference value is greater than or equal to the preset color difference Color difference value, then determine whether the color value of the part region of the processed video frame is within the corresponding color value range based on the color value correspondence, and if so, determine whether there is a color difference image in each image group corresponding to the processed video frame group, and then use the processed video frame as the decoded target video.

进一步地,一实施例中,步骤S604之后,还包括:Further, in an embodiment, after step S604, it further includes:

步骤a,若存在,则获取颜色差异图像组中的差异图像帧对应的第一色彩分布,以及差异图像帧中的参考帧对应的第二色彩分布;Step a, if there is, then obtain the first color distribution corresponding to the difference image frame in the color difference image group, and the second color distribution corresponding to the reference frame in the difference image frame;

步骤b,基于所述第二色彩分布对所述第一色彩分布进行匹配处理,以获得处理后的差异图像帧,并采用处理后的差异图像帧替换颜色差异图像组中的差异图像帧,得到处理后的颜色差异图像组;Step b, performing matching processing on the first color distribution based on the second color distribution to obtain a processed difference image frame, and replacing the difference image frame in the color difference image group with the processed difference image frame, to obtain: The processed color difference image group;

步骤c,基于处理后的颜色差异图像组以及处理后的视频帧中的正常图像组,确定所述目标视频。Step c, determining the target video based on the processed color difference image group and the processed normal image group in the video frame.

若存在,将处理后的视频帧中差值小于预设颜色差值的当前颜色差的视频帧作为差异图像帧,和/或,将处理后的视频帧中部位区域的色值处于对应的色值范围之外的视频帧作为差异图像帧,并根据差异图像帧所属的差异图像组确定参考帧,并获取颜色差异图像组中的差异图像帧对应的第一色彩分布,以及差异图像组中的参考帧对应的第二色彩分布,其中,第一色彩分布为差异的人物、物体或部位对应的像素点的色彩分布,第二色彩分布为参考帧中差异的人物、物体或部位对应的像素点的色彩分布。If there is, use the video frame with the current color difference whose difference value is less than the preset color difference value in the processed video frame as the difference image frame, and/or set the color value of the part area in the processed video frame in the corresponding color The video frames outside the value range are used as difference image frames, and the reference frame is determined according to the difference image group to which the difference image frame belongs, and the first color distribution corresponding to the difference image frame in the color difference image group is obtained, and the difference image group in the difference image group is obtained. The second color distribution corresponding to the reference frame, wherein the first color distribution is the color distribution of the pixels corresponding to the different characters, objects or parts, and the second color distribution is the pixels corresponding to the different characters, objects or parts in the reference frame color distribution.

而后,基于第二色彩分布对第一色彩分布进行匹配处理,以获得处理后的差异图像帧,具体地,将第二色彩分布内的各个像素点与第一色彩分布内的各个像素点进行匹配,将第一色彩分布中的各个像素点的像素值调整为第二色彩分布内的各个像素点的像素值,或者,还可设置一定的容错范围,先得到第二色彩分布内的各个像素点的像素值对应的像素调整范围,将第一色彩分布中的各个像素点的像素值调整为对应的像素调整范围中最接近的像素值。Then, matching processing is performed on the first color distribution based on the second color distribution to obtain a processed difference image frame. Specifically, each pixel in the second color distribution is matched with each pixel in the first color distribution , adjust the pixel value of each pixel in the first color distribution to the pixel value of each pixel in the second color distribution, or set a certain error tolerance range, first obtain each pixel in the second color distribution The pixel value of each pixel in the first color distribution is adjusted to the closest pixel value in the corresponding pixel adjustment range.

例如,第二色彩分布中的各个像素点的像素值依次为:#8F0000、#D70000、#F00000,第一色彩分布中的各个像素点的像素值依次为:#3F0000、#D80000、#F00000,像素调整范围的比例为10%,#3F0000超过#8F0000的,则#3F0000需要匹配最近的色值#8F0000上,#D70000与#D80000相似度较高,在容错范围内,#F00000与#F00000与一致。For example, the pixel values of each pixel in the second color distribution are: #8F0000, #D70000, #F00000, and the pixel values of each pixel in the first color distribution are: #3F0000, #D80000, #F00000, The ratio of the pixel adjustment range is 10%. If #3F0000 exceeds #8F0000, #3F0000 needs to match the nearest color value #8F0000. The similarity between #D70000 and #D80000 is high. Within the fault tolerance range, #F00000 and #F00000 are the same as Consistent.

最后,采用处理后的差异图像帧替换颜色差异图像组中的差异图像帧,得到处理后的颜色差异图像组,并基于处理后的颜色差异图像组以及处理后的视频帧中的正常图像组,确定所述目标视频Finally, the difference image frame in the color difference image group is replaced by the processed difference image frame, and the processed color difference image group is obtained, and based on the processed color difference image group and the normal image group in the processed video frame, determine the target video

本实施例提出的视频处理方法,通过基于所述压缩视频中的模型编号,获取预训练的GAN模型,将所述压缩视频中的视频帧输入预训练的GAN模型进行模型训练,以获得训练后的视频帧;接着基于所述压缩视频中各个图像组中参考帧的Y值,对训练后的视频帧中各个图像组进行处理,以获得处理后的视频帧;而后获取处理后的视频帧的各个图像组中人物或者物体的第二颜色差,基于颜色差以及第二颜色差,确定处理后的视频帧的各个图像组是否存在颜色差异图像组;然后若不存在,则将处理后的视频帧作为解码后的目标视频,能够根据压缩视频进行准确解码,得到目标视频。In the video processing method proposed in this embodiment, a pre-trained GAN model is obtained based on the model number in the compressed video, and the video frames in the compressed video are input into the pre-trained GAN model for model training, so as to obtain a post-training GAN model. Then, based on the Y value of the reference frame in each image group in the compressed video, each image group in the video frame after training is processed to obtain the processed video frame; then obtain the processed video frame. The second color difference of the person or object in each image group, based on the color difference and the second color difference, determine whether each image group of the processed video frame has a color difference image group; As the decoded target video, the frame can be accurately decoded according to the compressed video to obtain the target video.

本发明还提供一种视频处理装置,参照图4,所述视频处理装置包括:The present invention also provides a video processing device, referring to FIG. 4 , the video processing device includes:

分割模块10,用于对待处理视频的关键帧进行镜头分割操作,以获得多个图像组,其中,所述图像组中的各帧属于同一镜头;A segmentation module 10, configured to perform a shot segmentation operation on the key frames of the video to be processed, so as to obtain a plurality of image groups, wherein each frame in the image group belongs to the same shot;

第一获取模块20,用于获取各个图像组中人物以及物体的颜色差,分别基于图像组中相邻量两帧之间的相似度确定各帧的目标相似度,分别确定各个图像组中目标相似度大于或等于预设阈值的第一帧,基于所述第一帧分别确定各个的参考帧以及待处理帧;The first obtaining module 20 is used to obtain the color difference of characters and objects in each image group, determine the target similarity of each frame based on the similarity between two adjacent frames in the image group, and determine the target similarity in each image group respectively. For the first frame whose similarity is greater than or equal to a preset threshold, determine the respective reference frame and the frame to be processed based on the first frame;

拆解模块30,用于对所述待处理帧进行结构拆解操作,以分别获得待处理帧中的部位区域对应的色值范围,分别获取各个图像组中待处理帧的部位区域与色值范围之间的色值对应关系;The disassembly module 30 is configured to perform a structural disassembly operation on the to-be-processed frame, so as to obtain the color value range corresponding to the part area in the to-be-processed frame, respectively, to obtain the part area and color value of the to-be-processed frame in each image group. The color value correspondence between the ranges;

第二获取模块40,用于获取各个所述待处理帧对应的第一低色域图像帧,基于所述颜色差、所述第一低色域图像帧、所述色值对应关系以及所述参考帧,确定所述待处理视频对应的压缩视频。The second obtaining module 40 is configured to obtain the first low color gamut image frame corresponding to each of the frames to be processed, based on the color difference, the first low color gamut image frame, the color value correspondence and the With reference to the frame, the compressed video corresponding to the video to be processed is determined.

上述各程序单元所执行的方法可参照本发明视频处理方法各个实施例,此处不再赘述。For the methods executed by the above program units, reference may be made to the various embodiments of the video processing method of the present invention, which will not be repeated here.

本发明还提供一种计算机可读存储介质。The present invention also provides a computer-readable storage medium.

本发明计算机可读存储介质上存储有视频处理程序,所述视频处理程序被处理器执行时实现如上所述的视频处理方法的步骤。A video processing program is stored on the computer-readable storage medium of the present invention, and when the video processing program is executed by the processor, the steps of the above-mentioned video processing method are implemented.

其中,在所述处理器上运行的视频处理程序被执行时所实现的方法可参照本发明视频处理方法各个实施例,此处不再赘述。For the method implemented when the video processing program running on the processor is executed, reference may be made to the various embodiments of the video processing method of the present invention, which will not be repeated here.

此外,本发明实施例还提出一种计算机程序产品,该计算机程序产品上包括视频处理程序,所述视频处理程序被处理器执行时实现如上所述的视频处理方法的步骤。In addition, an embodiment of the present invention also provides a computer program product, the computer program product includes a video processing program, and when the video processing program is executed by a processor, implements the steps of the video processing method as described above.

需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者系统不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者系统所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者系统中还存在另外的相同要素。It should be noted that, herein, the terms "comprising", "comprising" or any other variation thereof are intended to encompass non-exclusive inclusion, such that a process, method, article or system comprising a series of elements includes not only those elements, It also includes other elements not expressly listed or inherent to such a process, method, article or system. Without further limitation, an element qualified by the phrase "comprising a..." does not preclude the presence of additional identical elements in the process, method, article or system that includes the element.

上述本发明实施例序号仅仅为了描述,不代表实施例的优劣。The above-mentioned serial numbers of the embodiments of the present invention are only for description, and do not represent the advantages or disadvantages of the embodiments.

通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在如上所述的一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本发明各个实施例所述的方法。From the description of the above embodiments, those skilled in the art can clearly understand that the method of the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is better implementation. Based on such understanding, the technical solutions of the present invention can be embodied in the form of software products in essence or the parts that make contributions to the prior art, and the computer software products are stored in a storage medium (such as ROM/RAM) as described above. , magnetic disk, optical disk), including several instructions to make a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) execute the methods described in the various embodiments of the present invention.

以上仅为本发明的优选实施例,并非因此限制本发明的专利范围,凡是利用本发明说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本发明的专利保护范围内。The above are only preferred embodiments of the present invention, and are not intended to limit the scope of the present invention. Any equivalent structure or equivalent process transformation made by using the contents of the description and drawings of the present invention, or directly or indirectly applied in other related technical fields , are similarly included in the scope of patent protection of the present invention.

Claims (10)

1. A video processing method, characterized in that the video processing method comprises the steps of:
performing shot segmentation operation on key frames of a video to be processed to obtain a plurality of image groups, wherein each frame in the image groups belongs to the same shot;
acquiring color differences corresponding to each image group, determining target similarity of each frame based on the similarity between two adjacent frames in the image group, determining a first frame with the target similarity being larger than or equal to a preset threshold value in each image group, determining a reference frame and a frame to be processed based on the first frame, wherein the color differences comprise character color differences and object color differences, determining the character color differences for each image group based on a character maximum frame to which the maximum area of each character in the image group belongs and a character minimum frame to which the minimum area belongs, and determining the object color differences based on an object maximum frame to which the maximum area of each object belongs and an object minimum frame to which the minimum area belongs;
performing structure disassembly operation on the frame to be processed to respectively obtain color value ranges corresponding to part regions in the frame to be processed, and respectively obtaining color value corresponding relations between the part regions and the color value ranges of the frame to be processed in each image group, wherein the part regions comprise all parts of people and objects, or the part regions comprise a plurality of regions with discontinuous color values in the frame to be processed;
acquiring a first low color gamut image frame corresponding to each frame to be processed, and determining a compressed video corresponding to the video to be processed based on the color difference, the first low color gamut image frame, the color value corresponding relationship and the reference frame, wherein the color difference, the first low color gamut image frame, the color value corresponding relationship and the reference frame are subjected to video encapsulation according to the sequence of an image group to obtain the compressed video, and the first low color gamut image frame is a black-and-white image frame or a wire frame image frame corresponding to the frame to be processed.
2. The video processing method according to claim 1, wherein the step of performing a structure decomposition operation on the frame to be processed to obtain color value ranges corresponding to the portion regions in the frame to be processed respectively comprises:
respectively mapping the to-be-processed frames based on preset rgb color partitions to obtain mapped to-be-processed frames, obtaining second low color gamut image frames corresponding to the mapped to-be-processed frames, determining boundary lines in each second low color gamut image frame based on a color value continuity rule, respectively determining part areas in the to-be-processed frames based on the boundary lines, and obtaining color value ranges corresponding to the part areas based on the to-be-processed frames, wherein the second low color gamut image frames are black-and-white images or grayscale images; or,
and identifying the frame image to be processed to obtain part areas in the frame to be processed, and acquiring color value ranges corresponding to the part areas based on the frame to be processed, wherein the part areas comprise different parts of people or objects in the frame to be processed.
3. The video processing method of claim 1, wherein the step of obtaining a first low color gamut image frame corresponding to each of the frames to be processed comprises:
converting the frame to be processed into a black-and-white image frame or a wire frame image frame to obtain the first low color gamut image frame; or,
determining an object contour in each frame to be processed based on an image edge detection algorithm, and performing Fourier transform operation on contour coordinates of the object contour to obtain the first low color gamut image frame.
4. The video processing method of claim 1, wherein the step of determining the object similarity of each frame based on the similarity between two adjacent frames in the image group comprises:
respectively mapping the image frames in each image group based on a preset rgb color partition to obtain a mapped image group;
acquiring a color histogram vector of each image frame in the mapped image group, determining the similarity between two adjacent frames in each image group based on the color histogram vector, and determining the target similarity of each frame based on the determined similarity; or,
normalizing the mapped image group to obtain a normalized image group, acquiring pixel pairs corresponding to a differentiation pixel point between two adjacent image frames in the normalized image group, and determining the pixel similarity between each pixel pair; and determining the similarity between two adjacent frames in each image group based on the pixel similarity, and determining the target similarity of each frame based on the similarity.
5. The video processing method according to any one of claims 1 to 4, wherein the step of determining the compressed video corresponding to the video to be processed based on the color difference, the first low color gamut image frame, the color value correspondence, and the reference frame comprises:
obtaining a low color gamut picture and a color picture comprising UV components corresponding to each frame to be processed, taking the low color gamut picture as the input of a GAN model to be trained, and taking the color picture as the output of the GAN model to be trained for model training to obtain a pre-trained GAN model, wherein the GAN model to be trained is a model GAN corresponding to the style of the video to be processed;
if a second frame with the target similarity smaller than a preset threshold exists in each image group, determining a compressed video corresponding to the video to be processed based on the color difference, a pre-trained GAN model, the low color gamut picture, the second frame, the color value corresponding relation and the reference frame;
and if the second frame with the target similarity smaller than the preset threshold value does not exist in each image group, determining the compressed video corresponding to the video to be processed based on the color difference, the pre-trained GAN model, the low color gamut picture, the color value corresponding relation and the reference frame.
6. The video processing method according to claim 5, wherein after the step of determining the compressed video corresponding to the video to be processed based on the color difference, the first low color gamut image frame, the color value correspondence, and the reference frame, the video processing method further comprises:
acquiring a pre-trained GAN model corresponding to a compressed video, and inputting a video frame in the compressed video into the pre-trained GAN model for model training to obtain a trained video frame;
processing each image group in the trained video frame based on the Y value of the reference frame in each image group of the compressed video to obtain a processed video frame;
determining whether each image group corresponding to the processed video frame has a color difference image group or not based on the color difference and the color value corresponding relation in the compressed video, and specifically, acquiring the current color difference of a person and the current color difference of an object in each image group corresponding to the processed video frame; if the difference value between the current color difference value of the person and the color difference value of the corresponding image group in the compressed video is larger than or equal to the preset color difference value, and the difference value between the current color difference value of the object and the color difference value of the corresponding image group in the compressed video is larger than or equal to the preset color difference value, determining whether the color value of the part area of the processed video frame is in the corresponding color value range or not based on the color value corresponding relation, wherein if the color value is in the corresponding color value range, determining that the color difference image group does not exist in each image group corresponding to the processed video frame;
and if the target video does not exist, the processed video frame is taken as the decoded target video.
7. The video processing method of claim 6, wherein the step of determining whether the color difference image group exists in each image group of the processed video frame further comprises:
if the color difference image group exists, acquiring a first color distribution corresponding to a difference image frame in the color difference image group and a second color distribution corresponding to a reference frame in the difference image group;
matching the first color distribution based on the second color distribution to obtain a processed difference image frame, and replacing the difference image frame in the color difference image group with the processed difference image frame to obtain a processed color difference image group;
and determining the target video based on the processed color difference image group and the processed normal image group in the video frame.
8. A video processing apparatus, characterized in that the video processing apparatus comprises:
the device comprises a segmentation module, a processing module and a processing module, wherein the segmentation module is used for carrying out lens segmentation operation on key frames of a video to be processed so as to obtain a plurality of image groups, and each frame in the image groups belongs to the same lens;
the first acquisition module is used for acquiring color differences corresponding to each image group, determining the target similarity of each frame based on the similarity between two adjacent frames in the image group, determining the first frame with the target similarity being larger than or equal to a preset threshold value in each image group, determining each reference frame and each frame to be processed based on the first frame, wherein the color differences comprise character color differences and object color differences, determining the character color differences for each image group based on the maximum character frame to which the maximum area of each character in the image group belongs and the minimum character frame to which the minimum area belongs, and determining the object color differences based on the maximum object frame to which the maximum area of each object belongs and the minimum object frame to which the minimum area belongs;
a disassembling module, configured to perform structure disassembling operation on the frame to be processed to obtain color value ranges corresponding to part regions in the frame to be processed, and obtain color value correspondence between the part regions and the color value ranges of the frame to be processed in each image group, where the part regions include parts of people and objects, or the part regions include multiple regions with discontinuous color values in the frame to be processed;
the second acquisition module is used for acquiring each first low color gamut image frame corresponding to the frame to be processed, and determining the compressed video corresponding to the video to be processed based on the color difference, the first low color gamut image frame, the color value corresponding relation and the reference frame, wherein the color difference, the first low color gamut image frame, the color value corresponding relation and the reference frame are subjected to video packaging according to the sequence of the image group to obtain the compressed video, and the first low color gamut image frame is a black-and-white image frame or a wire frame image frame corresponding to the frame to be processed.
9. A video processing apparatus, characterized in that the video processing apparatus comprises: memory, processor and video processing program stored on the memory and executable on the processor, which when executed by the processor implements the steps of the video processing method according to any of claims 1 to 7.
10. A computer-readable storage medium, characterized in that a video processing program is stored thereon, which when executed by a processor implements the steps of the video processing method according to any one of claims 1 to 7.
CN202110715548.4A 2021-06-24 2021-06-24 Video processing method, device, equipment and computer program product Active CN113453017B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110715548.4A CN113453017B (en) 2021-06-24 2021-06-24 Video processing method, device, equipment and computer program product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110715548.4A CN113453017B (en) 2021-06-24 2021-06-24 Video processing method, device, equipment and computer program product

Publications (2)

Publication Number Publication Date
CN113453017A CN113453017A (en) 2021-09-28
CN113453017B true CN113453017B (en) 2022-08-23

Family

ID=77813401

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110715548.4A Active CN113453017B (en) 2021-06-24 2021-06-24 Video processing method, device, equipment and computer program product

Country Status (1)

Country Link
CN (1) CN113453017B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114724074B (en) * 2022-06-01 2022-09-09 共道网络科技有限公司 Method and device for detecting risk video

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5627765A (en) * 1994-07-25 1997-05-06 Avid Technology, Inc. Method and apparatus for compressing and analyzing video and for creating a reference video
US6035060A (en) * 1997-02-14 2000-03-07 At&T Corp Method and apparatus for removing color artifacts in region-based coding
CN101729898A (en) * 2009-11-16 2010-06-09 中国人民解放军国防科学技术大学 Video coding and decoding methods and devices
CN104767998A (en) * 2015-03-25 2015-07-08 北京大学 A video-oriented visual feature encoding method and device
CN112203096A (en) * 2020-09-30 2021-01-08 北京金山云网络技术有限公司 Video encoding method, video encoding device, computer equipment and storage medium
CN112990191A (en) * 2021-01-06 2021-06-18 中国电子科技集团公司信息科学研究院 Shot boundary detection and key frame extraction method based on subtitle video

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100698106B1 (en) * 2000-03-07 2007-03-26 엘지전자 주식회사 Hierarchical Mixed Scene Change Detection Method in MPEG Compressed Video Environment
JP4520994B2 (en) * 2004-09-30 2010-08-11 パイオニア株式会社 Image processing apparatus, image processing method, and image processing program

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5627765A (en) * 1994-07-25 1997-05-06 Avid Technology, Inc. Method and apparatus for compressing and analyzing video and for creating a reference video
US6035060A (en) * 1997-02-14 2000-03-07 At&T Corp Method and apparatus for removing color artifacts in region-based coding
CN101729898A (en) * 2009-11-16 2010-06-09 中国人民解放军国防科学技术大学 Video coding and decoding methods and devices
CN104767998A (en) * 2015-03-25 2015-07-08 北京大学 A video-oriented visual feature encoding method and device
CN112203096A (en) * 2020-09-30 2021-01-08 北京金山云网络技术有限公司 Video encoding method, video encoding device, computer equipment and storage medium
CN112990191A (en) * 2021-01-06 2021-06-18 中国电子科技集团公司信息科学研究院 Shot boundary detection and key frame extraction method based on subtitle video

Also Published As

Publication number Publication date
CN113453017A (en) 2021-09-28

Similar Documents

Publication Publication Date Title
CN109919087B (en) Video classification method, model training method and model training device
US20220046261A1 (en) Encoding method and apparatus for screen sharing, storage medium, and electronic device
US20200258197A1 (en) Method for generating high-resolution picture, computer device, and storage medium
WO2020125631A1 (en) Video compression method and apparatus, and computer-readable storage medium
WO2021115242A1 (en) Super-resolution image processing method and related apparatus
WO2016082277A1 (en) Video authentication method and apparatus
WO2022073282A1 (en) Motion recognition method based on feature interactive learning, and terminal device
CN110069974B (en) Highlight image processing method and device and electronic equipment
CN110944160B (en) Image processing method and electronic equipment
US11763470B2 (en) Method and apparatus for aligning image frames, electronic device and storage medium
US20210209330A1 (en) Method for correction of the eyes image using machine learning and method for machine learning
CN112565887A (en) Video processing method, device, terminal and storage medium
US20180314916A1 (en) Object detection with adaptive channel features
CN109544441B (en) Image processing method and device, and skin color processing method and device in live broadcast
WO2025039830A1 (en) Image processing method, processing device, and storage medium
CN113453017B (en) Video processing method, device, equipment and computer program product
CN112468792A (en) Image recognition method and device, electronic equipment and storage medium
CN114565573A (en) Image quality evaluation method, device and storage medium
CN113627314B (en) Face image blur detection method, device, storage medium and electronic device
CN109479127A (en) Use video coding compressed picture segment data
CN110650309A (en) Video conference video image transmission method, terminal and readable storage medium
CN115767085A (en) Data processing method and device thereof
CN112967194B (en) Target image generation method and device, computer readable medium and electronic device
CN116958164A (en) An image processing method, device, electronic equipment and storage medium
CN114037715A (en) Image segmentation method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant