A kind of new method of area image interpolation
Technical field
Patent of the present invention belongs to technical field of image processing, is specifically related to a kind of new method of area image interpolation.
Background technology
Image, in acquisition process, has the impact of the factors such as non-linear, shooting angle due to imaging system itself, the image of acquisition can be made to produce out of proportion, even distortion, this kind of image degradation phenomenon is referred to as geometric distortion (distortion).When doing quantitative test to image, first will carry out accurate geometry correction to the image of distortion, in order to avoid affect the precision of quantitative test.Geometric distortion correction is divided into two steps: the first step carries out geometric transformation to original image coordinate space, drops on correct position to make pixel; Second step is the gray-scale value redefining new pixel, this is because after coordinate transform above, some pixel is pressed together sometimes, is sometimes scatter again, make the pixel after correction not drop in discrete coordinate points, therefore need the gray-scale value redefining these pixels.Conventional gray reconstruction interpolation algorithm has most nearest neighbour interpolation method, bilinear interpolation and bicubic interpolation method three kinds, but these three kinds of algorithms exist the problems such as gray scale is discontinuous, soft edge, calculated amount are large respectively.
Traditional interpolation algorithm all carries out same interpolation calculation to the pixel of entire image, do not consider the local characteristics of image, and the region that image generally has relatively flat region and grain details to enrich.Very little in the change of flat site image intensity value, at this moment adopt complicated interpolation algorithm compared with simple interpolation algorithm, interpolation is suitable, but operand increase is very large; Adopt complicated interpolation algorithm in the region that grain details is enriched, then can obtain higher-quality interpolation.Thus, adopt at the flat site of image the interpolation algorithm that operand is little, adopt bicubic interpolation in the region of grain details complexity, just can, after maintenance interpolation while picture quality, reduce calculated amount, reduce operation time.
Summary of the invention
For the theory of REGION INTERPOLATION algorithm, the present invention proposes a kind of new method gray level image to the area image interpolation of general applicability.The present invention effectively reduces operation time under being intended to substantially not change the prerequisite of interpolation precision, improves the operational efficiency of interpolation algorithm.
The technical matters that patent of the present invention solves can adopt following technical solution to realize:
A new method for area image interpolation, comprises the following steps:
1) using one of them end points in interpolation image four end points as the initial point of X-Y coordinate system, then in x and y direction image is carried out M and N decile respectively, so just obtain M × N number of grid.The choosing method of M, N value is: set a grid horizontal and vertical direction respectively containing 10 pixels, so can obtain following formula:
Wherein, L
f, D
frepresent horizontal pixel and the vertical pixel of image resolution ratio respectively;
2) the gray-scale value f that each grid four extreme coordinates places are corresponding is obtained
11, f
12, f
21, f
22and average E, calculate the meansquaredeviationσ of these four gray-scale values, formula is:
Meansquaredeviationσ reflects the dispersion degree of its four end points gray-scale values of grid, and clearly, σ numerical value is less, and the gray-scale value saltus step between four end points is less, also just shows that its gray scale texture is relatively more smooth;
3) the threshold value T of σ and setting is made quantitative comparison, if σ is less than T, then whole grid is classified as texture flat site (hereafter all representing with A), otherwise is classified as texture complex region (hereafter all representing with B).Threshold value T to ask for process as follows: set about from formula (2), order
t=(f
11-E)
2+(f
12-E)
2+(f
21-E)
2+(f
22-E)
2(3)
Definition grid four end points gray scale difference is between any two Δ f, so can obtain following relational expression:
In addition,
By formula (3), (4), (5), have:
If a region texture relatively flat, so its four end points gray scale difference Δ f between any two should meet following relational expression:
-p≤Δf
i≤p,i∈[1,2,…,6](7)
Wherein, p is the critical value of acceptable gray scale difference value.Due to different gray level images, the critical value of its acceptable gray scale difference value is different, in order to make the selected of p value have general applicability to gray level image, by the average gray value of itself and target image
(
the image processing software that value is general all can directly be obtained, as obtained by mean function in Matlab) connect, for it makes following simple quantitative relationship:
According to formula (7), convolution (8), so can be derived by formula (6) and obtain the following relational expression of t:
Convolution (2), thus obtain the quantitative equation of T:
4) image after step (3) divides, if it is adjacent to there is AA (or BB), then by this region merging technique;
5), after completing Region dividing, the gray scale difference value stage is just entered.If the point of interpolation belongs to region A, select the bilinear interpolation algorithm that precision is higher and calculated amount is less; If the point of interpolation belongs to region B or on the boundary line in AB region, in order to ensure that image has enough interpolation precisions, select the bicubic interpolation algorithm of full accuracy.
Accompanying drawing explanation
Accompanying drawing 1 is the algorithm simple process figure that the present invention is complete.
Accompanying drawing 2 is decile schematic diagram of interpolation image.
Accompanying drawing 3 is preliminary Region dividing schematic diagram of interpolation image.
Accompanying drawing 4 is that the final area after interpolation image adjacent area merges divides schematic diagram.
Embodiment
Below in conjunction with accompanying drawing, the specific embodiment of the present invention is described further.
1) input the low resolution image of interpolation, obtain the average gray value of image
horizontal pixel L
fwith vertical pixel D
f, the size of M, N and threshold value T is calculated respectively with formula (1) and (10);
2) with one of them end points of interpolation image for true origin, image is made M, N equal portions in x and y direction respectively, as shown in Figure 2;
3) the gray-scale value f at each grid extreme coordinates place is obtained
11, f
12, f
21, f
22, computation of mean values E, calculates respective meansquaredeviationσ with formula (1);
4) σ and threshold value T are carried out size to compare, if be less than T, then this grid is belonged to region A, otherwise, belong to region B, as shown in Figure 3;
5) if there is the adjacent grid of AA (or BB is adjacent), then merged and be fused to new region A (or region B), thus complete the division completely in region, its final effect (contrasts obviously for making design sketch as shown in Figure 3, a-quadrant white filled, B then uses filled black in region);
6) judge the region belonging to current interpolation point is in source images, if belong to region A, then use bilinear interpolation algorithm to carry out interpolation; If in the B of region or be positioned on the boundary line of AB, then bicubic interpolation algorithm is used to carry out interpolation;
7) interpolation of all pixels point has been judged whether, if complete, final image after output interpolation; The interpolation that previous step proceeds to remain pixel point if no, be then back to.
It is more than preferred embodiment of the present invention, description in instructions also just illustrates principle of the present invention, not any pro forma restriction is done to the present invention, every according to technical spirit of the present invention to any simple modification made for any of the above embodiments, equivalent variations and modification, all belong in the scope of invention technical scheme.