CN112862673B - Adaptive image scaling method, adaptive image scaling device, and storage device - Google Patents

Adaptive image scaling method, adaptive image scaling device, and storage device Download PDF

Info

Publication number
CN112862673B
CN112862673B CN201911101193.9A CN201911101193A CN112862673B CN 112862673 B CN112862673 B CN 112862673B CN 201911101193 A CN201911101193 A CN 201911101193A CN 112862673 B CN112862673 B CN 112862673B
Authority
CN
China
Prior art keywords
scaling
image
image data
along
stage
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
CN201911101193.9A
Other languages
Chinese (zh)
Other versions
CN112862673A (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.)
Shanghai Tuqing Microelectronics Co ltd
Original Assignee
Shanghai Tuqing Microelectronics 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 Shanghai Tuqing Microelectronics Co ltd filed Critical Shanghai Tuqing Microelectronics Co ltd
Priority to CN201911101193.9A priority Critical patent/CN112862673B/en
Publication of CN112862673A publication Critical patent/CN112862673A/en
Application granted granted Critical
Publication of CN112862673B publication Critical patent/CN112862673B/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

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Image Processing (AREA)

Abstract

The application provides an adaptive image scaling method, an adaptive image scaling device and a device with a storage function. The adaptive image scaling method includes: acquiring an image, and performing first-stage scaling on the image along a first direction to acquire first image data; determining whether to perform second-level scaling on the first image data along the first direction according to the first scaling ratio of the first direction; performing first-stage scaling on the image data scaled along the first direction along the second direction to obtain second image data, wherein the first direction is perpendicular to the second direction; a determination is made as to whether to perform a second level of scaling on the second image data in the second direction based on a second scaling ratio of the second direction. In this way, the image processing time delay can be reduced, and the image scaling efficiency can be improved.

Description

Adaptive image scaling method, adaptive image scaling device, and storage device
Technical Field
The present application relates to the field of image processing technologies, and in particular, to an adaptive image scaling method, an adaptive image scaling device, and a device with a storage function.
Background
With the continuous improvement of the resolution of a display screen and the existence of input sources with various resolutions, in order to better display video contents, the requirements on image scaling technology are also increasing.
The principle of image scaling is that the pixel points of an output image are summed according to the weighting of the neighborhood around the pixel points corresponding to an input image, the image scaling process is a low-pass filtering process in the frequency domain, and the size of the neighborhood and the selection of the weight coefficient directly affect the scaled image effect. Typical image scaling algorithms are the neighbor method, bilinear, bicubic, and lanczos algorithms.
The inventor of the present application has found in long-term research and development that the image scaling algorithm can improve the image quality, but has longer time delay in hardware processing and lower scaling efficiency.
Disclosure of Invention
The application mainly solves the technical problem of providing an image scaling method, an image scaling device and a device with a storage function, so as to reduce image processing time delay and improve image scaling efficiency.
In order to solve the technical problems, the application provides an image scaling method. The image scaling method comprises the following steps: acquiring an image, and performing first-stage scaling on the image along a first direction to acquire first image data; determining whether to perform second-level scaling on the first image data along the first direction according to the first scaling ratio of the first direction; performing first-stage scaling on the image data scaled along the first direction along the second direction to obtain second image data, wherein the first direction is perpendicular to the second direction; a determination is made as to whether to perform a second level of scaling on the second image data in the second direction based on a second scaling ratio of the second direction.
In order to solve the technical problems, the application provides an adaptive image scaling device. The adaptive image scaling apparatus includes: the device comprises a first image scaling module, a second image scaling module and a processing module, wherein the processing module is connected with the first image scaling module and the second image scaling module; the first image scaling module is used for performing first-stage scaling on the image along a first direction so as to acquire first image data; the processing module determines whether to perform second-stage scaling on the first image data along the first direction according to the first scaling ratio of the first direction; the second image scaling module performs first-stage scaling on the image data scaled along the first direction along the second direction to obtain second image data, wherein the first direction is perpendicular to the second direction; the processing module further determines whether to perform a second level of scaling on the second image data along a second direction based on a second scaling ratio of the second direction, wherein the first direction is perpendicular to the second direction.
In order to solve the technical problems, the application provides a device with a storage function. The apparatus having a storage function stores program data that can be executed to implement the above-described adaptive image scaling method.
Compared with the prior art, the application has the beneficial effects that: the adaptive image scaling method provided by the embodiment of the application comprises the following steps: acquiring an image, and performing first-stage scaling on the image along a first direction to acquire first image data; determining whether to perform second-level scaling on the first image data along the first direction according to the first scaling ratio of the first direction; performing first-stage scaling on the image data scaled along the first direction along the second direction to obtain second image data, wherein the first direction is perpendicular to the second direction; a determination is made as to whether to perform a second level of scaling on the second image data in the second direction based on a second scaling ratio of the second direction. In this way, the embodiment of the application firstly performs one-stage scaling on the image along the first direction, determines whether to perform second-stage scaling on the image along the first direction according to the first scaling rate of the image along the first direction, then performs first-stage scaling on the image data scaled along the first direction along the second direction, and determines whether to perform second-stage scaling on the image along the first direction according to the second scaling rate of the image along the second direction. Therefore, whether the image is subjected to second-stage scaling along a certain direction can be determined according to the scaling ratio of the image along the certain direction, and the whole image does not need to be subjected to second-stage scaling, so that the image processing time delay can be reduced, and the image scaling efficiency can be improved.
Drawings
FIG. 1 is a flow chart of an adaptive image scaling method according to an embodiment of the present application;
FIG. 2 is a flowchart illustrating a step S101 in the adaptive image scaling method according to the embodiment of FIG. 1;
FIG. 3 is a flowchart illustrating a step S1302 in the adaptive image scaling method of FIG. 1;
FIG. 4 is a schematic diagram illustrating a specific flow of step S301 in the embodiment of FIG. 3;
FIG. 5 is a schematic diagram illustrating a specific flow of step S302 in the embodiment of FIG. 3;
FIG. 6 is a schematic diagram of the structure of a polyphase filter in the adaptive image scaling device of the present application;
FIG. 7 is a flow chart of an embodiment of an adaptive image scaling method of the present application;
FIG. 8 is a schematic diagram of a color space conversion module in an adaptive image scaling device according to an embodiment of the present application;
FIG. 9 is a schematic diagram illustrating an embodiment of an adaptive image scaling apparatus;
FIG. 10 is a schematic view of a part of the structure of an embodiment of an adaptive image scaling device;
FIG. 11 is a schematic diagram of an embodiment of a device with memory function according to the present application;
FIG. 12 is a schematic diagram showing a specific flow of step S501 in the embodiment of FIG. 5;
FIG. 13 is a schematic flow chart of step S102 in the embodiment of FIG. 1;
Fig. 14 is a specific flowchart of step S104 in the embodiment of fig. 1.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
The present application first proposes an image scaling method, as shown in fig. 1, fig. 1 is a flowchart illustrating an embodiment of an adaptive image scaling method according to the present application. The adaptive image scaling method of the present embodiment includes the steps of:
Step S101: an image is acquired and scaled a first level in a first direction to acquire first image data.
Wherein the image is composed of a plurality of pixel points arranged in a matrix, and the first direction may be a vertical direction of the image, i.e., a column direction of the matrix.
Alternatively, the present embodiment may implement step S101 by a method as shown in fig. 2. The method of the present embodiment includes steps S201 to S203.
Step S201: a zoom instruction of the image is acquired.
The scaling instruction of the image comprises an amplifying instruction and a shrinking instruction, and the scaling instruction can be determined according to the original resolution before scaling of the image and the target resolution after scaling of the image. Specifically, the scaling ratio of the image can be determined according to the original resolution and the target resolution of the image, and the scaling ratio is compared with a ratio threshold value, and if the scaling ratio is larger than the ratio threshold value, a magnification instruction is generated; if the scaling ratio is smaller than the ratio threshold, generating a shrinking instruction; wherein the ratio threshold may be 1.
Step S202: if the scaling instruction is an amplifying instruction, interpolating pixels of the image along a first direction by adopting a bilinear method to obtain the interpolated pixels as first image data.
Step S203: if the scaling instruction is a scaling instruction, a neighborhood pixel of a pixel in the image is acquired along a first direction, a weighted value of the pixel and the neighborhood pixel is acquired by adopting a mean value method, and a new pixel is acquired according to the weighted value to serve as first image data.
In this embodiment, the image is enlarged and reduced based on bilinear principle, and the processing procedures of the two are opposite. Specifically, the image magnification may calculate a correlation weight coefficient according to a bilinear method, and interpolate pixels of the image according to the weight coefficient; the image reduction can obtain the weighted value of the pixel and the neighborhood pixel according to the bilinear principle, and the weighted value is used as the pixel value of the reduced pixel, wherein the neighborhood pixel can select two adjacent pixels, and related hardware resources can be saved. The image reduction method can achieve a better low-pass filtering effect, eliminate possible aliasing effects and improve image quality.
Of course, in other embodiments, images may be enlarged or reduced using, for example, bicubic differences or multi-phase differences.
The first-stage scaling may be used as a coarse adjustment, and in an application scenario where the image scaling is not required, only the first-stage scaling may be performed on the image.
In this embodiment, a similar method may be used to implement the first-stage scaling of the image along the second direction, which is not described herein.
Step S102: a determination is made as to whether to perform a second level of scaling on the first image data in the first direction based on the first scaling ratio of the first direction.
Specifically, the present embodiment may implement step S102 by a method as shown in fig. 13. The method of the present embodiment includes steps S1301 to S1303.
Step S1301: and matching the first scaling ratio with a preset ratio.
And acquiring a first scaling ratio of the image along a first direction, and matching the first scaling ratio with a preset ratio.
A first scaling ratio of the image in the first direction may be determined from the original resolution and the target resolution of the image in the first direction. The method for obtaining the first scaling ratio may refer to the specific method of step S201.
Step S1302: and if the first scaling ratio is successfully matched with the preset ratio, performing second-stage scaling on the first image data along the first direction so as to acquire third image data.
If the first scaling ratio is successfully matched with the preset ratio, performing second-stage scaling on the first image data, namely performing second-stage scaling on the image data after the first-stage scaling along the first direction.
Step S1303: if the first scaling ratio is unsuccessful in matching with the preset ratio, scaling of the image along the first direction is ended.
The preset ratio of the present embodiment may be a ratio range, the lower limit thereof may be 0.8, and the upper limit thereof may be 1.2, for example, the mapping relationship f 1 (a) between the preset ratio a and the zoom level is as follows:
for example, if the first scaling ratio is greater than or equal to 0.8 and less than or equal to 1.2, then only the image is scaled in the first direction by a first level or the like.
Step S103: and performing first-stage scaling on the image data scaled along the first direction along the second direction to acquire second image data, wherein the first direction is perpendicular to the second direction.
Wherein the second direction may be the horizontal direction of the image, i.e. the row direction of the matrix.
Specifically, the first image data may be first scaled in the second direction or the third image data may be first scaled in the second direction to obtain the second image data.
Step S104: a determination is made as to whether to perform a second level of scaling on the second image data in the second direction based on a second scaling ratio of the second direction.
Specifically, the present embodiment may implement step S104 by a method as shown in fig. 14. The method of the present embodiment includes steps S1401 to S1403.
Step S1401: and matching the second scaling ratio with a preset ratio.
And acquiring a second scaling ratio of the image along a second direction, and matching the second scaling ratio with a preset ratio.
A second scaling ratio of the image in the second direction may be determined from the original resolution and the target resolution of the image in the second direction. The method for obtaining the second scaling ratio may refer to the specific method of step S201.
Step S1402: and if the second scaling ratio is successfully matched with the preset ratio, performing second-stage scaling on the second image data along the second direction so as to acquire fourth image data.
And if the second scaling ratio is successfully matched with the preset ratio, performing second-stage scaling on the second image data, namely performing second-stage scaling on the image data subjected to the first-stage scaling along a second direction.
Step S1403: if the second scaling ratio is unsuccessful in matching with the preset ratio, scaling of the image along the second direction is ended.
And taking the second image data as a final result after image scaling to finish the self-adaptive scaling of the image.
The second scaling ratio is the same as the first scaling ratio described above and is not described here.
Unlike the prior art, the present embodiment first performs a first-stage scaling on an image along a first direction, determines whether to perform a second-stage scaling on the image along the first direction according to a first scaling ratio of the image along the first direction, then performs a first-stage scaling on image data scaled along the first direction along a second direction, and determines whether to perform a second-stage scaling on the image along the first direction according to a second scaling ratio of the image along the second direction. Therefore, whether the image is subjected to second-stage scaling along a certain direction can be determined according to the scaling ratio of the image along the certain direction, and the whole image does not need to be subjected to second-stage scaling, so that the image processing time delay can be reduced, and the image scaling efficiency can be improved.
Although the existing image scaling algorithm can improve the image quality of the image, for some images with more obvious edges, because the algorithm with better scaling effect is closer to an ideal low-pass filter in the frequency domain, the loss of high-frequency components can be caused, and ringing effect is also easier to generate.
For this purpose, the present embodiment may implement step S1302 by a method as shown in fig. 3. The method of the present embodiment includes steps S301 to S302.
Step S301: edge information of the first image data is acquired, and a scaling weight coefficient of the first image data is determined according to the edge information.
Alternatively, the present embodiment may implement step S301 by a method as shown in fig. 4. The method of the present embodiment includes steps S401 to S402.
Step S401: pixels of the first image data are acquired.
From the above analysis, the first image data is the pixels of the image after the first-stage scaling, so that the pixels of the first image can be obtained by obtaining the pixels of the image after the first scaling, which are arranged along the first direction.
Step S402: the second derivative of the pixel is obtained and matched to a threshold.
The second derivative of the pixels of the image can represent abrupt points (i.e., zero crossings) in the image, which are often edge points of the image, so that the second derivative of the pixels of the image can represent edge information of the image.
Therefore, the edge information of the first image data can be obtained using the following second derivative formula. Where x is the position information of the pixel, f 2 (x+1) and f 2 (x-1) are the pixel values of the neighborhood pixels of the pixel, and f 2 (x) is the pixel value of the pixel.
Of course, in other embodiments, there may be edge information obtained from the first image data using the first derivative of the image pixels or other algorithms.
Step S403: if the matching is successful, a scaling weight coefficient corresponding to a threshold value of the successful matching is obtained.
The threshold and scaling weight coefficients of this embodiment are multiple.
In an application scenario, the mapping relationship f 3 (C) of the edge information C, the threshold H 0-H4, and the scaling weight coefficient f 0-f4 of the first image data may be as follows:
For example, when the edge information C of the first image data is smaller than the threshold H 0, the scaling weight coefficient of the first image data is f 0.
The lanczos kernel function is selected by default as the kernel function of the scaling weight coefficient. Because the Lanczos kernel image scaling has better effect on image enhancement, the Lanczos kernel image scaling is used as a default weight coefficient of scaling, and the adaptive scaling weight coefficient can be generated according to different edge information
The scaling weight coefficient is a low-pass filter in the frequency domain, and different groups of scaling weight coefficients can be generated according to a method of designing the low-pass filter by a limited impulse filter; in addition, a lanczos kernel function can be selected as the kernel function of the default scaling weight coefficient, since the default scaling weight coefficient is closer to the ideal low-pass filter in the frequency domain; in addition, the lanczos kernel is a preferred compromise in reducing aliasing, sharpness and ringing effects; the lanczos kernel function has better effect on image enhancement while low-pass filtering, takes the low-pass filter as a default weight coefficient of scaling, and can generate an adaptive scaling weight coefficient according to different edge information. The lanczos kernel function L (x) is as follows:
The lanczos kernel function can be divided into a horizontal direction (second direction) and a vertical direction (first direction) by SVD (singular value decomposition), so that the calculated amount and the system time delay can be reduced; different scaling methods correspond to different scaling weight coefficients and the width and height of the scaling weight coefficients.
Step S302: and performing second-stage scaling on the first image data along the first direction according to the scaling weight coefficient to acquire third image data.
The third image data is image data of the image subjected to the second-stage scaling in the first direction.
Alternatively, the present embodiment may perform second-stage scaling on the first image using a polyphase filter according to the scaling weight coefficient. Specifically, alternatively, the present embodiment may implement step S302 by a method as shown in fig. 5. The method of the present embodiment includes steps S501 to S503.
Step S501: the plurality of scaling weight coefficients are divided into a plurality of groupings.
The scaling weight coefficients are divided into n groups of different phases according to phase uniformity (as shown in fig. 6) to form a plurality of different filtering branches p (1) -p (n).
Alternatively, the present embodiment may implement the above-described step S501 by a method as shown in fig. 12. The method of the present embodiment includes step S1201 and step S1202.
Step S1201: the design requirements of the low pass filter and the number of scaling weight coefficients are obtained.
Step S1202: and obtaining a plurality of groups of scaling weight coefficients through a software function according to the design requirements and the number, and carrying out fixed-point processing and storage on the scaling weight coefficients.
The software function may be a software function in matlab or fdatool, or a window function, etc.; the scaling weight coefficient is fixed-point processed, so that the calculation cost can be reduced.
The scaling weight coefficient of the embodiment can determine the correlation value according to the low-pass filter design and combining the fixed-point design; several groups of scaling weight coefficients can be pre-stored in a memory SRAM, and different groups of scaling weight coefficients can be selected according to different index values; and the values of the weight coefficients can be scaled by software, while the threshold value can be set by software.
Step S502: and respectively filtering the first image data by using a polyphase filter, wherein the number of phases of the polyphase filter is the same as the number of groups, and the filtering coefficient of the polyphase filter is correspondingly set with the scaling weight coefficient.
Each filtering branch performs low-pass filtering on the first image data x.
The setting of the filter coefficient of the polyphase filter corresponding to the scaling weight coefficient means that each filter branch selects a corresponding filter coefficient according to the scaling weight coefficient of the first image, and the low-pass filtering is performed on the first image data x by using the filter coefficient.
Step S503: the filtered first image data is obtained as third image data from a plurality of outputs of the polyphase filter.
Multiplying and adding the first image data x and the filter coefficient of each filter branch; at the output of the polyphase filter, data is selected from n sets of filtered data at n outputs as third image data y in steps r x n (r is input size/output size). Where r is the ratio of the size of the first image x to the size of the third image data y.
In this way, the filtering with higher previous orders can be divided into a plurality of filtering with lower orders by the polyphase filter, so that the time delay of the system can be reduced, and the calculated amount can be reduced.
Compared with the prior art, the method and the device for scaling the image according to the edge information of the image are different from the prior art, and the problem that the image with more prominent edges is easy to cause ringing effect for some scaling coefficients close to an ideal low-pass filter can be improved.
The step S1402 may also be implemented by using the method described above to implement a first-stage zoom and a second-stage zoom of the image along the second direction, which are not described herein.
Therefore, the method of the present embodiment can selectively perform the second-stage scaling on the image in two directions or in any one direction or not according to the scaling ratio of the image in the first direction and the scaling ratio in the second direction.
The present application further proposes an image scaling method according to another embodiment, as shown in fig. 7, the method specifically includes the following steps:
Step S701: the image is acquired, and whether the format of the image is the first format is determined, if not, step S702 is executed, and if yes, step S703 is executed directly.
The first format of this embodiment is YUV format.
Step S702: the image is color space converted.
Since the data source of the image may be in YUV format, it is necessary to convert YUV format into RGB format and then scale the image in RGB format.
The color space conversion formula is as follows:
The color space conversion can be realized by a color space conversion module as shown in fig. 8, which is set to process three components of one pixel at the same time in the RGB color space; the processing module has a clipping function, and can prevent the bit width exceeding the set bit width in data processing; the coefficient a 00-a22、offset0-offset2 may be configurable by software; the correlation coefficient may be preset according to the standards BT601 or BT709, and the data bit width fix-point processing may be performed.
The present embodiment adapts to image content of different input formats by color space conversion.
Step S703: the image is first scaled in a first direction to obtain first image data.
Step S704: and respectively acquiring first scaling ratios of the images along the first direction, and matching the first scaling ratios with preset ratios.
Step S705: and if the first scaling ratio is successfully matched with the preset ratio, performing second-stage scaling on the first image to acquire second image data.
Step S706: the first image data or the second image data is scaled along a second direction, wherein the first direction is perpendicular to the second direction.
Steps S703 to S706 in this embodiment are similar to steps S101 to S104 described above, and are not repeated here.
The present application further provides an image scaling device, as shown in fig. 9, the image scaling device 90 of the present embodiment includes: the first image scaling module 91, the second image scaling module 92 and the processing module 93, wherein the processing module 93 is connected with the first image scaling module 91 and the second image scaling module 92; the first image scaling module 91 is configured to perform a first-stage scaling on the image along a first direction to obtain first image data; the processing module 93 determines whether to perform a second level of scaling on the first image data along the first direction according to the first scaling ratio of the first direction; the second image scaling module 92 performs a first-stage scaling on the image data scaled along the first direction along the second direction to obtain second image data, wherein the first direction is perpendicular to the second direction; the processing module 93 further determines whether to perform a second level of scaling on the second image data along a second direction based on a second scaling ratio of the second direction, wherein the first direction is perpendicular to the second direction.
Unlike the prior art, the image scaling device 90 of the present embodiment can determine whether to perform the second-stage scaling on the image along a certain direction according to the scaling ratio of the image along the certain direction, without performing the second-stage scaling on the whole image, so that the image processing delay can be reduced, and the image scaling efficiency can be improved.
In another embodiment, as shown in fig. 10, a first image scaling module (not labeled) of the present embodiment includes a first image scaling unit 911 and a second image scaling unit 912, and a second image scaling module (not labeled) includes a third image scaling unit 921 and a fourth image scaling unit 922; wherein the first image scaling unit 911 is used for performing a first-stage scaling on the image in the first direction, the second image scaling unit 912 is used for performing a second-stage scaling on the image data scaled by the first image scaling unit 911 in the first direction, the third image scaling unit 921 is used for performing a second-stage scaling on the image data scaled by the first image scaling unit 911 or the image data scaled by the second image scaling unit 912 in the second direction, and the fourth image scaling unit 922 is used for performing a second-stage scaling on the image data scaled by the third image scaling unit 922 in the second direction.
Optionally, the image scaling apparatus 90 of this embodiment further includes an edge information statistics module (not shown), which is connected to the processing module (not shown) and the first image scaling module, wherein the edge statistics module includes a first edge statistics unit 941 and a second edge statistics unit 942, the first edge statistics unit 941 is used for obtaining edge information of the image data scaled by the first image scaling unit 911, and the second edge statistics unit 942 is used for obtaining edge information of the image data scaled by the second image scaling unit 921; the processing module is further configured to determine a scaling weight coefficient of the image according to the edge information of the first edge statistics unit 941, and perform a second-stage scaling on the image data scaled by the first image scaling unit 911 according to the scaling weight coefficient; the processing module is further configured to determine a scaling weight coefficient of the image according to the edge information of the second edge statistics unit 942, and perform a second-stage scaling on the image data scaled by the third image scaling unit 921 according to the scaling weight coefficient, so as to obtain a fourth image.
Optionally, the image scaling device 90 of this embodiment further includes a color space conversion module 96, where the color space conversion module 96 is connected to the first image scaling unit 911, and the color space conversion module 96 is configured to convert the image in YUV format into the image in RGB format.
Optionally, the image scaling device 90 of the present embodiment further includes a memory (not shown), the memory includes a first storage unit 951 and a second storage unit 952, the first storage unit 951 is configured to store the edge information counted by the first edge information counting unit 941, and the second storage unit 952 is configured to store the edge information counted by the second edge information counting unit 942.
The adaptive image scaling device 10 of the present embodiment is further configured to implement the above adaptive image scaling method, which is not described herein.
In other embodiments, the image may also be scaled first in the second direction and then in the first direction.
The present application further proposes a device with storage function, as shown in fig. 11, the device with storage function 110 of the present embodiment is configured to store the related data 111 and the program data 112 of the above embodiment, where the related data 111 at least includes the image data, the scaling ratio, and the like, and the program data 112 can be executed in the method of the above method embodiment. The related data 111 and the program data 112 are described in detail in the above method embodiments, and are not described here again.
The device 110 with the storage function of the present embodiment may be, but is not limited to, a usb disk, an SD card, a PD optical drive, a mobile hard disk, a high-capacity floppy drive, a flash memory, a multimedia memory card, a server, etc.
Different from the prior art, acquiring an image, and performing first-stage scaling on the image along a first direction to acquire first image data; determining whether to perform second-level scaling on the first image data along the first direction according to the first scaling ratio of the first direction; performing first-stage scaling on the image data scaled along the first direction along the second direction to obtain second image data, wherein the first direction is perpendicular to the second direction; a determination is made as to whether to perform a second level of scaling on the second image data in the second direction based on a second scaling ratio of the second direction. In this way, the embodiment of the application firstly performs one-stage scaling on the image along the first direction, determines whether to perform second-stage scaling on the image along the first direction according to the first scaling rate of the image along the first direction, then performs first-stage scaling on the image data scaled along the first direction along the second direction, and determines whether to perform second-stage scaling on the image along the first direction according to the second scaling rate of the image along the second direction. Therefore, whether the image is subjected to second-stage scaling along a certain direction can be determined according to the scaling ratio of the image along the certain direction, and the whole image does not need to be subjected to second-stage scaling, so that the image processing time delay can be reduced, and the image scaling efficiency can be improved.
According to the embodiment of the application, one-stage scaling can be adopted for the image with lower requirement, two-stage scaling can be adopted for the image with higher requirement, and the scaling factor of the second-stage scaling can be dynamically selected according to the edge information of the image after the first-stage scaling and the programmable threshold value judgment. In this way, the problems that some images with more prominent edges can easily cause ringing effect for some zoom factors of a near-ideal low-pass filter or the images are blurred due to the fact that improper zoom factors are selected can be improved.
The embodiment of the application can dynamically switch whether to adopt two-stage scaling according to the scaling ratio and can adjust the scaling ratio of each stage of scaling. In this way, for some scenes with larger scaling coefficients, the two-stage scaling can better improve the scaling effect.
And selecting a lanczos kernel scaling factor for the common image, enhancing the contrast of the image, and selecting the common kernel scaling factor for the image which is easy to generate ringing effect.
In the prior art, a proper image algorithm has obvious influence on the image output quality, a simpler algorithm easily causes the sawtooth effect of the image, a more ideal algorithm easily causes the ringing effect, and meanwhile, although the effect of some algorithms is better, the algorithm is difficult to realize in hardware because of more complexity and related parameters of the algorithm, and the frame rate of the whole system does not meet the more ideal requirement
After scaling in the first direction is completed, the data processed in the first direction directly passes through the second direction, new pixel points are obtained through field weighted summation in the first-stage scaling, if the second-stage scaling is needed, the weighted summation is carried out through the scaling weight factors, and finally a scaled image is obtained, wherein the data path is transmitted downwards in a pipeline mode from one stage to one stage.
The embodiment of the application can dynamically select the proper scaling weight factor according to the image content and combine the design mode of a hardware pipeline so as to reduce the time delay of a system while improving the image scaling quality.
In addition, the above-described functions, if implemented in the form of software functions and sold or used as a separate product, may be stored in a mobile terminal-readable storage medium, i.e., the present application also provides a storage device storing program data that can be executed to implement the method of the above-described embodiments, the storage device may be, for example, a U-disk, an optical disk, a server, or the like. That is, the present application may be embodied in the form of a software product comprising instructions for causing a smart terminal to perform all or part of the steps of the method described in the various embodiments.
In the description of the present application, a description of the terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present application. In this specification, schematic representations of the above terms are not necessarily directed to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, the different embodiments or examples described in this specification and the features of the different embodiments or examples may be combined and combined by those skilled in the art without contradiction.
Furthermore, the terms "first," "second," and the like, are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include at least one such feature. In the description of the present application, the meaning of "plurality" means at least two, for example, two, three, etc., unless specifically defined otherwise.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and further implementations are included within the scope of the preferred embodiment of the present application in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present application.
Logic and/or steps represented in the flowcharts or otherwise described herein, e.g., may be considered as a ordered listing of executable instructions for implementing logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device (which can be a personal computer, server, network device, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions). For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). In addition, the computer readable medium may even be paper or other suitable medium on which the program is printed, as the program may be electronically captured, via, for instance, optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner, if necessary, and then stored in a computer memory. The foregoing description is only of embodiments of the present application, and is not intended to limit the scope of the application, and all equivalent structures or equivalent processes using the descriptions and the drawings of the present application or directly or indirectly applied to other related technical fields are included in the scope of the present application.

Claims (12)

1. An adaptive image scaling method, the adaptive image scaling method comprising:
acquiring an image, and performing first-stage scaling on the image along a first direction to acquire first image data;
Matching a first scaling ratio of the first direction with a preset ratio to determine whether to perform second-stage scaling on the first image data along the first direction;
performing first-stage scaling on the image data scaled along the first direction along a second direction to obtain second image data, wherein the first direction is perpendicular to the second direction;
and matching the second scaling ratio of the second direction with the preset ratio to determine whether to perform second-stage scaling on the second image data along the second direction.
2. The adaptive image scaling method of claim 1, wherein the step of determining whether to perform a second level of scaling on the first image data in the first direction comprises:
if the first scaling ratio is successfully matched with the preset ratio, performing second-stage scaling on the first image data along the first direction so as to acquire third image data;
And if the first scaling ratio is not successfully matched with the preset ratio, ending the scaling of the image along the first direction.
3. The adaptive image scaling method of claim 2, wherein the step of performing a first-stage scaling of the image data scaled in the first direction in the second direction to obtain second image data comprises:
the first image data is scaled in a first direction or the third image data is scaled in a second direction to obtain second image data.
4. The adaptive image scaling method of claim 3, wherein the step of determining whether to perform a second level of scaling on the second image data in the second direction comprises:
If the second scaling ratio is successfully matched with the preset ratio, performing second-stage scaling on the second image data along the second direction to acquire fourth image data;
And if the second scaling ratio is not successfully matched with the preset ratio, ending the scaling of the image along the second direction.
5. The method of adaptive image scaling of claim 1, wherein the step of first scaling the image in a first direction to obtain first image data comprises:
Obtaining a zoom instruction of the image;
If the scaling instruction is an amplifying instruction, interpolating pixels of the image along the first direction by adopting a bilinear method to obtain first image data which are the pixels after interpolation processing;
If the scaling instruction is a scaling instruction, a neighborhood pixel of a pixel in the image is acquired along the first direction, a weighted value of the pixel and the neighborhood pixel is acquired by adopting a mean value method, and a new pixel is acquired according to the weighted value to be used as first image data.
6. The method according to claim 2, wherein if the first scaling ratio is successfully matched with the preset ratio, the step of performing a second-stage scaling on the first image data along the first direction comprises:
Acquiring edge information of the first image data, and determining a scaling weight coefficient of the first image data according to the edge information;
And performing second-stage scaling on the first image data along the first direction according to the scaling weight coefficient so as to acquire third image data.
7. The adaptive image scaling method of claim 6, wherein the step of acquiring edge information of the first image data and determining scaling weight coefficients of the first image data based on the edge information comprises:
Acquiring pixels of the first image data;
Acquiring a second derivative of the pixel, and matching the second derivative with a threshold value;
if the matching is successful, a scaling weight coefficient corresponding to a threshold value of the successful matching is obtained.
8. The adaptive image scaling method of claim 6, wherein the step of second-stage scaling the first image data in a first direction according to the scaling weight coefficients comprises:
Dividing a plurality of the scaling weight coefficients into a plurality of groups;
filtering the first image data by using a polyphase filter, wherein the number of phases of the polyphase filter is the same as the number of groups, and the filtering coefficient of the polyphase filter is set corresponding to the scaling weight coefficient;
and acquiring filtered image data from a plurality of output ends of the multiphase filter as the third image data.
9. The adaptive image scaling method of claim 1, wherein prior to the step of first-stage scaling the image in the first direction, the adaptive image scaling method further comprises:
judging whether the format of the image is a first format or not;
if yes, executing the step of performing first-stage scaling on the image along the first direction;
if not, performing color space conversion on the image so as to perform first-stage scaling on the image after the color space conversion along a first direction.
10. The adaptive image scaling method of claim 8, wherein the step of dividing the plurality of scaling weight coefficients into a plurality of groups comprises:
acquiring the design requirement of a low-pass filter and the number of scaling weight coefficients;
And according to the design requirements and the number, acquiring a plurality of groups of scaling weight coefficients through a software function, and carrying out fixed-point processing and storage on the scaling weight coefficients.
11. An adaptive image scaling apparatus, characterized in that the adaptive image scaling apparatus comprises: the device comprises a first image scaling module, a second image scaling module and a processing module, wherein the processing module is connected with the first image scaling module and the second image scaling module;
The first image scaling module is used for performing first-stage scaling on the image along a first direction so as to acquire first image data; the processing module matches a first scaling ratio of the first direction with a preset ratio to determine whether to perform second-stage scaling on the first image data along the first direction; the second image scaling module performs first-stage scaling on the image data scaled along the first direction along a second direction to obtain second image data, wherein the first direction is perpendicular to the second direction; the processing module further matches a second scaling ratio of the second direction with the preset ratio to determine whether to perform a second-stage scaling on the second image data along the second direction, wherein the first direction is perpendicular to the second direction.
12. An apparatus having a storage function, characterized in that the apparatus stores program data executable to implement the adaptive image scaling method of any one of claims 1 to 10.
CN201911101193.9A 2019-11-12 2019-11-12 Adaptive image scaling method, adaptive image scaling device, and storage device Active CN112862673B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911101193.9A CN112862673B (en) 2019-11-12 2019-11-12 Adaptive image scaling method, adaptive image scaling device, and storage device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911101193.9A CN112862673B (en) 2019-11-12 2019-11-12 Adaptive image scaling method, adaptive image scaling device, and storage device

Publications (2)

Publication Number Publication Date
CN112862673A CN112862673A (en) 2021-05-28
CN112862673B true CN112862673B (en) 2024-06-14

Family

ID=75984403

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911101193.9A Active CN112862673B (en) 2019-11-12 2019-11-12 Adaptive image scaling method, adaptive image scaling device, and storage device

Country Status (1)

Country Link
CN (1) CN112862673B (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102201126A (en) * 2010-03-24 2011-09-28 联想(北京)有限公司 Image processing method, system and terminal

Family Cites Families (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5790714A (en) * 1994-11-01 1998-08-04 International Business Machines Corporation System and method for scaling video
KR20020054933A (en) * 2000-12-28 2002-07-08 윤종용 Image processing apparatus capable of changing active size and method for changing the active size thereof
KR100754893B1 (en) * 2005-03-14 2007-09-04 삼성전자주식회사 Image scaling device using one line memory and method thereof
CA2700344C (en) * 2007-09-19 2016-04-05 Thomson Licensing System and method for scaling images
CN101789235B (en) * 2009-01-22 2011-12-28 华为终端有限公司 Method and device for processing image
CN101923704B (en) * 2009-06-12 2012-09-05 深圳市融创天下科技股份有限公司 Adaptive image scaling method
CN102222317A (en) * 2011-06-22 2011-10-19 王洪剑 Image scaling method and system
KR102114233B1 (en) * 2013-12-13 2020-05-25 삼성전자 주식회사 Image processor
CN103699390A (en) * 2013-12-30 2014-04-02 华为技术有限公司 Image scaling method and terminal equipment
US20150278991A1 (en) * 2014-03-27 2015-10-01 Wipro Limited Method and system for image scaling
US9449366B2 (en) * 2014-09-25 2016-09-20 Sony Corporation Bayer-consistent raw scaling
KR20160070580A (en) * 2014-12-10 2016-06-20 삼성전자주식회사 Image Scaler for Having Adaptive Filter
CN104700360B (en) * 2015-04-01 2018-06-05 北京思朗科技有限责任公司 Image-scaling method and system based on edge self-adaption
CN108616701A (en) * 2016-12-12 2018-10-02 中国航空工业集团公司西安航空计算技术研究所 A kind of image-scaling method based on Sinc filters
CN109584204B (en) * 2018-10-15 2021-01-26 上海途擎微电子有限公司 Image noise intensity estimation method, storage medium, processing and recognition device
CN109903224B (en) * 2019-01-25 2023-03-31 珠海市杰理科技股份有限公司 Image scaling method and device, computer equipment and storage medium
CN109978768B (en) * 2019-03-28 2022-10-11 南京邮电大学 Image nonlinear scaling method based on visual saliency detection
CN110349090B (en) * 2019-07-16 2022-10-04 合肥工业大学 Image scaling method based on Newton second-order interpolation

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102201126A (en) * 2010-03-24 2011-09-28 联想(北京)有限公司 Image processing method, system and terminal

Also Published As

Publication number Publication date
CN112862673A (en) 2021-05-28

Similar Documents

Publication Publication Date Title
EP3017594B1 (en) Method and processor for efficient video processing in a streaming environment
US7483040B2 (en) Information processing apparatus, information processing method, recording medium, and program
JP5450600B2 (en) Improving image resolution
US7218418B2 (en) Digital de-screening of documents
US20070237425A1 (en) Image resolution increasing method and apparatus for the same
US20070188633A1 (en) Distortion correction of images using hybrid interpolation technique
CN1713268B (en) Image interpolation apparatus
KR101816661B1 (en) Ringing suppression in video scalers
US20040234165A1 (en) Image interpolation apparatus and method
US6166773A (en) Method and apparatus for de-interlacing video fields to progressive scan video frames
CN102246223B (en) Method and device for image resizing
CN102129666B (en) Image scaling method and device
US7375856B2 (en) Halftone screen frequency and magnitude estimation for digital descreening of documents
JP2001008037A (en) Pixel interpolation method and circuit
US11663698B2 (en) Signal processing method for performing iterative back projection on an image and signal processing device utilizing the same
US7365882B2 (en) Halftone screen frequency and magnitude estimation for digital descreening of documents
CN112862673B (en) Adaptive image scaling method, adaptive image scaling device, and storage device
US8755639B2 (en) Image scaling method and apparatus with enhancement of image quality
US20090087119A1 (en) Method and apparatus for arbitrary ratio image reduction
KR100463552B1 (en) Cubic convolution interpolation apparatus and method
KR20130059546A (en) Methods of interpolation based on edge and apparatuses for using the same
JP2002259960A (en) Image processing device and image processing method
US8588553B2 (en) Scaling method and device for image signals
US20040264809A1 (en) Image processing apparatus, image processing method and image processing system
KR101028449B1 (en) Method and apparatus for resizing image

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
GR01 Patent grant
GR01 Patent grant