Summary of the invention
Technical problem to be solved by this invention is to provide in a kind of piece coupling and dynamically adjusts and search for window sizeMethod and apparatus, can ensure, under the prerequisite of accuracy of coupling, to reduce amount of calculation.
In order to address the above problem, the invention discloses a kind of method of dynamic adjustment search window size, bagDraw together:
Calculate the interframe coefficient correlation of present frame and reference frame; Described interframe coefficient correlation is present frame each pointThe absolute value of the difference of pixel value sum and reference frame each point pixel value sum;
In the time that tried to achieve interframe coefficient correlation is within the first preset threshold value scope, by the size of search windowBe reduced to M1×N1; Wherein, the initial size of described search window is M0×N0;M1<M0,N1<N0。
Preferably, described method also comprises:
For object block to be searched in present frame, calculate the interior coefficient correlation of piece of described object block pixel;Described interior coefficient correlation is the difference of every bit pixel in object block and each point pixel arithmetic mean of instantaneous valueAbsolute value sum;
In the time that coefficient correlation in tried to achieve piece is within the second preset threshold value scope, by the size of search windowBe reduced to M2×N2;M2<M0,N2<N0。
Preferably, described the first preset threshold value scope is: be less than 2A; Wherein, A is current frame pixelNumber.
Preferably, reduce to search for the size of window according to interframe coefficient correlation, be specially:
In the time that described interframe coefficient correlation is being more than or equal to A and is being less than within the scope of 2A, M1Be more than or equal toM0/ 2 are less than M0Scope in equal proportion value, N1Be more than or equal to N0/ 2 are less than N0Scope in etc.Ratio value;
In the time that described interframe coefficient correlation is being more than or equal to A/2 and is being less than within the scope of A, M1Be more than or equal to5 are less than M0Equal proportion value in/2 scope, N1Be less than N being more than or equal to 50Geometric ratio in/2 scopeExample value;
Wherein, be adjusted into 5 × 5 according to the size minimum of interframe coefficient correlation search window; M1And N1ValueFor positive integer.
Preferably, described the second preset threshold value scope is for being less than 2B; Wherein, B is object block pixelNumber.
Preferably, reduce to search for the size of window according to coefficient correlation in piece, be specially:
In the time that described interior coefficient correlation is being more than or equal to B and is being less than within the scope of 2B, M2Be more than or equal toM/2 is less than the interior equal proportion value of scope of M, N2Geometric ratio in the scope that is more than or equal to N/2 and is less than NExample value;
In the time that described interior coefficient correlation is being more than or equal to B/2 and is being less than within the scope of B, M2Be more than or equal to 5Be less than the interior equal proportion value of scope of M/2, N2Be less than equal proportion in the scope of N/2 being more than or equal to 5Value;
Wherein, while reducing according to the size of interframe coefficient correlation search window, M value is M1; According to frameBetween the size of coefficient correlation search window while not adjusting, M value is M0; Search according to coefficient correlation in pieceThe size minimum of rope window is adjusted into 5 × 5; M2And N2Value is positive integer.
Further, the invention also discloses a kind of device of dynamic adjustment search window size, comprising:
Interframe Calculation of correlation factor unit, for calculating the interframe coefficient correlation of present frame and reference frame; InstituteState interframe coefficient correlation and be the difference of present frame each point pixel value sum and reference frame each point pixel value sumAbsolute value;
The first search window adjustment unit, for working as tried to achieve interframe coefficient correlation at the first preset threshold value modelWithin enclosing time, the size of search window is reduced to M1×N1; Wherein, the initial size of described search windowFor M0×N0;M1<M0,N1<N0。
Preferably, described device also comprises:
Calculation of correlation factor unit in piece, for for present frame object block to be searched, described in calculatingCoefficient correlation in the piece of object block pixel; Described interior coefficient correlation be every bit pixel in object block withThe absolute value sum of the difference of each point pixel arithmetic mean of instantaneous value;
The second search window adjustment unit, for working as in tried to achieve piece coefficient correlation at the second preset threshold value modelWithin enclosing time, the size of search window is reduced to M2×N2;M2<M0,N2<N0。
Preferably, described the first preset threshold value scope is: be less than 2A; Wherein, A is current frame pixelNumber.
Preferably, described the first search window adjustment unit reduces to search for the large of window according to interframe coefficient correlationLittle, be specially:
In the time that described interframe coefficient correlation is being more than or equal to A and is being less than within the scope of 2A, M1Be more than or equal toM0/ 2 are less than M0Scope in equal proportion value, N1Be more than or equal to N0/ 2 are less than N0Scope in etc.Ratio value;
In the time that described interframe coefficient correlation is being more than or equal to A/2 and is being less than within the scope of A, M1Be more than or equal to5 are less than M0Equal proportion value in/2 scope, N1Be less than N being more than or equal to 50Geometric ratio in/2 scopeExample value;
Wherein, be adjusted into 5 × 5 according to the size minimum of interframe coefficient correlation search window; M1And N1ValueFor positive integer.
Preferably, described the second preset threshold value scope is for being less than 2B; Wherein, B is object block pixelNumber.
Preferably, described the second search window adjustment unit reduces to search for the large of window according to coefficient correlation in pieceLittle, be specially:
In the time that described interior coefficient correlation is being more than or equal to B and is being less than within the scope of 2B, M2Be more than or equal toM/2 is less than the interior equal proportion value of scope of M, N2Geometric ratio in the scope that is more than or equal to N/2 and is less than NExample value;
In the time that described interior coefficient correlation is being more than or equal to B/2 and is being less than within the scope of B, M2Be more than or equal to 5Be less than the interior equal proportion value of scope of M/2, N2Be less than equal proportion in the scope of N/2 being more than or equal to 5Value;
Wherein, while reducing according to the size of interframe coefficient correlation search window, M value is M1; According to frameBetween the size of coefficient correlation search window while not adjusting, M value is M0; Search according to coefficient correlation in pieceThe size minimum of rope window is adjusted into 5 × 5; M2And N2Value is positive integer.
In addition, the invention also discloses a kind of block matching method, comprising:
Calculate the interframe coefficient correlation of present frame and reference frame; Described interframe coefficient correlation is present frame each pointThe absolute value of the difference of pixel value sum and reference frame each point pixel value sum;
In the time that tried to achieve interframe coefficient correlation is within the first preset threshold value scope, by the size of search windowBe reduced to M1×N1; Wherein, the initial size of described search window is M0×N0;M1<M0,N1<N0;
In search window in reference frame, the match block of object block to be searched in search present frame.
Preferably, before search match block, described method also comprises:
For object block to be searched in present frame, calculate the interior coefficient correlation of piece of described object block pixel;Described interior coefficient correlation is the difference of every bit pixel in object block and each point pixel arithmetic mean of instantaneous valueAbsolute value sum;
In the time that coefficient correlation in tried to achieve piece is within the second preset threshold value scope, by the size of search windowBe reduced to M2×N2;M2<M0,N2<N0。
Preferably, described the first preset threshold value scope is: be less than 2A; Wherein, A is current frame pixelNumber.
Preferably, described the second preset threshold value scope is for being less than 2B; Wherein, B is object block pixelNumber.
Preferably, the match block of object block to be searched in described search present frame, is specially:
Choose each piece in search window according to presetting rule, calculate object block and the pixel of searching for piece in windowPoor absolute value sum, will calculate the piece of minimum of a value as the match block of object block.
Further, the invention also discloses a kind of piece coalignment, comprising:
Interframe Calculation of correlation factor unit, for calculating the interframe coefficient correlation of present frame and reference frame; InstituteState interframe coefficient correlation and be the difference of present frame each point pixel value sum and reference frame each point pixel value sumAbsolute value;
The first search window adjustment unit, for working as tried to achieve interframe coefficient correlation at the first preset threshold value modelWithin enclosing time, the size of search window is reduced to M1×N1; Wherein, the initial size of described search windowFor M0×N0;M1<M0,N1<N0;
Match block search unit, in the search window of reference frame, to be searched in search present frameThe match block of object block.
Preferably, described device also comprises:
Calculation of correlation factor unit in piece, for for present frame object block to be searched, described in calculatingCoefficient correlation in the piece of object block pixel; Described interior coefficient correlation be every bit pixel in object block withThe absolute value sum of the difference of each point pixel arithmetic mean of instantaneous value;
The second search window adjustment unit, for working as in tried to achieve piece coefficient correlation at the second preset threshold value modelWithin enclosing time, the size of search window is reduced to M2×N2;M2<M0,N2<N0。
Preferably, described the first preset threshold value scope is: be less than 2A; Wherein, A is current frame pixelNumber.
Preferably, described the second preset threshold value scope is for being less than 2B; Wherein, B is object block pixelNumber.
Preferably, the match block of object block to be searched in described match block search unit search present frame,Be specially:
Choose each piece in search window according to presetting rule, calculate object block and the pixel of searching for piece in windowPoor absolute value sum, will calculate the piece of minimum of a value as the match block of object block.
Compared with prior art, the present invention has the following advantages:
The present invention (is present frame each point pixel value by the interframe coefficient correlation of calculating present frame and reference frameThe absolute value of the difference of sum and reference frame each point pixel value sum), when tried to achieve interframe coefficient correlation existsWithin the first preset threshold value scope time, the size that reduces to search for window. The method that the present invention proposes, foundationThe correlation of two two field picture contents, determines the size of suitable search window, can protect at block matching algorithmUnder the prerequisite of the card degree of accuracy, reduce the point of required coupling, reduced the complexity of calculating.
Further, the complying with as further adjustment search window size by coefficient correlation in the piece of object blockAccording to, calculate the absolute value sum of the difference of each point pixel in object block and pixel arithmetic mean of instantaneous value; Work as instituteWhen in the piece of trying to achieve, coefficient correlation is within the second preset threshold value scope, the size that reduces to search for window. ByIn the self-correlation of having considered object block itself, therefore adjust result more accurate, further reduceThe amount of calculation of piece coupling, has improved the speed that piece mates.
Detailed description of the invention
For above-mentioned purpose of the present invention, feature and advantage can be become apparent more, below in conjunction with accompanying drawingThe present invention is further detailed explanation with detailed description of the invention.
One of core idea of the present invention is, has proposed a kind of method of dynamic adjustment search window size,By calculating the degree of correlation (being interframe coefficient correlation) of present frame and reference frame, and preset threshold rangeCompare, in the time that interframe coefficient correlation is within the scope of this, the size that reduces to search for window. The present inventionEnsure at block matching algorithm, under the prerequisite of the degree of accuracy, to reduce the point of required coupling, reduced the complexity of calculatingDegree.
With reference to Fig. 1, show the stream of the embodiment of the method one of a kind of dynamic adjustment search window size of the present inventionCheng Tu, is characterized in that, comprising:
Step 101, the interframe coefficient correlation of calculating present frame and reference frame; Described interframe coefficient correlation isThe absolute value of the difference of present frame each point pixel value sum and reference frame each point pixel value sum;
The two field picture that need to carry out compression coding is present frame, described reference frame in time can be in advance orPerson lags behind present frame, and in the time that reference frame is before present frame, piece coupling is applied to backward motion estimation,In the time that reference frame is after present frame, piece coupling is applied to forward motion estimation. At general Video codingIn compression, the former frame image that the reference frame of choosing is present frame.
The main purpose of this step is to weigh the content relevance of two two field pictures, obtains between two two field picturesSimilarity degree, thus determine the size of the search window that block matching algorithm uses according to similarity degree. ThisThe similarity estimating method that invention proposes is the interframe coefficient correlation of calculating present frame and reference frame pixel. ToolBody, the interframe coefficient correlation of described present frame and reference frame is: present frame each point pixel value sum and ginsengExamine the absolute value of the difference of frame pixel each point pixel value sum, it has reacted the exhausted of present frame and reference frame pixelTo error, described error is less, illustrates that the content of two width images is more approaching. As follows, be interframeThe computing formula of coefficient correlation E:
Wherein, the wide of reference frame (also same present frame) image is w pixel; Reference frame is (also with currentFrame) height of image is h pixel; I span is 0~w, is the abscissa of pixel; J valueScope is 0~h, is the ordinate of pixel; PijFor on current frame image coordinate position (i, j) is locatedPixel value, QijFor the pixel value that coordinate position (i, j) is located in reference frame image.
Step 102, in the time that tried to achieve interframe coefficient correlation is within the first preset threshold value scope, will searchThe size of rope window is reduced to M1×N1; Wherein, the initial size of described search window is M0×N0;M1<M0,N1<N0。
In block matching algorithm, the size of search window has directly affected matching result. Conventionally two width images,Similarity degree large, should calculate main related pixel and not consider too much neighboring pixel, otherwiseThe noise of periphery may affect the accurate tolerance of relevant matches coefficient in block matching algorithm, so should selectWith less search window. Otherwise, if the movement differential of two width images is larger, should select largerSearch window, many neighboring pixels of considering of can trying one's best like this, thus obtain the most similar match point.
In order to reduce computation complexity, search window should be as far as possible little, but after being small enough to certain value, just havePossible radical change object block and the correlation of searching for piece in window. Meanwhile, in order to obtain exactly as far as possibleCorrelation between capture element, needs to ensure that search window is enough large, but so again can be because of image noiseCause radical change object block and the correlation of searching for piece in window with adding of incoherent pixel own.So should judge the similarity degree of current frame image and reference frame, obtain roughly relevant the closing of picture materialSystem, thus the size of definite suitable search window is accomplished autotelic calculating and is mated. Conventionally two,The difference of width image is less, and searching for window should reduce.
Be understandable that, before adjusting, need to pre-define the size of an original search window,Guaranteeing to search for window is unlikely to excessive and increases amount of calculation; Meanwhile, guaranteeing to search for window is unlikely to too small and causesReduce piece to be searched and the correlation of object block. The initial size of described search window is M0×N0, searchRope window region is: the left side at current goal piece expands M0Individual pixel, the right expand M0Individual pixel, onSide expands N0Individual pixel, below expand N0The region that individual pixel surrounds. Can set M0And N0GetNot etc., for example, the initial size of search window is not 16 × 8 or 8 × 16 to value. General, set M0And N0Value equates. Conventionally, for larger image, as 1280 × 720 image, search windowInitial size is decided to be 32 × 32; For less image, as 176 × 144 image, at the beginning of search windowBeginning size is decided to be 16 × 16.
General, in described present frame, the size of object block to be searched is: 16 × 16,16 × 8,8 ×16,8 × 8,8 × 4,4 × 8 or 4 × 4. For example, the size of selected object block is 16 × 16 picturesThe macro block of element, the size of its search window is 16 × 16. When the judgement interframe coefficient correlation of trying to achieve is theWithin one preset threshold value scope, the size of search window is reduced to M1×N1, described the first preset threshold valueScope is through the statistical analysis of multitude of video data is tried to achieve, and has general adaptability meaning. Can establishDetermine M1And N1Value equate, or M1And N1Value not etc. For example, search window by 16 ×16 are reduced to: 8 × 8,16 × 8,8 × 16 or other range size.
As shown in Figure 2, search for the signal of the embodiment of the method one of window size for a kind of dynamic adjustment of the present inventionFigure; Wherein, the object block in present frame has been shown in Fig. 2 (a), this object block is 16 × 16 sizes;Fig. 2 (b) has provided the size signal of the unadjusted search window in reference frame, and its size is 32 × 32;Fig. 2 (c) has provided the size signal of the search window after reducing in reference frame, and the size after adjustment is16×16。
It should be noted that, due to the complexity that the object of the invention is to reduce in block matching algorithm, therefore,, in adjustment process, search for the big or small or constant of window or reduce, but can not increase search window.
The embodiment of the present invention one, by calculating the interframe coefficient correlation of present frame and reference frame image, according toCompare with the first preset threshold value scope, judge whether to reduce to search for the size of window, can be at pieceJoin algorithm and ensure, under the prerequisite of the degree of accuracy, to reduce the point of required coupling, reduced the complexity of calculating.
With reference to Fig. 3, show the stream of the embodiment of the method two of a kind of dynamic adjustment search window size of the present inventionCheng Tu, comprising:
Step 301, the interframe coefficient correlation of calculating present frame and reference frame; Described interframe coefficient correlation isThe absolute value of the difference of present frame each point pixel value sum and reference frame each point pixel value sum;
Step 302, whether the judgement interframe coefficient correlation of trying to achieve is within the first preset threshold value scope;If so, after performing step 303, perform step 304; If not, the size of searching for window does not adjust,Directly execution step 304;
Step 303, the size that reduces to search for window;
In a preferred embodiment of the invention, described the first preset threshold value scope is: be less than 2A;Wherein, A is the number of present frame (same to reference frame) pixel. Interframe coefficient correlation E is more than or equal toWhen 2A, the size of search window is constant; While being less than 2A, search window reduces.
Further, reduce to search for the size of window according to interframe coefficient correlation, be specially:
In the time that described interframe coefficient correlation is being more than or equal to A and is being less than within the scope of 2A, M1Be more than or equal toM0/ 2 are less than M0Scope in equal proportion value, N1Be more than or equal to N0/ 2 are less than N0Scope in etc.Ratio value; In the time that described interframe coefficient correlation is being more than or equal to A/2 and is being less than within the scope of A, M1GreatlyBe less than M in equaling 50Equal proportion value in/2 scope, N1Be less than N being more than or equal to 50/ 2 scopeInterior equal proportion value; Wherein, be adjusted into 5 × 5 according to the size minimum of interframe coefficient correlation E search window;M1And N1Value is positive integer. That is:
When A≤E < 2A, M0/2≤M1<M0;N0/2≤N1<N0;
When A/2≤E < A, 5≤M1<M0/2;5≤N1<N0/2;
That is to say when E equals whole frame number of pixels the M of search window1、N1Value reduces by half; E equalsWhole frame number of pixels was divided by 2 o'clock, and search window is 5 × 5; If E is other value, basis and whole frameRatio between number of pixels, carries out scaled down to search window. It should be noted that equal proportion contractingHour, M1And N1Value be always integer, if the result of calculating is not positive integer number, thatJust get immediate value. E value is in a certain scope, M1And N1Immobilize. For example, AWhen≤E < 2A, the size of search window can only be 8 × 8,9 × 9,10 × 10,11 × 11,12 × 12,Value in 13 × 13,14 × 14.
It should be noted that, work as M0/ 2≤5 o'clock, M1Value is 5; Work as N0/ 2≤5 o'clock, N1Value is5. In addition, the minimum adjustment of search window is 5 × 5, and, in the time of E < A/2, search window size is always 5× 5. Ensure that, in search window, the accuracy of match block search, is unlikely to search for window too small, makesFor the piece of coupling is positioned at outside search window.
Step 304, for object block to be searched in present frame, calculates in the piece of described object block pixelCoefficient correlation; Described interior coefficient correlation is every bit pixel and the each point pixel arithmetic average in object blockThe absolute value sum of the difference of value;
In the embodiment of the present invention two, before obtaining the size of search window, also need to do a precision regulatingWhole process. Because in above-mentioned steps, by primary pretreatment only to having done one between two two field picturesIndividual rough calculating and estimation, do not consider other influences factor, relevant such as the oneself of object block itselfProperty etc. So embodiment of the present invention two-way is crossed the interior coefficient correlation of piece of object block as evaluation objective piece basisThe leading indicator of body correlation. Concrete, described interior coefficient correlation MSE is the each point in object blockThe absolute value sum of the difference of pixel and pixel arithmetic mean of instantaneous value. Conventionally, the size of MSE has been reacted targetThe pixel difference degree of piece itself, MSE is less, illustrates that the difference degree of object block is less, searches soThe size of rope window should correspondingly reduce. As follows, the computing formula for coefficient correlation MSE in piece:
Wherein, the wide of object block is m pixel; The height of object block is h pixel; I spanBeing 0~m, is the abscissa of pixel; J span is 0~n, is the ordinate of pixel; P 'ijForThe pixel value that in the object block of present frame, coordinate position (i, j) is located;For each point pixel in object blockArithmetic mean value.
Step 305, in the judgement piece of trying to achieve, whether coefficient correlation is within the second preset threshold value scope;If so, perform step 306; The size of if not, searching for window does not adjust;
Step 306, the size that reduces to search for window.
In a preferred embodiment of the invention, described the second preset threshold value scope is for being less than 2B; Wherein, BFor the number of object block pixel, when in piece, coefficient correlation MSE is more than or equal to 2B, the size of search windowConstant; While being less than 2B, search window reduces. Concrete, B=m × n, for example, for one 16 × 16Piece, the value of B is 256.
Further, reduce to search for the size of window according to coefficient correlation in piece, be specially:
In the time that described interior coefficient correlation is being more than or equal to B and is being less than within the scope of 2B, M1Be more than or equal toM/2 is less than equal proportion value in the scope of M, and N is geometric ratio in the scope that is more than or equal to N/2 and is less than NExample value; In the time that described interframe coefficient correlation is being more than or equal to A/2 and is being less than within the scope of A, M1Be greater thanEqual 5 and be less than equal proportion value in the scope of M/2, N is less than in the scope of N/2 etc. being more than or equal to 5Ratio value; Wherein, while reducing according to the size of interframe coefficient correlation search window, M value is M1;While not adjusting according to the size of interframe coefficient correlation search window, M value is M0; According to relevant in pieceThe size minimum of coefficient search window is adjusted into 5 × 5; M2And N2Value is positive integer. That is:
When B≤MSE < 2B, M/2≤M2<M;N/2≤N2<N;
When B/2≤MSE < B, 5≤M2<M/2;5≤N2<N/2;
M=M0Or M1;N=N0Or N1。
That is to say, if by the judgement of primary interframe coefficient correlation, reduced the large of search windowHour, the search window based on reducing last time dwindles adjustment again; If pass through interframe phase for the first timeClose the judgement of coefficient, when the size of search window does not change, on the basis of initial ranging window, dwindleAdjust.
For example, by the judgement of step 302, search window is reduced to 24 × 24 by 32 × 32; AgainCarried out the judgement of step 305, supposed MSE=3B/2, M2=3M1/4=18;N2=3N1/4=18,Search window is reduced to 18 × 18 again by 24 × 24. As shown in Figure 4, dynamically adjust for the present invention is a kind ofThe schematic diagram of the embodiment of the method two of search window size; Wherein, in Fig. 4 (a), illustrated in present frameThe size of object block, this object block is 16 × 16; Fig. 4 (b) has provided the search window in reference frameInitial size signal, its size is 16 × 16; Fig. 4 (c) has provided according to interframe coefficient correlation and has reducedAfter the size signal of search window, its size is 12 × 12; Fig. 4 (d) has provided according to relevant in pieceThe size signal of the search window that coefficient finally obtains, its size is 9 × 9.
And for example, by the judgement of step 302, search window is not done to change; Again carry out step 305Judgement, suppose MSE=3B/2, M2=3M0/4=12;N2=3N0/ 4=12, search window finally subtractsLittle is 12 × 12.
It should be noted that, in the time of M/2≤5, M2Value is 5; In the time of N/2≤5, N2Value is 5.With by calculating interframe coefficient correlation, to reduce to search for window identical, obtain by coefficient correlation in computing blockSearch window minimum be also 5 × 5. In the time of MSE < B/2, search window size is always 5 × 5. To protectCard is in search window, and the accuracy of match block search, is unlikely to search for window too small, makes to mate the mostPiece is positioned at outside search window.
In above-described embodiment, provide the wide and high preferred exemplary of simultaneously dwindling of search window, understandableBe, the size of search window has multiple minishing method, and the present invention does not limit at this, for example, and in concrete realityShi Shi, the height (wide constant) that can only reduce to search for wide (high constant) of window or search for window. For example,Search window is reduced to 16 × 8 or 8 × 16 etc. by 16 × 16.
By the embodiment of the present invention two, by calculating successively coefficient correlation in interframe coefficient correlation and piece, rightSearch window is adjusted, and owing to having considered the self-correlation of object block itself, therefore adjusts result moreAccurately.
With reference to Fig. 5, show the structure of the device embodiment of a kind of dynamic adjustment search window size of the present inventionFigure, comprising:
Interframe Calculation of correlation factor unit 501, for calculating the interframe coefficient correlation of present frame and reference frame;Described interframe coefficient correlation is the poor of present frame each point pixel value sum and reference frame each point pixel value sumAbsolute value;
The first search window adjustment unit 502, for working as tried to achieve interframe coefficient correlation at the first preset thresholdWithin value scope time, the size of search window is reduced to M1×N1; Wherein, described search window is initialSize is M0×N0;M1<M0,N1<N0。
Preferably, described the first preset threshold value scope is: be less than 2A; Wherein, A is current frame pixelNumber.
Further, described the first search window adjustment unit reduces to search for the large of window according to interframe coefficient correlationLittle, be specially:
In the time that described interframe coefficient correlation is being more than or equal to A and is being less than within the scope of 2A, M1Be more than or equal toM0/ 2 are less than M0Scope in equal proportion value, N1Be more than or equal to N0/ 2 are less than N0Scope in etc.Ratio value; In the time that described interframe coefficient correlation is being more than or equal to A/2 and is being less than within the scope of A, M1GreatlyBe less than M in equaling 50Equal proportion value in/2 scope, N1Be less than N being more than or equal to 50/ 2 scopeInterior equal proportion value; Wherein, be adjusted into 5 × 5 according to the size minimum of interframe coefficient correlation search window;M1And N1Value is positive integer.
As shown in Figure 5, in a preferred embodiment of the invention, consider that the oneself of object block itself is relevantProperty, described device also comprises:
Calculation of correlation factor unit 503 in piece, for for present frame object block to be searched, calculatesCoefficient correlation in the piece of described object block pixel; Described interior coefficient correlation is the every bit picture in object blockThe absolute value sum of the difference of element and each point pixel arithmetic mean of instantaneous value;
The second search window adjustment unit 504, for working as in tried to achieve piece coefficient correlation at the second preset thresholdWithin value scope time, the size of search window is reduced to M2×N2;M2<M0,N2<N0。
Preferably, described the second preset threshold value scope is for being less than 2B; Wherein, B is object block pixelNumber.
Further, described the second search window adjustment unit reduces to search for the large of window according to coefficient correlation in pieceLittle, be specially:
In the time that described interior coefficient correlation is being more than or equal to B and is being less than within the scope of 2B, M2Be more than or equal toM/2 is less than the interior equal proportion value of scope of M, N2Geometric ratio in the scope that is more than or equal to N/2 and is less than NExample value; In the time that described interior coefficient correlation is being more than or equal to B/2 and is being less than within the scope of B, M2Be greater thanEqual 5 and be less than equal proportion value in the scope of M/2, N2Be less than in the scope of N/2 being more than or equal to 5Equal proportion value; Wherein, while reducing according to the size of interframe coefficient correlation search window, M value is M1;While not adjusting according to the size of interframe coefficient correlation search window, M value is M0; According to relevant in pieceThe size minimum of coefficient search window is adjusted into 5 × 5; M2And N2Value is positive integer.
With reference to Fig. 6, be the flow chart of a kind of block matching method embodiment mono-of the present invention, comprising:
Step 601, the interframe coefficient correlation of calculating present frame and reference frame; Described interframe coefficient correlation isThe absolute value of the difference of present frame each point pixel value sum and reference frame each point pixel value sum;
Step 602, in the time that tried to achieve interframe coefficient correlation is within the first preset threshold value scope, will searchThe size of rope window is reduced to M1×N1; Wherein, the initial size of described search window is M0×N0;M1<M0,N1<N0;
Step 603, in the search window in reference frame, search in present frame object block to be searchedJoin piece.
Preferably, described the first preset threshold value scope is: be less than 2A; Wherein, A is current frame pixelNumber.
Further, reduce to search for the size of window according to interframe coefficient correlation, be specially:
In the time that described interframe coefficient correlation is being more than or equal to A and is being less than within the scope of 2A, M1Be more than or equal toM0/ 2 are less than M0Scope in equal proportion value, N1Be more than or equal to N0/ 2 are less than N0Scope in etc.Ratio value; In the time that described interframe coefficient correlation is being more than or equal to A/2 and is being less than within the scope of A, M1GreatlyBe less than M in equaling 50Equal proportion value in/2 scope, N1Be less than N being more than or equal to 50/ 2 scopeInterior equal proportion value; Wherein, be adjusted into 5 × 5 according to the size minimum of interframe coefficient correlation search window;M1And N1Value is positive integer.
With reference to Fig. 7, be the flow chart of a kind of block matching method embodiment bis-of the present invention, than above-mentioned realityExecute example, the present embodiment has been considered the self-correlation of object block, makes to adjust result more accurate, described sideMethod comprises:
Step 701, the interframe coefficient correlation of calculating present frame and reference frame; Described interframe coefficient correlation isThe absolute value of the difference of present frame each point pixel value sum and reference frame each point pixel value sum;
Step 702, in the time that tried to achieve interframe coefficient correlation is within the first preset threshold value scope, will searchThe size of rope window is reduced to M1×N1; Wherein, the initial size of described search window is M0×N0;M1<M0,N1<N0;
Step 703, for object block to be searched in present frame, calculates in the piece of described object block pixelCoefficient correlation; Described interior coefficient correlation is every bit pixel and the each point pixel arithmetic average in object blockThe absolute value sum of the difference of value;
Preferably, described the second preset threshold value scope is for being less than 2B; Wherein, B is object block pixelNumber.
Further, reduce to search for the size of window according to coefficient correlation in piece, be specially:
In the time that described interior coefficient correlation is being more than or equal to B and is being less than within the scope of 2B, M2Be more than or equal toM/2 is less than the interior equal proportion value of scope of M, N2Geometric ratio in the scope that is more than or equal to N/2 and is less than NExample value; In the time that described interior coefficient correlation is being more than or equal to B/2 and is being less than within the scope of B, M2Be greater thanEqual 5 and be less than equal proportion value in the scope of M/2, N2Be less than in the scope of N/2 being more than or equal to 5Equal proportion value; Wherein, while reducing according to the size of interframe coefficient correlation search window, M value is M1;While not adjusting according to the size of interframe coefficient correlation search window, M value is M0; According to relevant in pieceThe size minimum of coefficient search window is adjusted into 5 × 5; M2And N2Value is positive integer.
Step 704, in the time that coefficient correlation in tried to achieve piece is within the second preset threshold value scope, will searchThe size of rope window is reduced to M2×N2;M2<M0,N2<N0;
Step 705, in the search window in reference frame, search in present frame object block to be searchedJoin piece.
Further, the match block of object block to be searched in described search present frame, is specially: according in advancePut rule and choose each piece in search window, calculate the object block absolute value poor with the pixel of searching for piece in windowSum, will calculate the piece of minimum of a value as the match block of object block; Wherein, can choose and search successivelyIn rope window each, all searches for, and also can choose some in search window according to special algorithmSpecific, carry out part search; The object block absolute value sum SAD poor with the pixel of searching for piece in windowBe expressed as:
Wherein, Q (x, y) is the pixel value of each point on piece in search window; P (x, y) is the order of present frameThe pixel value of each point on mark piece; The poor coordinates computed (x, y) of pixel is at object block and search window each timeThe corresponding position value of middle; When SDA hour, the piece in corresponding search window and object blockJoin error minimum, the match block using this piece as object block.
With reference to Fig. 8, show the structure chart of a kind of coalignment embodiment of the present invention, comprising:
Interframe Calculation of correlation factor unit 801, for calculating the interframe coefficient correlation of present frame and reference frame;Described interframe coefficient correlation is the poor of present frame each point pixel value sum and reference frame each point pixel value sumAbsolute value;
The first search window adjustment unit 802, for working as tried to achieve interframe coefficient correlation at the first preset thresholdWithin value scope time, the size of search window is reduced to M1×N1; Wherein, described search window is initialSize is M0×N0;M1<M0,N1<N0;
Match block search unit 803, in the search window of reference frame, waits to search in search present frameThe match block of the object block of rope.
Preferably, described the first preset threshold value scope is: be less than 2A; Wherein, A is current frame pixelNumber.
Further, reduce to search for the size of window according to interframe coefficient correlation, be specially:
In the time that described interframe coefficient correlation is being more than or equal to A and is being less than within the scope of 2A, M1Be more than or equal toM0/ 2 are less than M0Scope in equal proportion value, N1Be more than or equal to N0/ 2 are less than N0Scope in etc.Ratio value; In the time that described interframe coefficient correlation is being more than or equal to A/2 and is being less than within the scope of A, M1GreatlyBe less than M in equaling 50Equal proportion value in/2 scope, N1Be less than N being more than or equal to 50/ 2 scopeInterior equal proportion value; Wherein, be adjusted into 5 × 5 according to the size minimum of interframe coefficient correlation search window;M1And N1Value is positive integer.
In a preferred embodiment of the invention, as shown in Figure 8, described device also comprises:
Calculation of correlation factor unit 804 in piece, for for present frame object block to be searched, calculatesCoefficient correlation in the piece of described object block pixel; Described interior coefficient correlation is the every bit picture in object blockThe absolute value sum of the difference of element and each point pixel arithmetic mean of instantaneous value;
The second search window adjustment unit 805, for working as in tried to achieve piece coefficient correlation at the second preset thresholdWithin value scope time, the size of search window is reduced to M2×N2;M2<M0,N2<N0。
Preferably, described the second preset threshold value scope is for being less than 2B; Wherein, B is object block pixelNumber.
Further, reduce to search for the size of window according to coefficient correlation in piece, be specially:
In the time that described interior coefficient correlation is being more than or equal to B and is being less than within the scope of 2B, M2Be more than or equal toM/2 is less than the interior equal proportion value of scope of M, N2Geometric ratio in the scope that is more than or equal to N/2 and is less than NExample value; In the time that described interior coefficient correlation is being more than or equal to B/2 and is being less than within the scope of B, M2Be greater thanEqual 5 and be less than equal proportion value in the scope of M/2, N2Be less than in the scope of N/2 being more than or equal to 5Equal proportion value; Wherein, while reducing according to the size of interframe coefficient correlation search window, M value is M1;While not adjusting according to the size of interframe coefficient correlation search window, M value is M0; According to relevant in pieceThe size minimum of coefficient search window is adjusted into 5 × 5; M2And N2Value is positive integer.
Concrete, the match block of object block to be searched in described match block search unit search present frame,Be specially: choose search each piece in window according to presetting rule, calculate piece in object block and search windowThe absolute value sum that pixel is poor, will calculate the piece of minimum of a value as the match block of object block.
Each embodiment in this description all adopts the mode of going forward one by one to describe, and each embodiment stressesBe all and the difference of other embodiment, between each embodiment identical similar part mutually referring to. For device embodiment, because it is substantially similar to embodiment of the method, so the ratio of describingSimpler, relevant part is referring to the part explanation of embodiment of the method.
Method and device thereof to a kind of dynamic adjustment search window provided by the present invention above, and a kind ofBlock matching method and device thereof, be described in detail, and applied specific case herein to of the present inventionPrinciple and embodiment are set forth, and the explanation of above embodiment is just of the present invention for helping to understandMethod and core concept thereof; Meanwhile, for one of ordinary skill in the art, according to thought of the present invention,All will change in specific embodiments and applications, in sum, this description is notBe interpreted as limitation of the present invention.