CN108471530B - Method and apparatus for detecting video - Google Patents
Method and apparatus for detecting video Download PDFInfo
- Publication number
- CN108471530B CN108471530B CN201810220202.5A CN201810220202A CN108471530B CN 108471530 B CN108471530 B CN 108471530B CN 201810220202 A CN201810220202 A CN 201810220202A CN 108471530 B CN108471530 B CN 108471530B
- Authority
- CN
- China
- Prior art keywords
- video
- detected
- images
- pixel
- 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
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N17/00—Diagnosis, testing or measuring for television systems or their details
- H04N17/004—Diagnosis, testing or measuring for television systems or their details for digital television systems
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N5/00—Details of television systems
- H04N5/14—Picture signal circuitry for video frequency region
- H04N5/142—Edging; Contouring
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N7/00—Television systems
- H04N7/01—Conversion of standards, e.g. involving analogue television standards or digital television standards processed at pixel level
- H04N7/0117—Conversion of standards, e.g. involving analogue television standards or digital television standards processed at pixel level involving conversion of the spatial resolution of the incoming video signal
- H04N7/012—Conversion between an interlaced and a progressive signal
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Computer Graphics (AREA)
- Health & Medical Sciences (AREA)
- Biomedical Technology (AREA)
- General Health & Medical Sciences (AREA)
- Television Systems (AREA)
Abstract
Description
技术领域technical field
本申请实施例涉及计算机技术领域,具体涉及用于检测视频的方法和设备。The embodiments of the present application relate to the field of computer technologies, and in particular, to methods and devices for detecting videos.
背景技术Background technique
目前广播电视电影等视频的视频格式类型分为隔行类型和逐行类型。隔行类型的视频中每帧视频图像按照奇数行和偶数行被分为两场,称为顶场和底场。在早期的标清时代,为了节省带宽,通常以场为单位传输视频,即将每帧视频图像丢掉一场,传输另外一场,并且早期的模拟电视也是按照场来播放视频的。因此,标清时代的视频通常都是隔行视频。在如今的高清时代,数字电视已经普及,而数字电视是按照帧来播放视频的,因此,对于早期的隔行视频,需要进行去隔行处理把隔行视频转换成逐行视频进行播放。At present, the video format types of videos such as radio, television and movies are divided into interlaced type and progressive type. In the interlaced type video, each frame of video image is divided into two fields according to odd-numbered lines and even-numbered lines, which are called top field and bottom field. In the early SD era, in order to save bandwidth, video was usually transmitted in units of fields, that is, one field of each frame of video image was dropped and another field was transmitted, and early analog TVs also played video according to fields. Therefore, video in the SD era is usually interlaced video. In today's high-definition era, digital TV has become popular, and digital TV plays video by frame. Therefore, for early interlaced video, it is necessary to perform de-interlacing processing to convert interlaced video into progressive video for playback.
然而,在对视频进行去隔行处理时,需要确定视频的顶底场顺序,以根据顶底场顺序对处理后的视频图像进行排序,才能确保处理后的视频中所显示的画面顺序不会出现错乱现象。However, when the video is deinterlaced, it is necessary to determine the top and bottom field order of the video to sort the processed video images according to the top and bottom field order, so as to ensure that the picture sequence displayed in the processed video does not appear. disorder.
发明内容SUMMARY OF THE INVENTION
本申请实施例提出一种用于检测视频的方法和设备。The embodiments of the present application provide a method and device for detecting video.
第一方面,本申请实施例提供了一种用于检测视频的方法,包括:获取待检测视频;对待检测视频进行逐隔行检测,确定待检测视频的逐隔行类型;响应于确定待检测视频的逐隔行类型是隔行类型,对待检测视频进行顶底场顺序检测,确定待检测视频的场优先顺序;生成待检测视频的检测结果,其中,待检测视频的检测结果中包括待检测视频的逐隔行类型和场优先顺序。In a first aspect, an embodiment of the present application provides a method for detecting a video, including: acquiring a video to be detected; performing interlace detection on the video to be detected, and determining the interlace type of the video to be detected; The progressive interlaced type is an interlaced type, and the top and bottom field sequence detection is performed on the video to be detected to determine the field priority of the video to be detected; the detection result of the video to be detected is generated, wherein the detection result of the video to be detected includes the video to be detected. Type and field precedence.
在一些实施例中,对待检测视频进行逐隔行检测,确定待检测视频的逐隔行类型,包括:对于待检测视频中的每帧待检测视频图像中的每个像素点,计算该像素点在水平方向上的变化量、该像素点的场频率值、该像素点的帧频率值和该像素点在时间上的变化量,对该像素点在水平方向上的变化量、该像素点的场频率值、该像素点的帧频率值和该像素点在时间上的变化量进行分析,确定该像素点是否是拉丝点;统计待检测视频中的每帧待检测视频图像中的拉丝点比例,得到统计结果;基于统计结果,确定待检测视频的逐隔行类型。In some embodiments, performing interlace detection on the video to be detected and determining the interlace type of the video to be detected includes: for each pixel in each frame of the video to be detected in the video to be detected, calculating the horizontal The amount of change in the direction, the field frequency value of the pixel, the frame frequency value of the pixel and the time change of the pixel, the change of the pixel in the horizontal direction, the field frequency of the pixel value, the frame frequency value of the pixel point, and the time change of the pixel point are analyzed to determine whether the pixel point is a drawing point; count the drawing point ratio in each frame of the video image to be detected in the video to be detected, and obtain Statistical results; based on the statistical results, determine the line-by-line type of the video to be detected.
在一些实施例中,对该像素点在水平方向上的变化量、该像素点的场频率值、该像素点的帧频率值和该像素点在时间上的变化量进行分析,确定该像素点是否是拉丝点,包括:若该像素点满足第一条件,则确定该像素点是拉丝点,其中,第一条件包括:像素点在水平方向上的变化量大于第一阈值、像素点在时间上的变化量大于第二阈值、像素点的帧频率值大于场频率值与第三阈值之和。In some embodiments, the change amount of the pixel point in the horizontal direction, the field frequency value of the pixel point, the frame frequency value of the pixel point, and the change amount of the pixel point in time are analyzed to determine the pixel point. Whether it is a wire drawing point includes: if the pixel point satisfies the first condition, then determining that the pixel point is a wire drawing point, wherein the first condition includes: the amount of change of the pixel point in the horizontal direction is greater than the first threshold, and the pixel point is at time. The amount of change on the pixel is greater than the second threshold value, and the frame frequency value of the pixel point is greater than the sum of the field frequency value and the third threshold value.
在一些实施例中,统计待检测视频中的每帧待检测视频图像中的拉丝点比例,得到统计结果,包括:对于待检测视频中的每帧待检测视频图像,计算该待检测视频图像中的拉丝点的数量与满足第二条件的像素点的数量的比值,其中,第二条件包括:像素点在水平方向上的变化量大于第一阈值、像素点在时间上的变化量大于第二阈值;将所得到的比值与第四阈值进行比较;若所得到的比值大于第四阈值,则确定该待检测视频图像的逐隔行类型是隔行类型;若所得到的比值不大于第四阈值,则确定该待检测视频图像的逐隔行类型是逐行类型。In some embodiments, counting the ratio of drawing points in each frame of the video image to be detected in the video to be detected, to obtain the statistical result, includes: for each frame of the video image to be detected in the video to be detected, calculating the percentage of the video image to be detected in the video image to be detected. The ratio of the number of drawing points to the number of pixel points that satisfy the second condition, wherein the second condition includes: the change amount of the pixel point in the horizontal direction is greater than the first threshold, and the change amount of the pixel point in time is greater than the second Threshold; compare the obtained ratio with the fourth threshold; if the obtained ratio is greater than the fourth threshold, then determine that the interlaced type of the video image to be detected is the interlaced type; if the obtained ratio is not greater than the fourth threshold, Then it is determined that the progressive interlaced type of the video image to be detected is the progressive type.
在一些实施例中,对待检测视频进行顶底场顺序检测,确定待检测视频的场优先顺序,包括:对于待检测视频中的每两帧相邻的待检测视频图像,将该两帧相邻的待检测视频图像分割成四场;利用上下两行像素点的平均值对缺失的场进行填充,得到四帧图像;计算四帧图像中的两帧图像中对应位置的像素点的差值的绝对值之和;对四帧图像中的两帧图像中对应位置的像素点的差值的绝对值之和进行分析,确定待检测视频的场优先顺序。In some embodiments, performing top-bottom field sequence detection on the video to be detected, and determining the field priority of the video to be detected, includes: for every two adjacent video images to be detected in the video to be detected, determining the adjacent video images of the two frames. The video image to be detected is divided into four fields; the missing field is filled with the average value of the pixel points of the upper and lower lines to obtain four frames of images; the difference of the pixel points of the corresponding positions in the two frame images of the four frames of images is calculated. Sum of absolute values: analyze the sum of absolute values of the differences of the pixel points at the corresponding positions in the two frames of images, and determine the field priority order of the video to be detected.
在一些实施例中,计算四帧图像中的两帧图像中对应位置的像素点的差值的绝对值之和,包括:将四帧图像划分为两对图像;计算每对图像中对应位置的像素点的差值的绝对值之和。In some embodiments, calculating the sum of absolute values of differences of pixel points at corresponding positions in two frames of images in the four frames of images includes: dividing the four frames of images into two pairs of images; The sum of the absolute values of the differences of the pixel points.
在一些实施例中,两对图像中的第一对图像包括:该两帧相邻的待检测视频图像中的前一帧待检测视频图像所分割成的底场和填充后生成的顶场拼成的图像、该两帧相邻的待检测视频图像中的后一帧待检测视频图像所分割成的顶场和填充后生成的底场拼成的图像;两对图像中的第二对图像包括:该两帧相邻的待检测视频图像中的前一帧待检测视频图像所分割成的顶场和填充后生成的底场拼成的图像、该两帧相邻的待检测视频图像中的后一帧待检测视频图像所分割成的底场和填充后生成的顶场拼成的图像。In some embodiments, the first pair of images in the two pairs of images includes: a bottom field and a top field mosaic generated after filling the previous video image to be detected in the two adjacent frames of video images to be detected. formed image, the next frame to be detected video image in the two adjacent video images to be detected is divided into the top field and the bottom field generated after filling; the second pair of images in the two pairs of images Including: an image composed of a top field and a bottom field generated after filling of the previous frame of the video image to be detected in the two adjacent video images to be detected, and an image of the two adjacent video images to be detected. The bottom field of the next frame of the video image to be detected is divided into an image composed of the top field generated after filling.
在一些实施例中,对四帧图像中的两帧图像中对应位置的像素点的差值的绝对值之和进行分析,确定待检测视频的场优先顺序,包括:将第一对图像中对应位置的像素点的差值的绝对值之和与第二对图像中对应位置的像素点的差值的绝对值之和进行比较;若第一对图像中对应位置的像素点的差值的绝对值之和大于第二对图像中对应位置的像素点的差值的绝对值之和,则确定待检测视频的场优先顺序是底场优先;若第一对图像中对应位置的像素点的差值的绝对值之和不大于第二对图像中对应位置的像素点的差值的绝对值之和,则确定待检测视频的场优先顺序是顶场优先。In some embodiments, analyzing the sum of the absolute values of the differences of the pixel points at the corresponding positions in the two frames of images in the four frames of images, and determining the field priority of the video to be detected, includes: The sum of the absolute values of the differences of the pixel points of the position is compared with the sum of the absolute values of the differences of the pixel points of the corresponding positions in the second pair of images; if the absolute value of the difference of the pixel points of the corresponding positions in the first pair of images is If the sum of the values is greater than the sum of the absolute values of the differences of the pixel points at the corresponding positions in the second pair of images, it is determined that the field priority of the video to be detected is the bottom field priority; if the difference between the pixel points at the corresponding positions in the first pair of images is If the sum of the absolute values of the values is not greater than the sum of the absolute values of the differences of the pixel points at the corresponding positions in the second pair of images, it is determined that the field priority order of the video to be detected is the top field priority.
在一些实施例中,该方法还包括:响应于确定待检测视频的逐隔行类型是逐行类型,生成待检测视频的检测结果,其中,待检测视频的检测结果中包括待检测视频的逐隔行类型。In some embodiments, the method further includes: in response to determining that the progressive interlaced type of the video to be detected is the progressive type, generating a detection result of the video to be detected, wherein the detection result of the video to be detected includes the progressive interlaced type of the video to be detected type.
在一些实施例中,该方法还包括:输出待检测视频的检测结果。In some embodiments, the method further includes: outputting the detection result of the video to be detected.
第二方面,本申请实施例提供了一种用于检测视频的装置,包括:获取单元,配置用于获取待检测视频;第一检测单元,配置用于对待检测视频进行逐隔行检测,确定待检测视频的逐隔行类型;第二检测单元,配置用于响应于确定待检测视频的逐隔行类型是隔行类型,对待检测视频进行顶底场顺序检测,确定待检测视频的场优先顺序;生成单元,配置用于生成待检测视频的检测结果,其中,待检测视频的检测结果中包括待检测视频的逐隔行类型和场优先顺序。In a second aspect, an embodiment of the present application provides an apparatus for detecting video, including: an acquisition unit, configured to acquire the video to be detected; a first detection unit, configured to perform interlace detection on the video to be detected, and determine the video to be detected. Detecting the progressive interlaced type of the video; a second detection unit configured to perform top and bottom field sequence detection on the video to be detected in response to determining that the progressive interlaced type of the video to be detected is the interlaced type, to determine the field priority of the video to be detected; the generating unit , configured to generate a detection result of the video to be detected, wherein the detection result of the video to be detected includes the interlace type and field priority of the video to be detected.
第三方面,本申请实施例提供了一种电子设备,该电子设备包括:一个或多个处理器;存储装置,用于存储一个或多个程序;当一个或多个程序被一个或多个处理器执行,使得一个或多个处理器实现如第一方面中任一实现方式描述的方法。In a third aspect, an embodiment of the present application provides an electronic device, the electronic device includes: one or more processors; a storage device for storing one or more programs; when one or more programs are stored by one or more The processor executes such that the one or more processors implement a method as described in any implementation of the first aspect.
第四方面,本申请实施例提供了一种计算机可读介质,其上存储有计算机程序,该计算机程序被处理器执行时实现如第一方面中任一实现方式描述的方法。In a fourth aspect, an embodiment of the present application provides a computer-readable medium on which a computer program is stored, and when the computer program is executed by a processor, implements the method described in any implementation manner of the first aspect.
本申请实施例提供的用于检测视频的方法和设备,通过对所获取的待检测视频进行逐隔行检测,从而确定待检测视频的逐隔行类型;在确定待检测视频的逐隔行类型是隔行类型的情况下,对待检测视频进行顶底场顺序检测,从而确定待检测视频的场优先顺序;最后生成待检测视频的检测结果。从而实现了快速地生成视频的检测结果。The method and device for detecting video provided by the embodiments of the present application, by performing interlace detection on the acquired video to be detected, so as to determine the interlace type of the video to be detected; when it is determined that the interlace type of the video to be detected is the interlace type In the case of , the top and bottom field sequence detection is performed on the video to be detected, so as to determine the field priority of the video to be detected; finally, the detection result of the video to be detected is generated. Thus, the detection result of the video can be quickly generated.
附图说明Description of drawings
通过阅读参照以下附图所作的对非限制性实施例所作的详细描述,本申请的其它特征、目的和优点将会变得更明显:Other features, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings:
图1是本申请实施例可以应用于其中的示例性系统架构图;FIG. 1 is an exemplary system architecture diagram to which embodiments of the present application may be applied;
图2是根据本申请的用于检测视频的方法的一个实施例的流程图;Figure 2 is a flowchart of one embodiment of a method for detecting video according to the present application;
图3是根据本申请的用于检测视频的方法的又一个实施例的流程图;Figure 3 is a flowchart of yet another embodiment of a method for detecting video according to the present application;
图4是一帧待检测视频图像中的像素点分布示意图;4 is a schematic diagram of the distribution of pixels in a frame of video images to be detected;
图5是两帧相邻的待检测视频图像分割成的四场中的像素点分布示意图;5 is a schematic diagram of the distribution of pixels in four fields into which two adjacent video images to be detected are divided;
图6是四场填充成的底场优先的四帧图像的像素点分布示意图;6 is a schematic diagram of the distribution of pixels of four frames of images with a bottom field that is filled with four fields;
图7是四场填充成的顶场优先的四帧图像的像素点分布示意图;FIG. 7 is a schematic diagram of the distribution of pixels of four frames of images with top field priority filled into four fields;
图8是适于用来实现本申请实施例的电子设备的计算机系统的结构示意图。FIG. 8 is a schematic structural diagram of a computer system suitable for implementing the electronic device according to the embodiment of the present application.
具体实施方式Detailed ways
下面结合附图和实施例对本申请作进一步的详细说明。可以理解的是,此处所描述的具体实施例仅仅用于解释相关发明,而非对该发明的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与有关发明相关的部分。The present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the related invention, but not to limit the invention. In addition, it should be noted that, for the convenience of description, only the parts related to the related invention are shown in the drawings.
需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。下面将参考附图并结合实施例来详细说明本申请。It should be noted that the embodiments in the present application and the features of the embodiments may be combined with each other in the case of no conflict. The present application will be described in detail below with reference to the accompanying drawings and in conjunction with the embodiments.
图1示出了可以应用本申请的用于检测视频的方法的实施例的示例性系统架构100。FIG. 1 illustrates an
如图1所示,系统架构100可以包括云服务器101、电子设备102、数字电视103和网络104、105。网络104用以在云服务器101和电子设备102之间提供通信链路的介质。网络105用以在电子设备102和数字电视103之间提供通信链路的介质。网络104、105可以包括各种连接类型,例如有线、无线通信链路或者光纤电缆等等。As shown in FIG. 1 , the
云服务器101可以通过网络104与电子设备102交互,以接收或发送消息等。电子设备102可以通过网络105与数字电视103交互,以接收或发送消息等。云服务器101可以是用于存储有大量隔行视频和/或逐行视频的服务器。数字电视103可以是用于播放逐行视频或者由隔行视频进行去隔行处理后所转换成的逐行视频的电视。The
电子设备102可以提供各种服务,例如电子设备102可以对获取到的待检测视频等数据进行分析等处理,并将处理结果(例如待检测视频的检测结果)反馈给数字电视103。The
需要说明的是,电子设备102可以是硬件,也可以是软件。当电子设备102为硬件时,可以是各种电子设备,包括但不限于ASIC(Application Specific IntegratedCircuit,专用集成电路)芯片、FPGA(Field Programmable Gate Array,现场可编程逻辑门阵列)、OTT(Over The Top,互联网电视)盒子、IPTV(Interactive PersonalityTelevision,交互式网络电视)盒子和服务器等等。当电子设备102为软件时,可以安装在上述所列举的电子设备中。其可以实现成多个软件或软件模块(例如用来提供分布式服务),也可以实现成单个软件或软件模块。在此不做具体限定。It should be noted that the
需要说明的是,本申请实施例所提供的用于检测视频的方法一般由电子设备102执行。It should be noted that, the method for detecting video provided by the embodiment of the present application is generally performed by the
应该理解,图1中的云服务器、电子设备、数字电视和网络的数量仅仅是示意性的。根据实现需要,可以具有任意数量的云服务器、电子设备、数字电视和网络。It should be understood that the numbers of cloud servers, electronic devices, digital TVs and networks in FIG. 1 are merely illustrative. There can be any number of cloud servers, electronic devices, digital TVs and networks according to implementation needs.
继续参考图2,其示出了根据本申请的用于检测视频的方法的一个实施例的流程200。该用于检测视频的方法,包括以下步骤:With continued reference to FIG. 2, a
步骤201,获取待检测视频。
在本实施例中,用于检测视频的方法的执行主体(例如图1所示的电子设备102)可以通过有线连接方式或者无线连接方式从云服务器(例如图1所示的云服务器101)获取待检测视频。其中,云服务器中可以存储有海量视频,不同的视频可以用不同的标识来区分。In this embodiment, the execution body of the method for detecting video (for example, the
实践中,用户可以通过数字电视(例如图1所示的数字电视103)发起视频播放请求,其中,视频播放请求中可以包括用户想要观看的视频的标识,云服务器可以根据用户想要观看的视频的标识从其存储的海量视频中查找到用户想要观看的视频,然后发送至上述执行主体。这里,用户想要观看的视频即为待检测视频。In practice, the user can initiate a video playback request through a digital TV (for example, the
步骤202,对待检测视频进行逐隔行检测,确定待检测视频的逐隔行类型。Step 202: Perform interlace detection on the video to be detected, and determine the interlace type of the video to be detected.
在本实施例中,基于步骤201所获取的待检测视频,上述执行主体可以对待检测视频进行逐隔行检测,从而确定待检测视频的逐隔行类型。In this embodiment, based on the to-be-detected video acquired in
在本实施例中,视频按视频格式类型可以分为隔行类型和逐行类型。通常,隔行类型的视频是通过隔行扫描所获得的。隔行扫描就是将视频中的每帧视频图像分割为两场,即从左到右,从上往下隔一行扫描一行,直到最后一行。其中,包含一帧视频图像中的所有奇数行的场是顶场,包含一帧视频图像中的所有偶数行的场是底场。逐行类型的视频是通过逐行扫描所获得的。逐行扫描就是视频中的每帧视频图像都是从左到右,从上到下逐行扫描,直到所有行被全部扫描。In this embodiment, the video can be classified into an interlaced type and a progressive type according to the video format type. Usually, interlaced type video is obtained by interlacing. Interlacing is to divide each frame of video image in the video into two fields, that is, scan one line from left to right, and scan one line from top to bottom until the last line. The field including all odd-numbered lines in one frame of video image is the top field, and the field including all even-numbered lines in one frame of video image is the bottom field. Progressive type video is obtained by progressive scanning. Progressive scanning means that each frame of video image in the video is scanned line by line from left to right, top to bottom, until all lines are scanned.
在本实施例的一些可选的实现方式中,云服务器中存储的视频中可以包括视频的属性信息,视频的属性信息中可以包括视频的逐隔行类型。因此,上述执行主体可以根据待检测视频中所包括待检测视频的属性信息确定待检测视频的逐隔行类型。若待检测视频的属性信息指示待检测视频是逐行类型的视频,那么确定待检测视频的逐隔行类型是逐行类型;若待检测视频的属性信息指示待检测视频是隔行类型的视频,那么确定待检测视频的逐隔行类型是隔行类型。In some optional implementations of this embodiment, the video stored in the cloud server may include attribute information of the video, and the attribute information of the video may include the video's line-by-line type. Therefore, the above-mentioned execution body may determine the progressive interlace type of the video to be detected according to the attribute information of the video to be detected included in the video to be detected. If the attribute information of the video to be detected indicates that the video to be detected is a progressive video, then it is determined that the progressive interlaced type of the video to be detected is progressive; if the attribute information of the video to be detected indicates that the video to be detected is an interlaced video, then It is determined that the progressive interlaced type of the video to be detected is the interlaced type.
步骤203,响应于确定待检测视频的逐隔行类型是隔行类型,对待检测视频进行顶底场顺序检测,确定待检测视频的场优先顺序。
在本实施例中,在确定待检测视频的逐隔行类型是隔行类型的情况下,上述执行主体可以对待检测视频进行顶底场顺序检测,从而确定待检测视频的场优先顺序。In this embodiment, when it is determined that the interlaced type of the video to be detected is the interlaced type, the above-mentioned execution body can perform top and bottom field sequence detection of the video to be detected, thereby determining the field priority of the video to be detected.
在本实施例中,由于为了节省带宽,隔行类型的视频的每帧视频图像丢掉了一场,因此,隔行类型的视频中的每帧隔行视频图像是由相邻的两帧视频图像中保留的两场拼合而成的。例如,相邻的两帧视频图像中的前一帧视频图像保留底场,后一帧视频图像保留顶场,将前一帧视频图像的底场与后一帧视频图像的顶场拼合,得到一帧隔行视频图像,且该隔行视频图像的场优先顺序是底场优先。又例如,相邻的两帧视频图像中的前一帧视频图像保留顶场,后一帧视频图像保留底场,将前一帧视频图像的顶场与后一帧视频图像的底场拼合,得到一帧隔行视频图像,其该隔行视频图像的场优先顺序是顶场优先。In this embodiment, in order to save bandwidth, each frame of video image of the interlaced type video loses one field. Therefore, each frame of the interlaced video image in the video of the interlaced type is reserved from two adjacent video images. Combining the two. For example, in two adjacent frames of video images, the bottom field of the previous frame of video image is reserved, and the top field of the next frame of video image is reserved, and the bottom field of the previous frame of video image and the top field of the next frame of video image are combined to obtain A frame of interlaced video images, and the field priority order of the interlaced video images is bottom field priority. For another example, the previous frame of video images in two adjacent video images retains the top field, the next frame of video images retains the bottom field, and the top field of the previous frame of video image and the bottom field of the next frame of video image are combined, A frame of interlaced video image is obtained, and the field priority order of the interlaced video image is top field priority.
在本实施例的一些可选的实现方式中,云服务器中存储的视频中可以包括视频的属性信息,视频的属性信息中可以包括视频的场优先顺序。因此,上述执行主体可以根据待检测视频中所包括待检测视频的属性信息确定待检测视频的场优先顺序。若待检测视频的属性信息指示待检测视频是底场优先的视频,那么确定待检测视频的场优先顺序是底场优先;若待检测视频的属性信息指示待检测视频是顶场优先的视频,那么确定待检测视频的场优先顺序是顶场优先。In some optional implementations of this embodiment, the video stored in the cloud server may include attribute information of the video, and the attribute information of the video may include the field priority of the video. Therefore, the above-mentioned executive body can determine the field priority order of the video to be detected according to the attribute information of the video to be detected included in the video to be detected. If the attribute information of the video to be detected indicates that the video to be detected is a bottom-field priority video, then determine that the field priority of the video to be detected is the bottom-field priority; if the attribute information of the video to be detected indicates that the video to be detected is a top-field priority video, Then it is determined that the field priority order of the video to be detected is the top field priority.
步骤204,生成待检测视频的检测结果。
在本实施例中,基于步骤202所确定的待检测视频的逐隔行类型和步骤203所确定的待检测视频的场优先顺序,上述执行主体可以生成待检测视频的检测结果。其中,待检测视频的检测结果中可以包括待检测视频的逐隔行类型和场优先顺序。这里,待检测视频的检测结果可以包括两种,一种是:待检测视频的逐隔行类型是隔行类型,且场优先顺序是底场优先;另一种是:待检测视频的逐隔行类型是隔行类型,且场优先顺序是顶场优先。In this embodiment, based on the progressive interlace type of the video to be detected determined in
在本实施例的一些可选的实现方式中,在确定待检测视频的逐隔行类型是逐行类型的情况下,上述执行主体可以生成待检测视频的检测结果。其中,待检测视频的检测结果中可以包括待检测视频的逐隔行类型。这里,待检测视频的检测结果可以包括一种,即:待检测视频的逐隔行类型是逐行类型。In some optional implementations of this embodiment, in a case where it is determined that the progressive interlaced type of the video to be detected is the progressive type, the above-mentioned execution body may generate a detection result of the video to be detected. The detection result of the video to be detected may include a line-by-line type of the video to be detected. Here, the detection result of the video to be detected may include one, that is, the progressive interlaced type of the video to be detected is the progressive type.
在本实施例的一些可选的实现方式中,在生成待检测视频的检测结果之后,上述执行主体可以输出待检测视频的检测结果。通常,上述执行主体可以将待检测视频和待检测视频的检测结果同时发送至数字电视,数字电视可以根据待检测视频的检测结果播放待检测视频。具体地,当待检测视频的检测结果指示待检测视频的逐隔行类型是逐行类型时,数字电视可以直接播放待检测视频;当待检测视频的检测结果指示待检测视频的逐隔行类型是隔行类型时,数字电视可以对待检测视频中的每帧待检测视频图像进行去隔行处理,然后根据待检测视频的检测结果中的场优先顺序对处理后的视频图像进行排序得到处理后的视频,最后播放处理后的视频。In some optional implementation manners of this embodiment, after generating the detection result of the video to be detected, the above-mentioned execution body may output the detection result of the video to be detected. Generally, the above-mentioned executive body can send the video to be detected and the detection result of the video to be detected to the digital TV at the same time, and the digital TV can play the video to be detected according to the detection result of the video to be detected. Specifically, when the detection result of the video to be detected indicates that the progressive type of the video to be detected is progressive, the digital TV can directly play the video to be detected; when the detection result of the video to be detected indicates that the progressive type of the video to be detected is interlaced Type, the digital TV can de-interlace each frame of the video image to be detected in the video to be detected, and then sort the processed video images according to the field priority in the detection result of the video to be detected to obtain the processed video, and finally Play the processed video.
本申请实施例提供的用于检测视频的方法和设备,通过对所获取的待检测视频进行逐隔行检测,从而确定待检测视频的逐隔行类型;在确定待检测视频的逐隔行类型是隔行类型的情况下,对待检测视频进行顶底场顺序检测,从而确定待检测视频的场优先顺序;最后生成待检测视频的检测结果。从而实现了快速地生成视频的检测结果。The method and device for detecting video provided by the embodiments of the present application, by performing interlace detection on the acquired video to be detected, so as to determine the interlace type of the video to be detected; when it is determined that the interlace type of the video to be detected is the interlace type In the case of , the top and bottom field sequence detection is performed on the video to be detected, so as to determine the field priority of the video to be detected; finally, the detection result of the video to be detected is generated. Thus, the detection result of the video can be quickly generated.
进一步参考图3,其示出了用于检测视频的方法的又一个实施例的流程300。该用于检测视频的方法,包括以下步骤:With further reference to Figure 3, a
步骤301,获取待检测视频。
在本实施例中,用于检测视频的方法的执行主体(例如图1所示的电子设备102)可以通过有线连接方式或者无线连接方式从云服务器(例如图1所示的云服务器101)获取待检测视频。In this embodiment, the execution body of the method for detecting video (for example, the
步骤302,对于待检测视频中的每帧待检测视频图像中的每个像素点,计算该像素点在水平方向上的变化量、该像素点的场频率值、该像素点的帧频率值和该像素点在时间上的变化量。
在本实施例中,对于待检测视频中的每帧待检测视频图像中的每个像素点,上述执行主体可以计算该像素点在水平方向上的变化量、该像素点的场频率值、该像素点的帧频率值和该像素点在时间上的变化量。In this embodiment, for each pixel point in each frame of the video image to be detected in the video to be detected, the above-mentioned execution body can calculate the amount of change of the pixel point in the horizontal direction, the field frequency value of the pixel point, the The frame frequency value of the pixel point and the amount of time change of the pixel point.
以图4为例,其示出了一帧待检测视频图像中的像素点分布示意图。其中,该待检测视频图像有5×5个像素点,第一个5为横向像素点个数,第二个5为纵向像素点个数,图4中的一个“●”表示一个像素点。Taking FIG. 4 as an example, it shows a schematic diagram of the distribution of pixel points in a frame of video image to be detected. The video image to be detected has 5×5 pixels, the first 5 is the number of horizontal pixels, the second 5 is the number of vertical pixels, and a “●” in FIG. 4 represents a pixel.
这里,可以通过如下公式计算图4中的第3行第3列的像素点在水平方向上的变化量hor_diff:Here, the horizontal change amount hor_diff of the pixels in the third row and the third column in Figure 4 can be calculated by the following formula:
hor_diff=(|c1-c2|+|c2-c3|+|c3-c4|+|c4-c5|)/4;hor_diff=(|c1-c2|+|c2-c3|+|c3-c4|+|c4-c5|)/4;
其中,c1是图4中的第3行第1列的像素点的像素值,c2是图4中的第3行第2列的像素点的像素值,c3是图4中的第3行第3列的像素点的像素值,c4是图4中的第3行第4列的像素点的像素值,c5是图4中的第3行第5列的像素点的像素值。Among them, c1 is the pixel value of the pixel point in the third row and the first column in FIG. 4 , c2 is the pixel value of the pixel point in the third row and the second column in FIG. 4 , and c3 is the third row in FIG. 4 . The pixel value of the pixel point in the 3rd column, c4 is the pixel value of the pixel point in the 3rd row and the 4th column in FIG. 4 , and c5 is the pixel value of the pixel point in the 3rd row and the 5th column in FIG. 4 .
这里,可以通过如下公式计算图4中的第3行第3列的像素点的场频率值field_freq:Here, the field frequency value field_freq of the pixel point in the 3rd row and 3rd column in FIG. 4 can be calculated by the following formula:
field_freq=|2×c3-a3-e3|;field_freq=|2×c3-a3-e3|;
其中,a3是图4中的第1行第3列的像素点的像素值,e3是图4中的第5行第3列的像素点的像素值。Among them, a3 is the pixel value of the pixel point in the first row and the third column in FIG. 4 , and e3 is the pixel value of the pixel point in the fifth row and the third column in FIG. 4 .
这里,可以通过如下公式计算图4中的第3行第3列的像素点的帧频率值frame_freq:Here, the frame frequency value frame_freq of the pixel point in the 3rd row and 3rd column in FIG. 4 can be calculated by the following formula:
frame_freq=|2×c3-b3-d3|;frame_freq=|2×c3-b3-d3|;
其中,b3是图4中的第2行第3列的像素点的像素值,d3是图4中的第4行第3列的像素点的像素值。Wherein, b3 is the pixel value of the pixel point in the second row and the third column in FIG. 4 , and d3 is the pixel value of the pixel point in the fourth row and the third column in FIG. 4 .
这里,可以通过如下公式计算图4中的第3行第3列的像素点在时间上的变化量temp_diff:Here, the temporal variation temp_diff of the pixels in the 3rd row and 3rd column in Figure 4 can be calculated by the following formula:
temp_diff=|last_c3-c3|;temp_diff=|last_c3-c3|;
其中,last_c3是图4的上一帧待检测视频图像中的第3行第3列的像素点的像素值。Wherein, last_c3 is the pixel value of the pixel point in the third row and the third column in the video image to be detected in the previous frame of FIG. 4 .
需要说明的是,这里的像素点的像素值可以是YUV中的Y的值。其中,其中,YUV是被欧洲电视系统所采用的一种颜色编码方法,“Y”表示明亮度(Luminance或Luma),也就是灰阶值;而“U”和“V”表示的则是色度(Chrominance或Chroma),作用是描述影像色彩及饱和度,用于指定像素的颜色。It should be noted that the pixel value of the pixel point here may be the value of Y in YUV. Among them, YUV is a color coding method adopted by the European television system, "Y" represents the brightness (Luminance or Luma), that is, the grayscale value; and "U" and "V" represent the color Degree (Chrominance or Chroma) is used to describe the color and saturation of the image and is used to specify the color of the pixel.
步骤303,对该像素点在水平方向上的变化量、该像素点的场频率值、该像素点的帧频率值和该像素点在时间上的变化量进行分析,确定该像素点是否是拉丝点。
在本实施例中,基于步骤302所计算出的该像素点在水平方向上的变化量、该像素点的场频率值、该像素点的帧频率值和该像素点在时间上的变化量,上述执行主体可以对该像素点在水平方向上的变化量、该像素点的场频率值、该像素点的帧频率值和该像素点在时间上的变化量进行分析,从而确定该像素点是否是拉丝点。In this embodiment, based on the variation of the pixel in the horizontal direction, the field frequency value of the pixel, the frame frequency value of the pixel and the temporal variation of the pixel calculated in
在本实施例的一些可选的实现方式中,上述执行主体可以通过如下分析方式确定该像素点是否是拉丝点:若该像素点满足第一条件,则确定该像素点是拉丝点,其中,第一条件可以包括:像素点在水平方向上的变化量大于第一阈值、像素点在时间上的变化量大于第二阈值、像素点的帧频率值大于场频率值与第三阈值之和。In some optional implementations of this embodiment, the above-mentioned execution body may determine whether the pixel point is a wire drawing point through the following analysis method: if the pixel point satisfies the first condition, it is determined that the pixel point is a wire drawing point, wherein, The first condition may include: the horizontal change of the pixel is greater than the first threshold, the temporal change of the pixel is greater than the second threshold, and the frame frequency value of the pixel is greater than the sum of the field frequency and the third threshold.
继续以图4为例,若图4中的第3行第3列的像素点同时满足以下3个条件,则该像素点是拉丝点,反之,则不是拉丝点:Continuing to take Figure 4 as an example, if the pixel in the 3rd row and 3rd column in Figure 4 satisfies the following three conditions at the same time, the pixel is a drawing point; otherwise, it is not a drawing point:
hor_diff>edge_thr;hor_diff > edge_thr;
temp_diff>move_thr;temp_diff > move_thr;
frame_freq>field_freq+freq_thr;frame_freq>field_freq+freq_thr;
其中,edge_thr是第一阈值,其取值范围通常在10附近,move_thr是第二阈值,freq_thr是第三阈值。Among them, edge_thr is the first threshold, and its value range is usually around 10, move_thr is the second threshold, and freq_thr is the third threshold.
这里,可以通过如下公式计算第二阈值move_thr:Here, the second threshold move_thr can be calculated by the following formula:
move_thr=max(frame_freq/4,5)。move_thr=max(frame_freq/4,5).
这里,可以通过如下公式计算第三阈值freq_thr:Here, the third threshold freq_thr can be calculated by the following formula:
freq_thr=frame_freq/4。freq_thr=frame_freq/4.
步骤304,统计待检测视频中的每帧待检测视频图像中的拉丝点比例,得到统计结果。
在本实施例中,上述执行主体可以统计待检测视频中的每帧待检测视频图像中的拉丝点的比例,从而得到统计结果。In this embodiment, the above-mentioned execution body can count the proportion of the wire drawing points in each frame of the video image to be detected in the video to be detected, so as to obtain the statistical result.
这里,可以预设第一参数fila_cnt,并设置其初始值为0,对于待检测视频中的每帧待检测视频图像,可以逐个确定像素点是否是拉丝点,若确定出一个像素点是拉丝点,将第一参数fila_cnt增加1,并继续确定下一个像素点是否是拉丝点,直至所有的像素点均被确定完毕,此时第一参数fila_cnt的值即为待检测视频图像中拉丝点的数量。Here, the first parameter fila_cnt can be preset, and its initial value is set to 0. For each frame of the video image to be detected in the video to be detected, it can be determined one by one whether the pixel is a wire drawing point. If it is determined that a pixel is a wire drawing point , increase the first parameter fila_cnt by 1, and continue to determine whether the next pixel is a drawing point until all pixels have been determined. At this time, the value of the first parameter fila_cnt is the number of drawing points in the video image to be detected. .
在本实施例的一些可选的实现方式中,对于待检测视频中的每帧待检测视频图像,上述执行主体可以首先计算该待检测视频图像中的拉丝点的数量与满足第二条件的像素点的数量的比值;然后将所得到的比值与第四阈值进行比较,若所得到的比值大于第四阈值,则确定该待检测视频图像的逐隔行类型是隔行类型,若所得到的比值不大于第四阈值,则确定该待检测视频图像的逐隔行类型是逐行类型。其中,第二条件可以包括:像素点在水平方向上的变化量大于第一阈值、像素点在时间上的变化量大于第二阈值。In some optional implementations of this embodiment, for each frame of the to-be-detected video image in the to-be-detected video, the above-mentioned execution body may first calculate the number of drawing points in the to-be-detected video image and the pixels that satisfy the second condition The ratio of the number of points; then compare the obtained ratio with the fourth threshold, if the obtained ratio is greater than the fourth threshold, then determine that the interlaced type of the video image to be detected is the interlaced type, if the obtained ratio is not If it is greater than the fourth threshold, it is determined that the progressive interlaced type of the video image to be detected is the progressive type. Wherein, the second condition may include: the change amount of the pixel point in the horizontal direction is greater than the first threshold, and the change amount of the pixel point in time is greater than the second threshold value.
继续以图4为例,若图4中的第3行第3列的像素点同时满足以下2个条件,则该像素点是满足第二条件的像素点,反之,则不是满足第二条件的像素点:Continuing to take FIG. 4 as an example, if the pixel in the third row and the third column in FIG. 4 satisfies the following two conditions at the same time, the pixel is a pixel that satisfies the second condition; otherwise, it does not satisfy the second condition. pixel:
hor_diff>edge_thr;hor_diff > edge_thr;
temp_diff>move_thr。temp_diff>move_thr.
这里,可以预设第二参数cnt,并设置其初始值为0,对于待检测视频中的每帧待检测视频图像,可以逐个确定像素点是否满足第二条件,若确定出一个像素点满足第二条件,将第二参数cnt增加1,并继续确定下一个像素点是否满足第二条件,直至所有的像素点均被确定完毕,此时第二参数cnt的值即为待检测视频图像中满足第二条件的像素点的数量。Here, the second parameter cnt can be preset, and its initial value is set to 0. For each frame of the video image to be detected in the video to be detected, it can be determined one by one whether the pixels meet the second condition, if it is determined that a pixel meets the first The second condition is to increase the second parameter cnt by 1, and continue to determine whether the next pixel satisfies the second condition until all pixels are determined. At this time, the value of the second parameter cnt is the video image to be detected that satisfies the second condition. The number of pixels for the second condition.
这里,可以通过如下公式计算该待检测视频图像中的拉丝点的数量与满足第二条件的像素点的数量的比值ratio:Here, the ratio ratio between the number of drawing points in the video image to be detected and the number of pixels satisfying the second condition can be calculated by the following formula:
ratio=fila_cnt/cnt。ratio=fila_cnt/cnt.
这里,可以预设第四阈值ratio_thr,其取值范围通常在0到1之间,并将ratio与第四阈值ratio_thr进行比较,若ratio>ratio_thr,则确定该待检测视频图像的逐隔行类型是隔行类型,反之,则确定该待检测视频图像是逐行类型。Here, a fourth threshold ratio_thr can be preset, and its value range is usually between 0 and 1, and the ratio is compared with the fourth threshold ratio_thr. If ratio>ratio_thr, it is determined that the line-by-line type of the video image to be detected is Interlaced type, otherwise, it is determined that the video image to be detected is of progressive type.
步骤305,基于统计结果,确定待检测视频的逐隔行类型。
在本实施例中,基于步骤304所得到的统计结果,上述执行主体可以确定待检测视频的逐隔行类型。In this embodiment, based on the statistical result obtained in
实践中,由于对一帧待检测视频图像的确定结果可能不准确,因此,可以累计多帧待检测视频图像的确定结果,来确定待检测视频的逐隔行类型。例如,若待检测视频中属于隔行类型的待检测视频图像的比例大于一定数值,则确定待检测视频的逐隔行类型是隔行类型,反之,则确定待检测视频的逐隔行类型是逐行类型。又例如,累计待检测视频中每帧待检测视频图像中拉丝点的数量,同时累计待检测视频中每帧待检测视频图像中满足第二条件的像素点的数量,将累计出的拉丝点的数量与累计出的满足第二条件的像素点的数量的比值与第四阈值进行比较,若所得到的比值大于第四阈值,则确定该待检测视频的逐隔行类型是隔行类型,若所得到的比值不大于第四阈值,则确定该待检测视频的逐隔行类型是逐行类型。In practice, since the determination result of one frame of video images to be detected may be inaccurate, the determination results of multiple frames of video images to be detected may be accumulated to determine the type of interlaced video to be detected. For example, if the proportion of to-be-detected video images belonging to the interlaced type in the video to be detected is greater than a certain value, then it is determined that the progressive interlaced type of the video to be detected is the interlaced type; otherwise, it is determined that the progressive interlaced type of the video to be detected is the progressive type. For another example, the number of drawing points in each frame of the video image to be detected in the video to be detected is accumulated, and the number of pixels that satisfy the second condition in each frame of the video image to be detected in the video to be detected is accumulated, and the accumulated number of drawing points in each frame of the video image to be detected is accumulated. The ratio of the number to the accumulated number of pixels satisfying the second condition is compared with the fourth threshold, and if the obtained ratio is greater than the fourth threshold, it is determined that the interlaced type of the video to be detected is the interlaced type, and if the obtained ratio is greater than the fourth threshold If the ratio is not greater than the fourth threshold, it is determined that the progressive interlaced type of the video to be detected is the progressive type.
步骤306,响应于确定待检测视频的逐隔行类型是隔行类型,对于待检测视频中的每两帧相邻的待检测视频图像,将该两帧相邻的待检测视频图像分割成四场。
在本实施例中,在确定待检测视频的逐隔行类型是隔行类型的情况下,对于待检测视频中的每两帧相邻的待检测视频图像,上述执行主体可以将该两帧相邻的待检测视频图像分割成四场。In this embodiment, when it is determined that the interlaced type of the video to be detected is the interlaced type, for every two adjacent frames of the video image to be detected in the video to be detected, the execution body may The video image to be detected is divided into four fields.
这里,由于隔行视频图像是由相邻的两帧图像中的一帧视频图像的底场与另一帧视频图像的顶场拼合而成的,因此,每帧隔行视频图像可以被分割两场,其中一场属于相邻的两帧图像中的一帧视频图像,另一场属于相邻的两帧图像中的另一帧视频图像。Here, since the interlaced video image is composed of the bottom field of one frame of video image and the top field of another frame of video image in two adjacent frames of images, each frame of interlaced video image can be divided into two fields, One field belongs to one frame of video image in two adjacent frames of images, and the other field belongs to another frame of video image in the two adjacent frames of images.
以图5为例,其示出了两帧相邻的待检测视频图像分割成的四场中的像素点分布示意图。其中,每个虚线框框住的是一帧待检测视频图像分割成的两场,每场包括3行像素点,图5中的一个“■”表示一行像素点。Taking FIG. 5 as an example, it shows a schematic diagram of the distribution of pixels in four fields divided into two adjacent video images to be detected. Wherein, each dashed frame frame is a frame of video image to be detected into two fields, each field includes 3 rows of pixels, a “■” in FIG. 5 represents a row of pixels.
步骤307,利用上下两行像素点的平均值对缺失的场进行填充,得到四帧图像。Step 307: Fill the missing field with the average value of the upper and lower rows of pixels to obtain four frames of images.
在本实施例中,基于步骤306所分割成的四场,上述执行主体可以利用上下两行像素点的平均值对缺失的场进行填充,从而得到四帧图像。In this embodiment, based on the four fields divided into
以图6为例,其示出了四场填充成的底场优先的四帧图像的像素点分布示意图。其中,每帧视频图像包括6行像素点,图6中的一个“■”表示保留的场的一行像素点,一个“□”表示填充的场的一行像素点,标号为1的图像是两帧相邻的待检测视频图像中的前一帧待检测视频图像所分割成的底场和填充后生成的顶场拼成的图像,标号为2的图像是两帧相邻的待检测视频图像中的前一帧待检测视频图像所分割成的顶场和填充后生成的底场拼成的图像,标号为3的图像是两帧相邻的待检测视频图像中的后一帧待检测视频图像所分割成的底场和填充后生成的顶场拼成的图像,标号为4的图像是两帧相邻的待检测视频图像中的后一帧待检测视频图像所分割成的顶场和填充后生成的底场拼成的图像。Taking FIG. 6 as an example, it shows a schematic diagram of pixel point distribution of four frames of images filled with four fields and having a bottom field priority. Among them, each frame of video image includes 6 lines of pixels, a "■" in Figure 6 represents a line of pixels in the reserved field, and a "□" represents a line of pixels in the filled field, and the image marked with 1 is two frames. In the adjacent video images to be detected, the image of the bottom field divided into the video image to be detected of the previous frame and the top field generated after filling, the image marked with 2 is two adjacent video images to be detected. The image of the top field and the bottom field generated after filling the previous frame of the video image to be detected is divided into, and the image marked with 3 is the next frame of the video image to be detected in the two adjacent video images to be detected. The image formed by the divided bottom field and the top field generated after filling, the image marked with 4 is the top field and the filling divided into the next frame of the video image to be detected in the two adjacent video images to be detected. Post-generated bottom field stitched image.
以图7为例,其示出了四场填充成的顶场优先的四帧图像的像素点分布示意图。其中,每帧视频图像包括6行像素点,图7中的一个“■”表示保留的场的一行像素点,一个“□”表示填充的场的一行像素点,标号为1的图像是两帧相邻的待检测视频图像中的前一帧待检测视频图像所分割成的底场和填充后生成的顶场拼成的图像,标号为2的图像是两帧相邻的待检测视频图像中的前一帧待检测视频图像所分割成的顶场和填充后生成的底场拼成的图像,标号为3的图像是两帧相邻的待检测视频图像中的后一帧待检测视频图像所分割成的底场和填充后生成的顶场拼成的图像,标号为4的图像是两帧相邻的待检测视频图像中的后一帧待检测视频图像所分割成的顶场和填充后生成的底场拼成的图像。Taking FIG. 7 as an example, it shows a schematic diagram of the pixel point distribution of the top-field priority four-frame image filled with four fields. Among them, each frame of video image includes 6 lines of pixels, a "■" in Figure 7 represents a line of pixels in the reserved field, and a "□" represents a line of pixels in the filled field, and the image marked with 1 is two frames. In the adjacent video images to be detected, the image of the bottom field divided into the video image to be detected of the previous frame and the top field generated after filling, the image marked with 2 is two adjacent video images to be detected. The image of the top field and the bottom field generated after filling the previous frame of the video image to be detected is divided into, and the image marked with 3 is the next frame of the video image to be detected in the two adjacent video images to be detected. The image that the bottom field is divided into and the top field generated after filling, the image marked with 4 is the top field and the filling that the next frame of the video image to be detected is divided into two adjacent video images to be detected. Post-generated bottom field stitched image.
需要说明的是,在图6和图7中,无论生成的四帧图像如何排序,相同标号的图像是同一帧图像,例如图6中标号为1的图像是两帧相邻的待检测视频图像中的前一帧待检测视频图像所分割成的底场和填充后生成的顶场拼成的图像,图7中标号为1的图像同样是两帧相邻的待检测视频图像中的前一帧待检测视频图像所分割成的底场和填充后生成的顶场拼成的图像。It should be noted that, in FIG. 6 and FIG. 7 , no matter how the generated four frames of images are sorted, the images with the same label are the same frame of images, for example, the image with the label of 1 in FIG. 6 is two adjacent frames of video images to be detected. The image that the bottom field and the top field generated after filling the previous frame of the video image to be detected are spliced together, and the image labeled 1 in FIG. An image composed of the bottom field divided into the video image to be detected and the top field generated after filling.
步骤308,计算四帧图像中的两帧图像中对应位置的像素点的差值的绝对值之和。Step 308: Calculate the sum of the absolute values of the differences of the pixel points at the corresponding positions in the two frames of images in the four frames of images.
在本实施例中,基于步骤307所得到的四帧图像,上述执行主体可以计算四帧图像中的两帧图像中对应位置的像素点的差值的绝对值之和。In this embodiment, based on the four frames of images obtained in
在本实施例的一些可选的实现方式中,上述执行主体可以首先将四帧图像划分为两对图像;然后计算每对图像中对应位置的像素点的差值的绝对值之和。例如,两对图像中的第一对图像可以包括:该两帧相邻的待检测视频图像中的前一帧待检测视频图像所分割成的底场和填充后生成的顶场拼成的图像、该两帧相邻的待检测视频图像中的后一帧待检测视频图像所分割成的顶场和填充后生成的底场拼成的图像;两对图像中的第二对图像可以包括:该两帧相邻的待检测视频图像中的前一帧待检测视频图像所分割成的顶场和填充后生成的底场拼成的图像、该两帧相邻的待检测视频图像中的后一帧待检测视频图像所分割成的底场和填充后生成的顶场拼成的图像。In some optional implementations of this embodiment, the above-mentioned execution body may firstly divide the four frames of images into two pairs of images; and then calculate the sum of the absolute values of the differences of pixel points at corresponding positions in each pair of images. For example, the first pair of images in the two pairs of images may include: an image composed of a bottom field and a top field generated after filling the two adjacent frames of the video images to be detected that are divided into the previous frame of the video image to be detected. , the image that the next frame to be detected video image in the two adjacent video images to be detected is divided into the top field and the bottom field generated after filling; The second pair of images in the two pairs of images can include: In the two adjacent frames of video images to be detected, the top field of the previous frame of the video image to be detected is divided into an image formed by the bottom field after filling, and the back field of the two adjacent frames of video images to be detected An image composed of a bottom field divided into a frame of video image to be detected and a top field generated after filling.
继续以图6或图7为例,第一对图像可以包括标号为1的图像和标号为4的图像,第二对图像可以包括标号为2的图像和标号为3的图像。同时,可以通过如下公式计算标号为1的图像与标号为4的图像的对应位置的像素点的差值的绝对值之和diff_abs_sum14;Continuing to take FIG. 6 or FIG. 7 as an example, the first pair of images may include an image numbered 1 and an image numbered 4, and the second pair of images may include an image numbered 2 and an image numbered 3. At the same time, the sum of the absolute values of the difference between the pixel points at the corresponding positions of the image labeled 1 and the image labeled 4 can be calculated by the following formula diff_abs_sum14;
其中,i为正整数,且1≤i≤N,N为图像的行数,j为正整数,且1≤j≤M,M为图像的列数,f1为标号为1的图像中的像素点的像素值,fij 1为标号为1的图像中的第i行第j列的像素点的像素值,f4为标号为4的图像中的像素点的像素值,fij 4为标号为4的图像中的第i行第j列的像素点的像素值。Among them, i is a positive integer, and 1≤i≤N, N is the number of rows of the image, j is a positive integer, and 1≤j≤M, M is the number of columns of the image, f 1 is the number of images in the image labeled 1 The pixel value of the pixel point, f ij 1 is the pixel value of the pixel point in the i-th row and the j-th column in the image labeled 1, f 4 is the pixel value of the pixel point in the image labeled 4, and f ij 4 is The pixel value of the pixel in the i-th row and the j-th column in the image labeled 4.
这里,可以通过如下公式计算标号为2的图像与标号为3的图像的对应位置的像素点的差值的绝对值之和diff_abs_sum23;Here, the sum of the absolute values of the difference between the pixel points at the corresponding positions of the image labeled 2 and the image labeled 3 can be calculated by the following formula diff_abs_sum23;
其中,f2为标号为2的图像中的像素点的像素值,fij 2为标号为2的图像中的第i行第j列的像素点的像素值,f3为标号为3的图像中的像素点的像素值,fij 3为标号为3的图像中的第i行第j列的像素点的像素值。Wherein, f 2 is the pixel value of the pixel in the image labeled 2, f ij 2 is the pixel value of the pixel in the ith row and jth column in the image labeled 2, and f 3 is the image labeled 3 The pixel value of the pixel in , f ij 3 is the pixel value of the pixel in the i-th row and the j-th column in the image labeled 3.
需要说明的是,这里的像素点的像素值也可以是YUV中的Y的值。It should be noted that the pixel value of the pixel point here may also be the value of Y in YUV.
步骤309,对四帧图像中的两帧图像中对应位置的像素点的差值的绝对值之和进行分析,确定待检测视频的场优先顺序。
在本实施例中,基于步骤308所计算出的四帧图像中的两帧图像中对应位置的像素点的差值的绝对值之和,上述执行主体可以对四帧图像中的两帧图像中对应位置的像素点的差值的绝对值之和进行分析,从而确定待检测视频的场优先顺序。In this embodiment, based on the sum of the absolute values of the difference values of the pixel points at the corresponding positions in the two frames of images in the four frames of images calculated in
在本实施例的一些可选的实现方式中,上述执行主体可以将第一对图像中对应位置的像素点的差值的绝对值之和与第二对图像中对应位置的像素点的差值的绝对值之和进行比较;若第一对图像中对应位置的像素点的差值的绝对值之和大于第二对图像中对应位置的像素点的差值的绝对值之和,则确定待检测视频的场优先顺序是底场优先;若第一对图像中对应位置的像素点的差值的绝对值之和不大于第二对图像中对应位置的像素点的差值的绝对值之和,则确定待检测视频的场优先顺序是顶场优先。In some optional implementations of this embodiment, the above-mentioned execution body may calculate the sum of the absolute values of the difference values of the pixel points at the corresponding positions in the first pair of images and the difference value of the pixel points at the corresponding positions in the second pair of images If the sum of the absolute values of the differences of the pixel points at the corresponding positions in the first pair of images is greater than the sum of the absolute values of the differences of the pixel points at the corresponding positions in the second pair of images, it is determined to be The field priority order of the detected video is the bottom field priority; if the sum of the absolute values of the differences of the pixel points at the corresponding positions in the first pair of images is not greater than the sum of the absolute values of the differences of the pixel points at the corresponding positions in the second pair of images , then it is determined that the field priority order of the video to be detected is the top field priority.
继续以图6或图7为例,可以将diff_abs_sum14与diff_abs_sum23进行比较,若diff_abs_sum14>diff_abs_sum23,则确定待检测视频的场优先顺序是底场优先,反之,则确定待检测视频的场优先顺序是顶场优先。Continuing to take FIG. 6 or FIG. 7 as an example, diff_abs_sum14 can be compared with diff_abs_sum23. If diff_abs_sum14>diff_abs_sum23, it is determined that the field priority of the video to be detected is the bottom field priority, otherwise, it is determined that the field priority of the video to be detected is the top field Field priority.
步骤310,生成待检测视频的检测结果。
在本实施例中,上述执行主体可以生成待检测视频的检测结果。其中,待检测视频的检测结果中可以包括待检测视频的逐隔行类型和场优先顺序。这里,待检测视频的检测结果可以包括两种,一种是:待检测视频的逐隔行类型是隔行类型,且场优先顺序是底场优先;另一种是:待检测视频的逐隔行类型是隔行类型,且场优先顺序是顶场优先。In this embodiment, the above-mentioned execution body may generate a detection result of the video to be detected. The detection result of the video to be detected may include the interlace type and field priority of the video to be detected. Here, the detection results of the video to be detected can include two types, one is: the progressive interlaced type of the video to be detected is the interlaced type, and the field priority is bottom field priority; the other is: the progressive interlaced type of the video to be detected is Interlaced type, and the field priority is top field priority.
从图3中可以看出,与图2对应的实施例相比,本实施例中的用于检测视频的方法的流程300突出了确定待检测视频的逐隔行类型和场优先顺序的步骤。由此,本实施例描述的方案提高了所确定出的待检测视频的逐隔行类型和场优先顺序的准确度。As can be seen from FIG. 3 , compared with the embodiment corresponding to FIG. 2 , the
下面参考图8,其示出了适于用来实现本申请实施例的电子设备的计算机系统800的结构示意图。图8示出的电子设备仅仅是一个示例,不应对本申请实施例的功能和使用范围带来任何限制。Referring next to FIG. 8 , it shows a schematic structural diagram of a
如图8所示,计算机系统800包括中央处理单元(CPU)801,其可以根据存储在只读存储器(ROM)802中的程序或者从存储部分808加载到随机访问存储器(RAM)803中的程序而执行各种适当的动作和处理。在RAM 803中,还存储有系统800操作所需的各种程序和数据。CPU 801、ROM 802以及RAM 803通过总线804彼此相连。输入/输出(I/O)接口805也连接至总线804。As shown in FIG. 8, a
以下部件连接至I/O接口805:包括键盘、鼠标等的输入部分806;包括诸如阴极射线管(CRT)、液晶显示器(LCD)等以及扬声器等的输出部分807;包括硬盘等的存储部分808;以及包括诸如LAN卡、调制解调器等的网络接口卡的通信部分809。通信部分809经由诸如因特网的网络执行通信处理。驱动器810也根据需要连接至I/O接口805。可拆卸介质811,诸如磁盘、光盘、磁光盘、半导体存储器等等,根据需要安装在驱动器810上,以便于从其上读出的计算机程序根据需要被安装入存储部分808。The following components are connected to the I/O interface 805: an
特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信部分809从网络上被下载和安装,和/或从可拆卸介质811被安装。在该计算机程序被中央处理单元(CPU)801执行时,执行本申请的方法中限定的上述功能。需要说明的是,本申请所述的计算机可读介质可以是计算机可读信号介质或者计算机可读介质或者是上述两者的任意组合。计算机可读介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本申请中,计算机可读介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本申请中,计算机可读的信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读的信号介质还可以是计算机可读介质以外的任何计算机可读介质,该计算机可读介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:无线、电线、光缆、RF等等,或者上述的任意合适的组合。In particular, according to embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the method illustrated in the flowchart. In such an embodiment, the computer program may be downloaded and installed from the network via the
可以以一种或多种程序设计语言或其组合来编写用于执行本申请的操作的计算机程序代码,所述程序设计语言包括面向目标的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如”C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。Computer program code for performing the operations of the present application may be written in one or more programming languages, including object-oriented programming languages—such as Java, Smalltalk, C++, but also conventional Procedural programming language - such as "C" language or similar programming language. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer, or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (eg, using an Internet service provider through Internet connection).
附图中的流程图和框图,图示了按照本申请各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。The flowchart and block diagrams in the Figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code that contains one or more logical functions for implementing the specified functions executable instructions. It should also be noted that, in some alternative implementations, the functions noted in the blocks may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It is also noted that each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations, can be implemented in dedicated hardware-based systems that perform the specified functions or operations , or can be implemented in a combination of dedicated hardware and computer instructions.
描述于本申请实施例中所涉及到的单元可以通过软件的方式实现,也可以通过硬件的方式来实现。所描述的单元也可以设置在处理器中,例如,可以描述为:一种处理器包括获取单元、第一检测单元、第二检测单元和生成单元。其中,这些单元的名称在某种情况下并不构成对该单元本身的限定,例如,获取单元还可以被描述为“获取待检测视频的单元”。The units involved in the embodiments of the present application may be implemented in a software manner, and may also be implemented in a hardware manner. The described unit may also be provided in the processor, for example, it may be described as: a processor includes an acquisition unit, a first detection unit, a second detection unit and a generation unit. Wherein, the names of these units do not constitute a limitation on the unit itself under certain circumstances, for example, the acquisition unit may also be described as "a unit for acquiring the video to be detected".
作为另一方面,本申请还提供了一种计算机可读介质,该计算机可读介质可以是上述实施例中描述的电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该电子设备执行时,使得该电子设备:获取待检测视频;对待检测视频进行逐隔行检测,确定待检测视频的逐隔行类型;响应于确定待检测视频的逐隔行类型是隔行类型,对待检测视频进行顶底场顺序检测,确定待检测视频的场优先顺序;生成待检测视频的检测结果,其中,待检测视频的检测结果中包括待检测视频的逐隔行类型和场优先顺序。As another aspect, the present application also provides a computer-readable medium. The computer-readable medium may be included in the electronic device described in the above embodiments; it may also exist alone without being assembled into the electronic device. middle. The above-mentioned computer-readable medium carries one or more programs, and when the above-mentioned one or more programs are executed by the electronic device, the electronic device: acquires the video to be detected; performs interlace detection on the video to be detected, and determines the content of the video to be detected. Progressive interlaced type; in response to determining that the progressive interlaced type of the video to be detected is the interlaced type, perform top and bottom field sequence detection on the video to be detected, and determine the field priority of the video to be detected; generate a detection result of the video to be detected, wherein the video to be detected is detected. The detection result includes the progressive interlace type and field priority of the video to be detected.
以上描述仅为本申请的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本申请中所涉及的发明范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离上述发明构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本申请中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。The above description is only a preferred embodiment of the present application and an illustration of the applied technical principles. Those skilled in the art should understand that the scope of the invention involved in this application is not limited to the technical solution formed by the specific combination of the above technical features, and should also cover the above technical features or Other technical solutions formed by any combination of its equivalent features. For example, a technical solution is formed by replacing the above features with the technical features disclosed in this application (but not limited to) with similar functions.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810220202.5A CN108471530B (en) | 2018-03-16 | 2018-03-16 | Method and apparatus for detecting video |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810220202.5A CN108471530B (en) | 2018-03-16 | 2018-03-16 | Method and apparatus for detecting video |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108471530A CN108471530A (en) | 2018-08-31 |
CN108471530B true CN108471530B (en) | 2020-10-02 |
Family
ID=63265334
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810220202.5A Active CN108471530B (en) | 2018-03-16 | 2018-03-16 | Method and apparatus for detecting video |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108471530B (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1941854A (en) * | 2005-09-26 | 2007-04-04 | 英特尔公司 | Detecting video format information in a sequence of video pictures |
CN101420615A (en) * | 2008-11-18 | 2009-04-29 | 华为技术有限公司 | Method and device for detecting video field sequence and video processing system |
CN101690177A (en) * | 2007-05-09 | 2010-03-31 | 英国电讯有限公司 | Video signal analysis |
CN107071326A (en) * | 2017-04-26 | 2017-08-18 | 西安诺瓦电子科技有限公司 | Method for processing video frequency and device |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7450180B2 (en) * | 2004-12-29 | 2008-11-11 | General Instrument Corporation | Method for detecting interlaced material and field order |
-
2018
- 2018-03-16 CN CN201810220202.5A patent/CN108471530B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1941854A (en) * | 2005-09-26 | 2007-04-04 | 英特尔公司 | Detecting video format information in a sequence of video pictures |
CN101690177A (en) * | 2007-05-09 | 2010-03-31 | 英国电讯有限公司 | Video signal analysis |
CN101420615A (en) * | 2008-11-18 | 2009-04-29 | 华为技术有限公司 | Method and device for detecting video field sequence and video processing system |
CN107071326A (en) * | 2017-04-26 | 2017-08-18 | 西安诺瓦电子科技有限公司 | Method for processing video frequency and device |
Also Published As
Publication number | Publication date |
---|---|
CN108471530A (en) | 2018-08-31 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP6697755B2 (en) | Video display device and video display method | |
CN108833938B (en) | Method and apparatus for selecting video covers | |
US9854232B2 (en) | Systems and methods for picture quality monitoring | |
EP2624550A1 (en) | Content transmitting device, content transmitting method, content reproduction device, content reproduction method, program, and content delivery system | |
US8116593B2 (en) | Image processing apparatus, image processing method, and program for determining a zoom area for a displayed zoom image | |
WO2017211250A1 (en) | Image overlay display method and system | |
US7256835B2 (en) | Apparatus and method for deinterlacing video images | |
US7898598B2 (en) | Method and apparatus for video mode judgement | |
KR20200027491A (en) | Adaptive high dynamic range tone mapping using overlay instructions | |
GB2559246A (en) | Display apparatus, control method therefor, and program | |
US20050036061A1 (en) | De-interlacing of video data | |
USRE45306E1 (en) | Image processing method and device thereof | |
CN108471530B (en) | Method and apparatus for detecting video | |
US8866967B2 (en) | Method and apparatus for motion adaptive deinterlacing | |
EP4529154A1 (en) | Video processing method and apparatus, and electronic device and storage medium | |
US9392145B2 (en) | Mechanism for facilitating dynamic phase detection with high jitter tolerance for images of media streams | |
WO2017101348A1 (en) | Method and device for deinterlacing interlaced videos | |
US20080165277A1 (en) | Systems and Methods for Deinterlacing Video Data | |
US12081902B2 (en) | Systems and methods for signal transmission | |
Stolitzka et al. | New procedures to evaluate visually lossless compression for display systems | |
CN115439660A (en) | Detection method, detection device, electronic equipment and medium | |
US7262811B2 (en) | System and method for automatic zoom | |
CN108965764B (en) | Image processing method and electronic device | |
US8284307B1 (en) | Method for processing digital video fields | |
CN103731718A (en) | Method and apparatus for detecting a television channel change event |
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 | ||
CP03 | Change of name, title or address |
Address after: Room 80536, Shanghai Patentee after: Shanghai Zongzhang Technology Group Co.,Ltd. Country or region after: China Address before: Room 80536, Shanghai Patentee before: SHANGHAI ZHANGMEN SCIENCE AND TECHNOLOGY Co.,Ltd. Country or region before: China |
|
CP03 | Change of name, title or address |