CN111476718B - Image amplification method and device, storage medium and terminal equipment - Google Patents
Image amplification method and device, storage medium and terminal equipment Download PDFInfo
- Publication number
- CN111476718B CN111476718B CN202010295751.6A CN202010295751A CN111476718B CN 111476718 B CN111476718 B CN 111476718B CN 202010295751 A CN202010295751 A CN 202010295751A CN 111476718 B CN111476718 B CN 111476718B
- Authority
- CN
- China
- Prior art keywords
- image
- mapping
- row
- expansion
- obtaining
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 69
- 230000003321 amplification Effects 0.000 title claims description 9
- 238000003199 nucleic acid amplification method Methods 0.000 title claims description 9
- 238000013507 mapping Methods 0.000 claims abstract description 130
- 238000004364 calculation method Methods 0.000 claims abstract description 37
- 239000011159 matrix material Substances 0.000 claims description 47
- 238000004590 computer program Methods 0.000 claims description 4
- 238000012545 processing Methods 0.000 abstract description 6
- 238000007792 addition Methods 0.000 description 16
- 230000000694 effects Effects 0.000 description 8
- 238000010586 diagram Methods 0.000 description 5
- 230000006870 function Effects 0.000 description 3
- 230000009286 beneficial effect Effects 0.000 description 2
- 238000004422 calculation algorithm Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T3/00—Geometric image transformations in the plane of the image
- G06T3/40—Scaling of whole images or parts thereof, e.g. expanding or contracting
- G06T3/4007—Scaling of whole images or parts thereof, e.g. expanding or contracting based on interpolation, e.g. bilinear interpolation
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Image Processing (AREA)
Abstract
The embodiment of the invention relates to the technical field of image processing and discloses an image amplifying method, which comprises the following steps: expanding the original image to obtain an expanded image; obtaining the magnification of the first direction and the magnification of the second direction; obtaining and storing a mapping coefficient of a first direction; interpolation in a first direction is carried out on the expansion image, and a first output image is obtained; obtaining and storing a mapping coefficient of the second direction according to the magnification of the second direction; and carrying out interpolation in a second direction on the first output image to obtain a target image. According to the invention, by expanding the image and improving the mapping, a unified calculation method can be adopted for acquiring all pixel values in the target image, only one corresponding module is required to be designed in the hardware implementation process, so that the use of logic resources is reduced, and the calculation redundancy of the two-dimensional interpolation is reduced by splitting the two-dimensional interpolation of bilinear interpolation into two one-dimensional interpolation.
Description
Technical Field
The present invention relates to the field of image processing technologies, and in particular, to an image amplifying method, an image amplifying device, a storage medium, and a terminal device.
Background
The image magnification is realized by a plurality of methods, and most of the methods are realized by interpolation operation, and a nearest neighbor interpolation method, a bilinear interpolation method, a bicubic interpolation method and the like are commonly used. The nearest neighbor interpolation method is the simplest, but the amplified image can generate obvious sawtooth effect, and the amplifying effect is poor; the bicubic interpolation effect is excellent, but the operation complexity is too high, and the hardware implementation is difficult; the bilinear interpolation can eliminate the sawtooth effect to a great extent, has a good amplification effect and low operation complexity, can meet most application requirements, and is the most widely applied.
Existing bilinear interpolation is to perform linear interpolation in two different directions respectively. The principle is as follows: mapping the coordinates of the pixel points to be inserted of the target image to the original image, finding 4 adjacent pixel points in the original image, performing interpolation twice in the row direction and performing interpolation once in the column direction by utilizing the pixel values of the 4 pixel points, and obtaining an output value, wherein the output value is the pixel value of the pixel points to be inserted in the target image. As shown in fig. 1, p is a position corresponding to one pixel point of the target image in the original image after mapping, p1, p2, p3 and p4 are 4 pixel points adjacent to p in the original image, and assuming that the coordinates of p1 are (i, j), the coordinates of p2, p3 and p4 are (i, j+1), (i+1, j), (i+1, j+1), respectively. By using the 4 pixel values of p1, p2, p3 and p4, the pixel value of p can be obtained through corresponding operation, and then the pixel value of the corresponding position of the target image can be obtained. The specific operation process is as follows: let the pixel value of each pixel in the original image be f (x), x is the pixel coordinate, then:
f(p12)=f(p1)+m*(f(p2)–f(p1)) (1)
f(p34)=f(p3)+m*(f(p4)–f(p3)) (2)
f(p)=f(p12)+n*(f(p34)–f(p12)) (3)
wherein m is the fractional part corresponding to the column coordinate of p, as shown in fig. 1, the distances between p1 and p12, and the distances between p3 and p34 are all m; n is the fractional part corresponding to the row coordinate of p, and the distance between p12 and p is n. Equations (1), (2), and (3) each correspond to one interpolation, which requires 1 multiplication and 2 additions, and therefore one bilinear interpolation requires 3 multiplications and 6 additions.
In addition, in the existing method, in the early stage of the interpolation process, first, the coordinates of the pixels to be inserted in the target image need to be mapped to the original image. Assuming that the original image is a×b, the target image is m×n (M > a, N > b), the coordinates of the pixel to be inserted in the target image are (y 1, x 1), and the coordinates of the pixel mapped to the original image are (y, x), then:
x=x1*b/N (4)
y=y1*a/M (5)
each pixel to be inserted needs to undergo the mapping process described above, where b/N and a/M are constants, and only one calculation is needed, and then the value is saved, so that the mapping process of each pixel to be inserted needs 2 multiplications, and the edge pixels need special processing.
In summary, the target image with the size of m×n is calculated by bilinear interpolation, which requires m×n×6 additions, m×n×5 multiplications, and in the hardware implementation process, too many multipliers are needed, which occupies more logic resources, and an image amplifying method with smaller computation is needed.
Disclosure of Invention
The embodiment of the invention aims to provide an image amplifying method, an image amplifying device, a storage medium and terminal equipment, which solve the technical problems that the existing image amplifying method needs to use too many multipliers in the hardware implementation process, occupies more logic resources and has large operation amount.
In order to solve the technical problems, the embodiment of the invention provides the following technical scheme:
in a first aspect, an embodiment of the present invention provides an image magnification method, including:
expanding the original image to obtain an expanded image;
according to the target image and the original image, obtaining the magnification of the first direction and the magnification of the second direction;
obtaining and storing a mapping coefficient of the first direction according to the amplification factor of the first direction;
according to the mapping coefficients of the target image and the first direction, interpolation of the first direction is carried out on the expansion image, and a first output image is obtained;
obtaining and storing a mapping coefficient of the second direction according to the magnification of the second direction;
and carrying out interpolation in the second direction on the first output image according to the mapping coefficient in the second direction to obtain a target image.
In a second aspect, an embodiment of the present invention provides an image amplifying apparatus applied to a processor, the apparatus including:
the image expansion unit is used for expanding the original image to obtain an expanded image;
the amplifying and calculating unit is used for obtaining the amplifying power in the first direction and the amplifying power in the second direction according to the target image and the original image;
the first mapping unit is used for obtaining and storing a mapping coefficient of the first direction according to the magnification of the first direction;
the first interpolation unit is used for carrying out interpolation in the first direction on the expansion image according to the mapping coefficients of the target image and the first direction to obtain a first output image;
the second mapping unit is used for acquiring and storing the mapping coefficient of the second direction according to the magnification of the second direction;
and the second interpolation unit is used for interpolating the first output image in the second direction according to the mapping coefficient in the second direction to obtain a target image.
In some embodiments, the image expansion unit is specifically configured to:
constructing an expansion matrix; copying the pixel values of the first row of the original image to the middle position of the first row of the expansion matrix; copying pixel values of a first row and a first column of an original image to positions of the first row and the first column of the expansion matrix; copying the pixel value of the last column of the first row of the original image to the position of the last column of the first row of the expansion matrix to form the pixel value of the first row of the expansion matrix; obtaining pixel values of the last row, the first column and the last column of the expansion matrix according to the obtaining mode of the pixel values of the first row of the expansion matrix; and copying the original image pixel value to the middle position of the expansion matrix to obtain an expansion image.
In some embodiments, the first interpolation unit is specifically configured to:
acquiring a first coordinate mapping value of a first direction according to the mapping coefficient of the first direction; according to the first coordinate mapping value of the first direction, obtaining a second coordinate mapping value of the first direction through one-time addition calculation, and sequentially iterating until all the coordinate mapping values of the first direction are obtained; and carrying out interpolation in the first direction on the expansion image according to the coordinate mapping values in the first direction to obtain a first output image.
In some embodiments, the second interpolation unit is specifically configured to:
acquiring a first coordinate mapping value of the second direction according to the mapping coefficient of the second direction; according to the first coordinate mapping value of the second direction, obtaining a second coordinate mapping value of the second direction through one-time addition calculation, and sequentially iterating until all the coordinate mapping values of the second direction are obtained; and carrying out interpolation in the second direction on the expansion image according to the mapping values of the coordinates in the second direction to obtain a target image.
In a third aspect, an embodiment of the present invention provides a computer-readable storage medium, where the computer-readable storage medium includes a stored program, where the program executes the image magnification method described above.
In a fourth aspect, an embodiment of the present invention further provides a terminal device, including a memory, and a processor, where the memory stores a computer program, and the processor is configured to execute the image enlarging method by using the computer program.
The embodiment of the invention has the beneficial effects that: different from the prior art, the image amplifying method provided by the embodiment of the invention comprises the steps of expanding an original image to obtain an expanded image; according to the target image and the original image, obtaining the magnification of the first direction and the magnification of the second direction; obtaining and storing a mapping coefficient of the first direction according to the amplification factor of the first direction; according to the mapping coefficients of the target image and the first direction, interpolation of the first direction is carried out on the expansion image, and a first output image is obtained; obtaining and storing a mapping coefficient of the second direction according to the magnification of the second direction; and carrying out interpolation in the second direction on the first output image according to the mapping coefficient in the second direction to obtain a target image. Through the mode, the embodiment of the invention can adopt a unified calculation method by expanding the image and improving the mapping, only one corresponding module is needed to be designed in the hardware implementation process, so that the use of logic resources is reduced, the two-dimensional interpolation of bilinear interpolation is split into two one-dimensional interpolation, the final calculation result can be consistent with the original result, and the calculation redundancy of the two-dimensional interpolation is reduced.
Drawings
One or more embodiments are illustrated by way of example and not limitation in the figures of the accompanying drawings, in which like references indicate similar elements, and in which the figures of the drawings are not to be taken in a limiting sense, unless otherwise indicated.
FIG. 1 is a schematic diagram of a mapped corresponding pixel in an original image according to the background of the invention;
FIG. 2 is a schematic overall flow chart of an image magnification method according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of an image magnifying device according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a terminal device according to an embodiment of the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
In addition, the technical features of the embodiments of the present invention described below may be combined with each other as long as they do not collide with each other.
Referring to fig. 2, fig. 2 is an overall flow chart of an image amplifying method according to an embodiment of the invention;
as shown in fig. 2, the image enlarging method includes:
step S201: expanding the original image to obtain an expanded image;
specifically, an expansion matrix is constructed; copying the pixel values of the first row of the original image to the middle position of the first row of the expansion matrix; copying pixel values of a first row and a first column of an original image to positions of the first row and the first column of the expansion matrix; copying the pixel value of the last column of the first row of the original image to the position of the last column of the first row of the expansion matrix to form the pixel value of the first row of the expansion matrix; obtaining pixel values of the last row, the first column and the last column of the expansion matrix according to the obtaining mode of the pixel values of the first row of the expansion matrix; and copying the original image pixel value to the middle position of the expansion matrix to obtain an expansion image.
In this embodiment, let the original image be a×b, expand the original image to obtain an expanded image (a+2) ×b+2, and specifically include the following steps: constructing an expansion matrix of (a+2) × (b+2), copying the pixel value of the 1 st row of the original image, and placing the pixel value in the middle position of the 1 st row of the expansion matrix; copying the pixel value of the 1 st row and the 1 st column of the original image, and placing the pixel value at the 1 st row and the 1 st column of the expansion matrix; copying the pixel value of the 1 st row and the last 1 st column of the original image, and placing the pixel value at the 1 st row and the last 1 st column of the expansion matrix; in total b+2 elements, constitute the first row of elements of the expansion matrix. The elements of the last row, the first column and the last column of the expansion matrix can be obtained according to the method. The a.b pixel values of the original image are duplicated and put in the middle position of the expansion matrix in a one-to-one correspondence manner, so that an expansion image of the original image is formed.
By expanding the original image, an expanded image (a+2) ×b+2 is obtained, and the total number of rows and total columns of the expanded image are both greater than 2 in the original image, so that in order to use the unified calculation of the pixel values of all pixels in the target image, the mapping formulas (4) and (5) also need to be correspondingly improved:
x=x1*b/N+1 (6)
y=y1*a/M+1 (7)
taking formula (7) as an example for explanation, the influence of adding one row on the first row of the original image on the subsequent pixel calculation is eliminated by adding 1 to the mapping formula (7) on the basis of formula (5), through the processing, 4 adjacent pixel values obtained after the mapping of the target image to the expanded image are kept consistent with the original calculation process, and the effect of formula (6) is kept consistent with that of formula (7).
Taking the total number of lines of the extended image as an example, the total number of lines of the extended image is a+2, which is greater than 2 than that of the original image, the above description describes the effect of adding one line above the first line of the original image, and then the effect of adding one line below the last line of the original image is analyzed: the pixel value of the last line of the target image is calculated, y1=m is substituted into formula (7) to obtain the mapping coordinate y=a+1, and in order to calculate the pixel value of the line by using a unified formula, the pixel value of the a+2 line is needed to be used, so that the pixel value of the a+2 line is needed to be added below the last line of the original image, and the pixel value of the a+2 line is needed to be formed.
In summary, by introducing the extended image and improving the mapping formula, the calculation of all pixel values of the target image can be performed by adopting a unified calculation method, and only one corresponding module is required to be designed in the hardware implementation process.
The foregoing process is illustrated by way of example, and not by way of limitation, in order to facilitate a better understanding of the concepts of the invention by others: let the original image be 20 x 20, the target image be 30 x 30, the expanded image of the original image be 22 x 22, calculate the pixel value of the 1 st row and 30 th column of the target image, map its column coordinates to the original image, it can be obtained by formula (6), x=30x20/30+1=21, map its row coordinates to the original image, it can be obtained by formula (7) y=1 x 20/30+1=1.15, then the corresponding 4 pixel coordinates of the original image participating in calculation are (1, 21), (1, 22), (2, 21), (2, 22), the coordinate values are all in the coordinate range of the expanded image, after coordinate mapping, the other edge pixels of the target image are all in the coordinate range of the expanded image, it can use unified calculation of the pixel values of these pixels.
Step S202: according to the target image and the original image, obtaining the magnification of the first direction and the magnification of the second direction;
in this embodiment, the first direction is a row direction or a column direction, and the second direction is a column direction or a row direction. In the following embodiments, a specific case where the first direction is the row direction and the second direction is the column direction is described, and the magnification in the row direction is sx=n/b and the magnification in the column direction is sy=m/a, which are calculated from the target images m×n (M > a, N > b).
Step S203: obtaining and storing a mapping coefficient of the first direction according to the amplification factor of the first direction;
in this embodiment, according to the magnification Sx in the row direction, the mapping coefficient cx=1/Sx in the row direction is calculated, and the coefficient is stored, and according to the magnification Sx in the row direction, the mapping coefficient cx=1/Sx in the row direction is calculated, and by using the mapping coefficient Cx, the multiplication involved in the process of mapping the target image to the original image can be converted into the addition, and in the process of performing the row direction interpolation, the total number of rows of the output image a×n to be calculated and the original image a×b not performing the column direction mapping process can be equal. The method comprises the following steps: column coordinate map values of the first row first column, the first row second column, the first row third column, …, of the output image need to be calculated. For the pixels of the first row and the first column, the mapping value of the column coordinates thereof c1=cx+1; for the pixels of the first row and the second column, the mapping value of the column coordinates thereof c2=c1+cx; for the pixels in the third column of the first row, the mapping values of the column coordinates c3=c2+cx, and so on, all the mapping values of the column coordinates can be obtained. Therefore, only the coefficient Cx needs to be saved, and the calculation of the coordinate mapping value of the subsequent pixel column only needs to add Cx on the basis of the coordinate mapping value of the adjacent previous pixel column. By the method, M times of multiplication related to the formula (6) can be converted into addition, and the use of logic resources can be reduced in the hardware implementation process.
Step S204: according to the mapping coefficients of the target image and the first direction, interpolation of the first direction is carried out on the expansion image, and a first output image is obtained;
specifically, the interpolating the extended image in the first direction according to the mapping coefficients of the target image and the first direction, to obtain a first output image specifically includes:
acquiring a first coordinate mapping value of a first direction according to the mapping coefficient of the first direction;
according to the first coordinate mapping value of the first direction, obtaining a second coordinate mapping value of the first direction through one-time addition calculation, and sequentially iterating until all the coordinate mapping values of the first direction are obtained;
and carrying out interpolation in the first direction on the expansion image according to the coordinate mapping values in the first direction to obtain a first output image.
In this embodiment, interpolation in the row direction is first performed according to the mapping coefficient Cx in the row direction to obtain the first output image a×n, so that bilinear interpolation is divided into two one-dimensional interpolations, the interpolation in the row direction is performed first, the interpolation involves 1 multiplication and 2 additions, and the output image of the interpolation in the row direction is a×n, so that the process involves a×n multiplications and a×n×2 additions.
The two-dimensional interpolation of bilinear interpolation is split into two one-dimensional interpolation, the final calculation result can be consistent with the original result, and the calculation redundancy of the two-dimensional interpolation of bilinear interpolation is reduced. The two-dimensional interpolation of bilinear interpolation demonstrates computational redundancy by: let a×b be the original image, m×n be the target image, and (a+2) ×b+2 be the extended image of the original image.
Calculating the pixel value of the c-th row and d-th column of the target image, which is obtained by the formulas (7) and (6):
e=c*a/M+1
f=d*b/N+1
[e] the decimal part representing the downward rounding of e is g, and [ f ] represents the downward rounding of f, and the decimal part of f is h, then the coordinates of 4 pixels adjacent to the decimal part in the original image are: ([ e ], [ f ]), ([ e ], [ f ] +1), ([ e ] +1, [ f ] +1), and then calculated using formulas (1), (2), and (3), wherein m=h, n=g:
p([e],f)=p([e],[f])+h*(p([e],[f]+1)–p([e],[f])) (8)
p([e]+1,f)=p([e]+1,[f])+h*(p([e]+1,[f]+1)–p([e]+1,[f])) (9)
p(e,f)=p([e],f)+g*(p([e]+1,f)–p([e],f)) (10)
where p (i, j) represents the pixel value of the coordinate (i, j), the pixel value of the c-th row and d-th column of the target image is p (e, f).
Calculating the pixel value of the (c+1) th row and the (d) th column of the target image, wherein the pixel value is obtained by the formulas (7) and (6):
k=(c+1)*a/M+1=e+a/M
l=d*b/N+1=f
the integer part of k is [ e ] or [ e ] +1, the fractional part is r, the integer part of l is [ f ], and the fractional part is h.
When the integer part of k is [ e ], 4 pixel coordinates adjacent thereto in the original image are: ([ e ], [ f ]), ([ e ], [ f ] +1), ([ e ] +1, [ f ] +1), and then calculated using formulas (1), (2), and (3), wherein m=h, n=r:
p([e],f)=p([e],[f])+h*(p([e],[f]+1)–p([e],[f])) (11)
p([e]+1,f)=p([e]+1,[f])+h*(p([e]+1,[f]+1)–p([e]+1,[f])) (12)
p(k,f)=p([e],f)+r*(p([e]+1,f)–p([e],f)) (13)
p(k,l)=p(k,f) (14)
where p (i, j) represents the pixel value of the coordinate (i, j), the pixel value of the (c+1) th row and the (d) th column of the target image is p (k, l). By comparing formulas (8) to (14), the calculation processes of formulas (8) and (11) are identical, and the calculation processes of formulas (9) and (12) are identical.
When the integer part of k is [ e ] +1, 4 pixel coordinates adjacent thereto in the original image are: ([ e ] +1, [ f ]), ([ e ] +1, [ f ] +1), ([ e ] +2, [ f ] +1), and then calculated using formulas (1), (2), and (3), wherein m=h, n=r:
p([e]+1,f)=p([e]+1,[f])+h*(p([e]+1,[f]+1)–p([e]+1,[f])) (15)
p([e]+2,f)=p([e]+2,[f])+h*(p([e]+2,[f]+1)–p([e]+2,[f])) (16)
p(k,f)=p([e]+1,f)+r*(p([e]+2,f)–p([e]+1,f)) (17)
p(k,l)=p(k,f) (18)
where p (i, j) represents the pixel value of the coordinate (i, j), the pixel value of the (c+1) th row and the (d) th column of the target image is p (k, l). By comparing formulas (8) to (10), (15) to (18), the calculation processes of formulas (9) and (15) are identical.
Through the calculation process, the two-dimensional interpolation of bilinear interpolation is proved to have calculation redundancy, and meanwhile, the feasibility of splitting the two-dimensional interpolation of bilinear interpolation into two one-dimensional interpolation is also demonstrated.
Step S205: obtaining and storing a mapping coefficient of the second direction according to the magnification of the second direction;
in this embodiment, the mapping coefficient cy=1/Sy in the column direction is calculated from the first output image a×n and the magnification Sy in the column direction in the above steps, and the coefficient is stored.
Step S206: according to the mapping coefficient of the second direction, interpolation of the second direction is carried out on the first output image, and a target image is obtained;
in this embodiment, the interpolating the first output image in the second direction according to the mapping coefficient in the second direction to obtain a specific target image:
acquiring a first coordinate mapping value of the second direction according to the mapping coefficient of the second direction;
according to the first coordinate mapping value of the second direction, obtaining a second coordinate mapping value of the second direction through one-time addition calculation, and sequentially iterating until all the coordinate mapping values of the second direction are obtained;
and carrying out interpolation in the second direction on the expansion image according to the mapping values of the coordinates in the second direction to obtain a target image.
It can be seen that this interpolation also involves 1 multiplication, 2 additions, and the target image m×n can be obtained by column-direction interpolation, and this process involves m×n multiplications and m×n×2 additions. And step S204 involves a multiplication of N times and a addition of N times, so that the interpolation calculation process involves M times n+a times and M times N < N > 2 (M > a) times and M times n+a times and N times and M times N < N > 4 (M > a) times, the method is far smaller than M multiplied by N multiplied by 3 and M multiplied by N multiplied by 6 in the interpolation calculation process of the original algorithm, so that the operation amount is reduced, and the use of logic resources is further reduced in the hardware implementation process.
In an embodiment of the present invention, by providing an image magnification method, the method includes: expanding the original image to obtain an expanded image; according to the target image and the original image, obtaining the magnification of the first direction and the magnification of the second direction; obtaining and storing a mapping coefficient of the first direction according to the amplification factor of the first direction; according to the mapping coefficients of the target image and the first direction, interpolation of the first direction is carried out on the expanded image, and a first output image is obtained; obtaining and storing a mapping coefficient of the second direction according to the magnification of the second direction; and carrying out interpolation in the second direction on the first output image according to the mapping coefficient in the second direction to obtain a target image. By expanding the image and improving the mapping, a unified calculation method can be adopted for obtaining all pixel values in the target image, and only one corresponding module is needed to be designed in the hardware implementation process, so that the use of logic resources is reduced, the two-dimensional interpolation of bilinear interpolation is split into two one-dimensional interpolation, the final calculation result can be consistent with the original result, and the calculation redundancy of the two-dimensional interpolation is reduced.
Referring to fig. 3, fig. 3 is a schematic diagram of an image amplifying device according to an embodiment of the invention; the image enlarging apparatus may be applied to an image display terminal.
As shown in fig. 3, the image enlarging apparatus 30 includes:
an image expansion unit 31 for expanding the original image to obtain an expanded image;
an amplification calculation unit 32 for obtaining a magnification in the first direction and a magnification in the second direction from the target image and the original image;
a first mapping unit 33, configured to obtain and store a mapping coefficient of the first direction according to the magnification factor of the first direction;
a first interpolation unit 34, configured to interpolate the extended image in a first direction according to the mapping coefficients of the target image and the first direction, so as to obtain a first output image;
a second mapping unit 35, configured to obtain and store a mapping coefficient of the second direction according to the magnification factor of the second direction;
a second interpolation unit 36, configured to interpolate the first output image in the second direction according to the mapping coefficient in the second direction, so as to obtain a target image.
Further, the image expansion unit 31 is specifically configured to construct an expansion matrix; copying the pixel values of the first row of the original image to the middle position of the first row of the expansion matrix; copying pixel values of a first row and a first column of an original image to positions of the first row and the first column of the expansion matrix; copying pixel values of the last column of the first row of the original image to the position of the last column of the first row of the expansion matrix to form a first row element of the expansion matrix; obtaining the elements of the last row, the first column and the last column of the expansion matrix according to the obtaining mode of the elements of the first row of the expansion matrix; and copying the original image pixel value to the middle position of the expansion matrix to obtain an expansion image.
Further, the first interpolation unit 34 is specifically configured to obtain a first coordinate mapping value in the first direction according to the mapping coefficient in the first direction; according to the first coordinate mapping value of the first direction, obtaining a second coordinate mapping value of the first direction through one-time addition calculation, and sequentially iterating until all the coordinate mapping values of the first direction are obtained; and carrying out interpolation in the first direction on the expansion image according to the coordinate mapping values in the first direction to obtain a first output image.
Further, the second interpolation unit 36 is specifically configured to obtain a first coordinate mapping value in the second direction according to the mapping coefficient in the second direction; according to the first coordinate mapping value of the second direction, obtaining a second coordinate mapping value of the second direction through one-time addition calculation, and sequentially iterating until all the coordinate mapping values of the second direction are obtained; and carrying out interpolation in the second direction on the expansion image according to the mapping values of the coordinates in the second direction to obtain a target image.
Since the apparatus embodiments and the method embodiments are based on the same concept, on the premise that the contents do not conflict with each other, the contents of the apparatus embodiments may refer to the method embodiments, which are not described herein.
Referring to fig. 4, fig. 4 is a schematic structural diagram of a terminal device according to an embodiment of the present invention. The terminal device may be an electronic device capable of performing image processing, such as an intelligent display device and a mobile display device.
As shown in fig. 4, the terminal device 40 includes one or more processors 41 and a memory 42. One processor 41 is taken as an example in fig. 4.
The processor 41 and the memory 42 may be connected by a bus or otherwise, which is illustrated in fig. 4 as a bus connection.
The memory 42 is a non-volatile computer-readable storage medium that can be used to store a non-volatile software program, a non-volatile computer-executable program, and modules, such as the units (e.g., the units described in fig. 3) corresponding to an image enlarging method in the embodiment of the invention. The processor 41 performs various functional applications of the image enlarging method and data processing by executing nonvolatile software programs, instructions and modules stored in the memory 42, that is, functions of the respective modules and units of the image enlarging method and the apparatus embodiment of the above-described method embodiment.
The modules are stored in the memory 42, which when executed by the one or more processors 41, perform the image magnification method in any of the method embodiments described above, for example, performing the steps shown in fig. 2 described above; the functions of the various modules or units described in fig. 3 may also be implemented.
Processors of embodiments of the present invention exist in a variety of forms including, but not limited to:
(1) Tower type processor
While a typical tower processor chassis is much larger than a typical PC chassis, a large tower chassis is much coarser and generally has no fixed standard in overall dimensions.
(2) Rack-mounted processor
Rack processors are of the type that meet the intensive deployment of enterprises, resulting in 19 inch racks as standard width processors ranging in height from 1U to several U. Placing the processor on the rack is not only beneficial to routine maintenance and management, but also may avoid unexpected failures. First, the placement processor does not take up excessive space. The rack processors are neatly arranged in the rack, and space is not wasted. Secondly, the connecting wires and the like can be neatly received and released into the rack. The power line, the LAN line and the like can be well wired in the cabinet, and connecting lines piled on the ground can be reduced, so that accidents such as wire falling caused by foot kicking and the like are prevented. The specified dimensions are the width (48.26 cm=19 inches) and height (a multiple of 4.445 cm) of the processor. Because of the 19 inch width, a rack that meets this specification is sometimes referred to as a "19 inch rack".
(3) Blade type processor
Blade processors are a low cost processor platform of HAHD (High Availability High Density, high availability, high density) designed specifically for the specific application industry and high density computer environment, where each "blade" is actually a system motherboard, similar to a separate processor. In this mode, each motherboard runs its own system, serving a specified different user group, without correlation to each other. But the motherboards may be integrated into one processor cluster using system software. In trunking mode, all motherboards can be connected to provide a high speed network environment, can share resources, and serve the same user group.
Embodiments of the present invention also provide a non-volatile computer storage medium storing computer-executable instructions that are executed by one or more processors, such as the one processor 41 in fig. 4, to cause the one or more processors to perform the image magnification method in any of the method embodiments described above, such as performing the steps shown in fig. 2 described above; the functions of the individual units described in fig. 3 can also be implemented.
The above-described embodiments of the apparatus or device are merely illustrative, in which the unit modules illustrated as separate components may or may not be physically separate, and the components shown as unit modules may or may not be physical units, may be located in one place, or may be distributed over multiple network module units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
From the above description of embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus a general purpose hardware platform, or may be implemented by hardware. Based on such understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the related art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for up to a computer device (which may be a personal computer, a processor, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; the technical features of the above embodiments or in the different embodiments may also be combined within the idea of the invention, the steps may be implemented in any order, and there are many other variations of the different aspects of the invention as described above, which are not provided in detail for the sake of brevity; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.
Claims (8)
1. A method of image magnification, the method comprising:
expanding the original image to obtain an expanded image, and specifically, constructing an expansion matrix; copying the pixel values of the first row of the original image to the middle position of the first row of the expansion matrix; copying pixel values of a first row and a first column of an original image to positions of the first row and the first column of the expansion matrix; copying the pixel value of the last column of the first row of the original image to the position of the last column of the first row of the expansion matrix to form the pixel value of the first row of the expansion matrix; obtaining pixel values of the last row, the first column and the last column of the expansion matrix according to the obtaining mode of the pixel values of the first row of the expansion matrix; copying original image pixel values to the middle position of the expansion matrix to obtain an expansion image;
according to the target image and the original image, obtaining the magnification of the first direction and the magnification of the second direction;
obtaining and storing a mapping coefficient of the first direction according to the amplification factor of the first direction;
according to the mapping coefficients of the target image and the first direction, interpolation of the first direction is carried out on the expansion image, and a first output image is obtained;
obtaining and storing a mapping coefficient of the second direction according to the magnification of the second direction;
and carrying out interpolation in the second direction on the first output image according to the mapping coefficient in the second direction to obtain a target image.
2. The image magnification method according to claim 1, wherein the interpolating the expanded image in the first direction according to the mapping coefficients of the target image and the first direction obtains a first output image specifically:
acquiring a first coordinate mapping value of a first direction according to the mapping coefficient of the first direction;
according to the first coordinate mapping value of the first direction, obtaining a second coordinate mapping value of the first direction through one-time addition calculation, and sequentially iterating until all the coordinate mapping values of the first direction are obtained;
and carrying out interpolation in the first direction on the expansion image according to the coordinate mapping values in the first direction to obtain a first output image.
3. The image magnification method according to claim 1, wherein the interpolating the first output image in the second direction according to the mapping coefficient in the second direction obtains a target image specifically:
acquiring a first coordinate mapping value of the second direction according to the mapping coefficient of the second direction;
according to the first coordinate mapping value of the second direction, obtaining a second coordinate mapping value of the second direction through one-time addition calculation, and sequentially iterating until all the coordinate mapping values of the second direction are obtained;
and carrying out interpolation in the second direction on the expansion image according to the mapping values of the coordinates in the second direction to obtain a target image.
4. An image magnification device, characterized in that the device comprises:
the image expansion unit is used for expanding the original image to obtain an expanded image, and the image expansion unit is specifically used for constructing an expansion matrix; copying the pixel values of the first row of the original image to the middle position of the first row of the expansion matrix; copying pixel values of a first row and a first column of an original image to positions of the first row and the first column of the expansion matrix; copying the pixel value of the last column of the first row of the original image to the position of the last column of the first row of the expansion matrix to form the pixel value of the first row of the expansion matrix; obtaining pixel values of the last row, the first column and the last column of the expansion matrix according to the obtaining mode of the pixel values of the first row of the expansion matrix; copying original image pixel values to the middle position of the expansion matrix to obtain an expansion image;
the amplifying and calculating unit is used for obtaining the amplifying power in the first direction and the amplifying power in the second direction according to the target image and the original image;
the first mapping unit is used for obtaining and storing a mapping coefficient of the first direction according to the magnification of the first direction;
the first interpolation unit is used for carrying out interpolation in the first direction on the expansion image according to the mapping coefficients of the target image and the first direction to obtain a first output image;
the second mapping unit is used for acquiring and storing the mapping coefficient of the second direction according to the magnification of the second direction;
and the second interpolation unit is used for interpolating the first output image in the second direction according to the mapping coefficient in the second direction to obtain a target image.
5. The image magnification device according to claim 4, wherein the first interpolation unit is specifically configured to obtain a first coordinate mapping value in a first direction according to a mapping coefficient in the first direction; according to the first coordinate mapping value of the first direction, obtaining a second coordinate mapping value of the first direction through one-time addition calculation, and sequentially iterating until all the coordinate mapping values of the first direction are obtained; and carrying out interpolation in the first direction on the expansion image according to the coordinate mapping values in the first direction to obtain a first output image.
6. The image magnification device according to claim 4, wherein the second interpolation unit is specifically configured to obtain a first coordinate mapping value in the second direction according to a mapping coefficient in the second direction; according to the first coordinate mapping value of the second direction, obtaining a second coordinate mapping value of the second direction through one-time addition calculation, and sequentially iterating until all the coordinate mapping values of the second direction are obtained; and carrying out interpolation in the second direction on the expansion image according to the mapping values of the coordinates in the second direction to obtain a target image.
7. A computer readable storage medium, characterized in that the computer readable storage medium comprises a stored program, wherein the program when run performs the method of any of the preceding claims 1 to 3.
8. A terminal device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to execute the method according to any of the claims 1 to 3 by means of the computer program.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010295751.6A CN111476718B (en) | 2020-04-15 | 2020-04-15 | Image amplification method and device, storage medium and terminal equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010295751.6A CN111476718B (en) | 2020-04-15 | 2020-04-15 | Image amplification method and device, storage medium and terminal equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111476718A CN111476718A (en) | 2020-07-31 |
CN111476718B true CN111476718B (en) | 2023-05-05 |
Family
ID=71753565
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010295751.6A Active CN111476718B (en) | 2020-04-15 | 2020-04-15 | Image amplification method and device, storage medium and terminal equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111476718B (en) |
Families Citing this family (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112053283B (en) * | 2020-08-13 | 2024-05-31 | 深圳市洲明科技股份有限公司 | Image scaling method, storage medium and electronic device |
CN112215754B (en) * | 2020-10-26 | 2024-01-26 | 北京达佳互联信息技术有限公司 | Image amplifying method, device, electronic equipment and storage medium |
CN113096045B (en) * | 2021-04-14 | 2024-09-10 | 深圳市元征科技股份有限公司 | Bitmap stretching method, bitmap stretching device and electronic equipment |
CN113592714A (en) * | 2021-08-05 | 2021-11-02 | 杭州雄迈集成电路技术股份有限公司 | Image amplification method, module and system |
CN114461112A (en) * | 2022-01-28 | 2022-05-10 | 海宁奕斯伟集成电路设计有限公司 | Image display method and device for screen menu type regulating mode |
CN116071242B (en) * | 2023-03-17 | 2023-07-14 | 山东云海国创云计算装备产业创新中心有限公司 | Image processing method, system, equipment and storage medium |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108986033A (en) * | 2018-07-26 | 2018-12-11 | 西安电子科技大学 | Image-scaling method based on bilinear interpolation algorithm processing |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2002024815A (en) * | 2000-06-13 | 2002-01-25 | Internatl Business Mach Corp <Ibm> | Image conversion method for converting into enlarged image data, image processing device, and image display device |
CN100373912C (en) * | 2006-07-10 | 2008-03-05 | 宁波大学 | Quick double linear interpolating method in image amplification process |
CN101980281B (en) * | 2010-09-30 | 2012-09-19 | 深圳市理邦精密仪器股份有限公司 | Ultrasonic image amplification method and amplification system |
CN109191377B (en) * | 2018-07-25 | 2020-06-19 | 西安电子科技大学 | Image amplification method based on interpolation |
CN110223232A (en) * | 2019-06-06 | 2019-09-10 | 电子科技大学 | A kind of video image amplifying method based on bilinear interpolation algorithm |
-
2020
- 2020-04-15 CN CN202010295751.6A patent/CN111476718B/en active Active
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108986033A (en) * | 2018-07-26 | 2018-12-11 | 西安电子科技大学 | Image-scaling method based on bilinear interpolation algorithm processing |
Also Published As
Publication number | Publication date |
---|---|
CN111476718A (en) | 2020-07-31 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111476718B (en) | Image amplification method and device, storage medium and terminal equipment | |
CN108205700B (en) | Neural network operation device and method | |
CN111724304B (en) | Image scaling method and device, terminal equipment and storage medium | |
CN110580324B (en) | Image matrix operation method and device, computer equipment and storage medium | |
US11328395B2 (en) | Image processing method, image processing device, electronic equipment and computer readable storage medium | |
CN110390075B (en) | Matrix preprocessing method, device, terminal and readable storage medium | |
CN111210389A (en) | Image scaling processing method and device | |
CN104714986A (en) | Three-dimensional picture searching method and three-dimensional picture searching system | |
CN110580522A (en) | Convolution calculation method and related equipment | |
CN114138231B (en) | Method, circuit and SOC for executing matrix multiplication operation | |
CN112580675B (en) | Image processing method and device and computer readable storage medium | |
CN105069747B (en) | Image interpolation method and device | |
CN111079643B (en) | Face detection method and device based on neural network and electronic equipment | |
CN111161289B (en) | Method and device for improving contour precision of object in image | |
CN107977923B (en) | Image processing method, image processing device, electronic equipment and computer readable storage medium | |
US20040046764A1 (en) | Pixel delta interpolation method and apparatus | |
CN115810086A (en) | Three-dimensional scene reconstruction method and device, computer equipment and storage medium | |
CN111260559B (en) | Image zooming display method and device and terminal equipment | |
KR101688435B1 (en) | Apparatus and Method of Generating Integral Image using Block Structure | |
CN112712461B (en) | Image deconvolution processing method and device and terminal equipment | |
CN114549945A (en) | Remote sensing image change detection method and related device | |
CN113468469A (en) | Convolution processing method and device of feature graph executed by computer and electronic equipment | |
US10936864B2 (en) | Grid layout determination from a document image | |
CN113111891B (en) | Image reconstruction method and device, terminal equipment and storage medium | |
CN116993798B (en) | Image processing method and electronic equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
CB02 | Change of applicant information | ||
CB02 | Change of applicant information |
Address after: Area D and E, 7th floor, building 3, Tingwei Industrial Park, No.6 Liufang Road, Xin'an street, Shenzhen City, Guangdong Province 518000 Applicant after: Shenzhen Aixiesheng Technology Co.,Ltd. Address before: Area D and E, 7th floor, building 3, Tingwei Industrial Park, No.6 Liufang Road, Xin'an street, Shenzhen City, Guangdong Province 518000 Applicant before: SHENZHEN AIXIESHENG TECHNOLOGY Co.,Ltd. |
|
GR01 | Patent grant | ||
GR01 | Patent grant |