Image magnification method, module, and system

By performing edge processing and phase data weighting calculation on the target image, the problem of poor image quality when the magnification is large in the prior art is solved, and high-quality image amplification is realized in high-magnification scenarios.

CN113592714BActive Publication Date: 2025-05-16ZHEJIANG XINMAI SILICON CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110896783.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-05
Publication Date
2025-05-16
Estimated Expiration
2041-08-05

AI Technical Summary

Technical Problem

When the magnification is large, the existing image magnification method causes jagging at the low frequency boundary of the magnified image, the high frequency area is blurred, and the image quality is poor. It is only suitable for scenes with magnification less than 8 times.

Method used

By acquiring the target image, configuring the magnification direction and magnification, the target image is edged and the stretched image is obtained by calculating. The weighted calculation is performed using phase data and associated pixel data, the reconstruction pixel data is calculated, and the associated pixel data and phase data are updated through phase prediction data, reducing the calculation amount.

Benefits of technology

When the magnification is greater than 8 times, the clarity of the enlarged image is significantly improved, ensuring that the low-frequency boundaries are not jagged, and the high-frequency area is not blurred, which improves the image quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113592714B_ABST
    Figure CN113592714B_ABST
Patent Text Reader

Abstract

The present invention discloses an image magnification method, module, and system, wherein the method is to magnify the target image based on the magnification direction and magnification to obtain a stretched image containing a number of reconstructed pixel data; the steps of calculating the current reconstructed pixel data are: extracting phase data and associated pixel data; weighted fusion of each associated pixel data based on the phase data and the magnification to obtain the current reconstructed pixel data; also performing phase prediction based on the magnification and the phase data to obtain phase prediction data; performing update judgment based on the phase prediction data to obtain a corresponding judgment result; updating the associated pixel data based on the judgment result, and also updating the phase data based on the judgment result and the phase prediction data. The present invention designs the image magnification method, and when the magnification is greater than 8 times, the obtained stretched image still ensures that the low-frequency boundary is free of jagged edges and the high-frequency area is not blurred.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing, and in particular to an image magnification technology. Background Art

[0002] Nowadays, bilinear interpolation calculation is often performed using source pixel points adjacent to the interpolation point in the four directions of up, down, left, and right (a total of four source pixel points) to interpolate and enlarge the target image. However, when the magnification is large, the low-frequency boundary of the obtained enlarged image has obvious jagged edges and the high-frequency is blurred. Therefore, in order to ensure the image quality of the enlarged image, the existing image enlargement method is only applicable to scenes with a magnification of less than 8 times. Summary of the invention

[0003] The present invention aims at the disadvantage that the image magnification method in the prior art has poor quality of the obtained magnified image when the magnification factor is large, and provides an image magnification method capable of improving the clarity of the magnified image.

[0004] In order to solve the above technical problems, the present invention is solved by the following technical solutions:

[0005] A method for image magnification comprises the following steps:

[0006] Acquire a target image, and configure a magnification direction and a magnification factor, wherein the magnification direction is a vertical direction or a horizontal direction;

[0007] Performing edge processing on the target image based on the magnification direction (using adjacent rows and columns for edge processing) to obtain a corresponding source image, wherein the source image includes a plurality of source pixel data, and each source pixel data is arranged along the magnification direction;

[0008] In the present application, the edge is added based on the number of associated pixel data. For example, when the number of associated pixel data is 2m, m rows or columns of pixel data are added to the upper and lower sides (or left and right sides) of the target image according to the magnification direction.

[0009] Based on the magnification direction, the magnification factor and the source pixel data, a corresponding stretched image is obtained by calculation.

[0010] This application is suitable for scenes such as image stretching and image magnification;

[0011] The stretched image includes a plurality of reconstructed pixel data, and each reconstructed pixel data is calculated in sequence based on the magnification direction, the magnification factor and the source pixel data. The step of calculating the current reconstructed pixel data is as follows:

[0012] Extracting phase data and associated pixel data, wherein the associated pixel data is at least four source pixel data adjacent to the current reconstructed pixel data in the amplification direction;

[0013] The phase data is used to represent the position distribution relationship between the reconstructed pixel data and its associated pixel data. Figure 1 This application uses the phase data as the basis to assign weights to each associated pixel data. Since the number of associated pixel data is at least 4, it not only contains pixel information (i.e., pixel value), but also provides pixel change information, thereby effectively improving image quality.

[0014] Performing weighted calculation on each associated pixel data based on the phase data and the magnification factor to obtain corresponding weighted pixel data;

[0015] Calculating and obtaining current reconstructed pixel data based on the weighted pixel data and the magnification factor;

[0016] Based on the magnification and the phase data, predicting the phase data of the next reconstructed pixel data to obtain phase prediction data;

[0017] Based on the phase prediction data, determine whether the associated pixel data of the current reconstructed pixel data is consistent with the associated pixel data corresponding to the next reconstructed pixel data, and obtain a corresponding determination result;

[0018] The associated pixel data is updated based on the judgment result, and the phase data is also updated based on the judgment result and the phase prediction data.

[0019] In the present application, update judgment is performed based on phase prediction data, and the associated pixel data and phase data can be automatically updated. In the process of calculating each reconstructed pixel data of the stretched image based on the magnification direction, there is no need to find the associated pixel data of each reconstructed pixel data in the source image, and there is no need to calculate the distance between the reconstructed pixel data and each associated pixel data, which greatly reduces the amount of calculation.

[0020] As an implementable method:

[0021] The magnification factor includes a magnification factor numerator and a magnification factor denominator, that is, the magnification factor numerator and the magnification factor denominator are prime numbers to each other;

[0022] In the present application, the magnification factor is expressed by a fraction, so that in the process of one-dimensional data magnification, the distance of the image sample points before magnification is digitized with reference to the numerator parameter, and the distance of the image sample points after magnification is digitized with reference to the denominator parameter. The position of the image sample points after magnification can be depicted with the digitized image sample points before magnification as coordinates, so that the phase relationship between the image sample points after magnification and the adjacent image sample points before magnification can be calculated. Figure 1 , Figure 1 The five-pointed star in the middle indicates the image sample points after enlargement, the dots indicate the image sample points before enlargement, D represents the denominator parameter, N represents the numerator parameter, and phi represents the phase data.

[0023] The number of the associated pixel data is 4, which are first associated pixel data, second associated pixel data, third associated pixel data and fourth associated pixel data in sequence;

[0024] When there is less associated pixel data, such as in the existing bilinear interpolation algorithm, only two adjacent source pixels are used for calculation in the magnification direction, and the quality of the resulting magnified image is poor;

[0025] When there are too many associated pixel data, source pixel data that is far away from the current reconstructed data will become interference data, affecting the accuracy of the current reconstructed data.

[0026] In the prior art, based on the position of the point to be interpolated, pixel points adjacent to the point to be interpolated are often extracted from the target image, and then the distance between the point to be interpolated and the pixel point is calculated based on the coordinates of the extracted pixel points. Finally, based on the ratio of the distances and the pixel values ​​of each pixel point, the pixel value of the point to be interpolated is calculated.

[0027] Therefore, the more associated pixel data there are, the greater the amount of calculation and the longer the calculation time will be.

[0028] In this application, by designing the phase data and the weight calculation formula, the weight corresponding to each associated pixel data is calculated based on the phase data, so as to achieve the purpose of accurately magnifying the image to any multiple.

[0029] The formula for calculating the weight corresponding to each of the above associated pixel data is:

[0030] t1 = N-phi;

[0031] t2 = phi;

[0032]

[0033] p1=t1-p0;

[0034]

[0035] p2 = t2 - p3;

[0036] Among them, N represents the magnification numerator, phi represents the phase data of the current reconstructed pixel data, p0 is the weight corresponding to the first associated pixel data, p1 is the weight corresponding to the second associated pixel data, p2 is the weight corresponding to the third associated pixel data, p3 is the weight corresponding to the third associated pixel data, t1 and t2 are intermediate parameters, and "*" represents multiplication operation.

[0037] After the associated pixel data is multiplied by the corresponding weight, the corresponding weighted pixel data is obtained. After the weighted pixel data are summed, they are divided by the magnification factor numerator to obtain the corresponding reconstructed pixel data.

[0038] The present application ensures the image quality of the obtained stretched image by designing the above-mentioned weight formula, and ensures that there are no jagged edges at the low-frequency boundaries and no blurring at the high-frequency areas in large-magnification scenarios.

[0039] As an implementable method:

[0040] When the judgment result is inconsistent, the phase data is updated based on the magnification and the phase prediction data, and the associated pixel data is updated based on the sliding window mechanism. The step size of the sliding window is 1, and the sliding direction is the magnification direction.

[0041] When the judgment result is consistent, the phase data is updated based on the phase prediction data.

[0042] As an implementable method:

[0043] Calculate the sum of the magnification denominator and the phase data of the current reconstructed pixel data to obtain phase prediction data;

[0044] When the phase prediction data is greater than or equal to the amplification factor numerator, the judgment result is inconsistent, otherwise the judgment result is consistent;

[0045] When the judgment result is inconsistent, the phase data is updated using the difference between the phase prediction data and the amplification factor numerator.

[0046] As an implementable method:

[0047] When the current reconstructed pixel data is the first reconstructed pixel data in the magnification direction, the corresponding phase data is the initial phase data;

[0048] When the magnification is greater than 1, the initial phase data is 0.5*N, and when the magnification is equal to 1, the initial phase data is N, where N is the magnification numerator.

[0049] As an implementable method:

[0050] When the enlargement direction is a vertical direction, the source pixel data and the reconstructed pixel data are pixel rows;

[0051] When the enlargement direction is the horizontal direction, the source pixel data and the reconstructed pixel data are pixel columns.

[0052] As an implementable method:

[0053] When the magnification direction is vertical, the ratio of the pixel rows of the stretched image to the pixel rows of the target image is used as the corresponding magnification factor;

[0054] When the magnification direction is horizontal, the ratio of the pixel columns of the stretched image to the pixel columns of the target image is used as the corresponding magnification factor.

[0055] The present application also proposes an image magnification module, comprising:

[0056] An acquisition unit, used to acquire a target image, and also used to configure a magnification direction and a magnification factor, wherein the magnification direction is a vertical direction or a horizontal direction;

[0057] A preprocessing unit, configured to perform edge processing on the target image based on the magnification direction (using adjacent rows and columns for edge processing) to obtain a corresponding source image, wherein the source image includes a plurality of source pixel data sequentially arranged along the magnification direction;

[0058] The one-dimensional magnification unit is used to calculate and obtain a corresponding stretched image based on the magnification direction, the magnification factor and the source pixel data, wherein the stretched image includes a plurality of reconstructed pixel data.

[0059] As an implementable method:

[0060] The one-dimensional enlargement unit is used to calculate each reconstructed pixel data based on the enlargement direction, the enlargement factor and the source pixel data, and includes: an extraction unit, used to extract phase data and associated pixel data, wherein the associated pixel data is at least 4 source pixel data adjacent to the current reconstructed pixel data in the enlargement direction;

[0061] A calculation unit, used to perform weighted calculation on each associated pixel data based on the phase data and the magnification to obtain corresponding weighted pixel data; and also used to calculate and obtain current reconstructed pixel data based on the weighted pixel data and the magnification;

[0062] A prediction unit, configured to predict phase data of next reconstructed pixel data based on the magnification and the phase data, to obtain phase prediction data;

[0063] An updating judgment unit is used to judge whether the associated pixel data of the current reconstructed pixel data is consistent with the associated pixel data corresponding to the next reconstructed pixel data based on the phase prediction data, and obtain a corresponding judgment result;

[0064] An updating unit is used to update the associated pixel data based on the judgment result, and also to update the phase data based on the judgment result and the phase prediction data.

[0065] The present application also proposes an image magnification method for magnifying a target image in the horizontal direction and the vertical direction, comprising the following steps:

[0066] Get the original image and configure the vertical magnification and horizontal magnification;

[0067] Based on the vertical magnification factor, the original image is vertically magnified to obtain a stretched image, wherein the vertical magnification method is any one of the methods described above;

[0068] The stretched image is horizontally magnified based on the horizontal magnification to obtain a corresponding magnified image, and the horizontal method adopts any one of the methods described above.

[0069] This application breaks down the two-dimensional image magnification into two one-dimensional magnifications in the vertical direction and the horizontal direction, simplifying the image magnification implementation process;

[0070] Since the pixel row data in the source image needs to be weighted during the vertical magnification process, and in the hardware circuit implementation, a row buffer is required to store the pixel row data as the associated pixel data, the larger the pixel row data, the larger the storage space required and the higher the circuit resource cost. Therefore, in this application, vertical magnification is performed first, and then the corresponding stretched image is magnified horizontally, which can reduce costs in actual applications.

[0071] The present application also proposes an image magnification system, comprising:

[0072] A configuration module, used for acquiring an original image and configuring a vertical magnification and a horizontal magnification;

[0073] A vertical magnification module, used for vertically magnifying the original image based on the vertical magnification factor to obtain a stretched image;

[0074] A horizontal magnification module, used for horizontally magnifying the stretched image based on the horizontal magnification factor to obtain a corresponding magnified image;

[0075] The vertical enlargement module and the horizontal enlargement module both adopt the above-mentioned image enlargement module.

[0076] The present invention has significant technical effects due to the adoption of the above technical solution:

[0077] The present invention obtains the phase data and associated pixel data of the current reconstructed pixel data, and assigns weights to each associated pixel data based on the phase data to obtain a corresponding stretched image. When the magnification is greater than 8 times, the obtained stretched image still ensures that the low-frequency boundary has no jagged edges and the high-frequency area is not blurred. BRIEF DESCRIPTION OF THE DRAWINGS

[0078] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0079] Figure 1 It is a schematic diagram of the principle of four-point weighted calculation in an image magnification method of the present invention;

[0080] Figure 2 is a schematic diagram of the workflow of the image magnification method in Example 3;

[0081] Figure 3 It is an enlarged image obtained by enlarging the image 8 times based on the bilinear interpolation algorithm;

[0082] Figure 4 The enlarged image is obtained by enlarging the image 8 times based on the enlargement method disclosed in Example 3;

[0083] Figure 5 It is a module connection diagram of the image magnification module of the present invention. DETAILED DESCRIPTION

[0084] The present invention is further described in detail below in conjunction with embodiments. The following embodiments are for explanation of the present invention but the present invention is not limited to the following embodiments.

[0085] Embodiment 1: An image magnification method is provided, which magnifies a target image in one dimension based on a vertical direction, comprising the following steps:

[0086] S110, data acquisition:

[0087] Acquire the target image, configure the magnification direction and magnification factor. In this embodiment, the magnification direction is the vertical direction, and the magnification factor is greater than 1;

[0088] To configure the magnification:

[0089] Get the number of rows H before magnification, that is, the number of pixel rows H in the target image;

[0090] Get the number of rows after enlargement h, that is, the number of pixel rows h in the corresponding stretched image;

[0091] right Reduce the fraction to the simplest possible fraction As the magnification, it can be seen that the numerator of the magnification is Ny and the denominator of the magnification is Dy.

[0092] S120, pretreatment:

[0093] The first pixel row of the target image is used to add two lines of edges above the target image (on the side where the first pixel row is located), and the last pixel row of the target image is used to add two lines of edges below the target image to obtain the corresponding source image.

[0094] S130, vertical zoom:

[0095] Calculate each pixel row in the stretched image from top to bottom, that is, reconstruct the pixel data. The steps for calculating the reconstructed pixel data of the i-th row are as follows:

[0096] S131, obtaining the phase data phi of the i-th row of reconstructed pixel data y ;

[0097] When i=1, phi y =N y / 2, when i>1, extract the updated phi in the process of calculating the reconstructed pixel data of the i-1th row y .

[0098] Note: When the magnification is equal to 1 and i = 1, phi y =N y .

[0099] S132, weight calculation;

[0100] t1=N y -phi y t2=phi y

[0101]

[0102] p1=t1-p0

[0103]

[0104] p2=t2-p3

[0105] In the above formula, p0 to p3 are weights, and t1 and t2 are intermediate parameters.

[0106] S133, obtaining associated pixel data;

[0107] The i0th row of source data in the source image is taken as the first associated pixel data, and the obtained first associated pixel data to fourth associated data correspond to the i0th to i0+3th row data of the source image.

[0108] When i=1, i0=1, that is, the associated pixel data is the 1st to 4th row data of the source image.

[0109] When i>1, the value of i0 is updated in the process of extracting and calculating the reconstructed pixel data of the i-1th row.

[0110] S134, weighted calculation, the calculation formula is:

[0111]

[0112] Among them, Img_temp(i,:) represents the reconstructed pixel data of the i-th row, Img_in(i0,:) represents the first associated pixel data, Img_in(i0+1,:) represents the second associated pixel data, Img_in(i0+2,:) represents the third associated pixel data, and Img_in(i0+3,:) represents the fourth associated pixel data, where the value range of i0 is 1 to H+1.

[0113] Note: The product of the associated pixel data and the corresponding weight is the corresponding weighted pixel data.

[0114] S135, Data Update:

[0115] Calculate the phase prediction data phi 0y , phi 0y =phi y +D y ;

[0116] The phase prediction data phi 0y With magnification numerator N y Make comparisons;

[0117] When phi 0y ≥N y hour:

[0118] Let i0=i0+1, that is, the row numbers corresponding to the first associated pixel data to the fourth associated pixel data in the source image are sequentially increased by 1, the position is moved down by one row, and the associated pixel data is updated.

[0119] And phi y =phi 0y -N y , the difference between the phase prediction data and the amplification factor numerator is used as the phase value of the next row of reconstructed pixel data.

[0120] When phi 0y <N y hour:

[0121] i0 remains unchanged, that is, the associated pixel data is not updated;

[0122] phi y =phi 0y , that is, the phase prediction data is used as the phase value of the next row of reconstructed pixel data.

[0123] The image magnification method disclosed in this embodiment can magnify the target image by any multiple in the vertical direction.

[0124] Embodiment 2: An image magnification method is provided, which magnifies a target image in one dimension based on a horizontal direction, and comprises the following steps:

[0125] S210, data acquisition:

[0126] Acquire the target image, configure the magnification direction and magnification factor. In this embodiment, the magnification direction is horizontal and the magnification factor is greater than 1.

[0127] To configure the magnification:

[0128] Get the number of columns W before magnification, that is, the number of pixel columns W in the target image;

[0129] Get the number of columns w after enlargement, that is, the number of pixel columns w in the corresponding stretched image;

[0130] right Reduce the fraction to the simplest possible fraction As the magnification, it can be seen that the magnification numerator in this embodiment is N X , the denominator of the magnification is D X .

[0131] S220, pre-processing:

[0132] The first pixel column of the target image is used to add two columns of edges on the left side of the target image (the side where the first pixel column is located), and the last pixel column of the target image is used to add two columns of edges on the right side of the target image to obtain the corresponding source image.

[0133] Reference Figure 1 , Figure 1 Indicating the schematic diagram of the principle of amplifying 3 columns of pixel data by two times to obtain 6 columns of reconstructed pixel data during horizontal amplification;

[0134] Figure 1 The five-pointed star in the middle indicates the reconstructed pixel data, and the dots indicate the source pixel data, wherein dots 2 to 4 are pixel columns representing the target image, dots 0 and 1 are the edges of dot 2, and dots 5 and 6 are the edges of dot 4; Figure 1 D in the middle represents the denominator of the magnification factor D X , N represents the magnification numerator N X In this embodiment, the ratio of image magnification is represented by the distance between adjacent reconstructed pixel data and the distance between adjacent source pixel data.

[0135] S230, horizontal zoom:

[0136] Calculate the pixel data corresponding to the pixel columns in the stretched image from left to right, that is, reconstruct the pixel data. The steps for calculating the j-th column reconstructed pixel data are as follows:

[0137] S231, obtaining the phase data phi of the j-th column of reconstructed pixel data X ;

[0138] by Figure 1 When the pixel column corresponding to the first five-pointed star in is used as the current reconstructed pixel data, the source pixel data closest to it is as follows Figure 1 As shown in the dot 1, when calculating the current reconstructed pixel data, Figure 1 Here, phi is used as phase data to assign weights to the source pixel data corresponding to dots 0 to 3.

[0139] When j = 1, phi X =N X / 2, that is Figure 1 The value of phi is 1.

[0140] When j>1, extract the updated phi in the process of calculating the j-1th reconstructed pixel data X ;.

[0141] S232, weight calculation;

[0142] To distinguish from the weights in the vertical method process in Example 1, this embodiment uses k0 to k3 to represent weight coefficients, and the calculation formula is as follows:

[0143] t1=N x -phi x t2=phi x

[0144]

[0145] k1=t1-k0

[0146]

[0147] k2=t2-k3

[0148] In the above formula, t1 and t2 are intermediate parameters.

[0149] S233, obtaining associated pixel data;

[0150] The j0th column of source data in the source image is taken as the first associated pixel data, and the obtained first associated pixel data to fourth associated data correspond to the j0th to j0+3th column data of the source image.

[0151] When j=1, j0=1, that is, the corresponding associated pixel data is the 1st to 4th column data of the source image;

[0152] When j>1, the value of j0 is updated in the process of extracting and calculating the j-1th row of reconstructed pixel data.

[0153] Reference Figure 1 , each reconstructed pixel data is obtained by weighted calculation of 4 source pixel data, that is, it has 4 associated pixel data, among which the associated pixel data of the first reconstructed pixel data is the source pixel data indicated by dots 0 to 3; the associated pixel data of the 2nd to 3rd reconstructed pixel data is the source pixel data indicated by dots 1 to 4; the associated pixel data of the 4th to 5th reconstructed pixel data are all the source pixel data indicated by dots 2 to 5; the associated pixel data of the 6th reconstructed pixel data is the source pixel data indicated by dots 3 to 6.

[0154] S234, weighted calculation, the calculation formula is:

[0155]

[0156] Among them, Img_out(:, j) represents the pixel data of the jth column in the corresponding stretched image, that is, the reconstructed pixel data of the jth column, Img_temp(:, j0) represents the first associated pixel data, Img_temp(:, j0+1) represents the second associated pixel data, Img_temp(:, j0+2) represents the third associated pixel data, and Img_temp(:, j0+3) represents the fourth associated data, where the value range of j0 is 1 to W+1.

[0157] S235, Data Update:

[0158] Reference Figure 1 , the intervals between the reconstructed pixel data are the same, and the intervals between the source pixel data are also the same, so the source pixel data closest to the reconstructed pixel data can be determined according to the rule between them, and the associated pixel data of the reconstructed pixel data can be obtained according to the positional relationship between the reconstructed pixel data and its nearest neighbor. This embodiment specifically implements automatic update of the phase and associated pixel data based on the following steps:

[0159] Calculate the phase prediction data phi 0x , phi 0x =phi x +D x ;

[0160] The phase prediction data phi 0x With magnification numerator N x Make comparisons;

[0161] When phi 0x ≥N x hour:

[0162] Let j0=j0+1, that is, the column numbers corresponding to the first associated pixel data to the fourth associated pixel data in the source image are sequentially increased by 1, the positions are shifted right by one column, and the associated pixel data are updated.

[0163] And phi x =phi 0x -N x , the difference between the phase prediction data and the amplification factor numerator is used as the phase value of the next row of reconstructed pixel data.

[0164] When phi 0x <N x hour:

[0165] j0 remains unchanged, that is, the associated pixel data is not updated;

[0166] phi x =phi 0x , that is, the phase prediction data is used as the phase value of the next point in the current pixel row to reconstruct the pixel data.

[0167] The image magnification method disclosed in this embodiment can magnify the target image by any multiple in the horizontal direction.

[0168] Embodiment 3: An image magnification method, which is used to magnify a target image in the vertical direction and the horizontal direction, referring to Figure 2 , including the following steps:

[0169] Get the original image (size H×W) and configure the vertical magnification and horizontal magnification

[0170] The original image is substituted for the target image in Example 1 and vertically enlarged to obtain a corresponding stretched image (with a size of h×W);

[0171] The obtained stretched image is used instead of the target image in Example 2 to be horizontally enlarged to obtain a corresponding enlarged image (with a size of h×w).

[0172] In this embodiment, the step of magnifying a two-dimensional image is decomposed into two one-dimensional magnifications in the vertical direction and the horizontal direction, which simplifies the image magnification implementation process, and the magnification factor is expressed in the form of a fraction, which supports arbitrary magnification of the image, and adopts a 4-point weighted interpolation algorithm to ensure the image quality of the obtained magnified image;

[0173] Figure 3 is an enlarged image obtained by enlarging the image by 8 times based on the bilinear interpolation algorithm in the prior art, Figure 4This is an enlarged image obtained by enlarging the image 8 times according to the method disclosed in this embodiment. By comparison, it can be seen that no aliasing occurs at the low-frequency boundary of the image enlarged by the method disclosed in this embodiment, and the high-frequency area is clearer.

[0174] Note: Based on the magnification method disclosed in this embodiment, the image quality can be guaranteed when the image is magnified 10 times, 20 times or higher. However, since the existing image magnification tools only support magnification of 8 times, in order to facilitate comparison of the magnification effect, only the effect diagram of magnification of 8 times is provided.

[0175] Embodiment 3: An image magnification module comprises:

[0176] The acquisition unit 100 is used to acquire a target image and configure a magnification direction and a magnification factor, wherein the magnification direction is a vertical direction or a horizontal direction, and the magnification factor is greater than or equal to 1;

[0177] A preprocessing unit 200 is used to perform edge processing on the target image based on the magnification direction (using adjacent rows and columns to perform edge processing) to obtain a corresponding source image, wherein the source image includes a plurality of source pixel data sequentially arranged along the magnification direction;

[0178] A one-dimensional magnification unit 300, configured to calculate and obtain a corresponding stretched image based on the magnification direction, the magnification factor and the source pixel data, wherein the stretched image includes a plurality of reconstructed pixel data;

[0179] The one-dimensional enlargement unit 300 is used to calculate each reconstructed pixel data based on the enlargement direction, the enlargement factor and the source pixel data, and includes:

[0180] An extraction unit 310, configured to extract phase data and associated pixel data, wherein the associated pixel data is at least four source pixel data adjacent to the current reconstructed pixel data in the amplification direction;

[0181] The calculation unit 320 is used to perform weighted calculation on each associated pixel data based on the phase data and the magnification to obtain corresponding weighted pixel data; and is also used to calculate and obtain current reconstructed pixel data based on the weighted pixel data and the magnification;

[0182] A prediction unit 330, configured to predict phase data of next reconstructed pixel data based on the magnification and the phase data to obtain phase prediction data;

[0183] An updating judgment unit 340 is used to judge whether the associated pixel data of the current reconstructed pixel data is consistent with the associated pixel data corresponding to the next reconstructed pixel data based on the phase prediction data, and obtain a corresponding judgment result;

[0184] The updating unit 350 is used to update the associated pixel data based on the judgment result, and also to update the phase data based on the judgment result and the phase prediction data.

[0185] This embodiment is a device embodiment corresponding to Embodiment 1 and Embodiment 2. Since it is basically similar to Embodiment 1 and Embodiment 2, the description is relatively simple, and the relevant parts can be referred to the partial description of Embodiment 1 and Embodiment 2.

[0186] Embodiment 4: An image magnification system, comprising:

[0187] A configuration module, used for acquiring an original image and configuring a vertical magnification and a horizontal magnification;

[0188] A vertical magnification module, used for vertically magnifying the original image based on the vertical magnification factor to obtain a stretched image;

[0189] A horizontal magnification module, used for horizontally magnifying the stretched image based on the horizontal magnification factor to obtain a corresponding magnified image;

[0190] The vertical enlargement module and the horizontal enlargement module both adopt the image enlargement module disclosed in Example 3.

[0191] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0192] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0193] The present invention is described with reference to the flowcharts and / or block diagrams of the method, terminal device (system), and computer program product according to the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1A device that provides the functions specified in a block or multiple blocks.

[0194] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0195] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0196] It should be noted that:

[0197] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.

[0198] In addition, it should be noted that the shapes and names of the parts and components of the specific embodiments described in this specification may be different. Any equivalent or simple changes made based on the structure, features and principles described in the patent concept of the present invention are included in the protection scope of the patent of the present invention. The technicians in the technical field of the present invention can make various modifications or supplements to the specific embodiments described or replace them in a similar manner, as long as they do not deviate from the structure of the present invention or exceed the scope defined in the claims, they should all fall within the protection scope of the present invention.

Claims

1. An image magnification method, characterized in that: The following steps are involved: Acquire a target image, and configure a magnification direction and a magnification factor, wherein the magnification direction is a vertical direction or a horizontal direction; Performing edge processing on the target image based on the magnification direction to obtain a corresponding source image, wherein the source image includes a plurality of source pixel data; Obtaining a corresponding stretched image by calculation based on the magnification direction, the magnification factor and the source pixel data, wherein the stretched image includes a plurality of reconstructed pixel data; The steps to calculate the current reconstructed pixel data are: Extracting phase data and associated pixel data, wherein the associated pixel data is at least four source pixel data adjacent to the current reconstructed pixel data in the amplification direction; Performing weighted calculation on each associated pixel data based on the phase data and the magnification factor to obtain corresponding weighted pixel data; Calculating and obtaining current reconstructed pixel data based on the weighted pixel data and the magnification factor; Based on the magnification and the phase data, predicting the phase data of the next reconstructed pixel data to obtain phase prediction data; Based on the phase prediction data, determine whether the associated pixel data of the current reconstructed pixel data is consistent with the associated pixel data corresponding to the next reconstructed pixel data, and obtain a corresponding determination result; updating the associated pixel data based on the judgment result, and also updating the phase data based on the judgment result and the phase prediction data; The step of performing edge processing on the target image based on the magnification direction includes: When zooming in the vertical direction, the first pixel row of the target image is used to add two lines of edges above the target image, and the last pixel row of the target image is used to add two lines of edges below the target image, where the upper side of the target image represents the side where the first pixel row is located; When zooming in the horizontal direction, the first pixel column of the target image is used to add two columns of edges on the left side of the target image, and the last pixel column of the target image is used to add two columns of edges on the right side of the target image to obtain the corresponding source image; The updating of the associated pixel data based on the judgment result, and the updating of the phase data based on the judgment result and the phase prediction data, comprises: When the judgment result is inconsistent, the phase data is updated based on the magnification and the phase prediction data, and the associated pixel data is also updated based on the sliding window mechanism; When the judgment result is consistent, the phase data is updated based on the phase prediction data.

2. The image magnification method according to claim 1, characterized in that: The magnification factor includes a magnification factor numerator and a magnification factor denominator; The number of the associated pixel data is 4, which are first associated pixel data, second associated pixel data, third associated pixel data and fourth associated pixel data in sequence; The formula for calculating the weight corresponding to each of the above associated pixel data is: t1 = N-phi; t2 = phi; p1=t1-p0; p2 = t2 - p3; Among them, N represents the magnification numerator, phi represents the phase data of the current reconstructed pixel data, p0 is the weight corresponding to the first associated pixel data, p1 is the weight corresponding to the second associated pixel data, p2 is the weight corresponding to the third associated pixel data, p3 is the weight corresponding to the fourth associated pixel data, and t1 and t2 are intermediate parameters.

3. The image magnification method according to claim 1, characterized in that: Calculate the sum of the magnification denominator and the phase data of the current reconstructed pixel data to obtain phase prediction data; When the phase prediction data is greater than or equal to the amplification factor numerator, the judgment result is inconsistent, otherwise the judgment result is consistent; When the judgment result is inconsistent, the phase data is updated using the difference between the phase prediction data and the amplification factor numerator.

4. The image magnification method according to claim 3, characterized in that: When the current reconstructed pixel data is the first reconstructed pixel data in the magnification direction, the corresponding phase data is the initial phase data; When the magnification is greater than 1, the initial phase data is 0.5*N, where N is the magnification numerator.

5. The image magnification method according to claim 1 or 2, characterized in that: When the enlargement direction is a vertical direction, the source pixel data and the reconstructed pixel data are pixel rows; When the enlargement direction is the horizontal direction, the source pixel data and the reconstructed pixel data are pixel columns.

6. The image magnification method according to claim 5, characterized in that: When the magnification direction is vertical, the ratio of the pixel rows of the stretched image to the pixel rows of the target image is used as the corresponding magnification factor; When the magnification direction is horizontal, the ratio of the pixel columns of the stretched image to the pixel columns of the target image is used as the corresponding magnification factor.

7. An image magnification module, characterized in that: include: An acquisition unit, used to acquire a target image, and also used to configure a magnification direction and a magnification factor, wherein the magnification direction is a vertical direction or a horizontal direction; A preprocessing unit, configured to perform edge addition processing on the target image based on the magnification direction to obtain a corresponding source image, wherein the source image includes a plurality of source pixel data; a one-dimensional magnification unit, configured to calculate and obtain a corresponding stretched image based on the magnification direction, the magnification factor and the source pixel data, wherein the stretched image includes a plurality of reconstructed pixel data; The one-dimensional amplification unit comprises: An extraction unit, configured to extract phase data and associated pixel data, wherein the associated pixel data is at least four source pixel data adjacent to the current reconstructed pixel data in the amplification direction; A calculation unit, used to perform weighted calculation on each associated pixel data based on the phase data and the magnification to obtain corresponding weighted pixel data; and also used to calculate and obtain current reconstructed pixel data based on the weighted pixel data and the magnification; A prediction unit, configured to predict phase data of next reconstructed pixel data based on the magnification and the phase data, to obtain phase prediction data; An updating judgment unit is used to judge whether the associated pixel data of the current reconstructed pixel data is consistent with the associated pixel data corresponding to the next reconstructed pixel data based on the phase prediction data, and obtain a corresponding judgment result; an updating unit, configured to update the associated pixel data based on the judgment result, and to update the phase data based on the judgment result and the phase prediction data; The step of performing edge processing on the target image based on the magnification direction includes: When zooming in the vertical direction, the first pixel row of the target image is used to add two lines of edges above the target image, and the last pixel row of the target image is used to add two lines of edges below the target image, where the upper side of the target image represents the side where the first pixel row is located; When zooming in the horizontal direction, the first pixel column of the target image is used to add two columns of edges on the left side of the target image, and the last pixel column of the target image is used to add two columns of edges on the right side of the target image to obtain the corresponding source image; The updating of the associated pixel data based on the judgment result, and the updating of the phase data based on the judgment result and the phase prediction data, comprises: When the judgment result is inconsistent, the phase data is updated based on the magnification and the phase prediction data, and the associated pixel data is also updated based on the sliding window mechanism; When the judgment result is consistent, the phase data is updated based on the phase prediction data.

8. An image magnification method, characterized in that: The following steps are involved: Get the original image and configure the vertical magnification and horizontal magnification; The original image is vertically magnified based on the vertical magnification factor to obtain a stretched image, wherein the vertical magnification method is the method described in any one of claims 1 to 6; The stretched image is horizontally enlarged based on the horizontal magnification to obtain a corresponding enlarged image, and the horizontal method adopts the method described in any one of claims 1 to 6.

9. An image magnification system, characterized in that: include: A configuration module, used for acquiring an original image and configuring a vertical magnification and a horizontal magnification; A vertical magnification module, used to vertically magnify the original image based on the vertical magnification factor to obtain a stretched image; A horizontal magnification module, used for horizontally magnifying the stretched image based on the horizontal magnification factor to obtain a corresponding magnified image; The vertical enlargement module and the horizontal enlargement module both adopt the image enlargement module described in claim 7.

Citation Information

Patent Citations

  • Image magnification method based on edge extraction

    CN103136752A

  • Real-time foreground extraction method based on monocular platform and device thereof

    CN107346547A