Summary of the invention
The object of the present invention is to provide a kind of Zoom method of multimedia video image, its high-quality of realizing digital video image amplifies.
For realizing the Zoom method of a kind of multimedia video image that purpose of the present invention provides, comprise the following steps:
A kind of Zoom method of multimedia video image is characterized in that, comprises the following steps:
Steps A, multimedia video image is carried out the colour space transformation operation, make multimedia video image satisfy in the color space after conversion, the amount of information of the multimedia video image that three color components comprise is inequality, the information of multimedia video image concentrates on one of them color component, color component to maximum image information of comprising multimedia video image, adopting when amplifying makes color component obtain the complicated interpolation method of better effect, to other color component, adopt simple relatively interpolation method, carry out the convergent-divergent of multimedia video image and handle.
Also comprise the following steps:
Step B after a plurality of color components of color space for the treatment of the multimedia video image of convergent-divergent dispose respectively, carries out colour space transformation to multimedia video image, and it is transformed to rgb color space, finishes the convergent-divergent of multimedia video image.
In the described steps A, described complicated interpolation method is Spline Interpolation Method or cube convolution method.
It is characterized in that in the described steps A, described simple relatively interpolation method is bilinear interpolation method or neighbor interpolation method.
Described Spline Interpolation Method is the bicubic spline interpolation method after bicubic spline interpolation method or the improvement.
Described color space or be the YUV color space perhaps is the YCrCb color space, perhaps is the HSI color space.
Described steps A also comprises the following steps:
Steps A 1, treat the multimedia video image of convergent-divergent, in the YUV color space, adopt bilinear interpolation method that U, V component are carried out processing and amplifying, adopt Spline Interpolation Method the Y component to be handled the multimedia video image that obtains amplifying multimedia video image.
Described steps A 1 comprises the following steps:
Steps A 11 to multimedia video image, adopts bilinear interpolation method or neighbor interpolation method to carry out processing and amplifying at the YUV color space to the U of multimedia video image, V component;
Steps A 12 to multimedia video image, adopts Spline Interpolation Method or cube convolution interpolation method to carry out processing and amplifying at the YUV color space to the Y component of multimedia video image.
In the described steps A 12, described Spline Interpolation Method is the bicubic spline interpolation method, comprises the following steps:
Steps A 121 is for the pixel (x in the target multimedia video image
1, y
1), by contrary geometric transformation:
Obtain the position coordinates of pixel mapping in the former multimedia video image in the target multimedia video image
Wherein, M when carrying out processing and amplifying, amplification multiple,
Through rounding the coordinate (x after obtaining rounding downwards
0, y
0), that is:
Steps A 122 is calculated the position coordinates of pixel mapping in the former multimedia video image in the target multimedia video image
With round after coordinate (x
0, y
0) between difference be:
Steps A 123, with u, the value substitution interpolation kernel function S (x) of v draws:
Steps A 124 reads the pixel (x of former multimedia video image
0, y
0) all around 4 * 4 pixel, constitute matrix:
Steps A 125, according to interpolation formula:
Calculate the pixel value of target multimedia video image;
Steps A 126, all pixels in the whole target multimedia video image are scanned in repeating step A121~125, finish the bicubic spline interpolation of whole multimedia video image, the multimedia video image that obtains amplifying.
In the described steps A 12, described Spline Interpolation Method is improved bicubic spline interpolation method, comprises the following steps:
Steps A 121 ', according to multiplication factor, the interpolation kernel functional value that calculating may be used;
Steps A 122 ' with the value integer of interpolation kernel function, and becomes 2 power, saves as S_int
2(x) value;
Steps A 123 ' is got a subimage block that is of a size of M*M of target multimedia video image;
Steps A 124 ', calculate each pixel correspondence in the subimage block difference (u, v) and S_int
2(x) value;
Steps A 125 ' confirms whether subimage block is arranged in target multimedia video image Far Left, if, then read pixel in the pairing multimedia video image of subimage block (k, l) 4 * 4 the matrix that pixel constituted all around,
Steps A 126 ' is taken out a pixel in the target multimedia video image subimage block, obtains corresponding S_int
2(x) value;
Steps A 127 ', for the subimage block correspondence
And difference (u, v) substitution bicubic spline interpolating matrix formula calculates, and moves to right 20 with calculating the result who obtains, and obtains target multimedia video image pixel value;
Steps A 128 ' confirms whether handle all pixels in the current subimage block;
Steps A 129 ' confirms whether to handle all subimage blocks in the target multimedia video image.
Described steps A 125 ' comprises the following steps:
Steps A 1251 ' if subimage block is to be arranged in target multimedia video image Far Left, then reads the subimage block B of M*M from former multimedia video image;
Steps A 1252 ', if subimage block is not to be arranged in target multimedia video image Far Left, then reading M pixel of row and last the right three of calculating the subimage block B ' of the M*M that uses from former multimedia video image is listed as and constitutes new subimage block B together.
Described steps A 128 ' also further comprises the following steps:
Steps A 1281 ' if handled all pixels in the current subimage block, then continues steps A 129 ';
Steps A 1282 ' if do not handle all pixels in the current subimage block, is then returned steps A 126 '.
Described steps A 129 ' also further comprises the following steps:
Steps A 1291 ' if handled all pixels in the current subimage block, then finishes amplifieroperation;
Steps A 1292 ' if do not handle all pixels in the current subimage block, is then returned steps A 123 '.
Described steps A also comprises the following steps:
Steps A 2 is treated the multimedia video image of convergent-divergent, at three color components of YUV color space to video data, adopts bilinear interpolation method or neighbor interpolation method to dwindle processing respectively.
When described bilinear interpolation method is handled, comprise the following steps:
Steps A 21, for the pixel in the target multimedia video image, obtain the position coordinates of pixel mapping in the former multimedia video image in the target multimedia video image by contrary geometric transformation, position coordinates is through rounding the coordinate that obtains after the round numbers downwards;
Steps A 22, calculate pixel mapping in the target multimedia video image in the former multimedia video image position coordinates and round after coordinate between difference;
Steps A 23 is utilized bilinear interpolation method, calculates the pixel value of target multimedia video image;
Steps A 24 judges whether to finish the scanning of the pixel of whole multimedia video image, if do not finish, then gets back to steps A 21, begins to handle next pixel; If finish, then the interpolation of whole multimedia video image finishes, and finishes computing.
The invention has the beneficial effects as follows: the Zoom method of multimedia video image of the present invention, it can keep the video image details well, has extraordinary zooming effect; Realize simply not only can realizing, also can realize with hardware easily with software; For the common video image, can obtain good effect.Especially during the relatively poor video of the picture quality under being used for low code check, network environment situation mal-condition, can obtain the video scaling effect outstanding than additive method.
Embodiment
In order to make purpose of the present invention, technical scheme and advantage clearer,, the Zoom method of a kind of multimedia video image of the present invention is further elaborated below in conjunction with drawings and Examples.Should be appreciated that specific embodiment described herein only in order to explanation the present invention, and be not used in qualification the present invention.
The method that the purpose of this invention is to provide a kind of multimedia video image convergent-divergent, the high-quality convergent-divergent of the video image under the especially low code check condition of realization digital video.
In order to achieve the above object, the technical scheme that the present invention takes is: to having a plurality of color components, color component includes the color space of the video image of the different information of image, (wherein the Y component is a luminance signal as the YUV color space, U component and V component are represented two color difference signals respectively, image information mainly concentrates on the Y component), YCrCb color space (image information mainly concentrates on the Y component), HSI color space (image information mainly concentrates on the I component), a plurality of color components of video image are handled respectively.Wherein, color component to the more image information that comprises video image, adopting when amplifying makes color component obtain the complicated interpolation method (algorithm) of better effect, as Spline Interpolation Method (algorithm), cube convolution interpolation method (algorithm) to other color component, adopts simple relatively interpolation method (algorithm), as bilinear interpolation method (algorithm) or neighbor interpolation method (algorithm), the video image that obtains amplifying.Wherein, for dwindling of video image, adopt bilinear interpolation method (algorithm) or neighbor interpolation method (algorithm) to handle video image.Different color components is adopted different interpolation algorithms, realize the high-quality and high-efficiency convergent-divergent of video image.
YUV color space with the video image that comprises the YUV color component is an example below, describe multimedia video image Zoom method of the present invention in detail, but, should be noted that, the Zoom method to multimedia video image of the embodiment of the invention, be equally applicable to comprise YCrCb color space, HSI color space or other has a plurality of color components, color component includes the color space of the video image of the different information of image.
Comprise a kind of Zoom method of multimedia video image of color space of the video image of YUV color component in the embodiment of the invention, comprise the following steps:
Step S100, video image is carried out the colour space transformation operation, make image satisfy in the color space after conversion, the information content of image that three color components comprise is inequality, and the information of image concentrates on one of them color component, to the color component of maximum image information of comprising video image, adopting when amplifying makes color component obtain the complicated interpolation method of better effect, to other color component, adopt simple relatively interpolation method, carry out the convergent-divergent of video image and handle.
Multimedia video image Zoom method of the present invention, at first video image is carried out the colour space transformation operation, make image satisfy in the color space after conversion, the information content of image that three color components comprise is inequality, the information of image concentrates on one of them color component, be converted to the video image of YUV color space as video image with rgb color space, inequality in the information content of image that the different color component of YUV includes; And then the video image of described color space carried out convergent-divergent.
The conversion in the different color space of video image is a kind of prior art, and it is not innovation and creation of the present invention, and those skilled in the art can realize its conversion process according to content disclosed by the invention, therefore, describes in detail no longer one by one in the present invention.
Step S110 treats the multimedia video image of convergent-divergent, at three color components of YUV color space to video data, it is the Y component of luminance signal, two color difference signal U components and V component adopt bilinear interpolation method or neighbor interpolation method to dwindle processing respectively, referring to Fig. 1.
The bilinear interpolation of image is to utilize 4 adjoint points of object pixel to make linear interpolation on both direction, with the distance as weight.Be implemented as follows:
The object pixel coordinate is (x
1, y
1), by the floating-point coordinate that obtains after the inverse transformation be
Obtain integer to (x through rounding downwards
0, y
0), establish
(x then
1, y
1) gray value located can obtain with following formula:
Calculate then
Obtain the target video image after the interpolation.
As a kind of enforceable mode, the reduction operation process of video image of the present invention comprises the steps: in detail
As former digital video image is that (x, y), carry out interpolation operation target video image afterwards is f ' (x to f
1, y
1), minification is M.
After computing began, from (0,0) some beginning of target video image, pointwise was handled.Step is as follows, and algorithm flow is seen Fig. 2:
Step S111 is for the pixel (x in the target video image
1, y
1), by contrary geometric transformation
Obtain the position coordinates of pixel mapping in the original image in the target video image
Through rounding the coordinate (x after obtaining rounding downwards
0, y
0), that is:
Step S112 calculates the position coordinates of pixel mapping in the original image in the target video image
With round after coordinate (x
0, y
0) between difference be:
Step S113 utilizes bilinear interpolation method (algorithm), calculates the pixel value of target video image:
The formula of described bilinear interpolation method is as follows:
Also promptly:
Step S114 judges whether to finish the scanning of the pixel of entire image, if do not finish, then gets back to step S111, begins to handle next pixel; If finish, then the interpolation of whole digital video image finishes, and finishes computing.
As another kind of embodiment, the YUV color space is dwindled processing to three color components of video data, adopt nearest field interpolation method, step and step S111~114 are basic identical, use neighbor interpolation method (algorithm) on just method (algorithm) is selected, wherein, neighbor interpolation method (algorithm) is a kind of prior art, those skilled in the art can utilize neighbor interpolation method (algorithm) to realize the processing of dwindling of this video image according to the description of the embodiment of the invention, thereby describe in detail no longer one by one in embodiments of the present invention.
Step S120, treat the multimedia video image of convergent-divergent, in the YUV color space, adopt bilinear interpolation method (algorithm) that U, V component are carried out processing and amplifying, adopt Spline Interpolation Method (algorithm) that the Y component is handled video image, the video image that obtains amplifying is referring to Fig. 2.
Step S121 to multimedia video image, adopts bilinear interpolation method or neighbor interpolation method to carry out processing and amplifying at the YUV color space to the U of video image, V component;
Multimedia video image is amplified, to U, V component carry out the specific implementation of processing and amplifying and video image to dwindle the method (algorithm) that is adopted identical, therefore, in embodiments of the present invention, describe in detail no longer one by one.
Step S122 to multimedia video image, adopts Spline Interpolation Method (algorithm) or cube convolution interpolation method (algorithm) to carry out processing and amplifying at the YUV color space to the Y component of video image.
For the Y component data, adopt Spline Interpolation Method (algorithm).Compare neighbor interpolation algorithm and bilinear interpolation algorithm, spline interpolation has been made best balance between accuracy and computing consume.
Described batten is piecewise function (a normally multinomial), and what each section was smooth links together.
As a kind of enforceable mode, spline interpolation of the present invention is the bicubic spline interpolation.
A) describe the process utilize the bicubic spline interpolation method to be implemented in the processing that the YUV color space amplifies the Y component of video image below in detail.
As a kind of embodiment, in the bicubic spline interpolation method, utilize the B-batten to realize in the embodiment of the invention.
The B-batten is one of the most frequently used spline function, can obtain from convolution from a basic function.
The basic function form is as follows:
Interpolating function can be by β
Basis(x) function obtains from convolution:
β
1(x)=β
Basis(x)*β
Basis(x)
N rank B-spline function can be obtained by N-1 basic function convolution:
When N=4, can obtain a cube B-spline interpolation kernel function:
With the bicubic spline interpolation application in video image is handled the time, the bicubic spline interpolation considers that the pixel mapping of the target image that generates returns the floating-point coordinate of original image
16 adjoint points on every side can be used matrix
Expression.If the pixel coordinate of target video image is (x
1, y
1), by the floating-point coordinate of the correspondence that obtains after how much inverse transformations be
Obtain integer to (x through rounding downwards
0, y
0).
If
And establish:
Target pixel value then
Can obtain by following interpolation formula:
Therefore, the Y component bicubic spline interpolation of the embodiment of the invention is carried out processing and amplifying and is comprised the following steps:
Former digital video image is that (x, y), carry out interpolation operation target video image afterwards is f ' (x to f
1, y
1), suppose that multiplication factor is M.
After computing began, from (0,0) some beginning of target video image, pointwise was handled, and algorithm flow is seen Fig. 3.Detailed process is as follows:
Step S1221 is for the pixel (x in the target video image
1, y
1), by contrary geometric transformation:
Obtain the position coordinates of pixel mapping in the original image in the target video image
Through rounding the coordinate (x after obtaining rounding downwards
0, y
0), that is:
Step S1222 calculates the position coordinates of pixel mapping in the original image in the target video image
With round after coordinate (x
0, y
0) between difference be:
Step S1223, with u, the value substitution interpolation kernel function S (x) of v draws:
Step S1224 reads the pixel (x of original video image
0, y
0) near 4 * 4 pixel, constitute matrix:
Step S1225, according to interpolation formula:
Calculate the pixel value of target video image.
Step S1226, all pixels in the whole target video image are scanned in repeating step S1221~1225, finish the bicubic spline interpolation of whole digital video image, the video image that obtains amplifying.
The process of the processing that the bicubic spline interpolation fast algorithm implementation after describe in detail to utilize improving B) is amplified the Y component of video image at the YUV color space.
Former digital video image be f (x, y), former digital video image is wide to be width_original, high be height_original, the target video image that carries out after the interpolation operation is f ' (x
1, y
1), the wide of the target video image after the difference is width_interpol, the high height_interpol of being, supposes that multiplication factor is M, so:
For amplifying M situation doubly, can be being divided into some M * M rank matrix in the target video image:
(wherein, k, l ∈ Z, and satisfy
)
Each M * M rank matrix
The subimage block that can regard a target video image as, matrix
In all pixel mapping return original image, the same pixel in all corresponding original image (k, l).4 * 4 pixels that are used for the bicubic spline interpolation that this point closes on constitute matrix
That is to say that for each M * M subimage block, the interpolation result of all pixels of this subimage block inside all is to use identical
Value calculate.Therefore, can disposablely read out
(kM, the lM) M * M in pixel can reduce the memory access number of times to the subimage F of disposable then processing target image so in a large number, improves the degree of parallelism of computing.
Therefore, in target video image, be image division some subimage blocks that are of a size of M * M size, block-by-block is handled.
In addition, in processing procedure, use difference two tuples (u, v), it is defined as follows:
For the pixel (x in the target video image
1, y
1), by contrary geometric transformation:
Obtain the position coordinates of pixel mapping in the original image in the target video image
Obtain integer to (x through rounding downwards
0, y
0),
That is:
Calculate the position coordinates of pixel mapping in the original image in the target video image
With round after coordinate (x
0, y
0) between difference be:
Be called difference two tuples (u, v).
Bicubic spline interpolation fast algorithm after detailed description Y component employing of the present invention improves below carries out the implementation process of processing and amplifying, and algorithm flow is seen Fig. 4, and concrete steps are as follows:
Step S1221 ' carries out initialization to the function of bicubic interpolation and obtains kernel function;
In the initialization procedure after interpolation process starts, at first calculate several interpolation kernel functions that in calculating process, may occur.
For the multiplication factor M that determines, need the result of calculation of the interpolation kernel function used to determine in the calculating process.If with x represent difference two tuples (u, v) the u in or v value are under the situation of M in multiplication factor, parameter x have M kind value (
), so need M kind interpolation kernel function S (x
i) (i=0 wherein, 1 ..., M-1).
The kernel function integer that calculates is also approximate.The interpolation kernel functional value that calculates is a floating number, moves to left 10 for each interpolation kernel functional value, amplifies 1000 times and rounds then, can obtain integer interpolation kernel functional value, is designated as S_int (x).Then, the value of interpolation kernel function is replaced with the most contiguous 2 power.Obtain one group of new value, be designated as S_int
2(x), it is inferior with respect to 2 power that it has write down each interpolation kernel function.
So far, initialization is finished.
Step S1222 ', determine current pending subimage block F (kM, lM), calculate matrix F (kM, lM) in corresponding difference two tuples of each pixel (u, value v), and be saved as matrix
Uv in the formula (k, l)=(u (k, l), v (k, l))
Step S1223 ', (kM lM) is leftmost image block, then reads 4 * 4 pixels in the pairing original image of current pending image block as if current pending image block F
Be put in the internal memory.
(kM, lM) each pixel in is all corresponding identical owing to F
So only need read once
Get final product.
If (kM lM) is not leftmost image block, then reads last round of processing current pending image block F
The right a row pixel value (4 pixels of row), then and
The right three columns new according to constituting together
Matrix, a columns that newly reads is according to being placed on
The right three columns according to the right, be used for current F (kM, the calculating of pixel value lM).
Step S1224 ', image block F (kM, lM) each pixel in are handled in pointwise;
Concrete operations are as follows:
For F (kM, the capable j row of i pixel f lM) (kM+i, lM+j),
According to formula
Can obtain:
Matrix operation is launched and can obtain:
Use prior good as calculated and S_int integer (x) value replacement S (x) function, further use then to be rewritten into 2 the inferior S_int of power
2(x) and shift operation replace S_int (x) value:
f(kM+i,lM+j)
=[f(k,l)□S_int(u+1)+f(k+1,l)□S_int(u)+f(k+2,l)□S_int(u-1)+f(k+3,l)□S_int(u-2)]□S_int(v+1)
+[f(k,l+1)□S_int(u+1)+f(k+1,l+1)□S_int(u)+f(k+2,l+1)□S_int(u-1)+f(k+3,l+1)□S_int(u-2)]□S_int(v)
+[f(k,l+2)□S_int(u+1)+f(k+1,l+2)□S_int(u)+f(k+2,l+2)□S_int(u-1)+f(k+3,l+2)□S_int(u-2)]□S_int(v-1)
+[f(k,l+3)□S_int(u+1)+f(k+1,l+3)□S_int(u)+f(k+2,l+3)□S_int(u-1)+f(k+3,l+3)□S_int(u-2)]□S_int(v-2)
=[f(k,l)□S_int
2(u+1)+f(k+1,l)□S_int
2(u)+f(k+2,l)□S_int
2(u-1)+f(k+3,l)□S_int
2(u-2)]□S_int
2(v+1)
+[f(k,l+1)□S_int
2(u+1)+f(k+1,l+1)□S_int
2(u)+f(k+2,l+1)□S_int
2(u-1)+f(k+3,l+1)□S_int
2(u-2)]□S_int
2(v)
+[f(k,l+2)□S_int
2(u+1)+f(k+1,l+2)□S_int
2(u)+f(k+2,l+2)□S_int
2(u-1)+f(k+3,l+2)□S_int
2(u-2)]□S_int
2(v-1)
+[f(k,l+3)□S_int
2(u+1)+f(k+1,l+3)□S_int
2(u)+f(k+2,l+3)□S_int
2(u-1)+f(k+3,l+3)□S_int
2(u-2)]□S_int
2(v-2)
Wherein, the in the formula represents left shift operation, for for simplicity, uses u in formula, v represent u (i, j), v (i, j).
Next, step S1223 ' is obtained and f (kM+i, lM+j) corresponding
The uv that calculates with step S1222 ' (kM+i lM+j) brings top formula into, calculate f (kM+i, lM+j).
At last, with f (kM+i lM+j) moves to right 20, obtain f (kM+i, lM+j) the final pixel value result of pixel:
f
final(kM+i,lM+j)=f(kM+i,lM+j)□?20。
Execution in step S1224 ' repeatedly is up to image block
Interior all M * M pixel all disposes.
Step S1225 ' judges whether to handle all images piece in the target video image, if do not handle, then gets back to step S1223 '; If handled all images piece in the target video image, then target video image Y component interpolation finishes.
As another kind of embodiment, the YUV color space is carried out processing and amplifying to three color components of video data, adopt the cube convolution interpolation method, bicubic spline interpolation method (algorithm) or step S1221 '~1225 ' in step and step S1221~1226 are basic identical, just use cube convolution interpolation method (algorithm) in method (algorithm) selection, wherein, the cube convolution interpolation method is a kind of prior art, those skilled in the art can utilize cube convolution interpolation method (algorithm) to realize the processing of dwindling of this video image according to the description of the embodiment of the invention, thereby describe in detail no longer one by one in embodiments of the present invention.
As another kind of embodiment, to comprising YCrCb color space with the video image that comprises the YCrCb color component, processing to the Y component is identical with the Y component processing of the YUV color space of the embodiment of the invention, handles identical to the processing of Cb and Cr color component and the U of YUV with the V component.Therefore, describe in detail no longer one by one in embodiments of the present invention.
As another kind of embodiment, to comprising HSI color space with the video image that comprises the HSI color component, processing to I component is identical with the Y component processing of the YUV color space of the embodiment of the invention, handles identical to the processing of H and S color component and the U of YUV with the V component.Therefore, describe in detail no longer one by one in embodiments of the present invention.
Step S200 after a plurality of components of color space for the treatment of the multimedia video image of convergent-divergent dispose respectively, carries out colour space transformation to image, and it is transformed to rgb color space, finishes the convergent-divergent of multimedia video image.
No matter be reduction operation or amplifieroperation, after treating that three color component data dispose respectively, if need not carry out other operation bidirectional at the YUV color space, just can carry out colour space transformation to image, it is transformed to rgb color space, comes display image by display routine then or carry out further other processing.
Conversion from the YUV color space to rgb color space is a kind of prior art, and it is not innovation and creation of the present invention, those skilled in the art are according to content disclosed by the invention, can realize its conversion process, therefore, describe in detail no longer one by one in the present invention.
The Zoom method of a kind of multimedia video image of the present invention has proposed a kind of fast algorithm of bicubic spline interpolation, and quick bicubic spline interpolation algorithm is applied in the video image zooming.The embodiment of the invention has following beneficial effect: (1) has significantly reduced the computation complexity of bicubic spline interpolation, can realize the real-time convergent-divergent of video with the personal computer (PC) of common configuration; (2) can be good at keeping the video image details, have extraordinary zooming effect; (3) algorithm is realized simply not only can realizing with software, also can realize with hardware easily; (4), can obtain good effect for the common video image; During in particular for the relatively poor video of the picture quality under low code check, the network environment situation mal-condition, can obtain the video amplification effect outstanding than additive method.
In conjunction with the drawings to the description of the specific embodiment of the invention, others of the present invention and feature are conspicuous to those skilled in the art.
More than specific embodiments of the invention are described and illustrate it is exemplary that these embodiment should be considered to it, and be not used in and limit the invention, the present invention should make an explanation according to appended claim.