CN104202551A - Method and device for video data acquisition - Google Patents
Method and device for video data acquisition Download PDFInfo
- Publication number
- CN104202551A CN104202551A CN201410425811.6A CN201410425811A CN104202551A CN 104202551 A CN104202551 A CN 104202551A CN 201410425811 A CN201410425811 A CN 201410425811A CN 104202551 A CN104202551 A CN 104202551A
- Authority
- CN
- China
- Prior art keywords
- video
- data
- video data
- effective dose
- resolution
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 70
- 230000008569 process Effects 0.000 claims abstract description 36
- 238000012544 monitoring process Methods 0.000 claims description 47
- 238000012545 processing Methods 0.000 claims description 38
- 230000005540 biological transmission Effects 0.000 claims description 4
- 230000007812 deficiency Effects 0.000 claims 5
- 238000005498 polishing Methods 0.000 claims 3
- 230000001360 synchronised effect Effects 0.000 abstract description 13
- 238000009825 accumulation Methods 0.000 abstract description 5
- 238000010586 diagram Methods 0.000 description 13
- 238000013480 data collection Methods 0.000 description 9
- 238000004590 computer program Methods 0.000 description 7
- 230000006870 function Effects 0.000 description 6
- 230000000295 complement effect Effects 0.000 description 5
- 238000012986 modification Methods 0.000 description 5
- 230000004048 modification Effects 0.000 description 5
- 230000002159 abnormal effect Effects 0.000 description 3
- 230000007704 transition Effects 0.000 description 3
- 238000006243 chemical reaction Methods 0.000 description 2
- 238000001514 detection method Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 230000006872 improvement Effects 0.000 description 1
- 238000007689 inspection Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 238000011084 recovery Methods 0.000 description 1
- 238000012795 verification Methods 0.000 description 1
Landscapes
- Closed-Circuit Television Systems (AREA)
Abstract
本发明公开了一种视频数据采集方法及装置,该方法包括:确定当前需要的视频分辨率;在采集过程中实时根据视频的同步信号监测视频数据的有效量,并判断监测到的视频数据的有效量与当前需要的视频分辨率包括的值所表示的数据量是否一致;在不一致时,根据监测到的视频数据的有效量与当前需要的视频分辨率包括的值所表示的数据量之间的大小关系对视频数据进行处理。由于在采集视频的过程中利用视频的同步信号实时监测视频数据的有效量,并根据视频分辨率确定监测到的所述视频数据的有效量是一致,发现不一致即进行处理,避免了因数据错位而导致的错误累积,使得在视频信号源恢复正常时,该采集错误不会影响后续视频信号的采集。
The invention discloses a method and device for collecting video data. The method includes: determining the video resolution currently required; Whether the effective amount is consistent with the amount of data represented by the value included in the currently required video resolution; The size relationship of the video data is processed. Since the effective amount of the video data is monitored in real time by using the synchronous signal of the video in the process of collecting the video, and the effective amount of the monitored video data is determined to be consistent according to the video resolution, and the inconsistency is found to be processed, thereby avoiding data misalignment The resulting error accumulation makes the collection error not affect subsequent video signal collection when the video signal source returns to normal.
Description
技术领域technical field
本发明涉及数字信号处理技术,尤其涉及一种视频数据采集方法及装置。The invention relates to digital signal processing technology, in particular to a method and device for collecting video data.
背景技术Background technique
视频数据采集(Video Capture)主要作用是将摄像机、录像机、电视机输出的模拟视频信号转换为数字视频信号,供后续处理和传输。The main function of video data acquisition (Video Capture) is to convert the analog video signal output by the camera, video recorder, and TV into a digital video signal for subsequent processing and transmission.
通用嵌入式处理器往往比专用视频处理器用于更多的片上存储资源,对提高系统性能很有帮助。但通用处理器的不足之处是没有专门的视频采集接口,由于现场可编程门阵列(Field-Programmable Gate Array,FPGA)具有接口扩展形式较灵活的特点,因此,目前用于视频处理的嵌入式系统大多采用FPGA+通用处理器的架构。General-purpose embedded processors tend to use more on-chip storage resources than dedicated video processors, which is very helpful for improving system performance. However, the shortcoming of general-purpose processors is that there is no dedicated video acquisition interface. Since the field-programmable gate array (Field-Programmable Gate Array, FPGA) has the characteristics of flexible interface expansion, the embedded video processing currently used Most of the systems use FPGA+general-purpose processor architecture.
利用FPGA的接口扩展形式灵活的优势可实现实时视频采集工作。然而,在实际使用过程中常出现视频源信号不稳定或突然中断现象,现有的视频数据采集方法重点关注采集功能实现和性能的提高并不对这些情况进行考虑,继续进行视频数据的集采,这就使得采集的数据较大程度上会出现错误,并且由于错误的累积,即使在视频源信号恢复正常,该错误也无法消除,采集到的视频数据依然是错误的。因此,现有的视频数据采集方法存在在视频源信号异常时一旦出现采集错误,即使在视频源信号恢复正常后仍无法正确进行视频信号采集的问题。Real-time video acquisition can be realized by utilizing the flexible advantages of the FPGA interface expansion form. However, in the actual use process, the video source signal is often unstable or suddenly interrupted. The existing video data collection methods focus on the realization of the collection function and the improvement of performance without considering these situations, and continue to collect video data. This makes the collected data error to a large extent, and due to the accumulation of errors, even if the video source signal returns to normal, the error cannot be eliminated, and the collected video data is still wrong. Therefore, the existing video data collection method has the problem that once a collection error occurs when the video source signal is abnormal, the video signal cannot be collected correctly even after the video source signal returns to normal.
发明内容Contents of the invention
有鉴于此,本发明实施例提供了一种视频数据采集方法及装置,用以解决现有技术中视频源信号异常时一旦出现采集错误,即使在视频源信号恢复正常后仍无法正确进行视频信号采集的问题。In view of this, the embodiment of the present invention provides a method and device for collecting video data, which is used to solve the problem that once a collection error occurs when the video source signal is abnormal in the prior art, even after the video source signal returns to normal, the video signal cannot be correctly processed. collection problem.
本发明实施例提供一种视频数据采集方法及装置,具体如下:Embodiments of the present invention provide a method and device for collecting video data, specifically as follows:
第一方面,一种视频数据采集方法,所述方法包括:In a first aspect, a video data collection method, the method includes:
确定当前需要的视频分辨率,所述视频分辨率是当前需要的视频格式下的视频分辨率;Determine the currently required video resolution, where the video resolution is the video resolution in the currently required video format;
在采集过程中实时根据视频的同步信号监测视频数据的有效量;During the acquisition process, the effective amount of video data is monitored in real time according to the synchronous signal of the video;
判断监测到的视频数据的有效量与当前需要的视频分辨率包括的值所表示的数据量是否一致;Determine whether the effective amount of monitored video data is consistent with the amount of data represented by the value included in the currently required video resolution;
在判断结果为不一致时,根据监测到的视频数据的有效量与当前需要的视频分辨率包括的值所表示的数据量之间的大小关系对视频数据进行处理,并且处理后得到的视频数据的有效量与当前需要的视频分辨率包括的值所表示的数据量一致。When the judgment result is inconsistent, the video data is processed according to the size relationship between the effective amount of the monitored video data and the amount of data represented by the value included in the currently required video resolution, and the video data obtained after processing The effective amount is consistent with the amount of data represented by the value included in the currently required video resolution.
结合第一方面,在第一种可能实现的方式中,所述根据监测到的视频数据的有效量与当前需要的视频分辨率包括的值所表示的数据量之间的大小关系对视频数据进行处理,包括:With reference to the first aspect, in the first possible implementation manner, the video data is processed according to the size relationship between the monitored effective amount of video data and the amount of data represented by the value included in the currently required video resolution. processing, including:
在监测到的视频数据的有效量小于当前需要的视频分辨率包括的值所表示的数据量时,确定监测到的所述视频数据的有效量不足,并进行数据补齐处理;When the effective amount of the monitored video data is less than the amount of data represented by the value included in the currently required video resolution, it is determined that the effective amount of the monitored video data is insufficient, and data completion processing is performed;
在监测到的视频数据的有效量大于当前需要的视频分辨率包括的值所表示的数据量时,确定监测到的所述视频数据的有效量超量,并进行数据截断处理。When the effective amount of the monitored video data is greater than the amount of data represented by the value included in the currently required video resolution, it is determined that the effective amount of the monitored video data is excessive, and data truncation processing is performed.
结合第一方面,以及第一方面的第一种可能实现方式,在第二种可能实现的方式中,所述方法还包括:In combination with the first aspect and the first possible implementation manner of the first aspect, in the second possible implementation manner, the method further includes:
在采集过程中实时监测视频的同步信号的正确性;During the acquisition process, the correctness of the synchronization signal of the video is monitored in real time;
在监测到视频的同步信号出现错误时,输出删除当前传输的视频帧数据指令并等待采集新一帧视频数据。When an error occurs in the synchronous signal of the video, it outputs an instruction to delete the currently transmitted video frame data and waits for a new frame of video data to be collected.
结合第一方面的第一种可能实现的方式,在第三种可能实现的方式中,所述在采集过程中实时根据视频的同步信号监测视频数据的有效量包括:In combination with the first possible implementation manner of the first aspect, in the third possible implementation manner, the real-time monitoring of the effective amount of video data according to the synchronization signal of the video during the acquisition process includes:
在采集过程中实时根据视频帧中每行有效视频起始SAV码和有效视频结束EAV码监测该行视频数据的有效量;During the acquisition process, monitor the effective amount of video data of each row in real time according to the effective video start SAV code and the effective video end EAV code of each row in the video frame;
所述判断监测到的视频数据的有效量与当前需要的视频分辨率包括的值所表示的数据量是否一致,包括:Whether the effective amount of the video data monitored by the judgment is consistent with the amount of data represented by the value included in the currently required video resolution includes:
判断该行视频数据的有效量与当前需要的视频分辨率包括的横向上的值所表示的数据量是否一致。It is judged whether the effective amount of the row of video data is consistent with the data amount represented by the value in the horizontal direction included in the currently required video resolution.
结合第一方面的第三种可能实现的方式,在第四种可能实现的方式中,所述在监测到的视频数据的有效量小于当前需要的视频分辨率包括的值所表示的数据量时,确定监测到的所述视频数据的有效量不足,并进行数据补齐处理,包括:In combination with the third possible implementation manner of the first aspect, in the fourth possible implementation manner, when the effective amount of monitored video data is less than the amount of data represented by the value included in the currently required video resolution , determining that the effective amount of the monitored video data is insufficient, and performing data complement processing, including:
在确定该行视频数据的有效量小于所述视频分辨率包括的横向上的值所表示的数据量,确定监测到的所述视频数据的有效量不足,并将采集到的最后一个数据持续输出,直至达到所述视频分辨率包括的横向上的值所表示的数据量;When it is determined that the effective amount of the row of video data is less than the amount of data represented by the value in the horizontal direction included in the video resolution, it is determined that the effective amount of the monitored video data is insufficient, and the last collected data is continuously output , until the amount of data represented by the horizontal value included in the video resolution is reached;
在监测到的视频数据的有效量大于当前需要的视频分辨率包括的值所表示的数据量时,确定监测到的所述视频数据的有效量超量,并进行数据截断处理,包括:When the effective amount of the monitored video data is greater than the amount of data represented by the value included in the currently required video resolution, it is determined that the effective amount of the monitored video data is excessive, and data truncation processing is performed, including:
在确定该行视频数据的有效量大于所述视频分辨率包括的横向上的值所表示的数据量时,确定监测到的所述视频数据的有效量超量,并中止采集到的视频数据的输出,直至当前行的行有效信号的状态转换为无效When it is determined that the effective amount of the row of video data is greater than the amount of data represented by the value on the horizontal direction included in the video resolution, it is determined that the effective amount of the monitored video data exceeds the amount, and the video data collected is suspended. output until the state of the row valid signal of the current row transitions to inactive
第二方面,一种视频数据采集装置,所述装置包括:In a second aspect, a video data collection device, said device comprising:
分辨率确定单元,用于确定当前需要的视频分辨率,所述视频分辨率是当前需要的视频格式下的视频分辨率;A resolution determination unit, configured to determine the currently required video resolution, where the video resolution is the video resolution in the currently required video format;
第一监测单元,用于在采集过程中实时根据视频的同步信号监测视频数据的有效量;The first monitoring unit is used to monitor the effective amount of video data in real time according to the synchronous signal of the video during the acquisition process;
判断单元,用于判断监测到的视频数据的有效量与当前需要的视频分辨率包括的值所表示的数据量是否一致;A judging unit, configured to judge whether the effective amount of the monitored video data is consistent with the amount of data represented by the value included in the currently required video resolution;
第一执行单元,用于在判断结果为不一致时,根据监测到的视频数据的有效量与当前需要的视频分辨率包括的值所表示的数据量之间的大小关系对视频数据进行处理,并且处理后得到的视频数据的有效量与当前需要的视频分辨率包括的值所表示的数据量一致。The first execution unit is used to process the video data according to the size relationship between the effective amount of the monitored video data and the amount of data represented by the value included in the currently required video resolution when the judgment result is inconsistent, and The effective amount of video data obtained after processing is consistent with the amount of data represented by the value included in the currently required video resolution.
结合第二方面,在第一种可能实现的方式中,所述第一执行单元,进一步用于在监测到的视频数据的有效量小于当前需要的视频分辨率包括的值所表示的数据量时,确定监测到的所述视频数据的有效量不足,并进行数据补齐处理;在监测到的视频数据的有效量大于当前需要的视频分辨率包括的值所表示的数据量时,确定监测到的所述视频数据的有效量超量,并进行数据截断处理。With reference to the second aspect, in the first possible implementation manner, the first execution unit is further configured to: when the effective amount of monitored video data is less than the amount of data represented by the value included in the currently required video resolution , determine that the effective amount of the monitored video data is insufficient, and perform data complement processing; when the effective amount of the monitored video data is greater than the amount of data represented by the value included in the currently required video resolution, determine that the monitored The effective amount of the video data is excessive, and data truncation processing is performed.
结合第二方面,以及第二方面的第一种可能实现的方式,在第二种可能实现的方式中,所述装置还包括:With reference to the second aspect and the first possible implementation manner of the second aspect, in the second possible implementation manner, the device further includes:
第二监测单元,用于在采集过程中实时监测视频的同步信号的正确性;The second monitoring unit is used to monitor the correctness of the synchronization signal of the video in real time during the acquisition process;
第二执行单元,用于在监测到视频的同步信号出现错误时,输出删除当前传输的视频帧数据指令并等待采集新一帧视频数据。The second execution unit is configured to output an instruction to delete the currently transmitted video frame data and wait for a new frame of video data to be collected when an error is detected in the synchronous signal of the video.
结合第二方面的第二种可能实现的方式,在第三种可能实现的方式中,进一步用于在采集过程中实时根据视频帧中每行有效视频起始SAV码和有效视频结束EAV码监测该行视频数据的有效量;In combination with the second possible implementation of the second aspect, in the third possible implementation, it is further used to monitor in real time according to the effective video start SAV code and effective video end EAV code of each line in the video frame during the acquisition process the effective amount of video data for the row;
所述判断单元,进一步用于判断该行视频数据的有效量与当前需要的视频分辨率包括的横向上的值所表示的数据量是否一致。The judging unit is further configured to judge whether the effective amount of the row of video data is consistent with the data amount represented by the value in the horizontal direction included in the currently required video resolution.
结合第二方面的第三种可能实现的方式,在第四种可能实现的方式中,所述第一执行单元,进一步用于在确定该行视频数据的有效量小于所述视频分辨率包括的横向上的值所表示的数据量,确定监测到的所述视频数据的有效量不足,并将采集到的最后一个数据持续输出,直至达到所述视频分辨率包括的横向上的值所表示的数据量;在确定该行视频数据的有效量大于所述视频分辨率包括的横向上的值所表示的数据量时,确定监测到的所述视频数据的有效量超量,并中止采集到的视频数据的输出,直至当前行的行有效信号的状态转换为无效。With reference to the third possible implementation manner of the second aspect, in a fourth possible implementation manner, the first execution unit is further configured to determine that the effective amount of video data in the row is less than the video resolution included in the The amount of data represented by the value on the horizontal direction determines that the effective amount of the monitored video data is insufficient, and continues to output the last data collected until it reaches the value represented by the value on the horizontal direction included in the video resolution Amount of data; when determining that the effective amount of video data in this line is greater than the amount of data represented by the value on the horizontal direction included in the video resolution, determine that the effective amount of the monitored video data is excessive, and stop collecting Video data is output until the state of the line valid signal of the current line transitions to inactive.
在本发明实施例的技术方案中,在采集视频的过程中利用视频的同步信号实时监测视频数据的有效量,并判断监测到的视频数据的有效量与当前需要的视频分辨率包括的值所表示的数据量是否一致,一旦发现不一致,就进行处理,并且根据监测到的视频数据的有效量与当前需要的视频分辨率包括的值所表示的数据量之间的大小关系对视频数据进行处理,并且处理后得到的视频数据的有效量与当前需要的视频分辨率包括的值所表示的数据量一致,避免因数据错位而导致的错误累积,使得在视频信号源恢复正常时,该采集错误不会影响后续正确进行视频信号采集。In the technical solution of the embodiment of the present invention, the effective amount of video data is monitored in real time by using the synchronous signal of the video during the process of collecting the video, and the difference between the effective amount of the monitored video data and the value included in the currently required video resolution is judged. Whether the amount of data represented is consistent, and once it is found to be inconsistent, it will be processed, and the video data will be processed according to the size relationship between the effective amount of monitored video data and the amount of data represented by the value included in the currently required video resolution , and the effective amount of video data obtained after processing is consistent with the amount of data represented by the value included in the currently required video resolution, avoiding error accumulation caused by data misalignment, so that when the video signal source returns to normal, the acquisition error It will not affect the subsequent correct video signal acquisition.
附图说明Description of drawings
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简要介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域的普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings that need to be used in the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For Those of ordinary skill in the art can also obtain other drawings based on these drawings without making creative efforts.
图1为本发明实施例一中的一种视频数据采集方法的流程图;Fig. 1 is the flow chart of a kind of video data collection method in the embodiment 1 of the present invention;
图2为本发明实施例一中的另一种视频数据采集方法的流程图;FIG. 2 is a flow chart of another method for collecting video data in Embodiment 1 of the present invention;
图3为本发明实施例二中的视频采集系统的结构示意图;3 is a schematic structural diagram of a video acquisition system in Embodiment 2 of the present invention;
图4为本发明实施例二中的视频数据采集方法的流程图;Fig. 4 is the flowchart of the video data acquisition method in the second embodiment of the present invention;
图5为本发明实施例二中的BT.656标准视频行格式的示意图;5 is a schematic diagram of the BT.656 standard video line format in Embodiment 2 of the present invention;
图6为本发明实施例二中的为SAV或EAV的8个比特的定义图;FIG. 6 is a definition diagram of 8 bits of SAV or EAV in Embodiment 2 of the present invention;
图7为本发明实施例二中的自动检错状态机的示意图;7 is a schematic diagram of an automatic error detection state machine in Embodiment 2 of the present invention;
图8为本发明实施例三中的视频数据采集装置的结构示意图。FIG. 8 is a schematic structural diagram of a video data collection device in Embodiment 3 of the present invention.
具体实施方式Detailed ways
为了使本发明的目的、技术方案和优点更加清楚,下面将结合附图对本发明作进一步地详细描述,显然,所描述的实施例仅仅是本发明一部份实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本发明保护的范围。In order to make the object, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, rather than all embodiments . Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.
为了解决现有技术中的视频源信号异常时一旦出现采集错误,即使在视频源信号恢复正常后仍无法正确进行视频信号采集的问题,本发明实施例提供一种视频数据采集方法及装置。In order to solve the problem in the prior art that once a collection error occurs when the video source signal is abnormal, the video signal cannot be collected correctly even after the video source signal returns to normal, the embodiment of the present invention provides a video data collection method and device.
为了清楚地理解本发明实施例的方案,下面对本发明视频采集中涉及到概念进行说明。In order to clearly understand the solutions of the embodiments of the present invention, concepts involved in the video capture of the present invention will be described below.
视频分辨率是用于度量图像内数据量多少的一个参数,通常表示成每英寸像素(Pixel per inch,ppi),例如:视频分辨率为320*180是指它在横向和纵向上的有效像素,并且该横向和纵向上的有效像素也可以表示数据量;Video resolution is a parameter used to measure the amount of data in an image, usually expressed as pixels per inch (ppi), for example: a video resolution of 320*180 refers to its effective pixels in horizontal and vertical directions , and the effective pixels in the horizontal and vertical directions can also represent the amount of data;
一个视频序列是由N个帧组成的,采集图像的时候一般有2种扫描方式,一种是逐行扫描(progressive scanning),一种是隔行扫描(interlaced scanning)。对于隔行扫描,每一帧一般有2个场(field),一个是顶场(top field),另一个是底场(bottom field)。假设一帧图像是720行,那么,顶场就包含其中所有的偶数行,而底场则包含其中所有的奇数行。对于顶场,有效数据行就是一帧图像的所有偶数行,而底场,有效数据行就是一帧图像的所有奇数行。A video sequence is composed of N frames. There are generally two scanning methods when acquiring images, one is progressive scanning and the other is interlaced scanning. For interlaced scanning, each frame generally has 2 fields, one is the top field and the other is the bottom field. Assuming that a frame of image has 720 lines, then the top field contains all the even-numbered lines, and the bottom field contains all the odd-numbered lines. For the top field, valid data lines are all even lines of a frame of image, and for the bottom field, valid data lines are all odd lines of a frame of image.
并且,一个场是由三个部分组成的:Also, a field is composed of three parts:
场=垂直消隐顶场(First Vertical Blanking)+有效数据行(Active Video)+垂直消隐底场(Second Vertical Blanking);Field = vertical blanking top field (First Vertical Blanking) + effective data line (Active Video) + vertical blanking bottom field (Second Vertical Blanking);
每一行视频数据是由以下四个部分组成的:Each line of video data is composed of the following four parts:
行=有效视频结束标志码(End of Active Video,EAV码)+水平消隐(Horizontal Vertical Blanking)+有效视频起始标志码(Start of Active Video,SAV码)+有效数据(Active Video)。Line = effective video end sign code (End of Active Video, EAV code) + horizontal blanking (Horizontal Vertical Blanking) + active video start sign code (Start of Active Video, SAV code) + valid data (Active Video).
下面通过具体实施例对本发明方案进行详细描述,当然,本发明并不限于以下实施例。The solution of the present invention will be described in detail below through specific examples. Of course, the present invention is not limited to the following examples.
实施例一Embodiment one
本发明实施例一提供一种视频数据采集方法,其流程图如图1所示,具体包括以下步骤:Embodiment 1 of the present invention provides a video data acquisition method, the flow chart of which is shown in Figure 1, specifically comprising the following steps:
步骤101:确定当前需要的视频分辨率,该视频分辨率是当前需要的视频格式下的视频分辨率;Step 101: Determine the currently required video resolution, which is the video resolution in the currently required video format;
步骤102:在采集过程中实时根据视频的同步信号监测视频数据的有效量;Step 102: monitor the effective amount of video data in real time according to the synchronous signal of the video during the acquisition process;
该同步信号包括:SAV码和EAV码。The synchronization signal includes: SAV code and EAV code.
其中,有效量可以是指每一行视频数据的有效数据量,也可以是指一帧视频数据的有效数据行数;Wherein, the effective amount may refer to the effective data amount of each line of video data, or may refer to the number of effective data lines of one frame of video data;
并且在本步骤102中,可以针对每行视频数据的有效量进行监测;也可以针对预先设定的行的视频数据的有效量进行监测,例如,每隔一行或两行对行视频数据的有效量进行监测;还可以监测每一帧视频数据的有效数据行数;还可以对每行视频数据的有效量进行监测的同时,针对每一帧视频数据的有效数据行数进行监测。And in this step 102, can monitor the effective amount of video data of each row; also can monitor the effective amount of video data of the preset row, for example, every other row or two rows are valid for row video data It can also monitor the number of effective data lines of each frame of video data; while monitoring the effective amount of each line of video data, it can also monitor the number of effective data lines of each frame of video data.
针对每行视频数据的有效量进行监测时,可以较为及时地发现是否出现采集错误,可把错误控制在一行内;在针对预先设定的行的视频数据的有效量进行监测时,可以较为节省系统的监测资源,也能发现采集错误并进行相应地处理,可把错误控制在预先设定的行内;针对每一帧视频数据的有效数据行数进行监测时,可把错误控制在一帧内。When monitoring the effective amount of video data of each line, it is possible to find out whether there is an acquisition error in a timely manner, and the error can be controlled within one line; when monitoring the effective amount of video data of a preset line, it can save money. The monitoring resources of the system can also detect acquisition errors and deal with them accordingly, and the errors can be controlled within the preset lines; when monitoring the effective data lines of each frame of video data, the errors can be controlled within one frame .
具体的,由于视频数据中每一行均包含SAV码和EAV码,因此,在采集过程中可以实时根据视频帧中每行的SAV码和EAV码监测该行视频数据的有效量;也可以实时根据视频帧中每一行的SAV码和EAV码对每一帧视频数据的有效数据行数进行监测,还可以实时根据视频帧中每一行的SAV码和EAV码同时对行视频数据的有效量和每一帧视频数据的有效行数进行监测。Concrete, because each line in the video data all comprises SAV sign indicating number and EAV sign indicating number, therefore, can monitor the effective quantity of this line of video data in real time according to the SAV sign indicating number and EAV sign indicating number of each line in the video frame; The SAV code and EAV code of each line in the video frame can monitor the number of effective data lines of each frame of video data, and can also simultaneously monitor the effective amount of video data and each line of video data in real time according to the SAV code and EAV code of each line in the video frame. The number of effective lines of a frame of video data is monitored.
在对每一帧视频数据的有效数据行数进行监测时,可以首先设置有效行计数器,针对每一帧开始进行监测时,该有效行计数器初始值设为0,然后根据每行的有效视频起始SAV码和有效视频结束EAV码来确定该行是否是有效数据行,在该行是有效数据行时,将行有效行计数器的计数值加1。When monitoring the number of effective data lines of each frame of video data, the effective line counter can be set first. When monitoring each frame, the initial value of the effective line counter is set to 0, and then according to the effective video of each line Start SAV code and effective video end EAV code to determine whether this row is a valid data row, and when this row is a valid data row, add 1 to the count value of the valid row counter.
步骤103:判断监测到的视频数据的有效量与当前需要的视频分辨率包括的值所表示的数据量是否一致,在判断结果为一致时,跳转至步骤102;在判断结果为不一致时,执行步骤104;Step 103: Judging whether the effective amount of the monitored video data is consistent with the amount of data represented by the value included in the currently required video resolution, when the judgment result is consistent, jump to step 102; when the judgment result is inconsistent, Execute step 104;
由于视频分辨率中包含视频画面在横向和纵向上的有效像素信息,该有效像素信息也可以表示数据量,因此,可以用视频分辨率来对监测到的视频数据的有效量进行衡量;Since the video resolution contains the effective pixel information of the video picture in the horizontal and vertical directions, the effective pixel information can also represent the amount of data, therefore, the video resolution can be used to measure the effective amount of the monitored video data;
具体的,在采集过程中实时根据视频帧中每行有效视频起始SAV码和有效视频结束EAV码监测该行视频数据的有效量进行监测时,本步骤103具体包括:Concretely, when monitoring the effective quantity of video data of this line according to the start SAV code of each line of effective video in the video frame and the end EAV code of effective video in real time during the acquisition process, this step 103 specifically includes:
判断监测到的行视频数据的有效量与当前需要的视频分辨率包括的横向上的值所表示的数据量是否一致;Judging whether the effective amount of the monitored line video data is consistent with the amount of data represented by the horizontal value included in the currently required video resolution;
在采集过程中实时根据视频帧中每一行的SAV码和EAV码对每一帧视频数据的有效数据行数进行监测时,本步骤103具体包括:When monitoring the effective data line number of each frame of video data according to the SAV code and EAV code of each line in the video frame in real time during the acquisition process, this step 103 specifically includes:
判断监测到的帧视频数据的有效量与当前需要的视频分辨率包括的纵向上的值所表示的数据量是否一致,以及判断该帧是否还有有效数据量;Judging whether the effective amount of the monitored frame video data is consistent with the amount of data represented by the vertical value included in the currently required video resolution, and judging whether the frame still has an effective amount of data;
此时,若该有效行计数器等于视频分辨率的纵向上的值所表示的数据量,且该帧是不存在有效数据行,则确定视频数据的有效量正常,并跳转至步骤102;否则,执行步骤104。Now, if this effective line counter is equal to the amount of data represented by the value on the vertical direction of the video resolution, and there is no effective data line in this frame, then it is determined that the effective amount of video data is normal, and jumps to step 102; otherwise , go to step 104.
步骤104:根据监测到的视频数据的有效量与当前需要的视频分辨率包括的值所表示的数据量之间的大小关系对视频数据进行处理,并且处理后得到的视频数据的有效量与当前需要的视频分辨率包括的值所表示的数据量一致。Step 104: Process the video data according to the size relationship between the monitored effective amount of video data and the amount of data represented by the value included in the currently required video resolution, and the effective amount of video data obtained after processing is the same as the current The required video resolution includes the same amount of data as the value represented.
具体的,本步骤104中根据监测到的视频数据的有效量与当前需要的视频分辨率包括的值所表示的数据量之间的大小关系对视频数据进行处理,包括:Specifically, in this step 104, the video data is processed according to the size relationship between the effective amount of the monitored video data and the amount of data represented by the value included in the currently required video resolution, including:
在监测到的视频数据的有效量小于当前需要的视频分辨率包括的值所表示的数据量时,确定监测到的视频数据的有效量不足,并进行数据补齐处理;When the effective amount of the monitored video data is less than the amount of data represented by the value included in the currently required video resolution, it is determined that the effective amount of the monitored video data is insufficient, and data complement processing is performed;
在监测到的视频数据的有效量大于当前需要的视频分辨率包括的值所表示的数据量时,确定监测到的视频数据的有效量超量,并进行数据截断处理。When the effective amount of the monitored video data is greater than the amount of data represented by the value included in the currently required video resolution, it is determined that the effective amount of the monitored video data exceeds the amount, and data truncation processing is performed.
进一步地,若采集过程中实时监测的视频数据的有效量为行视频数据的有效量时,则上述在监测到的视频数据的有效量小于当前需要的视频分辨率包括的值所表示的数据量时,确定监测到的视频数据的有效量不足,并进行数据补齐处理,包括:Further, if the effective amount of video data monitored in real time during the acquisition process is the effective amount of line video data, then the effective amount of video data monitored is less than the amount of data represented by the value included in the currently required video resolution When it is determined that the effective amount of the monitored video data is insufficient, and the data is supplemented, including:
在监测到该行视频数据的有效量小于视频分辨率包括的横向上的值所表示的数据量时,确定监测到的视频数据的有效量不足,并将采集到的最后一个数据持续输出,直至达到视频分辨率包括的横向上的值所表示的数据量;When it is detected that the effective amount of video data in this line is less than the amount of data represented by the horizontal value included in the video resolution, it is determined that the effective amount of the monitored video data is insufficient, and the last data collected will continue to be output until Reach the amount of data represented by the value in the horizontal direction included in the video resolution;
上述在监测到的视频数据的有效量大于当前需要的视频分辨率包括的值所表示的数据量时,确定监测到的视频数据的有效量超量,并进行数据截断处理,包括:When the effective amount of the monitored video data is greater than the amount of data represented by the value included in the currently required video resolution, determine that the effective amount of the monitored video data is excessive, and perform data truncation processing, including:
在监测到该行视频数据的有效量大于视频分辨率包括的横向上的值所表示的数据量时,确定监测到的视频数据的有效量超量,并中止采集到的视频数据的输出,直至当前行的行有效信号的状态转换为无效。When it is detected that the effective amount of the video data of this line is greater than the data amount represented by the horizontal value included in the video resolution, it is determined that the effective amount of the monitored video data exceeds the amount, and the output of the collected video data is suspended until The state of the row valid signal for the current row transitions to invalid.
若采集过程中实时监测的视频数据的有效量为一帧视频数据的有效数据行数时,则上述在监测到的视频数据的有效量小于当前需要的视频分辨率包括的值所表示的数据量时,确定监测到的视频数据的有效量不足,并进行数据补齐处理,包括:If the effective amount of video data monitored in real time during the acquisition process is the number of effective data lines of a frame of video data, then the effective amount of the above-mentioned monitored video data is less than the amount of data represented by the value included in the currently required video resolution When it is determined that the effective amount of the monitored video data is insufficient, and the data is supplemented, including:
在监测到一帧视频数据的有效数据行数小于视频分辨率包括的纵向上的值所表示的数据量,且该帧不存在有效数据行时,确定监测到的视频数据的有效量不足,并将采集到的最后一行有效数据行的数据持续输出,直至达到视频分辨率包括的纵向上的值所表示的数据量;When it is detected that the number of effective data lines of a frame of video data is less than the amount of data represented by the value in the vertical direction included in the video resolution, and there is no effective data line in the frame, it is determined that the effective amount of the monitored video data is insufficient, and Continuously output the data of the last line of valid data line collected until reaching the amount of data represented by the vertical value included in the video resolution;
上述在监测到的视频数据的有效量大于当前需要的视频分辨率包括的值所表示的数据量时,确定监测到的视频数据的有效量超量,并进行数据截断处理,包括:When the effective amount of the monitored video data is greater than the amount of data represented by the value included in the currently required video resolution, determine that the effective amount of the monitored video data is excessive, and perform data truncation processing, including:
在监测到一帧视频数据的有效数据行数等于或大于视频分辨率包括的纵向上的值所表示的数据量且该帧仍存在有效数据行时,确定监测到的视频数据的有效量超量,并中止采集到的视频数据的输出,直至当前帧的有效数据行信号的状态转换为无效。When it is detected that the number of effective data lines of a frame of video data is equal to or greater than the amount of data represented by the vertical value included in the video resolution and there are still effective data lines in this frame, it is determined that the effective amount of the monitored video data is excessive , and suspend the output of the collected video data until the status of the valid data row signal of the current frame is changed to invalid.
在本发明实施例一的技术方案中,在采集视频的过程中利用视频的同步信号实时监测视频数据的有效量,并判断监测到的视频数据的有效量与当前需要的视频分辨率包括的值所表示的数据量是否一致,一旦发现不一致,就进行处理,并且根据监测到的视频数据的有效量与当前需要的视频分辨率包括的值所表示的数据量之间的大小关系对视频数据进行处理,并且处理后得到的视频数据的有效量与当前需要的视频分辨率包括的值所表示的数据量一致,避免因数据错位而导致的错误累积,使得在视频信号源恢复正常时,该采集错误不会影响后续正确进行视频信号采集。In the technical solution of Embodiment 1 of the present invention, the effective amount of video data is monitored in real time by using the synchronous signal of the video in the process of collecting video, and the value included in the effective amount of the monitored video data and the currently required video resolution is judged Whether the amount of data represented is consistent, once it is found to be inconsistent, it will be processed, and the video data will be processed according to the size relationship between the effective amount of video data monitored and the amount of data represented by the value included in the currently required video resolution. processing, and the effective amount of video data obtained after processing is consistent with the amount of data represented by the value included in the currently required video resolution, to avoid error accumulation caused by data misalignment, so that when the video signal source returns to normal, the acquisition The error will not affect the subsequent correct video signal acquisition.
考虑到在视频采集过程中,同步信号也可能出现错误,因此,为了实现对同步信号的监测,较优的,上述视频采集方法还包括如图2所示的以下步骤:Considering that during the video acquisition process, errors may also occur in the synchronous signal, therefore, in order to realize the monitoring of the synchronous signal, preferably, the above-mentioned video acquisition method also includes the following steps as shown in Figure 2:
步骤201:在采集过程中实时监测视频的同步信号的正确性;Step 201: monitor the correctness of the synchronization signal of the video in real time during the acquisition process;
步骤202:在监测到视频的同步信号出现错误时,输出删除当前传输的视频帧数据指令并等待采集新一帧视频数据,在监测到视频的同步信号没有出现错误时,继续进行采集。Step 202: When an error is detected in the video synchronization signal, output an instruction to delete the currently transmitted video frame data and wait for a new frame of video data to be collected; when no error is detected in the video synchronization signal, continue to collect.
在上述步骤201至步骤202中,考虑到同步信号出现错误,该帧的视频数据将无法使用,因此,采取删除当前传输的视频帧数据指令措施。In the above step 201 to step 202, it is considered that the video data of this frame will be unusable due to an error in the synchronous signal. Therefore, the instruction measure of deleting the currently transmitted video frame data is taken.
需要说明的是,步骤201和步骤202是在上述步骤101之后执行的,由于是实时监测同步信号,而同步信号在视频数据的每一有效数据行中均会出现,因此,步骤201与上述步骤102可以同时执行。It should be noted that step 201 and step 202 are performed after above-mentioned step 101, because the synchronous signal is monitored in real time, and the synchronous signal will appear in each effective data row of video data, therefore, step 201 and above-mentioned step 102 can be executed simultaneously.
下面通过实施例二中的以摄像头采集分辨率为720*576的BT.6568bitYCbCr4:2:2制式视频,进一步说明本发明的实施例一的方案。The solution of Embodiment 1 of the present invention will be further described below through the BT.6568bitYCbCr4:2:2 standard video with a resolution of 720*576 collected by the camera in Embodiment 2.
实施例二Embodiment two
如图3是本发明实施例二中的视频采集系统的结构示意图,包括:摄像头31、SAA7115芯片32、现场可编程门阵列(FPGA)33、可编程只读存储器(Programmable Read-Only Memory,PROM)34、静态随机存储器(StaticRandom Access Memory,SRAM)35和后续处理模块36;Fig. 3 is the structural representation of the video acquisition system in the embodiment of the present invention two, comprises: camera 31, SAA7115 chip 32, Field Programmable Gate Array (FPGA) 33, Programmable Read-Only Memory (Programmable Read-Only Memory, PROM ) 34, SRAM (StaticRandom Access Memory, SRAM) 35 and follow-up processing module 36;
其中,模拟视频采用SAA7115芯片32进行模数转换,可通过配置SAA7115的工作模式,使数据视频输出格式为BT.6568bit YCbCr4:2:2;Among them, the analog video adopts SAA7115 chip 32 for analog-to-digital conversion, and the data video output format can be BT.6568bit YCbCr4:2:2 by configuring the working mode of SAA7115;
FPGA33为主处理器,实时采集模数转换后的BT.6568bit YCbCr4:2:2格式的数字视频数据;FPGA33 is the main processor, which collects digital video data in BT.6568bit YCbCr4:2:2 format after analog-to-digital conversion in real time;
PROM 34、SRAM 35辅助FPGA实现视频数据采集。PROM 34, SRAM 35 assist FPGA to realize video data collection.
在图3所示的视频采集系统的硬件基础上,可实施本发明实施例二中的视频采集方法,当然本发明实施例二中的方案也不限于在图3所示的视频采集系统的硬件上实施。On the basis of the hardware of the video capture system shown in Figure 3, the video capture method in the second embodiment of the present invention can be implemented, certainly the scheme in the second embodiment of the present invention is not limited to the hardware of the video capture system shown in Figure 3 on the implementation.
图4所示是本发明实施例二的视频采集方法的流程示意图,包括以下步骤:Figure 4 is a schematic flow diagram of a video acquisition method in Embodiment 2 of the present invention, including the following steps:
步骤401:SAA7115芯片将采集的摄像头的模拟信号转换为数字信号;Step 401: the SAA7115 chip converts the collected analog signal of the camera into a digital signal;
步骤402:FPGA进行视频采集;Step 402: FPGA collects video;
本发明实施例二中采用隔行扫描的方式采集,此时,一帧数据视频分为两场,该两场为包含奇数行视频数据的顶场和包含偶数行视频数据的底场。BT.656标准规定一场由三部分组成:垂直消隐顶场、有效数据行和垂直消隐底场。每帧视频共有625行,有效视频数据576行,顶场有效数据开始于第23行,底场有效数据开始于第335行。如图5所示为BT.656标准视频行格式,每一行视频数据是由以下四个部分组成的:In Embodiment 2 of the present invention, interlaced scanning is used for collection. At this time, one frame of data video is divided into two fields, and the two fields are a top field containing odd-numbered lines of video data and a bottom field containing even-numbered lines of video data. The BT.656 standard stipulates that one field consists of three parts: vertical blanking top field, valid data line and vertical blanking bottom field. There are 625 lines in each frame of video, 576 lines of effective video data, the effective data of the top field starts from the 23rd line, and the effective data of the bottom field starts from the 335th line. As shown in Figure 5, it is the BT.656 standard video line format, and each line of video data is composed of the following four parts:
行=有效视频结束标志码(EAV码)+水平消隐(Horizontal VerticalBlanking)+有效视频起始标志码(SAV码)+有效数据(Active Video)。Line = active video end flag code (EAV code) + horizontal blanking (Horizontal Vertical Blanking) + active video start flag code (SAV code) + valid data (Active Video).
其中,EAV和SAV都是4个字节(Bytes),SAV后面是有效的视频数据;Wherein, both EAV and SAV are 4 bytes (Bytes), and SAV is followed by valid video data;
EAV和SAV的4个字节的格式规定如下(下面以16进制表示):FF 0000 XY;The format of the 4 bytes of EAV and SAV is specified as follows (hexadecimal representation below): FF 0000 XY;
其中,前三个字节为固定的,必须是FF 0000,而第4个字节(XY)是根据场、消隐信息而定的,如图6所示为SAV或EAV的8个bit含义的定义,其含义如下:Among them, the first three bytes are fixed and must be FF 0000, and the fourth byte (XY) is determined according to the field and blanking information, as shown in Figure 6, the meaning of the 8 bits of SAV or EAV definition, its meaning is as follows:
最高位比特Bit7为固定数据1;Bit6为F:标记场信息,传输顶场时为0,传输底场时为1;Bit5为V:标记消隐信息,传输消隐数据时为1,传输有效视频数据时为0;Bit4为H:标记EAV还是SAV,SAV为0,EAV为1;Bit3~Bit0为保护信号,其值取决于F、H、V,起到校验的作用。Bit3为V异或H;Bit2为F异或H;Bit1为F异或V;Bit0为F异或V异或H。有效视频数据按照Cb、Y、Cr、Y顺序排列,一行含有720字节Y,360字节Cb和Cr,共1440字节。The highest bit Bit7 is fixed data 1; Bit6 is F: mark field information, 0 when transmitting the top field, and 1 when transmitting the bottom field; Bit5 is V: mark blanking information, 1 when transmitting blanking data, and the transmission is valid When it is video data, it is 0; Bit4 is H: mark EAV or SAV, SAV is 0, EAV is 1; Bit3~Bit0 are protection signals, and their values depend on F, H, V, which play a role in verification. Bit3 is V XOR H; Bit2 is F XOR H; Bit1 is F XOR V; Bit0 is F XOR V XOR H. Effective video data is arranged in the order of Cb, Y, Cr, Y, a line contains 720 bytes Y, 360 bytes Cb and Cr, a total of 1440 bytes.
步骤403:FPGA实时监测视频数据有效数据量是否与当前需要的视频分辨率一致;在监测结果为一致时,执行步骤407;监测结果为不一致时,执行步骤404;Step 403: FPGA monitors in real time whether the effective data volume of the video data is consistent with the currently required video resolution; when the monitoring result is consistent, execute step 407; when the monitoring result is inconsistent, execute step 404;
步骤404:判断监测视频数据有效数据量是否大于当前需要的视频分辨率所表示的数据量,若是,则确定错误类型为数据超量,执行步骤405;若否,则确定错误类型为数据不足,执行步骤406;Step 404: Judging whether the effective data volume of the monitoring video data is greater than the data volume represented by the currently required video resolution, if so, then determining that the error type is data excess, and performing step 405; if not, then determining that the error type is insufficient data, Execute step 406;
步骤405:进行数据截断处理,得到恢复的视频数据,并执行步骤407;Step 405: Perform data truncation processing to obtain recovered video data, and execute step 407;
步骤406:进行数据补齐处理,得到恢复的视频数据,并执行步骤407;Step 406: Carry out data complement processing to obtain the restored video data, and execute step 407;
步骤407:输出给后续处理模块,并跳转至步骤402。Step 407: output to the subsequent processing module, and jump to step 402.
上述步骤403至步骤406可通过图7所示的自动检错状态机来实现。The above step 403 to step 406 can be realized by the automatic error detection state machine shown in FIG. 7 .
通过FPGA采集SAA7115输出的BT.656格式视频,采集过程由视频采集控制状态机控制完成,视频采集状态机包括五个状态:空闲状态、视频采集起始状态、视频采集阶段状态、视频采集结束状态和错误状态。空闲状态是初始状态,当视频SAV码到来时,进入视频采集起始状态;下一状态是视频采集阶段状态,若监测到EAV码进入视频采集结束状态,否则继续采集视频;当视频EAV码到来时,进入视频采集结束状态,下一步进入空闲状态;错误状态,标示视频采集过程出现错误,并做相应错误恢复处理。具体过程包括:The BT.656 format video output by SAA7115 is collected through FPGA. The collection process is controlled by the video collection control state machine. The video collection state machine includes five states: idle state, video collection start state, video collection stage state, and video collection end state and error status. The idle state is the initial state. When the video SAV code arrives, it enters the initial state of video collection; the next state is the state of the video collection stage. If the EAV code is detected, it enters the end state of video collection, otherwise continue to collect video; when the video EAV code arrives , it enters the end state of video capture, and enters the idle state in the next step; the error state indicates that an error occurred during the video capture process, and corresponding error recovery processing is performed. The specific process includes:
在空闲状态时,监测到0xFF0000数据(0xFF0000是BT.656标准中每行视频数据SAV码和EAV码的高字节,如图5所示),说明同步信号到来;When in the idle state, monitor 0xFF0000 data (0xFF0000 is the high byte of each line of video data SAV code and EAV code in the BT.656 standard, as shown in Figure 5), indicating that the synchronization signal arrives;
视频采集起始状态检查标志码不为SAV码(起始码定义如图5所示),进入错误状态;The video capture initial state inspection mark code is not SAV code (definition of initial code as shown in Figure 5), enters error state;
视频采集阶段状态实时统计采集视频的有效数据量,监测到一行有效视频数据的EAV码时,核对计数值是否为1440字节(720字节Y、360字节Cr和360字节Cb),若不足1440字节进入错误状态,当计数值超过1440字节后,结束码仍未到来进入错误状态;The status of the video acquisition stage counts the effective data volume of the collected video in real time. When the EAV code of a line of effective video data is detected, check whether the count value is 1440 bytes (720 bytes Y, 360 bytes Cr and 360 bytes Cb). If it is less than 1440 bytes, it enters an error state. When the count value exceeds 1440 bytes, the end code has not yet arrived and enters an error state;
视频采集结束状态检查标志码不为EAV码(EAV码定义如图5所示),进入错误状态,设置采集视频行数计数(初始值为0),在EAV状态成功完成时,行计数值增加1,当顶场数据和一帧数据采集结束时,核对行计数值是否分别为288行(一场数据的行数)和576行(一帧数据的行数),若不满足进入错误状态,若满足则将采集到的视频数据传入后续功能模块。The video capture end state check flag code is not EAV code (EAV code definition is shown in Figure 5), enter the error state, set the line count of the captured video (initial value is 0), and when the EAV state is successfully completed, the line count value increases 1. When the collection of the top field data and one frame of data is finished, check whether the line count value is 288 lines (the number of lines of one field of data) and 576 lines (the number of lines of one frame of data) respectively. If it is not satisfied, enter the error state, If it is satisfied, the collected video data is transferred to the subsequent functional module.
进入错误状态后,判断是由于视频数据不足还是超量引起的错误,如果发现数据采集不足(即采集到的该行数据量小于当前数据格式的每行数据量,当前数据格式的每行数据量是根据视频分辨率确定的)则对当前行进行数据补齐,将采集到的最后一个数据持续输出给下一个模块直至达到当前数据格式的每行数据量需求;如果发现数据采集到当前数据格式的每行数据量时,本行的行有效信号依然有效(即采集到的该行数据量超出了当前数据格式的每行数据量,当前数据格式的每行数据量是根据视频分辨率确定的),则中止数据向下一个处理模块的输出,直到当前行的行有效信号转换为无效状态,避免错误累积。判断如果是视频采集结束状态检查标志码不为EAV码或不为SAV码,则说明视频同步信号出错,此时通知后续功能模块删除当前传输的视频帧数据。完成上述操作后,错误状态解除进入空闲状态,等待采集新一帧视频数据。当依次监测到顶场第一个垂直消隐SAV码(0xAB)、顶场有效数据行EAV码(0x9D)及顶场有效数据行SAV码(0x80)时,说明后续数据为一帧视频数据的第一个有效数据,视频采集过程由此重新开始。After entering the error state, determine whether the error is caused by insufficient or excessive video data. If it is found that the data collection is insufficient (that is, the amount of data collected in this row is less than the amount of data in each row in the current data format, the amount of data in each row in the current data format It is determined according to the video resolution), then complete the data of the current line, and continuously output the last data collected to the next module until the data volume requirement of each line of the current data format is met; if the data is found to be collected in the current data format When the amount of data in each row of the current data format, the valid signal of the row is still valid (that is, the amount of data collected in this row exceeds the amount of data in each row in the current data format, and the amount of data in each row in the current data format is determined according to the video resolution ), the output of data to the next processing module is suspended until the row valid signal of the current row is converted to an invalid state, so as to avoid error accumulation. If it is judged that the video capture end state check mark code is not EAV code or not SAV code, then the video synchronization signal is wrong, and the follow-up function module is notified to delete the currently transmitted video frame data. After the above operations are completed, the error state is released and enters the idle state, waiting to collect a new frame of video data. When the first vertical blanking SAV code (0xAB) of the top field, the effective data line EAV code (0x9D) of the top field and the SAV code (0x80) of the effective data line of the top field are detected sequentially, it indicates that the subsequent data is the first frame of video data. A valid data, the video capture process starts again.
实施例三Embodiment three
基于与本发明实施例一的同一发明构思,本发明实施例三提供一种视频数据采集装置,其结构示意图如图8所示,该装置包括:分辨率确定单元81和第一监测单元82、判断单元83和第一执行单元84;其中:Based on the same inventive concept as that of Embodiment 1 of the present invention, Embodiment 3 of the present invention provides a video data acquisition device, the structural diagram of which is shown in FIG. 8 , the device includes: a resolution determination unit 81 and a first monitoring unit 82, Judgment unit 83 and first execution unit 84; wherein:
分辨率确定单元81,用于确定当前需要的视频分辨率,该视频分辨率是当前需要的视频格式下的视频分辨率;A resolution determination unit 81 is configured to determine the currently required video resolution, which is the video resolution in the currently required video format;
第一监测单元82,用于在采集过程中实时根据视频的同步信号监测视频数据的有效量;The first monitoring unit 82 is used to monitor the effective amount of video data in real time according to the synchronization signal of the video during the acquisition process;
判断单元83,用于判断监测到的视频数据的有效量与当前需要的视频分辨率包括的值所表示的数据量是否一致;A judging unit 83, configured to judge whether the effective amount of the monitored video data is consistent with the amount of data represented by the value included in the currently required video resolution;
第一执行单元84,用于在判断结果为不一致时,根据监测到的视频数据的有效量与当前需要的视频分辨率包括的值所表示的数据量之间的大小关系对视频数据进行处理,并且处理后得到的视频数据的有效量与当前需要的视频分辨率包括的值所表示的数据量一致。The first execution unit 84 is configured to process the video data according to the size relationship between the effective amount of the monitored video data and the amount of data represented by the value included in the currently required video resolution when the judgment result is inconsistent, And the effective amount of video data obtained after processing is consistent with the data amount represented by the value included in the currently required video resolution.
较优的,第一执行单元84,进一步用于在监测到的视频数据的有效量小于当前需要的视频分辨率包括的值所表示的数据量时,确定监测到的视频数据的有效量不足,并进行数据补齐处理;在监测到的视频数据的有效量大于当前需要的视频分辨率包括的值所表示的数据量时,确定监测到的视频数据的有效量超量,并进行数据截断处理。Preferably, the first execution unit 84 is further configured to determine that the effective amount of the monitored video data is insufficient when the effective amount of the monitored video data is less than the amount of data represented by the value included in the currently required video resolution, And perform data complement processing; when the effective amount of the monitored video data is greater than the amount of data represented by the value included in the currently required video resolution, determine that the effective amount of the monitored video data is excessive, and perform data truncation processing .
较优的,该装置还包括:Preferably, the device also includes:
第二监测单元85,用于在采集过程中实时监测视频的同步信号的正确性;The second monitoring unit 85 is used to monitor the correctness of the synchronization signal of the video in real time during the acquisition process;
第二执行单元86,用于在监测到视频的同步信号出现错误时,输出删除当前传输的视频帧数据指令并等待采集新一帧视频数据。The second execution unit 86 is configured to output an instruction to delete the currently transmitted video frame data and wait for a new frame of video data to be collected when an error is detected in the video synchronization signal.
较优的,第一监测单元82,进一步用于在采集过程中实时根据视频帧中每行有效视频起始SAV码和有效视频结束EAV码监测该行视频数据的有效量;Preferably, the first monitoring unit 82 is further used to monitor the effective amount of the line of video data in real time according to the start SAV code and the end EAV code of each line of effective video in the video frame during the acquisition process;
上述判断单元83,进一步用于判断该行视频数据的有效量与当前需要的视频分辨率包括的横向上的值所表示的数据量是否一致。The judging unit 83 is further configured to judge whether the effective amount of the row of video data is consistent with the data amount indicated by the value in the horizontal direction included in the currently required video resolution.
较优的,第一执行单元84,进一步用于在确定该行视频数据的有效量小于该视频分辨率包括的横向上的值所表示的数据量,确定监测到的视频数据的有效量不足,并将采集到的最后一个数据持续输出,直至达到视频分辨率包括的横向上的值所表示的数据量;在确定该行视频数据的有效量大于视频分辨率包括的横向上的值所表示的数据量时,确定监测到的视频数据的有效量超量,并中止采集到的视频数据的输出,直至当前行的行有效信号的状态转换为无效。Preferably, the first executing unit 84 is further configured to determine that the effective amount of the video data in the row is less than the amount of data represented by the value in the horizontal direction included in the video resolution, and determine that the effective amount of the monitored video data is insufficient, And continue to output the last collected data until it reaches the amount of data represented by the horizontal value included in the video resolution; when it is determined that the effective amount of video data in this row is greater than the value represented by the horizontal value included in the video resolution When the amount of data is exceeded, it is determined that the effective amount of the monitored video data exceeds the amount, and the output of the collected video data is stopped until the state of the line valid signal of the current line is converted to invalid.
本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、或计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art should understand that the embodiments of the present invention may be provided as methods, systems, or computer program products. Accordingly, the present invention can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It should be understood that each procedure and/or block in the flowchart and/or block diagram, and a combination of procedures and/or blocks in the flowchart and/or block diagram can be realized by computer program instructions. These computer program instructions may be provided to a general purpose computer, special purpose computer, embedded processor, or processor of other programmable data processing equipment to produce a machine such that the instructions executed by the processor of the computer or other programmable data processing equipment produce a An apparatus for realizing the functions specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to operate in a specific manner, such that the instructions stored in the computer-readable memory produce an article of manufacture comprising instruction means, the instructions The device realizes the function specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing device, causing a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby The instructions provide steps for implementing the functions specified in the flow chart or blocks of the flowchart and/or the block or blocks of the block diagrams.
尽管已描述了本发明的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例作出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本发明范围的所有变更和修改。While preferred embodiments of the invention have been described, additional changes and modifications to these embodiments can be made by those skilled in the art once the basic inventive concept is appreciated. Therefore, it is intended that the appended claims be construed to cover the preferred embodiment as well as all changes and modifications which fall within the scope of the invention.
显然,本领域的技术人员可以对本发明进行各种改动和变型而不脱离本发明的精神和范围。这样,倘若本发明的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalent technologies, the present invention also intends to include these modifications and variations.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410425811.6A CN104202551A (en) | 2014-08-26 | 2014-08-26 | Method and device for video data acquisition |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410425811.6A CN104202551A (en) | 2014-08-26 | 2014-08-26 | Method and device for video data acquisition |
Publications (1)
Publication Number | Publication Date |
---|---|
CN104202551A true CN104202551A (en) | 2014-12-10 |
Family
ID=52087771
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410425811.6A Pending CN104202551A (en) | 2014-08-26 | 2014-08-26 | Method and device for video data acquisition |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104202551A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112492298A (en) * | 2020-11-17 | 2021-03-12 | 北京三快在线科技有限公司 | Method and device for collecting image |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1901678A (en) * | 2005-07-19 | 2007-01-24 | 联发科技股份有限公司 | Method for protecting video encoder and video synchronization protector |
CN101686399A (en) * | 2008-09-28 | 2010-03-31 | 中兴通讯股份有限公司 | Device and method for transmitting video stream between chips of video conferphone system |
US20100178025A1 (en) * | 2009-01-14 | 2010-07-15 | International Business Machines Corporation | Intelligent synchronization of portable video devices |
CN101887711A (en) * | 2006-11-28 | 2010-11-17 | 晨星半导体股份有限公司 | Display screen position adjustment method |
CN102158693A (en) * | 2010-02-11 | 2011-08-17 | 联发科技股份有限公司 | Method for self-adaptively decoding embedded video bit stream and receiving system |
CN102549642A (en) * | 2009-09-30 | 2012-07-04 | Nec显示器解决方案株式会社 | Video display device and video display method |
CN103780875A (en) * | 2013-11-29 | 2014-05-07 | 信航(天津)科技有限公司 | High-resolution Cameralink signal acquisition device |
-
2014
- 2014-08-26 CN CN201410425811.6A patent/CN104202551A/en active Pending
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1901678A (en) * | 2005-07-19 | 2007-01-24 | 联发科技股份有限公司 | Method for protecting video encoder and video synchronization protector |
CN101887711A (en) * | 2006-11-28 | 2010-11-17 | 晨星半导体股份有限公司 | Display screen position adjustment method |
CN101686399A (en) * | 2008-09-28 | 2010-03-31 | 中兴通讯股份有限公司 | Device and method for transmitting video stream between chips of video conferphone system |
US20100178025A1 (en) * | 2009-01-14 | 2010-07-15 | International Business Machines Corporation | Intelligent synchronization of portable video devices |
CN102549642A (en) * | 2009-09-30 | 2012-07-04 | Nec显示器解决方案株式会社 | Video display device and video display method |
CN102158693A (en) * | 2010-02-11 | 2011-08-17 | 联发科技股份有限公司 | Method for self-adaptively decoding embedded video bit stream and receiving system |
CN103780875A (en) * | 2013-11-29 | 2014-05-07 | 信航(天津)科技有限公司 | High-resolution Cameralink signal acquisition device |
Non-Patent Citations (2)
Title |
---|
HONG XU JIANG,HUI YONG LI ET AL: "An Optimized Video Capture and Preprocesssing Strategy Based on FPGA", 《APPLIED MECHANICS AND MATERIALS》 * |
杨军: "基于FPGA的四路视频采集系统设计与实现", 《中国优秀硕士论文全文数据库-信息科技辑》 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112492298A (en) * | 2020-11-17 | 2021-03-12 | 北京三快在线科技有限公司 | Method and device for collecting image |
CN112492298B (en) * | 2020-11-17 | 2022-12-09 | 北京三快在线科技有限公司 | Method and device for collecting image |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107948463B (en) | A camera synchronization method, device and system | |
RU2013125228A (en) | METHOD AND DEVICE FOR DETECTING INPUTS BY USING GESTURES | |
WO2022017197A1 (en) | Intelligent product quality inspection method and apparatus | |
CN108259742B (en) | An image acquisition method and device | |
CN109257583B (en) | Seamless splicing method and system for images of projection equipment | |
CN102625110A (en) | Caching system and caching method for video data | |
CN110704268B (en) | Automatic testing method and device for video images | |
CN104202551A (en) | Method and device for video data acquisition | |
JPWO2015083408A1 (en) | System management apparatus, system management method, and program | |
CN110602481B (en) | Video quality detection method and device in video monitoring system | |
CN109714529A (en) | Optical filter switching method, device and the storage medium of image collecting device | |
WO2019218147A1 (en) | Method, apparatus and device for transmitting surveillance video | |
EP3203729B1 (en) | Method, device and video conference system for detecting video signals in same standard | |
CN107231540A (en) | High-speed video acquisition and transmission system | |
CN107959769B (en) | Video camera | |
JP6543214B2 (en) | Motion monitoring device | |
CN103994823A (en) | X-ray exposure automatic detection method | |
US9143701B2 (en) | Imaging apparatus capable of specifying shooting posture, method for specifying shooting posture, and storage medium storing program | |
JP5814668B2 (en) | Image processing device | |
JP5962502B2 (en) | Video data storage device, video data storage program, and video data storage system | |
CN105242855B (en) | A kind of quick continuous shooting method and system based on mobile terminal | |
KR20100133807A (en) | Resolution Conversion Method for Preview Mode and Image Sensor Using the Same | |
JP2565169B2 (en) | Video signal processing method | |
CN111444741B (en) | Data display method, data acquisition method, data display device, data acquisition device, electronic equipment and storage medium | |
JP6091079B2 (en) | Control device, control method and program |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20141210 |
|
RJ01 | Rejection of invention patent application after publication |