CN111724304B - 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
CN111724304B
CN111724304B CN202010535203.6A CN202010535203A CN111724304B CN 111724304 B CN111724304 B CN 111724304B CN 202010535203 A CN202010535203 A CN 202010535203A CN 111724304 B CN111724304 B CN 111724304B
Authority
CN
China
Prior art keywords
image
pixel
scaling
coefficient
column direction
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010535203.6A
Other languages
Chinese (zh)
Other versions
CN111724304A (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

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/4023Scaling of whole images or parts thereof, e.g. expanding or contracting based on decimating pixels or lines of pixels; based on inserting pixels or lines of pixels

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; performing row direction interpolation again after interpolating an input image according to the column direction to obtain an interpolation image; 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; obtaining a weight coefficient lookup table of the insertion point mapped to the input image according to the mapping coefficient; according to the weight coefficient lookup table and the input image, the scaled output image is obtained, and the embodiment of the invention provides that the addition and shift operation are used for completely replacing multiplication operation and floating point operation in the existing bilinear interpolation method by setting the weight coefficient lookup table, the scaled image is not obviously distorted, the occupation of image scaling algorithm resources is reduced, and the scaling of images with various resolutions is satisfied.

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 device has a fixed physical resolution and the resolution of the actual image data may be different from the physical resolution, and in order to correctly display the image, the terminal device needs to scale the actual image, most often based on bilinear interpolation algorithm, to match the image resolution.
The existing bilinear interpolation image scaling method has too many process multiplication steps, and as the functions of mobile terminal equipment are increased, the occupied equipment resources are increased, so that a resource-saving image scaling method is needed.
Disclosure of Invention
The embodiment of the invention mainly solves the technical problem of providing an image scaling method, an image scaling device, terminal equipment 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 problems, in a first aspect, a technical solution adopted in an embodiment of the present invention is: 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 interpolated image;
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;
obtaining a weight coefficient lookup table of the insertion point mapped to the input image according to the mapping coefficient;
And obtaining a scaled 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, and obtaining the interpolated image specifically includes:
Performing column direction interpolation on the input image;
and carrying out row direction interpolation on the image subjected to column direction interpolation to obtain an interpolation image.
Further, the 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 specifically includes:
Acquiring a mapping coefficient of a first pixel in a row direction, and on the basis of the mapping coefficient of the first pixel in the row direction, taking the scaling ratio in the row direction as a step length to acquire the mapping coefficient of each pixel in the row direction one by one;
and acquiring a mapping coefficient of the first pixel in the column direction, and on the basis of the mapping coefficient of the first pixel in the column direction, taking the scaling ratio in the column direction as a step length to acquire the mapping coefficient of each pixel in the column direction one by one.
Further, the obtaining the weight coefficient lookup table of the insertion point mapped 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, dividing the preset length into N equal division intervals, wherein N is an integer power of 2;
And generating a weight coefficient lookup table of mapping the insertion point to the input image by equally dividing the interval, the column direction weight coefficient pair and the row direction weight coefficient pair.
Further, N is 8.
Further, the obtaining 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 pairs in the corresponding equal division intervals in the weight coefficient lookup table to obtain a scaled output image.
In order to solve the above technical problems, 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 for acquiring an image scaling ratio including a row-direction scaling ratio and a column-direction scaling ratio from a resolution of an output image and a resolution of an input image;
the image interpolation unit is used for interpolating the input image according to the column direction and then interpolating the input image in the row direction again to obtain an interpolation 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 performing column direction interpolation on the input image;
And the second interpolation module is used for carrying out row direction interpolation on the image subjected to column direction interpolation again to obtain an interpolation image.
Further, the coefficient acquisition unit includes:
the first acquisition module is used for acquiring the mapping coefficient of the first pixel in the row direction, and based on the mapping coefficient of the first pixel in the row direction, the mapping coefficient of each pixel in the row direction is acquired one by taking the row direction scaling ratio as a step length;
The second obtaining module is used for obtaining the mapping coefficient of the first pixel in the column direction, and based on the mapping coefficient of the first pixel in the column direction, the mapping coefficient of each pixel in the column direction is obtained one by taking the scaling ratio in the column direction as a step length.
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, dividing the preset length into N equal-division intervals, wherein N is an integer power of 2;
The lookup table acquisition module is used for generating a weight coefficient lookup table with the insertion points mapped to the input image by equally dividing the interval, the column direction weight coefficient pair and the row direction weight coefficient pair.
Further, 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 equal division 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
A memory communicatively coupled to the at least one processor; wherein,
The memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method as described above in the first aspect.
To solve the above technical problem, in a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, where computer-executable instructions are stored, where the computer-executable instructions are configured to cause a computer to perform the method according to the first aspect.
To solve the above technical problem, in a fifth aspect, an embodiment of 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 perform the method as described in the first aspect above.
The embodiment of the invention has the beneficial effects that: unlike the prior art, embodiments of the present invention provide an image scaling method, apparatus, terminal device, and storage medium, which obtain an image scaling ratio by obtaining a row-direction scaling ratio and a column-direction scaling ratio from a resolution of an output image and a resolution of an input image; performing row direction interpolation again after interpolating the input image according to the column direction; 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; obtaining a weight coefficient lookup table of the insertion point mapped to the input image according to the mapping coefficient; according to the weight coefficient lookup table and the input image, the scaled output image is obtained, and according to the embodiment of the invention, the addition and shift operation is used to completely replace multiplication operation and floating point operation in the existing bilinear interpolation method, the scaled image is not obviously distorted, the occupation of image scaling algorithm resources is reduced, and the scaling of images with various resolutions is satisfied.
Drawings
In order to more clearly illustrate the technical solution of the embodiments of the present invention, the drawings that are required to be used in the embodiments of the present invention will be briefly described below. It is evident that the drawings described below are only some embodiments of the present invention and that other drawings may be obtained from these drawings without inventive effort for a person of ordinary skill in the art.
FIG. 1 is a flowchart of an image scaling method according to an embodiment of the present invention;
Fig. 2 is a schematic structural diagram of an image scaling device 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
The present invention will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present invention more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
It should be noted that, if not in conflict, the features of the embodiments of the present invention may be combined with each other, which is within the protection scope of the present invention. In addition, while functional block division is performed in a device diagram and logical order is shown in a flowchart, in some cases, the steps shown or described may be performed in a different order than the block division in the device, or in the flowchart.
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. The term "and/or" as used in this specification includes any and all combinations of one or more of the associated listed items.
In addition, the technical features of the embodiments of the present invention described below may be combined with each other as long as they do not collide with each other.
In particular, embodiments of the present invention are further described below with reference to the accompanying drawings.
As shown in fig. 1, an embodiment of the present invention provides an image scaling method, which may be performed by a terminal device, and which shows a flowchart of the image scaling method, the method including, but not limited to, the steps of:
step 11: an image scaling ratio is obtained from the resolution of the output image and the resolution of the input image, the scaling ratio comprising a row-direction scaling ratio and a column-direction scaling ratio.
In an embodiment of the present invention, the image scaling ratio is a ratio of image reduction or enlargement, 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=src_w/dst_w, and the column-direction scaling ratio v=src_h/dst_h.
Step 12: and interpolating the input image according to the column direction, and then interpolating again in the row direction to obtain an interpolation image.
In the embodiment of the invention, the existing bilinear interpolation formula is subjected to the fractional interpolation, and the bilinear interpolation formula is as follows:
X and y are mapping coefficients of the insertion point, x 1、x2、y1、y2 is a position point of a pixel adjacent to the insertion point, and f 11、f12、f21、f22 is a value of a pixel adjacent to the interpolation point on the input image line. Specifically, the input image is subjected to row direction interpolation through a row direction scaling formula, wherein the row direction scaling formula is used for Then, interpolating the image after column interpolation through a row direction scaling formula, wherein the row direction scaling formula/>An interpolated image is obtained, where fx1, fx2 are the pixel values adjacent to the column after column scaling. 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 the mapping coefficient of each pixel in the row direction is obtained one by taking the scaling ratio in the row direction as the step length on the basis of the mapping coefficient of the first pixel in the row direction; and acquiring a mapping coefficient of the first pixel in the column direction, and on the basis of the mapping coefficient of the first pixel in the column direction, taking the scaling ratio in the column direction as a step length to acquire the mapping coefficient of each pixel in the column direction one by one. Since the scaling ratio of each row is the same and one row mapping coefficient is shared, the row mapping coefficient is v, which is the column direction scaling ratio in step 11. There is a feature between two adjacent pixels in the same row that the mapping coefficient of the next pixel is the mapping coefficient of the previous pixel plus v, for example: the mapping coefficient of each line of the starting pixel is specified to be 0, so that the mapping coefficient of the first pixel in the same line is 0, the mapping coefficient of the second pixel is v, the mapping coefficient of the third pixel is 2*v, the line mapping coefficient of the fourth pixel is 3*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. And the common column mapping coefficient in the same column direction is h, wherein h is the scaling in the row direction in the step 11, only the value of h is needed to be saved, and the calculation of the pixel point mapping coefficient on the subsequent column only needs to be added with h on the basis of the mapping coefficient of the previous pixel in the same column.
Step 14: and according to the mapping coefficient, obtaining a weight coefficient lookup table of the mapping of the insertion point to the input image.
Step 15: and obtaining a scaled output image according to the weight coefficient lookup table and the input image.
The embodiment of the invention provides an image scaling method, which obtains an image scaling ratio according to the resolution of an output image and the resolution of an input image, wherein the scaling ratio comprises a row-direction scaling ratio and a column-direction scaling ratio; performing row direction interpolation again after interpolating the input image according to the column direction to obtain an interpolation image; 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; obtaining a weight coefficient lookup table of the insertion point mapped to the input image according to the mapping coefficient; according to the weight coefficient lookup table and the input image, the scaled output image is obtained, and according to the embodiment of the invention, the addition and shift operation is used to completely replace multiplication operation and floating point operation in the existing bilinear interpolation method, the scaled image is not obviously distorted, the occupation of image scaling algorithm resources is reduced, and the scaling of images with various resolutions is satisfied.
In some embodiments, the sub-flow of step 14 in the above method, the 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 Then determine column direction weight coefficient pairs/>Similarly, the row direction weight coefficient pair is/>
Sub-step 142: setting the distance between two adjacent pixel points of an input image as a preset length, dividing the preset length into N equal division intervals, wherein N is an integer power of 2;
In an embodiment of the present invention, preferably, N is 8. The distance between two adjacent pixel points of the input image is set to be a 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 of mapping the insertion point to the input image by equally dividing the interval, the column direction weight coefficient pair and the row direction weight coefficient pair.
In the embodiment of the invention, the weight coefficient pair corresponding to each equal division interval forms a lookup table, and the corresponding weight coefficient can be directly extracted only by judging which interval of 8 intervals x-x 1 belongs to, as shown in the following table:
for example, when the resolution of the input image is 4*4 and the resolution of the output image is 3*3, the column is scaled by 3/4, the vertical scaling ratio is 4/3, and the mapping coefficient of the output image to the input image is 0,4/3,8/3 according to step 13. According to step 14, the mapping coefficients are obtained to have a distance of 0,1/3,2/3 from the left neighboring pixel position, respectively [0,1/8 ], [2/8,3/8 ], [5/8, 6/8), thus obtaining the weight coefficient pairs (1, 0), (6/8, 2/8), (3/8, 5/8).
In some embodiments, the sub-process of step 15 in the above method, where step 15 specifically includes: and interpolating the input image according to the weight coefficient pairs in the corresponding equal division intervals in the weight coefficient lookup table to obtain a scaled output image. And obtaining a corresponding weight coefficient pair through a weight coefficient lookup table by using the pixel value of the input image, and outputting the pixel value corresponding to the image, thereby obtaining an output image with corresponding resolution.
The present invention also provides an embodiment of an image scaling device, please refer to fig. 2, which is a schematic structural diagram of the image scaling device provided in the embodiment of the present invention, 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 are connected in this order.
Wherein the ratio acquisition unit 21 is configured to obtain an image scaling ratio including a row-direction scaling ratio and a column-direction scaling ratio from a resolution of the output image and a resolution of the input image;
An image interpolation unit 22, configured to interpolate the input image according to the column direction, and then interpolate the input image again in the row direction to obtain an interpolated image;
A coefficient obtaining unit 23, configured to obtain a 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;
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;
An image scaling unit 25 for obtaining a scaled output image based on 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 performing column direction interpolation on the input image;
And the second interpolation module is used for carrying out row direction interpolation on the image subjected to column direction interpolation again to obtain an interpolation image.
In some embodiments, the coefficient obtaining unit 23 specifically includes:
the first acquisition module is used for acquiring the mapping coefficient of the first pixel in the row direction, and based on the mapping coefficient of the first pixel in the row direction, the mapping coefficient of each pixel in the row direction is acquired one by taking the row direction scaling ratio as a step length;
The second obtaining module is used for obtaining the mapping coefficient of the first pixel in the column direction, and based on the mapping coefficient of the first pixel in the column direction, the mapping coefficient of each pixel in the column direction is obtained one by taking the scaling ratio in the column direction as a step length.
In some embodiments, the look-up table acquisition unit 24 comprises:
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, dividing the preset length into N equal-division intervals, wherein N is an integer power of 2;
The lookup table acquisition module is used for generating a weight coefficient lookup table with the insertion points mapped to the input image by equally dividing the interval, the column direction weight coefficient pair and the row direction weight coefficient pair.
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 equal intervals in the weight coefficient lookup table to obtain a scaled output image
It should be noted that, since the image scaling device in the present embodiment is based on the same inventive concept as the above-described method embodiment, the corresponding content in the method embodiment is also applicable to the device embodiment, and will not be described in detail herein.
The embodiment of the invention also provides a terminal device, please refer to fig. 3, which is a schematic structural diagram of the terminal device provided in the embodiment of the invention, wherein the terminal device is a hardware structure capable of executing the image scaling method as 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 otherwise, for example in fig. 3.
The memory 320 is used as a non-volatile computer readable storage medium 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 respective modules shown in fig. 2. The processor 310 executes various functional applications of the server and data processing by running non-volatile software programs, instructions and modules stored in the memory 320, i.e. implements the image scaling method of the above-described method embodiments.
Memory 320 may include a storage program area that may store an operating system, at least one application program required for functionality, and a storage data area; the storage data area may store data created according to the use of the image scaling device, and the like. In addition, 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 remotely located relative to processor 310, which may be connected to the 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 of any of the method embodiments described above, for example, performing the method steps of fig. 1 described above, implementing the functions 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. Technical details not described in detail in this embodiment may be found in 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 which are executed by one or more processors, e.g., perform the method steps of fig. 1 described above, implementing 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-transitory computer readable storage medium, the computer program comprising program instructions which, when executed by a computer, cause the computer to perform the image scaling method in any of the method embodiments described above, for example, 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, a terminal device and a storage medium, wherein the image scaling 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; performing row direction interpolation again after interpolating the input image according to the column direction to obtain an interpolation image; 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; obtaining a weight coefficient lookup table of the insertion point mapped to the input image according to the mapping coefficient; according to the weight coefficient lookup table and the input image, the scaled output image is obtained, and according to the embodiment of the invention, the addition and shift operation is used to completely replace multiplication operation and floating point operation in the existing bilinear interpolation method, the scaled image is not obviously distorted, the occupation of image scaling algorithm resources is reduced, and the scaling of images with various resolutions is satisfied.
It should be noted that the above-described apparatus embodiments are merely illustrative, and the units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
From the above description of embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus a general purpose hardware platform, or may be implemented by hardware. Those skilled in the art will appreciate that all or part of the processes implementing the methods of the above embodiments may be implemented by a computer program for instructing relevant hardware, where the program may be stored in a computer readable storage medium, and where the program may include processes implementing 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 (Random Access Memory, RAM), or the like.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; the technical features of the above embodiments or in the different embodiments may also be combined within the idea of the invention, the steps may be implemented in any order, and there are many other variations of the different aspects of the invention as described above, which are not provided in detail for the sake of brevity; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit of the invention.

Claims (9)

1. A method of image scaling, the method comprising:
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;
Performing row direction interpolation again after interpolating the input image according to the column direction to obtain an interpolation image;
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;
according to the mapping coefficient, a weight coefficient lookup table of the insertion point mapped to the input image is obtained, and specifically, according to the mapping coefficient of the insertion point and the position point of the adjacent pixel of the insertion point, a column direction weight coefficient pair and a row direction weight coefficient pair are respectively obtained;
Setting the distance between two adjacent pixel points of an input image as a preset length, dividing the preset length into N equal division intervals, wherein N is an integer power of 2;
generating a weight coefficient lookup table with insertion points mapped to the input image by equally dividing intervals, column direction weight coefficient pairs and row direction weight coefficient pairs;
And obtaining a scaled output image according to the weight coefficient lookup table and the input image.
2. The image scaling method of claim 1, wherein interpolating the input image in the column direction and then interpolating the input image in the row direction again, the obtaining the interpolated image specifically comprises:
Performing column direction interpolation on the input image;
and performing row direction interpolation on the image subjected to column direction interpolation again to obtain an interpolation image.
3. The image scaling method according to claim 1, wherein 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 specifically comprises:
Acquiring a mapping coefficient of a first pixel in a row direction, and on the basis of the mapping coefficient of the first pixel in the row direction, taking the scaling ratio in the row direction as a step length to acquire the mapping coefficient of each pixel in the row direction one by one;
and acquiring a mapping coefficient of the first pixel in the column direction, and on the basis of the mapping coefficient of the first pixel in the column direction, taking the scaling ratio in the column direction as a step length to acquire the mapping coefficient of each pixel in the column direction one by one.
4. The image scaling method of claim 1 wherein N is 8.
5. The image scaling method of claim 1, wherein obtaining the scaled output image based on the weight coefficient lookup table and the input image comprises:
And interpolating the input image according to the weight coefficient pairs in the corresponding equal division intervals in the weight coefficient lookup table to obtain a scaled output image.
6. An image scaling apparatus, the apparatus comprising:
A ratio acquisition unit for acquiring an image scaling ratio including a row-direction scaling ratio and a column-direction scaling ratio from a resolution of an output image and a resolution of an input image;
the image interpolation unit is used for interpolating the input image according to the column direction and then interpolating the input image in the row direction again to obtain an interpolation 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 particularly, 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, dividing the preset length into N equal division intervals, wherein N is an integer power of 2;
generating a weight coefficient lookup table with insertion points mapped to the input image by equally dividing intervals, column direction weight coefficient pairs and row direction weight coefficient pairs;
and the image scaling unit is used for obtaining a scaled output image according to the weight coefficient lookup table and the input image.
7. The image scaling apparatus of claim 6, wherein the coefficient acquisition unit includes:
the first acquisition module is used for acquiring the mapping coefficient of the first pixel in the row direction, and based on the mapping coefficient of the first pixel in the row direction, the mapping coefficient of each pixel in the row direction is acquired one by taking the row direction scaling ratio as a step length;
The second obtaining module is used for obtaining the mapping coefficient of the first pixel in the column direction, and based on the mapping coefficient of the first pixel in the column direction, the mapping coefficient of each pixel in the column direction is obtained one by taking the scaling ratio in the column direction as a step length.
8. A terminal device, comprising:
At least one processor; and
A memory communicatively coupled to the at least one processor; wherein,
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 one of claims 1-5.
9. A non-transitory computer readable storage medium storing computer executable instructions for causing a computer to perform the image scaling method of any one of claims 1-5.
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 CN111724304A (en) 2020-09-29
CN111724304B true 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)

Families Citing this family (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
TWI824289B (en) * 2021-02-08 2023-12-01 明俐科技有限公司 Testing system and tesint method for image processing algorithm
CN114022366B (en) * 2022-01-06 2022-03-18 深圳鲲云信息科技有限公司 Image size adjusting device, adjusting method and equipment based on data stream architecture

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 (2)

* Cited by examiner, † Cited by third party
Title
基于FPGA的双通道全景图像采集系统研制;李琼;曾延安;;常州信息职业技术学院学报(第05期);全文 *
基于边缘方向插值的视频缩放算法及电路设计;史再峰;姚素英;赵雷;刘丰;;吉林大学学报(工学版)(第04期);全文 *

Also Published As

Publication number Publication date
CN111724304A (en) 2020-09-29

Similar Documents

Publication Publication Date Title
CN111724304B (en) Image scaling method and device, terminal equipment and storage medium
US11354785B2 (en) Image processing method and device, storage medium and electronic device
CN106780336B (en) Image reduction method and device
CN108600783B (en) Frame rate adjusting method and device and terminal equipment
CN111210389B (en) Image scaling processing method and device
US9286653B2 (en) System and method for increasing the bit depth of images
US11580621B2 (en) AI frame engine for mobile edge
CN111476718B (en) Image amplification method and device, storage medium and terminal equipment
CN107220934B (en) Image reconstruction method and device
US8412003B2 (en) Image processing methods, apparatus and computer program products using interdependent pixel interpolation operations
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
CN115190263B (en) Video scaling method, device, equipment and storage medium
CN112801879A (en) Image super-resolution reconstruction method and device, electronic equipment and storage medium
CN106296614B (en) Image processing apparatus and image processing method
CN107977923B (en) Image processing method, image processing device, electronic equipment and computer readable storage medium
CN111260559B (en) Image zooming display method and device and terminal equipment
CN107240064B (en) Image correction method and device and terminal
CN113962892A (en) Method and device for correcting wide-angle lens image distortion and photographic equipment
CN110363723B (en) Image processing method and device for improving image boundary effect
JP2007241859A (en) Image processor and image processing method
CN112419146A (en) Image processing method and device and terminal equipment
CN116012223A (en) Image resolution reduction method, system, device and storage medium
CN110349089B (en) Image processing method and device for improving linear interpolation effect

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