A kind of method for estimating image overall motion and device
Technical field
The present invention relates to a kind of image processing techniques, relate in particular to a kind of picture motion estimating method and device that is applied to video coding and image rectification.
Background technology
Image motion estimates in image processing field application is quite widely arranged, for example in fields such as video coding, image rectifications.Estimation is meant the position difference between the relevant scene of analyzing two width of cloth or multiple image, thereby obtains the motion vector of video camera or captured object.
Existing the most basic a kind of picture motion estimating method is that reference picture is divided into a lot of image blocks, in another width of cloth image, reference image block is done two-dimentional matching operation, find optimal match point (optimal match point is defined as two width of cloth image difference minimums in this position), represent optimal movement to estimate.Ask geometric average to obtain the overall motion estimation vector of image the motion estimation vectors of all images piece.The operand of this two-dimentional matching algorithm is big, is not suitable for embedded real-time operation.
A kind of picture motion estimating method of the advanced person who compares is based on projection theory, the matching operation of a two dimensional image is reduced to the matching operation of two one-dimensional vector that is:, thereby has improved search efficiency greatly.But this kind picture motion estimating method error is bigger, and main cause is respectively to exist partial content not occur in another width of cloth image between two width of cloth images.The projection of these picture materials has influenced the shape of image vector, thereby has reduced the precision of projection vector coupling.Therefore in order to improve the accuracy of estimation, still need all alternative points of two dimension traversal, this has reduced search efficiency again.
Summary of the invention
The objective of the invention is to address the above problem, a kind of method for estimating image overall motion and device are provided, when improving search precision, also improved search efficiency.
Technical scheme of the present invention is: the invention provides a kind of method for estimating image overall motion, comprising:
(1) with the projection on first direction of several width of cloth images, these one dimension projection vectors is done matching operation, find optimal match point, and sentence the common region that first direction is sheared these images respectively at this optimal match point;
(2) common region projection on second direction of these images of finishing will be sheared in the step (1), these one dimension projection vectors are done matching operation, find the first best reference point, obtain the motion vector on the first direction, and sentence the common region that second direction is sheared these images respectively at this first best reference point;
(3) with shearing the common region projection on first direction again of these images of finishing in the step (2), these one dimension projection vectors are done matching operation, find the second best reference point, obtain the motion vector on the second direction.
Above-mentioned method for estimating image overall motion, wherein, this first direction is a horizontal direction, this second direction is a vertical direction.
Above-mentioned method for estimating image overall motion, wherein, this optimal match point is represented the evaluation of estimating of vertical direction motion vector, and this first best reference point is represented the final estimated value of horizontal motion vector, and this second best reference point is represented the final estimated value of vertical direction motion vector.
Above-mentioned method for estimating image overall motion, wherein, this first direction is a vertical direction, this second direction is a horizontal direction.
Above-mentioned method for estimating image overall motion, wherein, this optimal match point is represented the evaluation of estimating of horizontal motion vector, and this first best reference point is represented the final estimated value of vertical direction motion vector, and this second best reference point is represented the final estimated value of horizontal motion vector.
Based on above-mentioned method for estimating image overall motion, the present invention also provides a kind of image overall movement estimation apparatus, comprising:
The first projection matching module with the projection on first direction of several width of cloth images, is done matching operation to these one dimension projection vectors, finds optimal match point;
First shear module is sentenced the common region that first direction is sheared these images respectively at the optimal match point that this first projection matching module obtains;
The second projection matching module with common region projection on second direction that this first shear module is sheared these images of finishing, is done matching operation to these one dimension projection vectors, finds the first best reference point, obtains the motion vector on the first direction;
Second shear module is sentenced the common region that second direction is sheared these images respectively at this first best reference point;
The 3rd projection matching module with the common region projection on first direction again that this second shear module is sheared these images of finishing, is done matching operation to these one dimension projection vectors, finds the second best reference point, obtains the motion vector on the second direction.
Above-mentioned image overall movement estimation apparatus, wherein, this first direction is a horizontal direction, this second direction is a vertical direction.
Above-mentioned image overall movement estimation apparatus, wherein, this optimal match point is represented the evaluation of estimating of vertical direction motion vector, and this first best reference point is represented the final estimated value of horizontal motion vector, and this second best reference point is represented the final estimated value of vertical direction motion vector.
Above-mentioned image overall movement estimation apparatus, wherein, this first direction is a vertical direction, this second direction is a horizontal direction.
Above-mentioned image overall movement estimation apparatus, wherein, this optimal match point is represented the evaluation of estimating of horizontal motion vector, and this first best reference point is represented the final estimated value of vertical direction motion vector, and this second best reference point is represented the final estimated value of horizontal motion vector.
The present invention contrasts prior art following beneficial effect: the present invention is by doing twice matching operation on level or vertical direction, the contrast level first time or vertical projection are with level or vertical projection can find out that two drop shadow curve's similarities of secondary projection are higher for the second time, the precision of match point is also higher, thereby has improved the estimation precision that the projection coupling obtains.Contrast existing method for estimating, the present invention need not image is carried out two dimension traversal coupling, only need image is carried out projection operation three times, thereby greatly reduce computation complexity, be fit to be applied in the embedded systems such as digital camera, Digital Video or camera cell phone.
Description of drawings
Fig. 1 is the flow chart of method for estimating image overall motion of the present invention.
Fig. 2 is the schematic diagram of two original images of a preferred embodiment of the present invention.
Fig. 3 is the schematic diagram of Fig. 2 embodiment projection for the first time.
Fig. 4 is the schematic diagram of Fig. 2 embodiment projection for the second time.
Fig. 5 is the schematic diagram of Fig. 2 embodiment projection for the third time.
Fig. 6 is that Fig. 2 embodiment splices the all-in-one-piece schematic diagram after overall motion estimation.
Fig. 7 is the theory diagram of image overall movement estimation apparatus of the present invention.
Embodiment
The invention will be further described below in conjunction with drawings and Examples.
Fig. 1 shows the flow process of method for estimating image overall motion of the present invention.Seeing also Fig. 1, is the detailed description to this each step of method flow below.
Step S1: with the projection on first direction of several width of cloth images, these one dimension projection vectors are mated, find optimal match point.
The first direction here can be a horizontal direction, also can be vertical direction.And if first direction is a horizontal direction, then optimal match point is the evaluation of estimating of representing the vertical direction motion vector; If first direction is a vertical direction, then optimal match point is the evaluation of estimating of representing the horizontal motion vector.
For example, the computational methods of the floor projection vector of the image that to calculate a size be W*H are with the value addition of W pixel of each row in this image, obtain this row projection value, floor projection vector that size is H of H capable projection value composition; The computational methods of the upright projection vector of the image that to calculate a size be W*H are the value additions with H pixel of each row in this image, obtain this row projection value, and W row projection value formed the upright projection vector that size is W.
The method of calculating two one dimension projection vector optimal match point positions can adopt following formula:
Wherein u and v are two one dimension projection vectors, and N is a vector length, M
iBe the matching value of ordering at i, the some position of matching value maximum is an optimal match point.
Because background image influences, the phenomenon of a plurality of optimal match points may appear, then needs all match points are all carried out following steps, find real global best matches.
Step S2: based on the optimal match point of step S1, above-mentioned these images are positioned at the parts of images at optimal match point place under shearing with first direction respectively.
The purpose of clip image is that the first direction extraneous areas has been got rid of the phenomenon of a plurality of match points to the influence of second direction projection in the rejection image, has improved two precision that the projection vector coupling is calculated.
Step S3: with shearing common region projection on second direction of these images of finishing among the step S2, these one dimension projection vectors are done matching operation, find the first best reference point, thereby obtain the motion vector on the first direction.The method of searching optimal match point among the lookup method of this first best reference point and the step S1 is similar, does not repeat them here.
If the first direction among step S1~S2 is a horizontal direction, then the second direction in this step is a vertical direction, and the first best reference point is represented the final estimated value of horizontal motion vector.Otherwise if the first direction among step S1~S2 is a vertical direction, then the second direction in this step is a horizontal direction, and the first best reference point is represented the final estimated value of vertical direction motion vector.
Step S4:: based on the first best reference point of step S3, above-mentioned these images are positioned at the parts of images at the first best reference point place under shearing with second direction respectively.The purpose of shearing is the irrelevant tortuous influence to the first direction projection of second direction in the rejection image, has further improved the computational accuracy of first direction optimal match point.
Step S5: to the common region projection on first direction again that step S4 shears these images of finishing, these one dimension projection vectors are done matching operation, find the second best reference point, thereby obtain the motion vector on the second direction.The method of searching optimal match point among the lookup method of this second best reference point and the step S1 is similar, does not repeat them here.
If first direction is a horizontal direction, then the second best reference point in this step is represented the final estimated value of vertical direction motion vector.If first direction is a vertical direction, then the second best reference point in this step is represented the final estimated value of horizontal motion vector.
Fig. 2~Fig. 6 shows an example of said method.Example is an example with two images, with floor projection, vertical projection, the computation sequence of floor projection shows the process of global motion estimating method once more.See also Fig. 3, this example is to two images shown in Figure 2, and the method that adopts step S1~S2 to describe is done the projection coupling to horizontal direction earlier, shears the common region of two width of cloth images at the match point place.Referring to Fig. 4, clip image is done vertical direction projection coupling again, obtain the motion vector of horizontal direction.Referring to Fig. 5, again clip image is done horizontal direction projection coupling more then, obtain the motion vector of vertical direction.Fig. 6 is based on the schematic diagram of the final image that horizontal motion vector and vertical direction motion vector be stitched together two width of cloth images.
Based on above-mentioned method principle, the present invention also provides a kind of image overall movement estimation apparatus.See also Fig. 7, this device comprises the first projection matching module 10, first shear module 11, the second projection matching module 12, second shear module 13, the 3rd projection matching module 14.Wherein the first projection matching module 10 is done matching operation with the projection on first direction of several width of cloth images to these one dimension projection vectors, finds optimal match point.First shear module 11 is sheared the common region at the optimal match point place of these images respectively based on the optimal match point that the first projection matching module 10 obtains.The common region that the second projection matching module 13 is sheared these images of finishing with first shear module 11 is made projection process on second direction, these one dimension projection vectors are done matching operation, finds the first best reference point, obtains the motion vector on the first direction.The first best reference point that second shear module 13 obtains based on the second projection matching module 13 is with second direction common region under the first best reference point place of these images shears.The 3rd projection matching module 14 is done matching operation with the common region projection on first direction again of second shear module 13 these images finished of shearing to these one dimension projection vectors, finds the second best reference point, obtains the motion vector on the second direction.
First direction in the above-mentioned module and second direction can be: first direction is a horizontal direction, second direction is a vertical direction, optimal match point is represented the evaluation of estimating of vertical direction motion vector, the first best reference point is represented the final estimated value of horizontal motion vector, and the second best reference point is represented the final estimated value of vertical direction motion vector.Perhaps first direction is a vertical direction, second direction is a horizontal direction, optimal match point is represented the evaluation of estimating of horizontal motion vector, and the first best reference point is represented the final estimated value of vertical direction motion vector, and the second best reference point is represented the final estimated value of horizontal motion vector.
The foregoing description provides to those of ordinary skills and realizes or use of the present invention; those of ordinary skills can be under the situation that does not break away from invention thought of the present invention; the foregoing description is made various modifications or variation; thereby protection scope of the present invention do not limit by the foregoing description, and should be the maximum magnitude that meets the inventive features that claims mention.