CN111476718A - Image amplification method and device, storage medium and terminal equipment - Google Patents

Image amplification method and device, storage medium and terminal equipment Download PDF

Info

Publication number
CN111476718A
CN111476718A CN202010295751.6A CN202010295751A CN111476718A CN 111476718 A CN111476718 A CN 111476718A CN 202010295751 A CN202010295751 A CN 202010295751A CN 111476718 A CN111476718 A CN 111476718A
Authority
CN
China
Prior art keywords
image
row
mapping
interpolation
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.)
Granted
Application number
CN202010295751.6A
Other languages
Chinese (zh)
Other versions
CN111476718B (en
Inventor
孙雪强
夏群兵
吴泽坚
陈琛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Aixiesheng Technology Co Ltd
Original Assignee
Shenzhen Aixiesheng Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Shenzhen Aixiesheng Technology Co Ltd filed Critical Shenzhen Aixiesheng Technology Co Ltd
Priority to CN202010295751.6A priority Critical patent/CN111476718B/en
Publication of CN111476718A publication Critical patent/CN111476718A/en
Application granted granted Critical
Publication of CN111476718B publication Critical patent/CN111476718B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • G06T3/4007Scaling 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 amplification method, which comprises the following steps: expanding the original image to obtain an expanded image; obtaining the magnification factor of the first direction and the magnification factor of the second direction; obtaining and storing a mapping coefficient in a first direction; performing interpolation in a first direction on the expanded image to obtain a first output image; acquiring and storing a mapping coefficient in the second direction according to the magnification factor in the second direction; and carrying out interpolation in the 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 uniform calculation method can be adopted for obtaining all pixel values in the target image, only one corresponding module needs to be designed in the hardware realization process, 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 the bilinear interpolation into two one-dimensional interpolations.

Description

Image amplification method and device, storage medium and terminal equipment
Technical Field
The present invention relates to the field of image processing technologies, and in particular, to an image amplification method, an image amplification apparatus, a storage medium, and a terminal device.
Background
There are many methods for implementing image amplification, and most of them are implemented by interpolation operation, and the commonly used methods include nearest neighbor interpolation, bilinear interpolation, bicubic interpolation, and the like. The nearest neighbor interpolation is the simplest to implement, but the amplified image can generate a relatively obvious sawtooth effect, and the amplification 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 better amplification effect and lower operation complexity, and can meet most application requirements, thereby having the widest application.
The conventional bilinear interpolation is performed in two different directions. The principle is as follows: the method comprises the steps of mapping coordinates of pixel points to be inserted of a target image to an original image, finding 4 pixel points adjacent to the target image in the original image, firstly carrying out twice interpolation in a row direction by using pixel values of the 4 pixel points, and then carrying out once interpolation in a column direction to obtain 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 the corresponding position of 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 if the coordinate of p1 is (i, j), the coordinates of p2, p3 and p4 are (i, j +1), (i +1, j +1), respectively. By using 4 pixel values of p1, p2, p3 and p4, the pixel value of p can be obtained through corresponding operation, and further the pixel value of the corresponding position of the target image is obtained. The specific operation process is as follows: if the pixel value of each pixel in the original image is f (x), and 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 decimal part corresponding to the column coordinate of p, as shown in fig. 1, the distances between p1 and p12, and 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. The equations (1), (2) and (3) correspond to one interpolation, and one interpolation needs 1 multiplication and 2 addition, so that one bilinear interpolation needs 3 multiplications and 6 additions.
In addition, in the prior art, in the early stage of the interpolation process, 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 (y1, x1), 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 go through the mapping process, wherein b/N and a/M are constants, only one calculation is needed, and the value is stored, so that the mapping process of each pixel to be inserted needs 2 multiplications, and the edge pixels need special treatment.
In summary, the bilinear interpolation is used to calculate the target image with size M × N, which requires M × N × 6 additions and M × N × 5 multiplications, and in the hardware implementation process, too many multipliers are required, which occupies more logic resources, and thus an image amplification method with smaller computation is needed.
Disclosure of Invention
The embodiment of the invention aims to provide an image amplification method, an image amplification device, a storage medium and terminal equipment, and solves the technical problems that too many multipliers are needed in the hardware implementation process of the conventional image amplification method, more logic resources are occupied, and the calculation amount is large.
In order to solve the above technical problems, embodiments of the present invention provide the following technical solutions:
in a first aspect, an embodiment of the present invention provides an image magnification method, where the method includes:
expanding the original image to obtain an expanded image;
obtaining the magnification factor of the first direction and the magnification factor of the second direction according to the target image and the original image;
obtaining and storing a mapping coefficient in the first direction according to the magnification factor in the first direction;
performing interpolation in a first direction on the extended image according to the mapping coefficient of the target image and the first direction to obtain a first output image;
acquiring and storing a mapping coefficient in the second direction according to the magnification factor in the second direction;
and performing second-direction interpolation 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 magnifying apparatus, applied to a processor, including:
the image expansion unit is used for expanding the original image to obtain an expanded image;
the magnification calculation unit is used for obtaining the magnification of the first direction and the magnification of 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 in the first direction according to the magnification factor in the first direction;
a first interpolation unit, configured to perform interpolation in a first direction on the extended image according to the target image and a mapping coefficient in the first direction, so as to obtain a first output image;
the second mapping unit is used for acquiring and storing the mapping coefficient in the second direction according to the magnification factor in the second direction;
and the second interpolation unit is used for 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 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 a position 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 the pixel values of the last row, the first column and the last column of the extended matrix according to the obtaining mode of the pixel values of the first row of the extended matrix; and copying the pixel value of the original image 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 in a first direction according to the mapping coefficient in the first direction; according to the first coordinate mapping value in the first direction, obtaining a second coordinate mapping value in the first direction through one-time addition calculation, and sequentially iterating until all coordinate mapping values in the first direction are obtained; and carrying out interpolation in the first direction on the extended image according to each coordinate mapping value 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 in the second direction according to the mapping coefficient in the second direction; according to the first coordinate mapping value in the second direction, obtaining a second coordinate mapping value in the second direction through one-time addition calculation, and sequentially iterating until obtaining all coordinate mapping values in the second direction; and performing interpolation in the second direction on the extended image according to each coordinate mapping value 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, and when the program runs, the image magnification method is performed.
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 magnification method through the computer program.
The embodiment of the invention has the beneficial effects that: different from the prior art, the image magnification method provided by the embodiment of the invention includes expanding an original image to obtain an expanded image; obtaining the magnification factor of the first direction and the magnification factor of the second direction according to the target image and the original image; obtaining and storing a mapping coefficient in the first direction according to the magnification factor in the first direction; performing interpolation in a first direction on the extended image according to the mapping coefficient of the target image and the first direction to obtain a first output image; acquiring and storing a mapping coefficient in the second direction according to the magnification factor in the second direction; and performing second-direction interpolation 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 enables all pixel values in the target image to be obtained by adopting a unified calculation method through image expansion and mapping improvement, only one corresponding module needs to be designed in the hardware realization process, the use of logic resources is reduced, the two-dimensional interpolation of bilinear interpolation is divided into two one-dimensional interpolations, 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 in the accompanying drawings, which correspond to the figures in which like reference numerals refer to similar elements and which are not to scale unless otherwise specified.
FIG. 1 is a diagram illustrating a corresponding pixel in an original image after mapping according to the background art of the present invention;
FIG. 2 is a schematic overall flowchart of an image enlarging 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
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In addition, the technical features involved in the embodiments of the present invention described below may be combined with each other as long as they do not conflict with each other.
Referring to fig. 2, fig. 2 is a schematic overall flowchart of an image magnifying method according to an embodiment of the present 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 a position 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 the pixel values of the last row, the first column and the last column of the extended matrix according to the obtaining mode of the pixel values of the first row of the extended matrix; and copying the pixel value of the original image to the middle position of the expansion matrix to obtain an expansion image.
In this embodiment, let the original image be a × b, and expand the original image to obtain an expanded image (a +2) × (b +2), specifically including the following steps: constructing an expansion matrix of (a +2) × (b +2), copying the 1 st row pixel value of the original image, and placing the pixel value at the middle position of the 1 st row of the expansion matrix; copying pixel values of the 1 st row and 1 st column of the original image, and placing the pixel values at the 1 st row and 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 position of the 1 st row and the last 1 st column of the expansion matrix; the total of b +2 elements constitutes the first row of elements of the spreading matrix. According to the method, the elements of the last row, the first column and the last column of the expanded matrix can be obtained. And copying a-b pixel values of the original image, and correspondingly placing the copied pixel values at the middle position of the expansion matrix to form an expanded image of the original image.
By expanding the original image, an expanded image (a +2) × (b +2) is obtained, the total number of rows and the total number of columns of the expanded image are both 2 greater than the original image, and in order to calculate the pixel values of all the pixels in the target image uniformly, the mapping equations (4) and (5) need to be improved accordingly:
x=x1*b/N+1 (6)
y=y1*a/M+1 (7)
taking formula (7) as an example for explanation, the mapping formula (7) eliminates the influence of adding one line on the first line of the original image on the subsequent pixel calculation by adding 1 to formula (5), and through the above processing, not only the 4 adjacent pixel values obtained after the target image is mapped to the extended image are kept consistent with the original calculation process, but also the function of formula (6) is kept consistent with formula (7).
Taking the total number of lines of the extended image as an example, where the total number of lines of the extended image is a +2, which is greater than 2 of the original image, the above describes the effect of adding one line above the first line of the original image, and 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 is substituted into the formula (7) to obtain the mapping coordinate y is a +1, and the pixel value of the line needs to be calculated by the pixel value of the a +2 th line in order to use a uniform formula, so that the pixel value of the a +2 th line needs to be formed by adding the pixel value of one line below the last line of the original image.
In summary, by introducing the extended image and improving the mapping formula, a unified calculation method can be adopted for calculating all pixel values of the target image, and only one corresponding module needs to be designed in the hardware implementation process.
The above process is illustrated by way of example, which is for the convenience of others to better understand the idea of the present invention, and is not intended to limit the invention: assuming that the original image is 20 × 20 and the target image is 30 × 30, the expanded image of the original image is 22 × 22, the pixel values of the 1 st row and 30 th column of the target image are calculated, the column coordinates of the pixel values are mapped to the original image, and the obtained value is obtained by the formula (6), x is 30 × 20/30+1 is 21, the row coordinates of the pixel values are mapped to the original image, and y is 1 20/30+1 is 1.15, so that the 4 pixel coordinates of the original image corresponding to the calculation are (1,21), (1,22), (2,21), and (2,22), and the coordinate values are all within the coordinate range of the expanded image, and similarly, after the other edge pixels of the target image are subjected to coordinate mapping, the coordinate values thereof are also all within the coordinate range of the expanded image, and the pixel values of the pixels can be uniformly calculated.
Step S202: obtaining the magnification factor of the first direction and the magnification factor of the second direction according to the target image and the original image;
in this embodiment, the first direction is a row direction or a column direction, and correspondingly, the second direction is a column direction or a row direction. In the following embodiments, the first direction is a row direction, and the second direction is a column direction, and from the target image M × N (M > a, N > b), the magnification factor in the row direction is calculated to be Sx ═ N/b, and the magnification factor in the column direction is calculated to be Sy ═ M/a.
Step S203: obtaining and storing a mapping coefficient in the first direction according to the magnification factor in the first direction;
in this embodiment, the row-direction mapping coefficient Cx is calculated to be 1/Sx from the row-direction magnification factor Sx and stored, the row-direction mapping coefficient Cx is calculated to be 1/Sx from the row-direction magnification factor Sx, and the multiplication involved in the process of mapping the target image to the original image can be converted into an addition by using the mapping coefficient Cx, and the original image a b can be calculated without performing the column-direction mapping process in the process of performing the row-direction interpolation, so that the total row number of the output images a N to be calculated is equal to the original image a b. The method comprises the following specific steps: the column coordinate mapping values for the first row and first column, the first row and second column, the first row and third column, …, of the output image need to be calculated. For a pixel in the first row and the first column, its column coordinate mapping value C1 ═ Cx + 1; for the pixel of the first row and the second column, the mapping value C2 of the column coordinate is C1+ Cx; for the pixel in the first row and the third column, the mapping value C3 of the column coordinate is C2+ Cx, and so on, and the mapping values of all the column coordinates can be obtained. Therefore, only the coefficient Cx needs to be stored, and the calculation of the subsequent pixel column coordinate mapping value only needs to add the coefficient Cx to the adjacent previous pixel column coordinate mapping value. 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: performing interpolation in a first direction on the extended image according to the mapping coefficient of the target image and the first direction to obtain a first output image;
specifically, the performing interpolation in the first direction on the extended image according to the target image and the mapping coefficient in the first direction to obtain a first output image specifically includes:
acquiring a first coordinate mapping value in a first direction according to the mapping coefficient in the first direction;
according to the first coordinate mapping value in the first direction, obtaining a second coordinate mapping value in the first direction through one-time addition calculation, and sequentially iterating until all coordinate mapping values in the first direction are obtained;
and carrying out interpolation in the first direction on the extended image according to each coordinate mapping value in the first direction to obtain a first output image.
In this embodiment, according to the mapping coefficient Cx in the row direction, interpolation in the row direction is performed first to obtain the first output image a × N, so that the 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 addition, and the output image interpolated in the row direction is a × N, so that the process involves a × N multiplication and a × N2 addition in total.
The two-dimensional interpolation of the bilinear interpolation is divided into two one-dimensional interpolations, the final calculation result can be kept consistent with the original result, and the calculation redundancy of the two-dimensional interpolation of the bilinear interpolation is reduced. The two-dimensional interpolation of the bilinear interpolation is proved to have the computational redundancy by the following operations: let the original image be a × b and the target image be M × N, the extended image of the original image be (a +2) × (b + 2).
Calculating the pixel value of the c-th row and the d-th column of the target image, and obtaining the following formulas (7) and (6):
e=c*a/M+1
f=d*b/N+1
[e] representing e rounded down, the fractional part of e is g, [ f ] representing f rounded down, the fractional part of f is h, then the 4 adjacent pixel coordinates in the original image are: ([ e ], [ f ]), ([ e ], [ f ] +1), ([ e ] +1, [ f ] +1), and then calculated using equations (1), (2), (3), where m is h, n is 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)
wherein p (i, j) represents the pixel value of the coordinate (i, j), and the pixel value of the c-th row and the d-th column of the target image is p (e, f).
Calculating the pixel value of the c +1 th row and the d column of the target image, which can be obtained from the formulas (7) and (6):
k=(c+1)*a/M+1=e+a/M
l=d*b/N+1=f
then 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 ], its 4-pixel coordinates adjacent to it in the original image are: ([ e ], [ f ]), ([ e ], [ f ] +1), ([ e ] +1, [ f ] +1), and then calculated using equations (1), (2), (3), where 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)
wherein p (i, j) represents the pixel value of the coordinate (i, j), and the pixel value of the c +1 th row and the d-th column of the target image is p (k, l). By comparing the formulas (8) to (14), the calculation processes of the formulas (8) and (11) are completely the same, and the calculation processes of the formulas (9) and (12) are completely the same.
When the integer part of k is [ e ] +1, its 4 pixel coordinates adjacent to it in the original image are: ([ e ] +1, [ f ]), ([ e ] +1, [ f ] +1), ([ e ] +2, [ f ] +1), and then calculated using equations (1), (2), and (3), where 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)
wherein p (i, j) represents the pixel value of the coordinate (i, j), and the pixel value of the c +1 th row and the d-th column of the target image is p (k, l). By comparing equations (8) - (10), (15) - (18), the calculation processes of equations (9) and (15) are completely the same.
Through the calculation process, the two-dimensional interpolation of the bilinear interpolation has the calculation redundancy, and meanwhile, the feasibility of splitting the two-dimensional interpolation of the bilinear interpolation into two one-dimensional interpolations is also demonstrated.
Step S205: acquiring and storing a mapping coefficient in the second direction according to the magnification factor in the second direction;
in the present embodiment, the column-direction mapping coefficient Cy is calculated as 1/Sy from the first output image a × N and the column-direction magnification Sy in the above-described steps, and the calculated coefficients are stored.
Step S206: according to the mapping coefficient in the second direction, performing interpolation in the second direction on the first output image to obtain a target image;
in this embodiment, the performing, according to the mapping coefficient in the second direction, interpolation in the second direction on the first output image to obtain a target image specifically:
acquiring 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 in the second direction, obtaining a second coordinate mapping value in the second direction through one-time addition calculation, and sequentially iterating until obtaining all coordinate mapping values in the second direction;
and performing interpolation in the second direction on the extended image according to each coordinate mapping value in the second direction to obtain a target image.
It should be understood that this interpolation also involves 1 multiplication and 2 addition, and the target image M × N can be obtained by column direction interpolation, and this process involves M × N multiplication and M × N2 addition. And step S204 involves a × N multiplications and a × N × 2 additions, so that M × N + a × N < M × N2 (M > a) multiplications and M × N2 + a × N2 < M × N4 (M > a) additions are involved in the interpolation process of the method, which is much smaller than M × N3 multiplications and M × N6 additions in the interpolation process of the original algorithm, thereby reducing the amount of operations and further reducing the use of logic resources in the hardware implementation process.
In an embodiment of the present invention, by providing an image enlarging method, the method includes: expanding the original image to obtain an expanded image; obtaining the magnification factor of the first direction and the magnification factor of the second direction according to the target image and the original image; obtaining and storing a mapping coefficient in the first direction according to the magnification factor in the first direction; performing interpolation in the first direction on the expanded image according to the mapping coefficient of the target image and the first direction to obtain a first output image; acquiring and storing a mapping coefficient in the second direction according to the magnification factor in the second direction; and performing 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 uniform calculation method can be adopted for obtaining all pixel values in the target image, only one corresponding module needs to be designed in the hardware realization process, the use of logic resources is reduced, the two-dimensional interpolation of the bilinear interpolation is divided into two one-dimensional interpolations, 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 magnifying device according to an embodiment of the present invention; the image magnification device can be applied to an image display terminal.
As shown in fig. 3, the image enlarging apparatus 30 includes:
an image expansion unit 31, configured to expand an original image to obtain an expanded image;
an enlargement calculation unit 32, configured to obtain an enlargement factor in the first direction and an enlargement factor in the second direction according to the target image and the original image;
the first mapping unit 33 is configured to obtain and store a mapping coefficient in the first direction according to the magnification factor in the first direction;
a first interpolation unit 34, configured to perform first-direction interpolation on the extended image according to the target image and a first-direction mapping coefficient, so as to obtain a first output image;
the second mapping unit 35 is configured to obtain and store a mapping coefficient in the second direction according to the magnification factor in the second direction;
and a second interpolation unit 36, configured to perform second-direction interpolation on the first output image according to the second-direction mapping coefficient to obtain a target image.
Further, the image expanding 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 a position 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 elements of the first row of the expansion matrix; obtaining elements of the last row, the first column and the last column of the extended matrix according to the obtaining mode of the elements of the first row of the extended matrix; and copying the pixel value of the original image 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 a first direction according to the mapping coefficient in the first direction; according to the first coordinate mapping value in the first direction, obtaining a second coordinate mapping value in the first direction through one-time addition calculation, and sequentially iterating until all coordinate mapping values in the first direction are obtained; and carrying out interpolation in the first direction on the extended image according to each coordinate mapping value in the first direction to obtain a first output image.
Further, the second interpolation unit 36 is specifically configured to obtain a second-direction first coordinate mapping value according to a second-direction mapping coefficient; according to the first coordinate mapping value in the second direction, obtaining a second coordinate mapping value in the second direction through one-time addition calculation, and sequentially iterating until obtaining all coordinate mapping values in the second direction; and performing interpolation in the second direction on the extended image according to each coordinate mapping value in the second direction to obtain a target image.
Since the apparatus embodiment and the method embodiment are based on the same concept, the contents of the apparatus embodiment may refer to the method embodiment on the premise that the contents do not conflict with each other, and are not described herein again.
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 or a mobile display device.
As shown in fig. 4, the terminal device 40 includes one or more processors 41 and a memory 42. In fig. 4, one processor 41 is taken as an example.
The processor 41 and the memory 42 may be connected by a bus or other means, such as the bus connection in fig. 4.
The memory 42, which is a non-volatile computer-readable storage medium, may be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as units corresponding to an image magnification method in an embodiment of the present invention (e.g., the units described in fig. 3). The processor 41 executes various functional applications of the image magnification method and data processing, i.e., functions of the respective modules and units of the above-described method embodiment image magnification method and the above-described apparatus embodiment, by executing the nonvolatile software program, instructions, and modules stored in the memory 42.
The memory 42 may include high speed random access memory and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some embodiments, memory 42 may optionally include memory located remotely from processor 41, which may be connected to processor 41 via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The modules are stored in the memory 42 and, when executed by the one or more processors 41, perform the image magnification method in any of the method embodiments described above, e.g., performing the various steps shown in fig. 2 described above; the functions of the individual modules or units described in fig. 3 may also be implemented.
Processors of embodiments of the invention exist in a variety of forms, including but not limited to:
(1) tower type processor
The general tower type processor chassis is almost as large as the commonly used PC chassis, while the large tower type chassis is much larger, and the overall dimension is not a fixed standard.
(2) Rack-mounted processor
Rack-mounted processors are of a type that meets the requirements of intensive deployment of enterprises, forms a 19-inch rack as a processor with a standard width, has a height of from 1U to several U, places the processors on the rack, and is not only beneficial to daily maintenance and management, but also possible to avoid unexpected failures.
(3) Blade type processor
A blade processor is a HAHD (High available High Density) low cost processor platform designed specifically for application specific industries and High Density computer environments, where each "blade" is essentially a system motherboard, similar to an individual processor. In this mode, each motherboard runs its own system, serving a designated group of different users, without any relationship to each other. But the motherboards may be grouped into a processor cluster using system software. In the cluster mode, all motherboards can be connected to provide a high-speed network environment, and resources can be shared to serve the same user group.
Embodiments of the present invention also provide a non-volatile computer storage medium, which stores computer-executable instructions, which are executed by one or more processors, such as one processor 41 in fig. 4, and can enable the one or more processors to execute the image magnification method in any of the above method embodiments, such as executing the image magnification method in any of the above method embodiments, for example, executing the above steps shown in fig. 2; the functions of the various units described in figure 3 may also be implemented.
The above-described embodiments of the apparatus or device are merely illustrative, wherein the unit modules described as separate parts may or may not be physically separate, and the parts displayed as module units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network module units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a general hardware platform, and certainly can also be implemented by hardware. Based on such understanding, the above technical solutions substantially or contributing to the related art may be embodied in the form of a software product, which may be stored in a computer-readable storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a processor, or a network device, etc.) to execute the method according to the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; within the idea of the invention, also technical features in the above embodiments or in different embodiments may be combined, 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 present 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 solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present application.

Claims (10)

1. A method of image magnification, the method comprising:
expanding the original image to obtain an expanded image;
obtaining the magnification factor of the first direction and the magnification factor of the second direction according to the target image and the original image;
obtaining and storing a mapping coefficient in the first direction according to the magnification factor in the first direction;
performing interpolation in a first direction on the extended image according to the mapping coefficient of the target image and the first direction to obtain a first output image;
acquiring and storing a mapping coefficient in the second direction according to the magnification factor in the second direction;
and performing second-direction interpolation 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 original image is expanded to obtain an expanded image, 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 a position 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 the pixel values of the last row, the first column and the last column of the extended matrix according to the obtaining mode of the pixel values of the first row of the extended matrix;
and copying the pixel value of the original image to the middle position of the expansion matrix to obtain an expansion image.
3. The image magnification method according to claim 1, wherein the interpolation in the first direction is performed on the extended image according to the mapping coefficient between the target image and the first direction to obtain a first output image, specifically:
acquiring a first coordinate mapping value in a first direction according to the mapping coefficient in the first direction;
according to the first coordinate mapping value in the first direction, obtaining a second coordinate mapping value in the first direction through one-time addition calculation, and sequentially iterating until all coordinate mapping values in the first direction are obtained;
and carrying out interpolation in the first direction on the extended image according to each coordinate mapping value in the first direction to obtain a first output image.
4. The image magnification method according to claim 1, wherein the interpolation in the second direction is performed on the first output image according to the mapping coefficient in the second direction to obtain a target image, specifically:
acquiring 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 in the second direction, obtaining a second coordinate mapping value in the second direction through one-time addition calculation, and sequentially iterating until obtaining all coordinate mapping values in the second direction;
and performing interpolation in the second direction on the extended image according to each coordinate mapping value in the second direction to obtain a target image.
5. An image magnification apparatus, characterized in that the apparatus comprises:
the image expansion unit is used for expanding the original image to obtain an expanded image;
the magnification calculation unit is used for obtaining the magnification of the first direction and the magnification of 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 in the first direction according to the magnification factor in the first direction;
a first interpolation unit, configured to perform interpolation in a first direction on the extended image according to the target image and a mapping coefficient in the first direction, so as to obtain a first output image;
the second mapping unit is used for acquiring and storing the mapping coefficient in the second direction according to the magnification factor in the second direction;
and the second interpolation unit is used for 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.
6. The image magnification device according to claim 5, characterized in that the image expansion unit 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 a position 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 the pixel values of the last row, the first column and the last column of the extended matrix according to the obtaining mode of the pixel values of the first row of the extended matrix; and copying the pixel value of the original image to the middle position of the expansion matrix to obtain an expansion image.
7. The image magnification device according to claim 5, wherein the first interpolation unit is specifically configured to obtain a first-direction first coordinate mapping value according to a first-direction mapping coefficient; according to the first coordinate mapping value in the first direction, obtaining a second coordinate mapping value in the first direction through one-time addition calculation, and sequentially iterating until all coordinate mapping values in the first direction are obtained; and carrying out interpolation in the first direction on the extended image according to each coordinate mapping value in the first direction to obtain a first output image.
8. The image magnification device according to claim 5, wherein the second interpolation unit is specifically configured to obtain a second-direction first coordinate mapping value according to a second-direction mapping coefficient; according to the first coordinate mapping value in the second direction, obtaining a second coordinate mapping value in the second direction through one-time addition calculation, and sequentially iterating until obtaining all coordinate mapping values in the second direction; and performing interpolation in the second direction on the extended image according to each coordinate mapping value in the second direction to obtain a target image.
9. A computer-readable storage medium, comprising a stored program, wherein the program is operable to perform the method of any of claims 1 to 4.
10. A terminal device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, and the processor is arranged to execute the method of any of claims 1 to 4 by means of the computer program.
CN202010295751.6A 2020-04-15 2020-04-15 Image amplification method and device, storage medium and terminal equipment Active CN111476718B (en)

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 true CN111476718A (en) 2020-07-31
CN111476718B 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)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112053283A (en) * 2020-08-13 2020-12-08 深圳市洲明科技股份有限公司 Image scaling method, storage medium and electronic device
CN112215754A (en) * 2020-10-26 2021-01-12 北京达佳互联信息技术有限公司 Image amplification method, device, electronic equipment and storage medium
CN113096045A (en) * 2021-04-14 2021-07-09 深圳市元征科技股份有限公司 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

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020076121A1 (en) * 2000-06-13 2002-06-20 International Business Machines Corporation Image transform method for obtaining expanded image data, image processing apparatus and image display device therefor
CN1901602A (en) * 2006-07-10 2007-01-24 宁波大学 Quick double linear interpolating method in image amplification process
CN101980281A (en) * 2010-09-30 2011-02-23 深圳市理邦精密仪器股份有限公司 Ultrasonic image amplification method and amplification system
CN108986033A (en) * 2018-07-26 2018-12-11 西安电子科技大学 Image-scaling method based on bilinear interpolation algorithm processing
CN109191377A (en) * 2018-07-25 2019-01-11 西安电子科技大学 A kind of image magnification method based on interpolation
CN110223232A (en) * 2019-06-06 2019-09-10 电子科技大学 A kind of video image amplifying method based on bilinear interpolation algorithm

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020076121A1 (en) * 2000-06-13 2002-06-20 International Business Machines Corporation Image transform method for obtaining expanded image data, image processing apparatus and image display device therefor
CN1901602A (en) * 2006-07-10 2007-01-24 宁波大学 Quick double linear interpolating method in image amplification process
CN101980281A (en) * 2010-09-30 2011-02-23 深圳市理邦精密仪器股份有限公司 Ultrasonic image amplification method and amplification system
CN109191377A (en) * 2018-07-25 2019-01-11 西安电子科技大学 A kind of image magnification method based on interpolation
CN108986033A (en) * 2018-07-26 2018-12-11 西安电子科技大学 Image-scaling method based on bilinear interpolation algorithm processing
CN110223232A (en) * 2019-06-06 2019-09-10 电子科技大学 A kind of video image amplifying method based on bilinear interpolation algorithm

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112053283A (en) * 2020-08-13 2020-12-08 深圳市洲明科技股份有限公司 Image scaling method, storage medium and electronic device
CN112053283B (en) * 2020-08-13 2024-05-31 深圳市洲明科技股份有限公司 Image scaling method, storage medium and electronic device
CN112215754A (en) * 2020-10-26 2021-01-12 北京达佳互联信息技术有限公司 Image amplification method, device, electronic equipment and storage medium
CN112215754B (en) * 2020-10-26 2024-01-26 北京达佳互联信息技术有限公司 Image amplifying method, device, electronic equipment and storage medium
CN113096045A (en) * 2021-04-14 2021-07-09 深圳市元征科技股份有限公司 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

Also Published As

Publication number Publication date
CN111476718B (en) 2023-05-05

Similar Documents

Publication Publication Date Title
CN111476718A (en) Image amplification method and device, storage medium and terminal equipment
EP3557484A1 (en) Neural network convolution operation device and method
CN111932437B (en) Image processing method, image processing device, electronic equipment and computer readable storage medium
CN110580324B (en) Image matrix operation method and device, computer equipment and storage medium
CN111724304B (en) Image scaling method and device, terminal equipment and storage medium
CN111210389B (en) Image scaling processing method and device
EP3093757A2 (en) Multi-dimensional sliding window operation for a vector processor
CN114493988A (en) Image blurring method, image blurring device and terminal equipment
CN111617480A (en) Point cloud rendering method and device
CN107977923B (en) Image processing method, image processing device, electronic equipment and computer readable storage medium
CN115965737A (en) Image rendering method and device, terminal equipment and storage medium
CN115147281A (en) Image parameter adjusting method, device, equipment and storage medium
CN115205115A (en) Image amplification method based on bilinear interpolation algorithm
CN113468469A (en) Convolution processing method and device of feature graph executed by computer and electronic equipment
CN111626938B (en) Image interpolation method, image interpolation device, terminal device, and storage medium
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
CN111260559A (en) Image zooming display method and device and terminal equipment
CN113469333B (en) Artificial intelligence processor, method and related products for executing neural network model
CN118036339B (en) Determination method and device for planetary magnetic field model coefficient and electronic equipment
CN117764819A (en) Image processing method, device, electronic equipment and storage medium
JP3777561B2 (en) Texture mapping circuit
CN116416129A (en) Image downsampling processing device and method
CN114895964A (en) Data processing device, method, chip, board card, electronic equipment and storage medium

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