CN111724304A - Image scaling method and device, terminal equipment and storage medium - Google Patents

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

Info

Publication number
CN111724304A
CN111724304A CN202010535203.6A CN202010535203A CN111724304A CN 111724304 A CN111724304 A CN 111724304A CN 202010535203 A CN202010535203 A CN 202010535203A CN 111724304 A CN111724304 A CN 111724304A
Authority
CN
China
Prior art keywords
image
pixel
column direction
scaling
coefficient
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
CN202010535203.6A
Other languages
Chinese (zh)
Other versions
CN111724304B (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 CN202010535203.6A priority Critical patent/CN111724304B/en
Publication of CN111724304A publication Critical patent/CN111724304A/en
Application granted granted Critical
Publication of CN111724304B publication Critical patent/CN111724304B/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 transformation in the plane of the image
    • G06T3/40Scaling the whole image or part thereof
    • G06T3/4023Decimation- or insertion-based scaling, e.g. pixel or line decimation

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Image Processing (AREA)
  • Editing Of Facsimile Originals (AREA)

Abstract

The embodiment of the invention relates to the technical field of image processing, and discloses an image scaling method, an image scaling device, terminal equipment and a storage medium, wherein the image scaling method comprises the steps of obtaining an image scaling ratio according to the resolution of an output image and the resolution of an input image; after the input image is interpolated according to the column direction, the line direction interpolation is carried out again to obtain an interpolated image; obtaining a mapping coefficient of each pixel in the row direction and the column direction of an output image according to the scaling ratio and the interpolation image; according to the mapping coefficient, obtaining a weight coefficient lookup table of the insertion point mapped to the input image; according to the weight coefficient lookup table and the input image, the zoomed output image is obtained, the embodiment of the invention provides that addition and shift operation are used for completely replacing multiplication operation and floating point operation in the conventional bilinear interpolation method by setting the weight coefficient lookup table, the zoomed image does not generate obvious distortion, the occupation of image zooming algorithm resources is reduced, and the zooming of images with various resolutions is met.

Description

Image scaling method and device, terminal equipment and storage medium
Technical Field
The embodiment of the invention relates to the technical field of image processing, in particular to an image scaling method, an image scaling device, terminal equipment and a storage medium.
Background
The terminal devices have a fixed physical resolution, but the resolution of the actual image data may be different from the physical resolution, and in order to correctly display the image, the terminal devices need to scale the actual image to match the image resolution, and the most common scaling is based on a bilinear interpolation algorithm.
The conventional bilinear interpolation image scaling method has too many multiplication steps in the process, and the occupied equipment resources are increased along with the increase of the functions of mobile terminal equipment, so that an image scaling method for saving resources is urgently needed.
Disclosure of Invention
The embodiment of the invention mainly solves the technical problem of providing an image scaling method, an image scaling device, a terminal device and a storage medium, and can solve the problem that the existing image scaling method occupies more resources.
In order to solve the above technical problem, in a first aspect, an embodiment of the present invention adopts a technical solution that: there is provided an image scaling method including:
obtaining an image scaling ratio according to the resolution of the output image and the resolution of the input image, wherein the scaling ratio comprises a row direction scaling ratio and a column direction scaling ratio;
respectively interpolating the input image according to the column direction and the row direction to obtain an interpolation image;
obtaining a mapping coefficient of each pixel in the row direction and the column direction of an output image according to the scaling ratio and the interpolation image;
according to the mapping coefficient, obtaining a weight coefficient lookup table of the insertion point mapped to the input image;
and obtaining a zoomed output image according to the weight coefficient lookup table and the input image.
Further, the interpolating the input image according to the column direction and the row direction respectively to obtain an interpolated image specifically includes:
performing column direction interpolation on the input image;
and performing line direction interpolation on the image subjected to the column direction interpolation to obtain an interpolated image.
Further, the obtaining a mapping coefficient of each pixel in a row direction and a column direction of the output image according to the scaling ratio and the interpolated image specifically includes:
acquiring a mapping coefficient of a first pixel in the row direction, and acquiring the mapping coefficient of each pixel in the row direction one by taking the row direction scaling ratio as a step length on the basis of the mapping coefficient of the first pixel in the row direction;
and acquiring the mapping coefficient of the first pixel in the column direction, and acquiring the mapping coefficients of each pixel in the column direction one by taking the column direction scaling ratio as a step length on the basis of the mapping coefficient of the first pixel in the column direction.
Further, the obtaining of the weight coefficient lookup table mapping the insertion point to the input image according to the mapping coefficient specifically includes:
respectively acquiring a column direction weight coefficient pair and a row direction weight coefficient pair according to the mapping coefficient of the insertion point and the position point of the adjacent pixel of the insertion point;
setting the distance between two adjacent pixel points of an input image as a preset length, and dividing the preset length into N equal intervals, wherein N is an integer power of 2;
and generating a weight coefficient lookup table with the insertion points mapped to the input image according to the equally divided intervals, the column direction weight coefficient pairs and the row direction weight coefficient pairs.
Further, the N is 8.
Further, the obtaining of the scaled output image according to the weight coefficient lookup table and the input image specifically includes:
and interpolating the input image according to the weight coefficient pair in the corresponding equally divided interval in the weight coefficient lookup table to obtain a zoomed output image.
In order to solve the above technical problem, in a second aspect, another technical solution adopted in the embodiment of the present invention is: there is provided an image scaling apparatus including:
a ratio acquisition unit configured to obtain an image scaling ratio including a row-direction scaling ratio and a column-direction scaling ratio, according to a resolution of an output image and a resolution of an input image;
the image interpolation unit is used for carrying out line direction interpolation again after the input image is interpolated according to the column direction to obtain an interpolated image;
the coefficient acquisition unit is used for acquiring the mapping coefficient of each pixel in the row direction and the column direction of the output image according to the scaling ratio and the interpolation image;
the lookup table acquisition unit is used for acquiring a weight coefficient lookup table of the insertion point mapped to the input image according to the mapping coefficient;
and the image scaling unit is used for obtaining a scaled output image according to the weight coefficient lookup table and the input image.
Further, the image interpolation unit includes:
the first interpolation module is used for carrying out column direction interpolation on the input image;
and the second interpolation module is used for carrying out line direction interpolation on the image subjected to the column direction interpolation again to obtain an interpolation image.
Further, the coefficient acquisition unit includes:
the first obtaining module is used for obtaining the mapping coefficient of the first pixel in the row direction, and obtaining the mapping coefficients of all the pixels in the row direction one by taking the row direction scaling ratio as a step length on the basis of the mapping coefficient of the first pixel in the row direction;
and the second acquisition module is used for acquiring the mapping coefficient of the first pixel in the column direction, and acquiring the mapping coefficients of each pixel in the column direction one by taking the scaling ratio in the column direction as a step length on the basis of the mapping coefficient of the first pixel in the column direction.
Further, the lookup table acquisition unit includes:
the weight obtaining module is used for respectively obtaining a column direction weight coefficient pair and a row direction weight coefficient pair according to the mapping coefficient of the insertion point and the position point of the adjacent pixel of the insertion point;
the interval obtaining module is used for setting the distance between two adjacent pixel points of the input image as a preset length, and dividing the preset length into N equal intervals, wherein N is an integer power of 2;
and the lookup table acquisition module is used for generating a weight coefficient lookup table of which the insertion points are mapped to the input image by equally dividing intervals, column direction weight coefficient pairs and row direction weight coefficient pairs.
Further, the N is 8.
Further, the image scaling unit is specifically configured to interpolate the input image according to the weight coefficient pair in the corresponding equally-divided interval in the weight coefficient lookup table, so as to obtain a scaled output image.
In order to solve the foregoing technical problem, in a third aspect, an embodiment of the present invention further provides a terminal device, including:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of the first aspect as described above.
In order to solve the above technical problem, in a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium storing computer-executable instructions for causing a computer to perform the method according to the first aspect.
In order to solve the above technical problem, in a fifth aspect, the present invention further provides a computer program product, which includes a computer program stored on a computer-readable storage medium, the computer program including program instructions, which, when executed by a computer, cause the computer to execute the method according to the first aspect.
The embodiment of the invention has the beneficial effects that: in contrast to the state of the art, embodiments of the present invention provide an image scaling method, apparatus, terminal device, and storage medium, the method obtaining an image scaling ratio including a row-direction scaling ratio and a column-direction scaling ratio by obtaining the image scaling ratio according to a resolution of an output image and a resolution of an input image; after the input image is interpolated according to the column direction, the line direction interpolation is carried out again; obtaining a mapping coefficient of each pixel in the row direction and the column direction of an output image according to the scaling ratio and the interpolation image; according to the mapping coefficient, obtaining a weight coefficient lookup table of the insertion point mapped to the input image; according to the embodiment of the invention, by setting the weight coefficient lookup table, the addition and the shift operation are completely used for replacing the multiplication operation and the floating point operation in the conventional bilinear interpolation method, and the zoomed image does not generate obvious distortion, so that the occupation of image zooming algorithm resources is reduced, and the zoomed output image of various resolution images is obtained.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required to be used in the embodiments of the present invention will be briefly described below. It is obvious that the drawings described below are only some embodiments of the invention, and that for a person skilled in the art, other drawings can be derived from them without inventive effort.
FIG. 1 is a flow chart of an image scaling method according to an embodiment of the present invention;
FIG. 2 is a schematic structural diagram of an image scaling apparatus according to an embodiment of the present invention;
fig. 3 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 present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
It should be noted that, if not conflicted, the various features of the embodiments of the invention may be combined with each other within the scope of protection of the invention. Additionally, while functional block divisions are performed in apparatus schematics, with logical sequences shown in flowcharts, in some cases, steps shown or described may be performed in sequences other than block divisions in apparatus or flowcharts.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. The terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used herein, the term "and/or" includes any and all combinations of one or more of the associated listed items.
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.
Specifically, the embodiments of the present invention will be further explained below with reference to the drawings.
As shown in fig. 1, an embodiment of the present invention provides an image scaling method, which may be executed by a terminal device, and shows a flowchart of the image scaling method, and the method includes, but is not limited to, the following steps:
step 11: image scaling ratios are obtained according to the resolution of the output image and the resolution of the input image, the scaling ratios including a row-direction scaling ratio and a column-direction scaling ratio.
In the embodiment of the present invention, the image scaling ratio is a ratio at which the image is reduced or enlarged, and the scaling ratio includes a row-direction scaling ratio and a column-direction scaling ratio. The resolution of the input image is src _ w × src _ h, the resolution of the output image is dst _ w × dst _ h, the row-direction scaling ratio h is src _ w/dst _ w, and the column-direction scaling ratio v is src _ h/dst _ h.
Step 12: and after the input image is interpolated according to the column direction, carrying out line direction interpolation again to obtain an interpolated image.
In the embodiment of the invention, the conventional bilinear interpolation formula is subjected to fractional interpolation, and the bilinear interpolation formula is as follows:
Figure RE-GDA0002595934230000061
x, y are mapping coefficients of the insertion point, x1、x2、y1、y2For the position points of the adjacent pixels of the insertion point, f11、f12、f21、f22Are mapped to adjacent pixel values on the input image line for the interpolation point. Specifically, the input image is interpolated in the row and column directions by a column direction scaling formula, wherein the column direction scaling formula
Figure RE-GDA0002595934230000062
Then, the image after the column interpolation is interpolated through a line direction scaling formula, wherein the line direction scaling formula
Figure RE-GDA0002595934230000063
An interpolated image is obtained where fx1, fx2 are the adjacent pixel values on the column scaled column. This step enables scaling of the input image resolution src _ w _ src _ h to src _ w _ dst _ h and then to dst _ w _ dst _ h.
Step 13: and obtaining the mapping coefficient of each pixel in the row direction and the column direction of the output image according to the scaling ratio and the interpolation image.
In the embodiment of the invention, the mapping coefficient of the first pixel in the row direction is obtained, and on the basis of the mapping coefficient of the first pixel in the row direction, the row direction scaling ratio is taken as a step length to obtain the mapping coefficients of each pixel in the row direction one by one; and acquiring the mapping coefficient of the first pixel in the column direction, and acquiring the mapping coefficients of each pixel in the column direction one by taking the column direction scaling ratio as a step length on the basis of the mapping coefficient of the first pixel in the column direction. Since the scaling ratio of each row is the same and one row mapping coefficient is shared, the row mapping coefficient is v, and v is the column direction scaling in step 11. There is a characteristic between two adjacent pixels in the same row, that is, the mapping coefficient of the next pixel is the mapping coefficient of the previous pixel plus v, for example: the mapping coefficient of the initial pixel of each row is defined as 0, so that the mapping coefficient of the first pixel of the same row is 0, the mapping coefficient of the second pixel is v, the mapping coefficient of the third pixel is 2 x v, the row mapping coefficient of the fourth pixel is 3 x v, and so on. Therefore, only the value of v needs to be saved, and the calculation of the mapping coefficient of the subsequent pixel on the same line only needs to add v on the basis of the mapping coefficient of the adjacent previous pixel. In the same way, the column mapping coefficient shared in the column direction is h, h is the scaling in the row direction in step 11, only the value of h needs to be saved, and the calculation of the pixel point mapping coefficient on the subsequent column only needs to add h on the basis of the mapping coefficient of the previous pixel in the same column.
Step 14: and obtaining a weight coefficient lookup table of the insertion point mapped to the input image according to the mapping coefficient.
Step 15: and obtaining a zoomed output image according to the weight coefficient lookup table and the input image.
An embodiment of the present invention provides an image scaling method, which obtains an image scaling ratio including a row direction scaling ratio and a column direction scaling ratio according to a resolution of an output image and a resolution of an input image; after the input image is interpolated according to the column direction, carrying out line direction interpolation again to obtain an interpolated image; obtaining a mapping coefficient of each pixel in the row direction and the column direction of an output image according to the scaling ratio and the interpolation image; according to the mapping coefficient, obtaining a weight coefficient lookup table of the insertion point mapped to the input image; according to the embodiment of the invention, by setting the weight coefficient lookup table, the addition and the shift operation are completely used for replacing the multiplication operation and the floating point operation in the conventional bilinear interpolation method, and the zoomed image does not generate obvious distortion, so that the occupation of image zooming algorithm resources is reduced, and the zoomed output image of various resolution images is obtained.
In some embodiments, the sub-process of step 14 in the above method, where step 14 specifically includes the following sub-steps:
substep 141: respectively acquiring a column direction weight coefficient pair and a row direction weight coefficient pair according to the mapping coefficient of the insertion point and the position point of the adjacent pixel of the insertion point;
in an embodiment of the invention, a column scaling formula of an input image
Figure RE-GDA0002595934230000081
Determine the column direction weight coefficient pair
Figure RE-GDA0002595934230000082
Similarly, the pair of column direction weight coefficients is
Figure RE-GDA0002595934230000083
Substep 142: setting the distance between two adjacent pixel points of an input image as a preset length, and dividing the preset length into N equal intervals, wherein N is an integer power of 2;
in the embodiment of the present invention, preferably, N is 8. The distance between two adjacent pixel points of the input image is set as the unit length, and the interval of the unit length is divided into 8 equal parts. I.e., [0,1/8), [1/8,2/8), [2/8,3/8), [3/8,4/8), [4/8,5/8), [5/8,6/8),
[6/8,7/8),[7/8,1]。
substep 143: and generating a weight coefficient lookup table with the insertion points mapped to the input image according to the equally divided intervals, the column direction weight coefficient pairs and the row direction weight coefficient pairs.
In the embodiment of the invention, the weight coefficient pair corresponding to each equally divided interval forms a lookup table, and only x-x needs to be judged1The corresponding weight coefficient can be directly extracted from any one of the 8 intervals, as shown in the following table:
Figure RE-GDA0002595934230000084
Figure RE-GDA0002595934230000091
for example, when the input image resolution is 4 × 4 and the output image resolution is 3 × 3, taking column scaling as an example, the column is scaled down 3/4 times and the vertical scaling ratio is 4/3, the output image is mapped to the input image with mapping coefficients of 0, 4/3, 8/3 according to step 13. According to step 14, mapping coefficients with distances of 0, 1/3, 2/3 from the left neighboring pixel position are obtained, belonging to [0,1/8 ], [2/8,3/8 ], [5/8,6/8), respectively, thus obtaining weight coefficient pairs (1, 0), (6/8, 2/8), (3/8, 5/8).
In some embodiments, in the sub-process of step 15 in the foregoing method, the step 15 specifically includes: and interpolating the input image according to the weight coefficient pair in the corresponding equally divided interval in the weight coefficient lookup table to obtain a zoomed output image. And obtaining corresponding weight coefficient pairs by the pixel values of the input image through a weight coefficient lookup table, and further outputting the pixel values corresponding to the image so as to obtain an output image with corresponding resolution.
The present invention further provides an embodiment of an image scaling device, please refer to fig. 2, which is a schematic structural diagram of an image scaling device provided in the embodiment of the present invention, and the image scaling device includes: a ratio acquisition unit 21, an image interpolation unit 22, a coefficient acquisition unit 23, a lookup table acquisition unit 24, and an image scaling unit 25, which are connected in this order.
Wherein the ratio obtaining unit 21 is configured to obtain an image scaling ratio including a row-direction scaling ratio and a column-direction scaling ratio according to a resolution of the output image and a resolution of the input image;
an image interpolation unit 22, configured to perform line direction interpolation again after interpolating the input image in the column direction, to obtain an interpolated image;
a coefficient obtaining unit 23, configured to obtain a mapping coefficient of each pixel in a row direction and a column direction of an output image according to the scaling ratio and the interpolated image;
a lookup table obtaining unit 24, configured to obtain a weight coefficient lookup table in which the insertion point is mapped to the input image according to the mapping coefficient;
and the image scaling unit 25 is used for obtaining a scaled output image according to the weight coefficient lookup table and the input image.
In some embodiments, the image interpolation unit 22 specifically includes:
the first interpolation module is used for carrying out column direction interpolation on the input image;
and the second interpolation module is used for carrying out line direction interpolation on the image subjected to the column direction interpolation again to obtain an interpolation image.
In some embodiments, the coefficient obtaining unit 23 specifically includes:
the first obtaining module is used for obtaining the mapping coefficient of the first pixel in the row direction, and obtaining the mapping coefficients of all the pixels in the row direction one by taking the row direction scaling ratio as a step length on the basis of the mapping coefficient of the first pixel in the row direction;
and the second acquisition module is used for acquiring the mapping coefficient of the first pixel in the column direction, and acquiring the mapping coefficients of each pixel in the column direction one by taking the scaling ratio in the column direction as a step length on the basis of the mapping coefficient of the first pixel in the column direction.
In some embodiments, the look-up table obtaining unit 24 includes:
the weight obtaining module is used for respectively obtaining a column direction weight coefficient pair and a row direction weight coefficient pair according to the mapping coefficient of the insertion point and the position point of the adjacent pixel of the insertion point;
the interval obtaining module is used for setting the distance between two adjacent pixel points of the input image as a preset length, and dividing the preset length into N equal intervals, wherein N is an integer power of 2;
and the lookup table acquisition module is used for generating a weight coefficient lookup table of which the insertion points are mapped to the input image by equally dividing intervals, column direction weight coefficient pairs and row direction weight coefficient pairs.
In some embodiments, the N is 8.
In some embodiments, the image scaling unit 25 is specifically configured to interpolate the input image according to the weight coefficient pairs in the corresponding equally divided intervals in the weight coefficient lookup table to obtain the scaled output image
It should be noted that, since the image scaling apparatus in the present embodiment is based on the same inventive concept as the method embodiment, the corresponding content in the method embodiment is also applicable to the apparatus embodiment, and is not described in detail herein.
Fig. 3 is a schematic structural diagram of a terminal device according to an embodiment of the present invention, where the terminal device is a hardware structure capable of executing the image scaling method shown in fig. 1. The terminal device includes:
at least one processor 310; and a memory 320 communicatively coupled to the at least one processor 310, one processor 310 being illustrated in fig. 3. The memory 320 stores instructions executable by the at least one processor 310 to enable the at least one processor 310 to perform the image scaling method described above with respect to fig. 1. The processor 310 and the memory 320 may be connected by a bus or other means, and fig. 3 illustrates an example of a connection by a bus.
The memory 320 is a non-volatile computer-readable storage medium, and can be used for storing non-volatile software programs, non-volatile computer-executable programs, and modules, such as program instructions/modules corresponding to the image scaling method in the embodiment of the present application, for example, the modules shown in fig. 2. The processor 310 executes various functional applications of the server and data processing by running nonvolatile software programs, instructions and modules stored in the memory 320, that is, implements the image scaling method of the above-described method embodiment.
The memory 320 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the image scaling device, and the like. Further, the memory 320 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 320 may optionally include memory located remotely from processor 310, which may be connected to an image scaling device 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 one or more modules are stored in the memory 320 and when executed by the one or more processors 310 perform the image scaling method in any of the method embodiments described above, e.g., perform the method steps of fig. 1 described above, implementing the functionality of the modules and units in fig. 2.
The product can execute the method provided by the embodiment of the application, and has the corresponding functional modules and beneficial effects of the execution method. For technical details that are not described in detail in this embodiment, reference may be made to the methods provided in the embodiments of the present application.
Embodiments of the present invention also provide a non-transitory computer-readable storage medium storing computer-executable instructions for execution by one or more processors, e.g., to perform the method steps of fig. 1 described above, to implement the functions of the modules in fig. 2.
Embodiments of the present invention also provide a computer program product comprising a computer program stored on a non-volatile computer-readable storage medium, the computer program comprising program instructions that, when executed by a computer, cause the computer to perform the image scaling method in any of the above-described method embodiments, e.g. to perform the method steps of fig. 1 described above, implementing the functions of the modules in fig. 2.
The embodiment of the invention provides an image scaling method, an image scaling device, terminal equipment and a storage medium, wherein the method obtains an image scaling ratio according to the resolution of an output image and the resolution of an input image, and the scaling ratio comprises a row direction scaling ratio and a column direction scaling ratio; after the input image is interpolated according to the column direction, carrying out line direction interpolation again to obtain an interpolated image; obtaining a mapping coefficient of each pixel in the row direction and the column direction of an output image according to the scaling ratio and the interpolation image; according to the mapping coefficient, obtaining a weight coefficient lookup table of the insertion point mapped to the input image; according to the embodiment of the invention, by setting the weight coefficient lookup table, the addition and the shift operation are completely used for replacing the multiplication operation and the floating point operation in the conventional bilinear interpolation method, and the zoomed image does not generate obvious distortion, so that the occupation of image zooming algorithm resources is reduced, and the zoomed output image of various resolution images is obtained.
It should be noted that the above-described device embodiments are merely illustrative, where the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on multiple network 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. It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware related to instructions of a computer program, which can be stored in a computer readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
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 invention.

Claims (10)

1. An image scaling method, characterized in that the method comprises:
obtaining an image scaling ratio according to the resolution of the output image and the resolution of the input image, wherein the scaling ratio comprises a row direction scaling ratio and a column direction scaling ratio;
after the input image is interpolated according to the column direction, carrying out line direction interpolation again to obtain an interpolated image;
obtaining a mapping coefficient of each pixel in the row direction and the column direction of an output image according to the scaling ratio and the interpolation image;
according to the mapping coefficient, obtaining a weight coefficient lookup table of the insertion point mapped to the input image;
and obtaining a zoomed output image according to the weight coefficient lookup table and the input image.
2. The image scaling method according to claim 1, wherein the performing line direction interpolation again after interpolating the input image in the column direction to obtain the interpolated image specifically comprises:
performing column direction interpolation on the input image;
and performing line direction interpolation on the image subjected to the column direction interpolation again to obtain an interpolated image.
3. The image scaling method according to claim 1, wherein the obtaining of the mapping coefficient of each pixel in the row direction and the column direction of the output image according to the scaling ratio and the interpolated image specifically comprises:
acquiring a mapping coefficient of a first pixel in the row direction, and acquiring the mapping coefficient of each pixel in the row direction one by taking the row direction scaling ratio as a step length on the basis of the mapping coefficient of the first pixel in the row direction;
and acquiring the mapping coefficient of the first pixel in the column direction, and acquiring the mapping coefficients of each pixel in the column direction one by taking the column direction scaling ratio as a step length on the basis of the mapping coefficient of the first pixel in the column direction.
4. The image scaling method according to claim 1, wherein said obtaining a look-up table of weight coefficients for mapping an insertion point to an input image based on the mapping coefficients comprises:
respectively acquiring a column direction weight coefficient pair and a row direction weight coefficient pair according to the mapping coefficient of the insertion point and the position point of the adjacent pixel of the insertion point;
setting the distance between two adjacent pixel points of an input image as a preset length, and dividing the preset length into N equal intervals, wherein N is an integer power of 2;
and generating a weight coefficient lookup table with the insertion points mapped to the input image according to the equally divided intervals, the column direction weight coefficient pairs and the row direction weight coefficient pairs.
5. The image scaling method of claim 4, wherein N is 8.
6. The image scaling method according to claim 4, wherein obtaining the scaled output image according to the weight coefficient lookup table and the input image specifically comprises:
and interpolating the input image according to the weight coefficient pair in the corresponding equally divided interval in the weight coefficient lookup table to obtain a zoomed output image.
7. An image scaling apparatus, characterized in that the apparatus comprises:
a ratio acquisition unit configured to obtain an image scaling ratio including a row-direction scaling ratio and a column-direction scaling ratio, according to a resolution of an output image and a resolution of an input image;
the image interpolation unit is used for carrying out line direction interpolation again after the input image is interpolated according to the column direction to obtain an interpolated image;
the coefficient acquisition unit is used for acquiring the mapping coefficient of each pixel in the row direction and the column direction of the output image according to the scaling ratio and the interpolation image;
the lookup table acquisition unit is used for acquiring a weight coefficient lookup table of the insertion point mapped to the input image according to the mapping coefficient;
and the image scaling unit is used for obtaining a scaled output image according to the weight coefficient lookup table and the input image.
8. The image scaling apparatus according to claim 7, wherein said coefficient acquisition unit includes:
the first obtaining module is used for obtaining the mapping coefficient of the first pixel in the row direction, and obtaining the mapping coefficients of all the pixels in the row direction one by taking the row direction scaling ratio as a step length on the basis of the mapping coefficient of the first pixel in the row direction;
and the second acquisition module is used for acquiring the mapping coefficient of the first pixel in the column direction, and acquiring the mapping coefficients of each pixel in the column direction one by taking the scaling ratio in the column direction as a step length on the basis of the mapping coefficient of the first pixel in the column direction.
9. A terminal device, comprising:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the image scaling method of any of claims 1-6.
10. A non-transitory computer-readable storage medium storing computer-executable instructions for causing a computer to perform the image scaling method according to any one of claims 1 to 6.
CN202010535203.6A 2020-06-12 2020-06-12 Image scaling method and device, terminal equipment and storage medium Active CN111724304B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010535203.6A CN111724304B (en) 2020-06-12 2020-06-12 Image scaling method and device, terminal equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010535203.6A CN111724304B (en) 2020-06-12 2020-06-12 Image scaling method and device, terminal equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111724304A true CN111724304A (en) 2020-09-29
CN111724304B CN111724304B (en) 2024-04-19

Family

ID=72566577

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010535203.6A Active CN111724304B (en) 2020-06-12 2020-06-12 Image scaling method and device, terminal equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111724304B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112215751A (en) * 2020-10-13 2021-01-12 Oppo广东移动通信有限公司 Image scaling method, image scaling device and terminal equipment
CN114022366A (en) * 2022-01-06 2022-02-08 深圳鲲云信息科技有限公司 Image size adjusting structure based on data stream architecture, image size adjusting method based on data stream architecture and image size adjusting equipment based on data stream architecture
CN114915803A (en) * 2021-02-08 2022-08-16 明俐科技有限公司 Real-time image scaling device and method

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102752588A (en) * 2011-04-22 2012-10-24 北京大学深圳研究生院 Video encoding and decoding method using space zoom prediction
CN106204453A (en) * 2016-07-14 2016-12-07 京东方科技集团股份有限公司 The interpolation method of a kind of image and device
CN109903224A (en) * 2019-01-25 2019-06-18 珠海市杰理科技股份有限公司 Image-scaling method, device, computer equipment and storage medium
CN110223232A (en) * 2019-06-06 2019-09-10 电子科技大学 A kind of video image amplifying method based on bilinear interpolation algorithm
CN111131740A (en) * 2019-12-03 2020-05-08 中国航空工业集团公司洛阳电光设备研究所 VESA time sequence real-time conversion method for realizing arbitrary scaling
CN111200716A (en) * 2020-01-08 2020-05-26 珠海亿智电子科技有限公司 Precision compensation method, system and storage medium for feature mapping scaling

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102752588A (en) * 2011-04-22 2012-10-24 北京大学深圳研究生院 Video encoding and decoding method using space zoom prediction
CN106204453A (en) * 2016-07-14 2016-12-07 京东方科技集团股份有限公司 The interpolation method of a kind of image and device
CN109903224A (en) * 2019-01-25 2019-06-18 珠海市杰理科技股份有限公司 Image-scaling method, device, computer equipment and storage medium
CN110223232A (en) * 2019-06-06 2019-09-10 电子科技大学 A kind of video image amplifying method based on bilinear interpolation algorithm
CN111131740A (en) * 2019-12-03 2020-05-08 中国航空工业集团公司洛阳电光设备研究所 VESA time sequence real-time conversion method for realizing arbitrary scaling
CN111200716A (en) * 2020-01-08 2020-05-26 珠海亿智电子科技有限公司 Precision compensation method, system and storage medium for feature mapping scaling

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
史再峰;姚素英;赵雷;刘丰;: "基于边缘方向插值的视频缩放算法及电路设计", 吉林大学学报(工学版), no. 04 *
李琼;曾延安;: "基于FPGA的双通道全景图像采集系统研制", 常州信息职业技术学院学报, no. 05 *
郑红;李俊;陈海霞;李钊;: "红外畸变图像并行校正快速实现算法研究", 仪器仪表学报, no. 11 *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112215751A (en) * 2020-10-13 2021-01-12 Oppo广东移动通信有限公司 Image scaling method, image scaling device and terminal equipment
CN114915803A (en) * 2021-02-08 2022-08-16 明俐科技有限公司 Real-time image scaling device and method
TWI824323B (en) * 2021-02-08 2023-12-01 明俐科技有限公司 Scaling device of real-time image and scaling method for using the same
CN114915803B (en) * 2021-02-08 2024-03-15 明俐科技有限公司 Real-time image zooming device and zooming method
CN114022366A (en) * 2022-01-06 2022-02-08 深圳鲲云信息科技有限公司 Image size adjusting structure based on data stream architecture, image size adjusting method based on data stream architecture and image size adjusting equipment based on data stream architecture
CN114022366B (en) * 2022-01-06 2022-03-18 深圳鲲云信息科技有限公司 Image size adjusting device, adjusting method and equipment based on data stream architecture

Also Published As

Publication number Publication date
CN111724304B (en) 2024-04-19

Similar Documents

Publication Publication Date Title
EP3754591A1 (en) Image processing method and device, storage medium and electronic device
CN111724304B (en) Image scaling method and device, terminal equipment and storage medium
CN106780336B (en) Image reduction method and device
CN111476718B (en) Image amplification method and device, storage medium and terminal equipment
CN111210389B (en) Image scaling processing method and device
CN114298900A (en) Image super-resolution method and electronic equipment
CN113538271A (en) Image display method, image display device, electronic equipment and computer readable storage medium
US20150029240A1 (en) Data interpolation method and system
CN109102463B (en) Super-resolution image reconstruction method and device
EP3301908A1 (en) Numerical image conversion method and device, and storage medium and device
JPH10208030A (en) Image processor and processing method
US8412003B2 (en) Image processing methods, apparatus and computer program products using interdependent pixel interpolation operations
CN106296614B (en) Image processing apparatus and image processing method
CN112801876A (en) Information processing method, information processing device, electronic equipment and storage medium
CN109996085B (en) Model training method, image processing method and device and electronic equipment
CN115190263B (en) Video scaling method, device, equipment and storage medium
CN107977923B (en) Image processing method, image processing device, electronic equipment and computer readable storage medium
US9594955B2 (en) Modified wallis filter for improving the local contrast of GIS related images
TWI540537B (en) Method and device for image zoom out processing
CN107240064B (en) Image correction method and device and terminal
CN111260559B (en) Image zooming display method and device and terminal equipment
CN113538525A (en) Optical flow estimation method, model training method and corresponding device
CN110363723B (en) Image processing method and device for improving image boundary effect
CN113962892A (en) Method and device for correcting wide-angle lens image distortion and photographic equipment
CN111093045A (en) Method and device for scaling video sequence resolution

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

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.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant