Identification of digital video signal parity field and bearing calibration
Technical field
The present invention relates to identification of a kind of digital video signal parity field and bearing calibration, belong to the computer digit field of video processing.
Background technology
The TV signal digitlization helps utilizing digital process instruments such as computer to be handled and program making, but because the vision signal after the digitlization is that digital video signal is still interleaved signal, the situation of parity field erroneous judgement can appear when utilizing computer to handle.This is because existing Digital Video Processing product or software are judged odd field or even field according to sequence number 0 or 1, the different Digital Video Processing products or the order of software set are inconsistent, the setting 0 that promptly has is odd field, the setting that has 1 is odd field, sets 1 phenomenon that will occur the parity field dislocation during for the vision signal of odd field when setting 0 for the device processes of odd field.
Existing parity field recognition methods is still by the field sync signal of digital video vertical blanking period is handled differentiates (referring to patent CN88106878.0), does not have directly to differentiate parity field according to the data (being video content) of digital effective video.Generally only handle digital effective video in the Digital Video Processing field, so existent method is not suitable for the parity field identification in the Digital Video Processing field.Here it is causes now because the parity field erroneous judgement influences the main cause of picture quality.
The parity field erroneous judgement can influence picture quality, as Fig. 1 and Fig. 2.Experienced program making or Video processing personnel understand naked eyes and find out these problems, by revising some the correction of carrying out parity field are set.Unfamiliar program making or Video processing personnel may not see these problems, thereby influence video quality.That is to say that existing identification to the digital video signal parity field is to rely on the naked eyes that the experience technical staff is arranged, correction means is artificial.
Summary of the invention
Main purpose of the present invention provides a kind of data according to digital effective video (video content) to be differentiated parity field and the video sequence of parity field field preface mistake is carried out method from dynamic(al) correction, is convenient to digital process instruments such as computer and handles and program making.
Innovative point of the present invention is: consider the common feature of different video content parity field field preface mistake, utilize digital effective video content to differentiate parity field, and the video sequence of field preface mistake is proofreaied and correct.
Technical scheme of the present invention such as Fig. 3, Fig. 4 and shown in Figure 5.This preface identification of parity field field and bearing calibration based on video content are to obtain original video stream as input by video camera, enter computer by becoming video data stream behind the video frequency collection card, are handled and computing by computer.Its method step is: computer system is accepted the raw digital video stream that capture card is handled well, through behind the video processing program, and the video data stream after output is proofreaied and correct through odd even.Scheme comprises following technology contents:
1, parity field field preface counter-rotating: first that is input in the computer by capture card according to the definition acquiescence of parity field is the odd field of input video sequence, second is the even field of input video sequence, the 3rd is odd field, the 4th is even field, and the like ... .. reverses strange, the even field sequence of the input video sequence of acquiescence, be about to odd field and change even field into, even field changes odd field into.
2, edge extracting: adopt the edge extracting technology, extract edge of image, obtain the edge of image energy after adding up.
3, parity field is discerned and is proofreaied and correct: the edge energy of the video sequence after comparing input video sequence and reversing, and judge that little person then is the video of a correct preface, and this video is exported.
Concrete scheme is as follows: obtain original video stream as input by video camera, original video stream becomes video data stream after by video frequency collection card and enters computer, is handled and computing by computer.Consider the common feature of different video content parity field field preface mistake, utilize digital effective video content to differentiate parity field, and the video sequence of field preface mistake is proofreaied and correct.May further comprise the steps:
1) at first, computer carries out luminance edges to original data stream and extracts, and extraction step is as follows:
To each two field picture P of video frequency collection card input, comprise strange, idol two field brightness Value Datas, the edge extracting algorithm in the employing formula (1):
Y
i=(A*Z
7+B*Z
8+C*Z
9)+(D*Z
4+E*Z
5+F*Z
6)+(G*Z
1+H*Z
2+I*Z
3) (1)
In the formula: Y
iFor applying mechanically the brightness value of i pixel behind the edge detection operator;
Z
1~Z
9For with the original intensity value of the corresponding pixel of edge detection operator, wherein Z
1The original intensity value of representing upper left pixel, Z
2The original intensity value of the pixel directly over the expression, Z
3The original intensity value of representing top-right pixel, Z
4The original intensity value of the pixel on the expression left side, Z
5The original intensity value of pixel of expression current location, i.e. the original intensity value of i pixel, Z
6The original intensity value of representing right-hand pixel, Z
7The original intensity value of the pixel of expression lower left, Z
8The original intensity value of the pixel under the expression, Z
9The original intensity value of representing bottom-right pixel.
A~I is the weight coefficient of edge detection operator.
According to above method, successively each pixel among the two field picture P is calculated, try to achieve the luminance edges image P ' of this two field picture.
2) edge energy adds up: edge energy refers to the summation of the brightness value of image border.To the luminance edges image P ' that as above extracts, the numerical value of each pixel is added up successively, try to achieve the edge energy E1 of image P.As the formula (2):
In the formula: m, n are respectively Horizontal number of pixels, the Vertical number of pixels of image P.
3) exchange parity field: to the original image of the capture card input definition exchange primary field preface according to parity field, concrete steps are as follows:
Brightness and chrominance samples (pixel) the quantization bit value of one frame original image P of capture card input are temporarily stored on the memory headroom Yr of PC, newly open up the memory headroom Yw of an identical size again.With behavior unit's reading video data in the Yr, and judge the parity of row preface j: when row preface j is odd number in the Yr memory headroom, with the video data of this row be stored in the j+1 of Yw memory headroom capable in; When row preface j was even number in the Yr memory headroom, the j-1 that then is stored in the Yw memory headroom was capable.According to the method described above, judge the parity of all the row prefaces of video data in the Yr memory headroom successively, and the current line video data is stored in the corresponding row among the Yw.So, then exchange the field preface of a two field picture parity field, generated the image Q of a frame parity field field preface exchange.
4) for the image Q after the parity field field preface exchange, repeating step 1), 2), obtain the edge energy E2 of image Q, show as (3):
The implication of Yi is identical with implication in (1) formula in the formula; M, the implication of n is identical with implication in (2) formula.
5) compare numerical values recited: compare E1, E2, the parity field field preface of the little person's representative of numerical value is a correct preface, that is: as if E1<E2, then image P is the correct image of field preface, otherwise Q is the correct image of field preface.
6) judgement output image: through 5), the image Pj that the last output field preface of computer is proofreaied and correct.
Described edge detection operator detects operator for the sobel horizontal edge or be Sobel diagonal angle edge detection operator or for Prewitt horizontal edge detection operator or be Prewitt diagonal angle edge detection operator.
The theoretical foundation of this programme is: find by a large amount of experiments and theory analysis, the image of parity field field preface mistake can produce more serious sawtooth ripple, that is: compare with the correct image of parity field field preface, the image detail information (marginal information) of parity field field preface mistake can be greatly improved.So input video sequence is strange, an idol preface is reversed once, the edge energy (edge energy refers to the summation of the brightness value of image border) of the video sequence after more original input video sequence and the counter-rotating, judge that little person then is the correct video of a preface, and with the output of this video, get final product the correct vision signal of the preface of showing up.Because therefore the unqualified picture material of this scheme is applicable to preface identification of parity field field and correction to any video content.
The present invention carries out from dynamic(al) correction the video sequence of parity field field preface mistake, is convenient to digital process instruments such as computer and handles and program making.Through lot of experiment validation, this method can hundred-percently be discerned and proofread and correct digital effective video (live image) parity field field preface.
Description of drawings
Fig. 1: the correct image of parity field field preface;
Fig. 2: the image of parity field field preface counter-rotating;
Fig. 3: system block diagram;
Fig. 4: computer code flow chart;
Fig. 5: video processing program flow chart.
Embodiment
The step of specific implementation is as follows:
Obtain original video stream as input by video camera, original video stream becomes video data stream after by video frequency collection card and enters computer, is handled and computing by computer.May further comprise the steps:
1) at first, computer carries out luminance edges to original data stream and extracts, and extraction step is as follows:
To each two field picture P of video frequency collection card input, comprise strange, idol two field brightness Value Datas, the edge extracting algorithm shown in the employing formula (1):
Y
i=(A*Z
7+B*Z
8+C*Z
9)+(D*Z
4+E*Z
5+F*Z
6)+(G*Z
1+H*Z
2+I*Z
3) (1)
In the formula: Y
iFor applying mechanically the brightness value of i pixel behind the edge detection operator;
Z
1~Z
9For with the original intensity value of the corresponding pixel of edge detection operator, wherein Z
1The original intensity value of representing upper left pixel, Z
2The original intensity value of the pixel directly over the expression, Z
3The original intensity value of representing top-right pixel, Z
4The original intensity value of the pixel on the expression left side, Z
5The original intensity value of pixel of expression current location, i.e. the original intensity value of i pixel, Z
6The original intensity value of representing right-hand pixel, Z
7The original intensity value of the pixel of expression lower left, Z
8The original intensity value of the pixel under the expression, Z
9The original intensity value of representing bottom-right pixel.
A~I is the weight coefficient of edge detection operator.
Detect operator for the sobel horizontal edge, the value of A~I be followed successively by 1,2,1,0,0,0 ,-1 ,-2 ,-1}.
According to above method, successively each pixel among the two field picture P is calculated, try to achieve the luminance edges image P ' of this two field picture.
At this, can also apply mechanically different operator masterplates, for example:
Sobel diagonal angle edge detection operator (45 degree direction), the value of A~I be followed successively by 2 ,-1,0 ,-1,0,1,0,1,2};
Sobel diagonal angle edge detection operator (negative 45 degree directions), the value of A~I be followed successively by 0,1,2 ,-1,0,1 ,-2 ,-1,0};
The Prewitt horizontal edge detects operator, the value of A~I be followed successively by 1,1,1,0,0,0 ,-1 ,-1 ,-1};
Prewitt diagonal angle edge detection operator (45 degree direction), the value of A~I be followed successively by 1 ,-1,0 ,-1,0,1,0,1,1};
Prewitt diagonal angle edge detection operator (negative 45 degree directions), the value of A~I be followed successively by 0,1,1 ,-1,0,1 ,-1 ,-1,0}.
2) edge energy adds up: to the luminance edges image P ' that as above extracts, the numerical value of each pixel is added up successively, try to achieve the edge energy E1 of image P.As the formula (2):
In the formula: m, n are respectively Horizontal number of pixels, the Vertical number of pixels of image P.For SD image, m=720, n=576; For the image of extended formatting, as the image of CIF form, m=360, n=240.
3) exchange parity field: to the original image of capture card input definition exchange primary field preface according to parity field.
The brightness and chrominance samples (pixel) the quantization bit value of one frame original image of capture card input are temporarily stored on the memory headroom Yr of PC, newly open up the memory headroom Yw of an identical size again.With behavior unit's reading video data in the Yr, and judge the parity of row preface j: when row preface j is odd number in the Yr memory headroom, with the video data of this row be stored in the j+1 of Yw memory headroom capable in; When row preface j was even number in the Yr memory headroom, the j-1 that then is stored in the Yw memory headroom was capable.According to the method described above, judge the parity of all the row prefaces of video data in the Yr memory headroom successively, and the current line video data is stored in the corresponding row among the Yw.So, then exchange the field preface of a two field picture parity field, generated the image Q of a frame parity field field preface exchange.
4) for the image Q after the parity field field preface exchange, repeating step 1), 2), try to achieve the edge energy E2 of image Q, show as (3):
The implication of Yi is shown as (1) in the formula; M, the implication of n is shown as (2)
5) compare numerical values recited: compare E1, E2, the parity field field preface of the little person's representative of numerical value is a correct preface, that is: as if E1<E2, then image P is the correct image of field preface, otherwise Q is the correct image of field preface.
6) the image Pj=P (or Q) that proofreaies and correct through parity field field preface is exported in judgement output image: through 5), computer at last.