Image sharpness enhancement method, device, storage medium and electronic device

By calculating the coordinate information of the corresponding position in the image before enlargement and weighted fusion technology, the problem of weakening of sharpness after image amplification is solved, and higher image sharpness and detail performance are achieved.

CN119784661APending Publication Date: 2025-04-08SHANGHAI WEIJING SEMICONDUCTOR CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411867977.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-18
Publication Date
2025-04-08

AI Technical Summary

Technical Problem

After magnifying the image, the existing image amplification algorithm causes the image sharpness to weaken, affecting the visual quality and the accuracy of subsequent analysis.

Method used

By calculating the second coordinate information of the corresponding position in the image before enlarging, the texture similarity weight and Euclidean distance weight are calculated based on the pixel value and texture characteristics of the neighboring pixel points, and the weighted fusion is performed to calculate the pixel value of the target pixel point.

Benefits of technology

It effectively enhances the sharpness of the image after magnification, making it closer to the sharpness of the image before magnification, and improves the sharpness and detail performance of the image.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119784661A_ABST
    Figure CN119784661A_ABST
Patent Text Reader

Abstract

The present application discloses an image sharpness enhancement method, device, storage medium and electronic device, wherein the image sharpness enhancement method includes calculating the second coordinate information of each corresponding position in the image before enlargement based on the first coordinate information of each target pixel in the enlarged image; calculating the effective value of the corresponding position based on the pixel value of the neighborhood pixel of the corresponding position and the second coordinate information; calculating the texture similarity weight of the neighborhood pixel according to the effective value; calculating the Euclidean distance weight of the neighborhood pixel according to the Euclidean distance between the corresponding position and the neighborhood pixel; and calculating the pixel value of the target pixel based on the texture similarity weight and the Euclidean distance weight. This scheme can enhance the sharpness of the enlarged image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of image processing technology, and specifically to an image sharpness enhancement method, device, storage medium and electronic device. Background Art

[0002] Image magnification technology is an important technology in the field of image processing and is widely used in many scenarios such as high-definition display, video surveillance, medical image analysis, and digital image editing. Its core goal is to convert low-resolution images into high-resolution images, while increasing the number of pixels while retaining the details and sharpness of the original image as much as possible, so as to improve the visual quality and usability of the image.

[0003] However, after using the existing image magnification algorithm to enlarge the image, the enlarged image is blurrier than the original image, that is, the image sharpness is weakened, which seriously affects the visual quality and the accuracy of subsequent analysis. Summary of the invention

[0004] The embodiments of the present application provide an image sharpness enhancement method, device, storage medium and electronic device, which can enhance the sharpness of an enlarged image.

[0005] In a first aspect, an embodiment of the present application provides a method for enhancing image sharpness, comprising:

[0006] Calculate the second coordinate information of each corresponding position in the image before the enlargement according to the first coordinate information of each target pixel point in the enlarged image;

[0007] Calculate the effective value of the corresponding position based on the pixel values ​​of the neighborhood pixels of the corresponding position and the second coordinate information;

[0008] Calculating the texture similarity weight of the neighborhood pixel points according to the effective value;

[0009] Calculating the Euclidean distance weight of the neighborhood pixel point according to the Euclidean distance between the corresponding position and the neighborhood pixel point;

[0010] The pixel value of the target pixel is calculated based on the texture similarity weight and the Euclidean distance weight.

[0011] In the image sharpness enhancement method provided in the embodiment of the present application, the second coordinate information of each corresponding position in the image before the amplification is calculated according to the first coordinate information of each target pixel point in the amplified image, including:

[0012] Get the zoom factor of the enlarged image relative to the image before enlargement;

[0013] The first coordinate information of each target pixel point in the amplified image is scaled based on the scaling factor to obtain the second coordinate information of each corresponding position in the image before amplification.

[0014] In the image sharpness enhancement method provided in an embodiment of the present application, the second coordinate information includes a second horizontal coordinate and a second vertical coordinate, the second horizontal coordinate includes a horizontal integer and a horizontal decimal, the second vertical coordinate includes a vertical integer and a vertical decimal, and the horizontal integer and the vertical integer constitute a reference pixel point.

[0015] In the image sharpness enhancement method provided in the embodiment of the present application, the effective value of the corresponding position is calculated based on the pixel value of the neighborhood pixel point of the corresponding position and the second coordinate information, including:

[0016] Determine a first neighborhood pixel point, a first neighborhood pixel point, and a third neighborhood pixel point of the reference pixel point;

[0017] Obtaining a reference pixel value, a first neighborhood pixel value, a second neighborhood pixel value, and a third neighborhood pixel value of the reference pixel point, the first neighborhood pixel point, the first neighborhood pixel point, and the third neighborhood pixel point;

[0018] The effective value of the corresponding position is calculated based on the vertical decimal, the horizontal decimal, the reference pixel value, the first neighborhood pixel value, the second neighborhood pixel value and the third neighborhood pixel value.

[0019] In the image sharpness enhancement method provided in the embodiment of the present application, the step of calculating the texture similarity weight of the neighborhood pixel points according to the effective value includes:

[0020] Respectively obtain pixel differences between pixel values ​​of several neighboring pixel points of the reference pixel point and the effective value;

[0021] A calculation is performed based on the pixel difference to obtain a texture similarity weight corresponding to each of the neighborhood pixels.

[0022] In the image sharpness enhancement method provided in the embodiment of the present application, the Euclidean distance weight of the neighborhood pixel point is calculated according to the Euclidean distance between the corresponding position and the neighborhood pixel point, including:

[0023] Obtaining coordinate information of a number of neighboring pixel points of the reference pixel point;

[0024] Calculating the Euclidean distance between the corresponding position and each of the neighborhood pixel points according to the second coordinate information and the coordinate information of each of the neighborhood pixel points;

[0025] The Euclidean distance weight corresponding to each of the neighborhood pixels is calculated based on the Euclidean distance.

[0026] In the image sharpness enhancement method provided in the embodiment of the present application, the step of calculating the pixel value of the target pixel point based on the texture similarity weight and the Euclidean distance weight includes:

[0027] Performing weighted fusion on the texture similarity weight and the Euclidean distance weight to obtain a comprehensive weight;

[0028] The pixel value of each neighborhood pixel point is weighted by using the comprehensive weight to obtain a weighted neighborhood pixel value;

[0029] A convolution operation is performed on the weighted neighborhood pixel values ​​to obtain the pixel value of the target pixel.

[0030] In a second aspect, an embodiment of the present application provides an image sharpness enhancement device, comprising:

[0031] A first calculation unit, used for calculating second coordinate information of each corresponding position in the image before amplification according to the first coordinate information of each target pixel point in the amplified image;

[0032] A second calculation unit, configured to calculate a valid value of the corresponding position based on pixel values ​​of neighboring pixels of the corresponding position and the second coordinate information;

[0033] A third calculation unit, used for calculating the texture similarity weight of the neighborhood pixel point according to the effective value;

[0034] A fourth calculation unit, configured to calculate a Euclidean distance weight of the neighborhood pixel point according to the Euclidean distance between the corresponding position and the neighborhood pixel point;

[0035] A fifth calculation unit is used to calculate the pixel value of the target pixel point based on the texture similarity weight and the Euclidean distance weight.

[0036] In a third aspect, the present application provides a storage medium storing a plurality of instructions, wherein the instructions are suitable for loading by a processor to execute any of the above-mentioned image sharpness enhancement methods.

[0037] In a fourth aspect, the present application provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements any of the above-described image sharpness enhancement methods when executing the computer program.

[0038] In summary, the image sharpness enhancement method provided in the embodiment of the present application adopts the method of calculating the second coordinate information of each corresponding position in the image before enlargement according to the first coordinate information of each target pixel in the enlarged image; calculating the effective value of the corresponding position based on the pixel value of the neighborhood pixel of the corresponding position and the second coordinate information; calculating the texture similarity weight of the neighborhood pixel according to the effective value; calculating the Euclidean distance weight of the neighborhood pixel according to the Euclidean distance between the corresponding position and the neighborhood pixel; calculating the pixel value of the target pixel based on the texture similarity weight and the Euclidean distance weight. This scheme introduces a weighted fusion of texture similarity weights and Euclidean distance weights, comprehensively considering the texture characteristics and spatial relationship between the target pixel and the neighborhood pixel, so that the sharpness of the enlarged image is closer to the sharpness of the image before enlargement. That is, this scheme can enhance the sharpness of the enlarged image. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0040] Figure 1 It is a flowchart of the image sharpness enhancement method provided in an embodiment of the present application.

[0041] Figure 2 It is a schematic diagram of neighborhood pixels provided in an embodiment of the present application.

[0042] Figure 3 It is a schematic diagram of the mapping relationship between the first function and the pixel difference provided in an embodiment of the present application.

[0043] Figure 4 This is another schematic diagram of neighborhood pixels provided in an embodiment of the present application.

[0044] Figure 5 It is a schematic diagram of the mapping relationship between the second function and the Euclidean distance provided in the embodiment of the present application.

[0045] Figure 6 It is a flow chart of the image sharpness enhancement device provided in an embodiment of the present application.

[0046] Figure 7 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0047] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0048] It should be noted that, in this article, the terms "include", "comprises" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element. In addition, components, features, and elements with the same name in different embodiments of the present application may have the same meaning or different meanings, and their specific meanings need to be determined by their explanation in the specific embodiment or further combined with the context of the specific embodiment.

[0049] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0050] In the subsequent description, the suffixes such as "module", "component" or "unit" used to represent elements are only used to facilitate the description of the present application, and have no specific meanings. Therefore, "module", "component" or "unit" can be used in a mixed manner.

[0051] In the description of the present application, it should be noted that the terms "upper", "lower", "left", "right", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present application and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present application. In addition, terms such as "first" and "second" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance.

[0052] After the image is enlarged using the existing image enlargement algorithm, the enlarged image is blurrier than the original image, that is, the image sharpness is weakened, which seriously affects the visual quality and the accuracy of subsequent analysis.

[0053] Based on this, the embodiments of the present application provide an image sharpness enhancement method, device, storage medium and electronic device. Specifically, the image sharpness enhancement device can be integrated in an electronic device, and the electronic device can be a server or a terminal or other device; wherein the terminal can include a mobile phone, a wearable smart device, a tablet computer, a laptop computer, and a personal computer (PC), etc.; the server can be a single server or a server cluster composed of multiple servers, and can be a physical server or a virtual server.

[0054] For example, after acquiring the enlarged image, the electronic device calculates the second coordinate information of each corresponding position in the image before enlargement based on the first coordinate information of each target pixel in the enlarged image; calculates the effective value of the corresponding position based on the pixel value of the neighborhood pixel at the corresponding position and the second coordinate information; calculates the texture similarity weight of the neighborhood pixel based on the effective value; calculates the Euclidean distance weight of the neighborhood pixel based on the Euclidean distance between the corresponding position and the neighborhood pixel; and calculates the pixel value of the target pixel based on the texture similarity weight and the Euclidean distance weight.

[0055] The technical solutions shown in the present application will be described in detail below through specific embodiments. It should be noted that the description order of the following embodiments is not intended to limit the priority order of the embodiments.

[0056] See also Figure 1 , Figure 1 : is a flow chart of the image sharpness enhancement method provided in the embodiment of the present application. The specific flow of the image sharpness enhancement method can be as follows:

[0057] 101. Calculate second coordinate information of corresponding positions in the image before amplification according to first coordinate information of each target pixel in the amplified image.

[0058] The corresponding position refers to the mapping position of a target pixel in the enlarged image in the image before enlargement, that is, the position mapped to the coordinate system of the image before enlargement through the first coordinate information. The second coordinate information of the corresponding position may be a non-integer coordinate, which is usually calculated by the scaling factor.

[0059] Specifically, the zoom factor of the enlarged image relative to the image before enlargement can be obtained first; then the first coordinate information of each target pixel in the enlarged image is scaled based on the zoom factor to obtain the second coordinate information of each corresponding position in the image before enlargement.

[0060] The scaling factor may include a horizontal scaling factor and a vertical scaling decimal. The first coordinate information may include a first horizontal coordinate and a second vertical coordinate. The second coordinate information may include a second horizontal coordinate and a second vertical coordinate. Since the second coordinate information may be a non-integer coordinate, the second horizontal coordinate may include a horizontal integer and a horizontal decimal, and the second vertical coordinate may include a vertical integer and a vertical decimal.

[0061] The following is an example to illustrate this step, for example, I represents a pixel value, x and y represent coordinates, and I(x, y) represents a pixel value at the coordinate (x, y).

[0062] The image before enlargement is defined as srcImg, the image width is srcW (number of pixels), and the image height is srcH (number of pixels); the pixel value at the second coordinate information (x, y) of the corresponding position in the image before enlargement is represented as I src The enlarged image is defined as dstImg, the image width is dstW (number of pixels), the image height is dstH (number of pixels), and the pixel value at the first coordinate information (x, y) of the target pixel point in the enlarged image is represented as I dst (x,y).

[0063] Then, the horizontal scaling factor scaleX can be: scaleX = srcW / dstW. The vertical scaling factor scaleY can be: scaleY = srcH / dstH. The second horizontal coordinate is the product of the first horizontal coordinate and the horizontal scaling factor, that is, the second horizontal coordinate localX = x*scaleX. The second vertical coordinate is the product of the first vertical coordinate and the vertical scaling factor, that is, the second vertical coordinate localY = y*scaleY. Among them, the horizontal integer is recorded as localX int , the horizontal decimal is recorded as localX float . Vertical integer localY int , the vertical decimal is recorded as localY float .

[0064] That is, the second coordinate information is (scaleX, scaleY). The reference pixel point composed of the horizontal integer and the vertical integer is (localX int ,localY int ).

[0065] 102. Calculate a valid value of the corresponding position based on the pixel values ​​of the neighborhood pixels of the corresponding position and the second coordinate information.

[0066] In the embodiment of the present application, a bilinear interpolation algorithm is used to calculate the effective value of the corresponding position. Specifically, the first neighborhood pixel point, the first neighborhood pixel point and the third neighborhood pixel point of the reference pixel point can be determined first; then the reference pixel value, the first neighborhood pixel value, the second neighborhood pixel value and the third neighborhood pixel value of the reference pixel point, the first neighborhood pixel point, the first neighborhood pixel point and the third neighborhood pixel point are obtained; finally, based on the vertical decimal, the horizontal decimal, the reference pixel value, the first neighborhood pixel value, the second neighborhood pixel value and the third neighborhood pixel value, the effective value of the corresponding position is calculated.

[0067] like Figure 2 As shown in the figure, when the bilinear interpolation algorithm is used to calculate the effective value of the corresponding position, the reference pixel point (localX int ,localY int ), the first neighboring pixel point, the second neighboring pixel point and the third neighboring pixel point are the right neighboring pixel point, the lower left neighboring pixel point and the lower right neighboring pixel point of the reference pixel point respectively. At this time, the reference pixel value is I(localX int ,localY int ), the first neighborhood pixel value is I(localX int +

[0068] 1,localYint, the second neighbor pixel value is IlocalXint,localYint+1, and the third neighbor pixel value is I(localXint int +1,localY int +1).

[0069] At this time, based on the reference pixel value I(localX int ,localY int ), horizontal decimal localX float and the first neighbor pixel value is I(localX int +1,localY int ) Calculate the first interpolation value srcValue1, srcValue1 = (localX float *I(localX int ,localY int ))+

[0070] ((1-localX float )*I(localX int +1,localY int )).

[0071] Then based on the second neighborhood pixel value I(localX int ,localY int+1), the third neighbor pixel value I(localX int +1,localY int +1) and the horizontal decimal localX float Calculate the second interpolation srcValue2, srcValue2 = 9localX float *I(localX int ,localY int +1))+(1-localX float )*

[0072] IlocalXint+1,localYint+1.

[0073] Finally, we can use the first interpolation srcValue1, the second interpolation srcValue2, and the vertical fraction localY float Calculate the effective value srcValue of the corresponding position, srcValue = (localY float ×srcValue1)+((1-localY float )×srcValue2).

[0075] 103. Calculate the texture similarity weight of the neighborhood pixels according to the effective value.

[0076] In the enlarged image, the value of each target pixel is the reference pixel (localX int ,localY int ) is obtained by weighting the pixel values ​​of several neighboring pixels. Therefore, the key to optimization is how to adjust the weighted weights of the pixel values ​​of the neighboring pixels so that the pixels of the weighted output image are uniform and the details are intact.

[0077] In the embodiment of the present application, the weighted weights of the pixel values ​​of the neighborhood pixels are adjusted according to the similarity of the pixel values. Empirical theory: In an area of ​​the image, the pixel values ​​are similar along the texture direction. In a flat area, the pixel values ​​of the neighborhood pixels are similar in all directions. Therefore, the pixel difference between the pixel values ​​of several neighborhood pixels of the reference pixel and the effective value can be obtained respectively; the texture similarity weight corresponding to each neighborhood pixel is obtained based on the pixel difference.

[0078] For example, the texture similarity weight of the neighborhood pixel (x+n, y+m) is denoted as ωI (,) , then the pixel difference ωTmp (,) =abs(I (x+n,) -srcValue). (x+n,)It is the pixel value of the neighborhood pixel (x+n,y+m), and srcValue is a valid value.

[0079] Afterwards, the pixel difference ωI (,) Multiplying with the first function α, we get the texture similarity weight of the neighborhood pixel (x+n, y+m) as ωI (,) ,ωI (,) =α(ωTmp (,) ).

[0080] Among them, the first function α comes from Figure 3 The mapping relationship shown in Figure 3 In the figure, the horizontal axis is the pixel difference ωTmp. The x-axis nodes β1 and β2 of the curve are settable by experience (the experience value is usually 1 / 3 and 2 / 3). Generally, the smaller the difference, the greater the weight. When the difference is 0, the weight is 1.

[0081] It should be noted that the reference pixel (localX int ,localY int ) refers to the number of neighboring pixels (localX int ,localY int ) is the pixel point in the symmetric area centered at . Figure 4 As shown, several neighborhood pixels refer to (localX ont ,localY int ) is the pixel point in the central 5*5 symmetrical area.

[0082] 104. Calculate the Euclidean distance weight of the neighborhood pixel point according to the Euclidean distance between the corresponding position and the neighborhood pixel point.

[0083] It can be understood that, in an area of ​​an image, the greater the Euclidean distance between pixels, the smaller the correlation of pixel values, and the closer the Euclidean distance between pixels, the greater the correlation of pixel values.

[0084] Therefore, the coordinate information of several neighborhood pixels of the reference pixel can be obtained first; then, based on the second coordinate information and the coordinate information of each neighborhood pixel, the Euclidean distance between the corresponding position and each neighborhood pixel is calculated; finally, the Euclidean distance weight corresponding to each neighborhood pixel is calculated based on the Euclidean distance.

[0085] For example, if the neighborhood pixel is (x+n, y+m), the second coordinate information of the corresponding position is (scaleX, scaleY). Then, the Euclidean distance between the corresponding position and the neighborhood pixel is

[0086]

[0087] After that, the Euclidean distance ωDTmp (,) can be multiplied by the second function γ to obtain the Euclidean distance weight ωD of the neighborhood pixel points (,) , ωD (,) = γ(ωDTmp (,) ).

[0088] Among them, the function γ comes from the mapping relationship as shown in Figure 5 . In Figure 5 , the abscissa is the Euclidean distance ωDTmp (,) . The γ mapping curve is as shown in Figure 5 : the smaller the distance, the greater the weight. The curve is approximately a Gaussian function, and its steepness can be controlled by adjusting the σ of the Gaussian function. Among them, maxD represents the maximum Euclidean distance determined by the size of the symmetric region centered on the reference pixel point.

[0089] 105. Calculate the pixel value of the target pixel point based on the texture similarity weight and the Euclidean distance weight.

[0090] Specifically, the texture similarity weight and the Euclidean distance weight can be weighted and fused to obtain a comprehensive weight; the comprehensive weight is used to weight the pixel values of each neighborhood pixel point to obtain the weighted neighborhood pixel values; a convolution operation is performed on several weighted neighborhood pixel values to obtain the pixel value of the target pixel point.

[0091] For example, the Euclidean distance weight of the neighborhood pixel point is ωD (,) , the texture similarity weight of the neighborhood pixel point is ωI (,) , and the pixel value of the neighborhood pixel point is I src (x + n, y + m). Then, at this time, the pixel value of the target pixel point is I dst (x, y), specifically as follows:

[0092]

[0093] Among them, m represents the horizontal offset, and n represents the vertical offset. j and k are index variables used to represent the positions of neighborhood pixel points, and are usually related to the size of the convolution kernel in the convolution operation. Specifically, j represents the row index (vertical direction) in the convolution kernel, and k represents the column index (horizontal direction) in the convolution kernel.

[0094] In the actual application process, assuming that the size of the convolution kernel is M×N, then, the value range of j is 0 ≤ j < M (representing the number of rows of the convolution kernel). The value range of k is 0 ≤ k < N (representing the number of columns of the convolution kernel).

[0095] In summary, the image sharpness enhancement method provided by the embodiment of the present application adopts the method of calculating the second coordinate information of each corresponding position in the image before enlargement according to the first coordinate information of each target pixel in the enlarged image; calculating the effective value of the corresponding position based on the pixel value and the second coordinate information of the neighborhood pixel of the corresponding position; calculating the texture similarity weight of the neighborhood pixel according to the effective value; calculating the Euclidean distance weight of the neighborhood pixel according to the Euclidean distance between the corresponding position and the neighborhood pixel; calculating the pixel value of the target pixel based on the texture similarity weight and the Euclidean distance weight. This scheme introduces the weighted fusion of texture similarity weight and Euclidean distance weight, comprehensively considers the texture characteristics and spatial relationship between the target pixel and the neighborhood pixel. Compared with the traditional neighborhood interpolation algorithm, this scheme can better retain the details and sharpness in the image, especially at the edge and texture part of the image, avoiding the problem of blurring and loss of details after image enlargement, and making the sharpness of the enlarged image closer to the sharpness of the image before enlargement. That is, this scheme can effectively enhance the sharpness of the enlarged image and improve the clarity and detail performance of the image.

[0096] In order to facilitate better implementation of the image sharpness enhancement method provided in the embodiment of the present application, the embodiment of the present application also provides an image sharpness enhancement device. The meanings of the terms are the same as those in the above-mentioned image sharpness enhancement method, and the specific implementation details can refer to the description in the method embodiment.

[0097] See also Figure 6 , Figure 6 2 is a schematic diagram of the structure of the image sharpness enhancement device provided in the embodiment of the present application. The image sharpness enhancement device may include a first calculation unit 201, a second calculation unit 202, a third calculation unit 203, a fourth calculation unit 204 and a fifth calculation unit 205. Among them,

[0098] The first calculation unit 201 is used to calculate the second coordinate information of each corresponding position in the image before the enlargement according to the first coordinate information of each target pixel point in the enlarged image;

[0099] A second calculation unit 202, configured to calculate a valid value of a corresponding position based on the pixel values ​​of the neighboring pixels of the corresponding position and the second coordinate information;

[0100] The third calculation unit 203 is used to calculate the texture similarity weight of the neighborhood pixel points according to the effective value;

[0101] A fourth calculation unit 204 is used to calculate the Euclidean distance weight of the neighborhood pixel point according to the Euclidean distance between the corresponding position and the neighborhood pixel point;

[0102] The fifth calculation unit 205 is used to calculate the pixel value of the target pixel point based on the texture similarity weight and the Euclidean distance weight.

[0103] The specific implementation of each of the above units can refer to the above-mentioned embodiment of the image sharpness enhancement method, which will not be described one by one here.

[0104] In summary, the image sharpness enhancement device provided by the embodiment of the present application can be used by the first calculation unit 201 to calculate the second coordinate information of each corresponding position in the image before enlargement according to the first coordinate information of each target pixel in the enlarged image; the second calculation unit 202 calculates the effective value of the corresponding position based on the pixel value and the second coordinate information of the neighborhood pixel of the corresponding position; the third calculation unit 203 calculates the texture similarity weight of the neighborhood pixel according to the effective value; the fourth calculation unit 204 calculates the Euclidean distance weight of the neighborhood pixel according to the Euclidean distance between the corresponding position and the neighborhood pixel; the fifth calculation unit 205 calculates the pixel value of the target pixel based on the texture similarity weight and the Euclidean distance weight. This scheme introduces the weighted fusion of the texture similarity weight and the Euclidean distance weight, comprehensively considers the texture characteristics and spatial relationship between the target pixel and the neighborhood pixel. Compared with the traditional neighborhood interpolation algorithm, this scheme can better retain the details and sharpness in the image, especially at the edge and texture part of the image, avoids the problem of blurring and loss of details after image enlargement, and makes the sharpness of the enlarged image closer to the sharpness of the image before enlargement. That is, this solution can effectively enhance the sharpness of the enlarged image and improve the clarity and detail of the image.

[0105] The present application also provides an electronic device, in which the image sharpness enhancement device of the present application can be integrated, such as Figure 7 As shown, it shows a schematic diagram of the structure of the electronic device involved in the embodiment of the present application, specifically:

[0106] The electronic device may include one or more processors 301 of processing cores and one or more computer-readable storage media memories 302 and other components. Those skilled in the art will appreciate that Figure 7 The electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0107] The processor 301 is the control center of the electronic device, which uses various interfaces and lines to connect various parts of the entire electronic device, and executes various functions of the electronic device and processes data by running or executing the software program and / or the present application stored in the memory 302, and calling the data stored in the memory 302, so as to monitor the electronic device as a whole. Optionally, the processor 301 may include one or more processing cores; preferably, the processor 301 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operation storage medium, user interface and application program, etc., and the modem processor mainly processes wireless communication. It is understandable that the above-mentioned modem processor may not be integrated into the processor 301.

[0108] The memory 302 can be used to store software programs and the present application. The processor 301 executes various functional applications and data processing by running the software programs and the present application stored in the memory 302. The memory 302 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating storage medium, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 302 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 302 may also include a memory controller to provide the processor 301 with access to the memory 302.

[0109] Although not shown, the electronic device may further include a display unit, an input unit, a power supply, etc., which will not be described in detail herein. Specifically in this embodiment, the processor 301 in the electronic device will load the executable files corresponding to the processes of one or more application programs into the memory 302 according to the following instructions, and the processor 301 will run the application programs stored in the memory 302, thereby realizing various functions, as follows:

[0110] Calculate the second coordinate information of each corresponding position in the image before the enlargement according to the first coordinate information of each target pixel point in the enlarged image;

[0111] Calculate the effective value of the corresponding position based on the pixel value of the neighborhood pixel point of the corresponding position and the second coordinate information;

[0112] According to the effective value, the texture similarity weight of the neighborhood pixel points is calculated;

[0113] According to the Euclidean distance between the corresponding position and the neighboring pixel points, the Euclidean distance weight of the neighboring pixel points is calculated;

[0114] The pixel value of the target pixel is calculated based on the texture similarity weight and the Euclidean distance weight.

[0115] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.

[0116] To this end, an embodiment of the present application provides a storage medium in which a plurality of instructions are stored, and the instructions can be loaded by a processor to execute the steps in any one of the generation methods provided in the embodiment of the present application. For example, the instructions can execute the following steps:

[0117] Calculate the second coordinate information of each corresponding position in the image before the enlargement according to the first coordinate information of each target pixel point in the enlarged image;

[0118] Calculate the effective value of the corresponding position based on the pixel value of the neighborhood pixel point of the corresponding position and the second coordinate information;

[0119] According to the effective value, the texture similarity weight of the neighborhood pixel points is calculated;

[0120] According to the Euclidean distance between the corresponding position and the neighboring pixel points, the Euclidean distance weight of the neighboring pixel points is calculated;

[0121] The pixel value of the target pixel is calculated based on the texture similarity weight and the Euclidean distance weight.

[0122] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0123] The storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0124] Since the instructions stored in the storage medium can execute the steps in any method provided in the embodiments of the present application, the beneficial effects that can be achieved by any method provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.

[0125] The image sharpness enhancement method, device, storage medium and electronic device provided by the present application are respectively introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the core idea of ​​the present application; at the same time, for technical personnel in this field, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A method for enhancing image sharpness, characterized in that: include: Calculate the second coordinate information of each corresponding position in the image before the enlargement according to the first coordinate information of each target pixel point in the enlarged image; Calculate the effective value of the corresponding position based on the pixel values ​​of the neighborhood pixels of the corresponding position and the second coordinate information; Calculating the texture similarity weight of the neighborhood pixel points according to the effective value; Calculating the Euclidean distance weight of the neighborhood pixel point according to the Euclidean distance between the corresponding position and the neighborhood pixel point; The pixel value of the target pixel is calculated based on the texture similarity weight and the Euclidean distance weight.

2. The image sharpness enhancement method according to claim 1, characterized in that: The step of calculating the second coordinate information of each corresponding position in the image before the enlargement according to the first coordinate information of each target pixel point in the enlarged image includes: Get the zoom factor of the enlarged image relative to the image before enlargement; The first coordinate information of each target pixel point in the amplified image is scaled based on the scaling factor to obtain the second coordinate information of each corresponding position in the image before amplification.

3. The image sharpness enhancement method according to claim 2, characterized in that: The second coordinate information includes a second horizontal coordinate and a second vertical coordinate, the second horizontal coordinate includes a horizontal integer and a horizontal decimal, the second vertical coordinate includes a vertical integer and a vertical decimal, and the horizontal integer and the vertical integer constitute a reference pixel point.

4. The image sharpness enhancement method according to claim 3, characterized in that: The calculating the effective value of the corresponding position based on the pixel value of the neighborhood pixel point of the corresponding position and the second coordinate information includes: Determine a first neighborhood pixel point, a first neighborhood pixel point, and a third neighborhood pixel point of the reference pixel point; Obtaining a reference pixel value, a first neighborhood pixel value, a second neighborhood pixel value, and a third neighborhood pixel value of the reference pixel point, the first neighborhood pixel point, the first neighborhood pixel point, and the third neighborhood pixel point; The effective value of the corresponding position is calculated based on the vertical decimal, the horizontal decimal, the reference pixel value, the first neighborhood pixel value, the second neighborhood pixel value and the third neighborhood pixel value.

5. The image sharpness enhancement method according to claim 3, characterized in that: Calculating the texture similarity weight of the neighborhood pixel points according to the effective value includes: Respectively obtain pixel differences between pixel values ​​of several neighboring pixel points of the reference pixel point and the effective value; Calculation is performed based on the pixel difference to obtain a texture similarity weight corresponding to each of the neighborhood pixels.

6. The image sharpness enhancement method according to claim 3, characterized in that: The calculating the Euclidean distance weight of the neighborhood pixel point according to the Euclidean distance between the corresponding position and the neighborhood pixel point comprises: Obtaining coordinate information of a number of neighboring pixel points of the reference pixel point; Calculating the Euclidean distance between the corresponding position and each of the neighborhood pixel points according to the second coordinate information and the coordinate information of each of the neighborhood pixel points; The Euclidean distance weight corresponding to each of the neighborhood pixels is calculated based on the Euclidean distance.

7. The image sharpness enhancement method according to claim 1, characterized in that: The calculating the pixel value of the target pixel point based on the texture similarity weight and the Euclidean distance weight includes: Performing weighted fusion on the texture similarity weight and the Euclidean distance weight to obtain a comprehensive weight; The pixel value of each neighborhood pixel point is weighted by using the comprehensive weight to obtain a weighted neighborhood pixel value; A convolution operation is performed on the weighted neighborhood pixel values ​​to obtain the pixel value of the target pixel.

8. An image sharpness enhancement device, characterized in that: include: A first calculation unit, used for calculating second coordinate information of each corresponding position in the image before amplification according to the first coordinate information of each target pixel point in the amplified image; A second calculation unit, configured to calculate a valid value of the corresponding position based on pixel values ​​of neighboring pixels of the corresponding position and the second coordinate information; A third calculation unit, used for calculating the texture similarity weight of the neighborhood pixel point according to the effective value; A fourth calculation unit, configured to calculate a Euclidean distance weight of the neighborhood pixel point according to the Euclidean distance between the corresponding position and the neighborhood pixel point; A fifth calculation unit is used to calculate the pixel value of the target pixel point based on the texture similarity weight and the Euclidean distance weight.

9. A storage medium, characterized in that: The storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the image sharpness enhancement method described in any one of claims 1-7.

10. An electronic device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the image sharpness enhancement method as described in any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Image zooming method and device and storage medium

    CN120070166A