An image sharpening method, device, computing device and storage medium

Through sparse matrix edge detection and convolution determination of sharpening direction and coefficient, the noise and computational complexity problems of image sharpening algorithms in the prior art are solved, and efficient image sharpening effect is achieved.

CN115330637BActive Publication Date: 2025-08-01JI RUI ZHI YUAN (XIAMEN) TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211048198.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-30
Publication Date
2025-08-01
Estimated Expiration
2042-08-30

AI Technical Summary

Technical Problem

Existing image sharpening methods such as Laplace image sharpening algorithm and USM algorithm generate noise and white and black dots when sharpening capabilities are limited or oversharpening, and the calculation is complex, which is not conducive to hardware implementation.

Method used

Use sparse matrix to detect edges and convolution to determine sharpening directions and coefficients, simplify the calculation process, avoid noise and reduce oversharpening, and improve image quality.

Benefits of technology

The calculation process of sharpening direction determination is simplified, the computing speed is accelerated, the white and black dots generated by oversharpening is reduced, and the image sharpening quality is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115330637B_ABST
    Figure CN115330637B_ABST
Patent Text Reader

Abstract

The present invention provides an image sharpening method, apparatus, computing device, and storage medium. The method includes: performing edge detection on an image to be sharpened to obtain boundary pixel points; determining a sparse matrix corresponding to a preset gradient angle; performing convolution on the image matrix where the boundary pixel points are located according to the sparse matrix to obtain target parameters of the boundary pixel points; where the sparse matrix and the image matrix have the same number of rows and columns; determining a sharpening direction and a sharpening coefficient according to the target parameters; and performing a sharpening process on the image to be sharpened according to the target parameters and the sharpening coefficient corresponding to the sharpening direction to obtain a sharpened image. The image sharpening method provided by this solution can improve the quality of the sharpened image and simplify the calculation process in image sharpening.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the technical field of image processing, and particularly to an image sharpening method, apparatus, computing device, and storage medium. Background Art

[0002] Due to the influence of imaging devices, external conditions, or the transmission process, the problem of the degradation of the acquired image quality often inevitably occurs, and the image shows the characteristics of low contrast and blurred edge details. This brings difficulties to applications based on image analysis. Image sharpening is a technology that compensates for the contours of an image, enhances the edges and the parts with gray level jumps of the image, and makes the image clear. It can highlight the edges and contours of things in the image, or the characteristics of certain linear target elements, thereby improving the visual effect of the image and being extremely useful in many fields.

[0003] Currently, the commonly used image sharpening methods include the Laplacian image sharpening algorithm and the USM (Unsharp Mask) algorithm. However, the Laplacian image sharpening algorithm has limited sharpening ability, generates more noise in the flat areas of the image, and also causes oversharpening, resulting in white and black dots, which affects the quality of the image. The USM (Unsharp Mask) algorithm also has oversharpening during the processing, generating black and white dots in the edge areas of the image, and its calculation is relatively complex, which is not conducive to hardware implementation. Summary of the Invention

[0004] The embodiments of the present invention provide an image sharpening method, apparatus, computing device, and storage medium, which can improve the quality of the sharpened image, simplify the calculation process in image sharpening, and accelerate the operation speed.

[0005] In a first aspect, the embodiments of the present invention provide an image sharpening method, including:

[0006] Performing edge detection on the image to be sharpened to obtain boundary pixel points;

[0007] Determining a sparse matrix corresponding to a preset gradient angle;

[0008] Convolving the image matrix where the boundary pixel points are located according to the sparse matrix to obtain target parameters of the boundary pixel points; wherein, the sparse matrix and the image matrix have the same number of rows and columns;

[0009] Determining a sharpening direction and a sharpening coefficient according to the target parameters;

[0010] Performing sharpening processing on the image to be sharpened according to the target parameters corresponding to the sharpening direction and the sharpening coefficient to obtain a sharpened image.

[0011] Optionally, the color space of the image to be sharpened is in the YUV format.

[0012] Optionally, the edge detection of the image to be sharpened to obtain boundary pixel points includes:

[0013] Calculating the initial gradient magnitude of each pixel point in the image to be sharpened by using a preset gradient operator;

[0014] Judging whether there is a target gradient magnitude greater than a preset threshold among the initial gradient magnitudes of each pixel point;

[0015] If there is, determining the pixel point corresponding to the target gradient magnitude as the boundary pixel point.

[0016] Optionally, the calculating the initial gradient magnitude of each pixel point in the image to be sharpened by using a preset gradient operator includes:

[0017] For each pixel point, calculating the horizontal gradient magnitude of the pixel point by using a first preset gradient operator;

[0018] Calculating the vertical gradient magnitude of the pixel point by using a second preset gradient operator;

[0019] Taking the sum of the absolute value of the horizontal gradient magnitude and the absolute value of the vertical gradient magnitude as the initial gradient magnitude of the pixel point.

[0020] Optionally, both the sparse matrix and the image matrix are 5*5 matrices;

[0021] The central pixel point of the image matrix is the boundary pixel point.

[0022] Optionally, the preset gradient angles include 0°, 45°, 90°, 135°.

[0023] Optionally, the determining the sharpening direction and the sharpening coefficient according to the target parameter includes:

[0024] For each boundary pixel point, performing an absolute value operation on the target parameters corresponding to each preset gradient angle and sorting them to determine the target parameter with the largest absolute value;

[0025] Determining the preset gradient angle corresponding to the target parameter with the largest absolute value as the sharpening direction;

[0026] Judging whether the target parameter with the largest absolute value is greater than zero;

[0027] If so, determining the sharpening coefficient as the first sharpening coefficient;

[0028] If not, determining the sharpening coefficient as the second sharpening coefficient; wherein, the second sharpening coefficient is greater than the first sharpening coefficient.

[0029] Optionally, performing sharpening processing on the image to be sharpened according to the target parameter corresponding to the sharpening direction and the sharpening coefficient to obtain a sharpened image includes:

[0030] For each of the boundary pixel points, the following operations are performed:

[0031] Determine the initial Y luminance component of the boundary pixel point in the image to be sharpened;

[0032] Calculate a target Y luminance component according to the initial Y luminance component, the target parameter corresponding to the sharpening direction, and the sharpening coefficient;

[0033] Update the initial Y luminance component to the target Y luminance component to complete the sharpening process.

[0034] Optionally, the sparse matrix is obtained by training with at least two sets of sample sets. Each set of sample sets includes an image to be sharpened as input, and a sharpened image and a sparse matrix as outputs.

[0035] In a second aspect, an embodiment of the present invention further provides an image sharpening apparatus, including:

[0036] A detection module, configured to perform edge detection on an image to be sharpened to obtain boundary pixel points;

[0037] An acquisition module, configured to determine a sparse matrix corresponding to a preset gradient angle;

[0038] A convolution module, configured to perform convolution on the image matrix where the boundary pixel points are located according to the sparse matrix to obtain target parameters of the boundary pixel points; wherein, the sparse matrix and the image matrix have the same number of rows and columns;

[0039] A determination module, configured to determine a sharpening direction and a sharpening coefficient according to the target parameters;

[0040] A sharpening module, configured to perform sharpening processing on the image to be sharpened according to the target parameter corresponding to the sharpening direction and the sharpening coefficient to obtain a sharpened image.

[0041] In a third aspect, an embodiment of the present invention further provides a computing device, including a memory and a processor. A computer program is stored in the memory. When the processor executes the computer program, the image sharpening method described in any one of the above is implemented.

[0042] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed on a computer, the computer is made to execute the image sharpening method described in any one of the above.

[0043] An embodiment of the present invention provides an image sharpening method, apparatus, computing device, and storage medium. The method first performs edge detection to effectively avoid generating noise in flat areas of the image, and then determines the sharpening direction of boundary pixel points based on a sparse matrix, which not only greatly simplifies the calculation process of determining the sharpening direction, speeds up the operation speed, but also is more conducive to hardware implementation, making the image sharpening method more efficient. At the same time, based on the sharpening coefficient, the white and black points generated by oversharpening are further reduced, and the quality of the sharpened image is further improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0045] Figure 1 is a flowchart of an image sharpening method provided by an embodiment of the present invention;

[0046] Figure 2 is a flowchart of another image sharpening method provided by an embodiment of the present invention;

[0047] Figure 3 is an image to be sharpened provided by an embodiment of the present invention;

[0048] Figure 4 is a sharpened image provided by an embodiment of the present invention;

[0049] Figure 5 is a sharpened image provided by an embodiment of the present invention;

[0050] Figure 6 is a hardware architecture diagram of a computing device provided by an embodiment of the present invention;

[0051] Figure 7 is a structural diagram of an image sharpening apparatus provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0052] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts fall within the scope of protection of the present invention.

[0053] As described above, the Laplacian image sharpening algorithm uses the differences between the current pixel and its adjacent 4 or 8 points to perform sharpening. According to its characteristics, it only sharpens the image using a 3*3 template. Therefore, its sharpening ability is limited, and it will generate more noise in the flat areas of the image. At the same time, it will also cause oversharpening, resulting in white and black dots. The USM (Unsharp Mask) algorithm needs to perform Gaussian blur to obtain a blunted image, then subtract the blunted image from the original image to obtain the high-frequency component, and add this high-frequency component to the original image to obtain the sharpened image. Although the sharpened image obtained by the USM algorithm has a better effect than the Laplacian image sharpening algorithm, oversharpening will also occur during this process, resulting in white and black dots. At the same time, its calculation is relatively complex and not conducive to hardware implementation. In view of this, the present invention uses a sparse matrix to optimize the calculation process of sharpening direction determination, simplifies this calculation process, thereby accelerating the operation speed, and enabling this calculation process to be implemented using hardware.

[0054] The following describes the specific implementation manners of the above concepts.

[0055] Please refer to Figure 1 , an embodiment of the present invention provides an image sharpening method, which includes:

[0056] Step 100, perform edge detection on the image to be sharpened to obtain boundary pixel points;

[0057] Step 102, determine a sparse matrix corresponding to a preset gradient angle;

[0058] Step 104, perform convolution on the image matrix where the boundary pixel points are located according to the sparse matrix to obtain the target parameters of the boundary pixel points; wherein, the sparse matrix and the image matrix have the same number of rows and columns;

[0059] Step 106, determine the sharpening direction and the sharpening coefficient according to the target parameters;

[0060] Step 108, perform sharpening processing on the image to be sharpened according to the target parameters and the sharpening coefficient corresponding to the sharpening direction to obtain a sharpened image.

[0061] It should be noted that a sparse matrix is generally defined as a matrix in which the number of non-zero elements is much smaller than the number of zero elements.

[0062] In the embodiment of the present invention, the image sharpening method first performs edge detection to effectively avoid generating noise in the flat area of the image, and then determines the sharpening direction of the boundary pixel points based on the sparse matrix, which not only greatly simplifies the calculation process of determining the sharpening direction, but also is more conducive to hardware implementation, reduces the complexity of hardware execution instructions, and can use a programmable logic circuit (for example, it can be an FPGA field programmable gate array) to implement the image sharpening method; at the same time, based on the sharpening coefficient, the white points and black points generated by oversharpening are further reduced, and the quality of the sharpened image is further improved.

[0063] The following describes Figure 1 The execution manner of each step shown.

[0064] First, for step 100, perform edge detection on the image to be sharpened to obtain boundary pixel points, including:

[0065] Calculate the initial gradient amplitude of each pixel point in the image to be sharpened by using a preset gradient operator;

[0066] Judge whether there is a target gradient amplitude greater than the preset threshold in the initial gradient amplitudes of each pixel point;

[0067] If it exists, determine the pixel point corresponding to the target gradient amplitude as the boundary pixel point.

[0068] In this step, any edge detection algorithm can be used for edge detection, so the preset gradient operator can be any corresponding operator. For example, the preset gradient operator includes but is not limited to the Soble operator for edge detection algorithm based on the first derivative, the Roberts operator for the algorithm of finding edges by using the local difference algorithm, the Prewitt operator for edge detection operator using the first-order differential operator, and the Laplacian operator based on the second-order differential.

[0069] It should be noted that when using the Soble operator, the preset gradient operator is

[0070]

[0071] When using the Roberts operator, the preset gradient operator is:

[0072]

[0073] When using the Prewitt operator, the preset gradient operator is:

[0074]

[0075] When using the Laplacian operator, the preset gradient operator can be the operator using the 4-neighborhood:

[0076]

[0077] The default gradient operator can also be an operator using an 8-neighborhood:

[0078]

[0079] Moreover, for step 100, the color space of the image to be sharpened is in YUV format.

[0080] Before step 100, the method further includes: when the color space of the image to be sharpened is in RGB format, converting the color space of the image to be sharpened into YUV format.

[0081] In the present invention, the image sharpening method is based on the YUV color space, rather than the RGB color space, because images based on the RGB color space are prone to color cast (i.e., color distortion) when sharpened, and sharpening images based on the RGB color space requires sharpening the three channels separately. However, for the YUV color space, based on the visual characteristics of the human eye that is sensitive to brightness but not to chroma, only the Y brightness component needs to be sharpened, thereby reducing most of the calculation amount, simplifying the calculation process, and making it more conducive to hardware implementation of the image sharpening method. It should be noted that the method of converting an image in RGB format to an image in YUV format is well known and will not be described in detail herein.

[0082] With respect to step 100, the initial gradient amplitude of each pixel in the image to be sharpened is calculated using a preset gradient operator, including:

[0083] For each pixel, using a first preset gradient operator to calculate the horizontal gradient amplitude of the pixel;

[0084] Calculating the vertical gradient amplitude of the pixel point using a second preset gradient operator;

[0085] The sum of the absolute value of the horizontal gradient amplitude and the absolute value of the vertical gradient amplitude is taken as the initial gradient amplitude of the pixel.

[0086] In the prior art, the calculation of the initial gradient amplitude and gradient angle using a preset gradient operator involves the calculation of squares, square roots, and arctan values. Since hardware systems have difficulty calculating squares, square roots, and arctan values, the calculation of the initial gradient amplitude is simplified in this step, thereby effectively optimizing the calculation process of the edge detection algorithm and enabling it to be applied in a hardware system for simple and efficient operation.

[0087] Specifically, the calculation formula of the initial gradient amplitude in the prior art is as follows:

[0088]

[0089] In step 100, the calculation formula for the initial gradient magnitude is as follows:

[0090] G = |G x | + |G y | (2)

[0091] where G is used to represent the initial gradient magnitude, G x is used to represent the horizontal gradient magnitude, and G y is used to represent the vertical gradient magnitude.

[0092] Then, for step 102, the preset gradient angles include 0°, 45°, 90°, and 135°.

[0093] In a preferred embodiment, the preset gradient angles include 0°, 45°, 90°, 135°, 180°, 225°, 270°, 315°, and 360°.

[0094] In this step, each preset gradient angle corresponds to a sparse matrix. Among them, the arrangement direction of the non-zero elements in the sparse matrix is the same as the corresponding preset gradient angle. Moreover, directly dividing the gradient angles in the above manner is more in line with the positional angle relationship between each pixel point in the image matrix arrangement, further simplifying the image sharpening process and making the image sharpening method more simple and efficient.

[0095] For step 102, the sparse matrix is obtained by training with at least two sets of sample sets. Each set of sample sets includes the image to be sharpened as the input, and the sharpened image and the sparse matrix as the output.

[0096] In the present invention, the sparse matrix is obtained by training with a large number of historical sample sets based on the image sharpening method of the present invention. Moreover, the sharpened images in the sample sets are high-quality sharpened images without white dots and black dots.

[0097] For step 104, both the sparse matrix and the image matrix are 5*5 matrices;

[0098] The central pixel point of the image matrix is a boundary pixel point.

[0099] It should be noted that the image matrix is a 5*5 image block centered on the boundary pixel point in the image to be sharpened.

[0100] In this step, compared with using a 3*3 convolution kernel in the prior art, the present invention uses a 5*5 convolution kernel, which has higher recognition efficiency, a faster rising speed of accuracy, and can more accurately grasp the essential features and local features of the image to be sharpened, so as to ensure that the sharpened image has high quality.

[0101] In a preferred embodiment, the preset gradient angles include 0°, 45°, 90°, and 135°. The sparse matrix M0 corresponding to the preset gradient angle of 0° obtained by training with the sample set is as follows:

[0102]

[0103] The sparse matrix M corresponding to the preset gradient angle of 45° 45 is as follows:

[0104]

[0105] The sparse matrix M corresponding to the preset gradient angle of 90° 90 is as follows:

[0106]

[0107] The sparse matrix M corresponding to the preset gradient angle of 135° 135 is as follows:

[0108]

[0109] Convolve the 5*5 image matrix where the boundary pixel points are located with the above four sparse matrices respectively to obtain four target parameters f0, f1, f2, and f3 of the boundary pixel points; among them, the target parameters are calculated using the following formula:

[0110] f0 = M 00 * PIC[i - 2:i + 2, j - 2:j + 2] (3)

[0111] f1 = M 45 * PIC[i - 2:i + 2, j - 2:j + 2] (4)

[0112] f2 = M 90 * PIC[i - 2:i + 2, j - 2:j + 2] (5)

[0113] f3 = M 135 * PIC[i - 2:i + 2, j - 2:j + 2] (6)

[0114] Among them, PIC[i - 2:i + 2, j - 2:j + 2] is used to represent the 5*5 image matrix centered on (i, j); (i, j) is used to represent the position coordinates of the boundary pixel point in the image to be sharpened; * is used to represent the convolution operation. Specifically, the top-leftmost pixel point of the image to be sharpened is taken as the (0, 0) point, the bottom-rightmost pixel point is taken as (pic_height - 1, pic_width - 1), and (i, j) is the position coordinates of a pixel point at a certain relative position (i, j) in the image to be sharpened.

[0115] For step 106, determine the sharpening direction and the sharpening coefficient according to the target parameter, including:

[0116] For each boundary pixel, perform an absolute value operation on the target parameters corresponding to each preset gradient angle and sort them to determine the target parameter with the largest absolute value;

[0117] Determine the preset gradient angle corresponding to the target parameter with the largest absolute value as the sharpening direction;

[0118] Judge whether the target parameter with the largest absolute value is greater than zero;

[0119] If so, determine the sharpening coefficient as the first sharpening coefficient;

[0120] If not, determine the sharpening coefficient as the second sharpening coefficient; wherein, the second sharpening coefficient is greater than the first sharpening coefficient.

[0121] In step 106, first determining the sharpening direction based on the target parameters corresponding to each preset gradient angle avoids the calculation of arctan values, further simplifies the image sharpening process, is more simple and efficient, and is beneficial to hardware implementation. The sharpening coefficient is set based on the human eye visual characteristics. Based on the characteristics that the human eye is sensitive to dark areas and insensitive to bright areas, and further determining the sharpening coefficient according to the size of the target parameter not only makes the sharpened image more in line with the human eye visual characteristics, but also enhances the image details and avoids the enhancement of noise, and can effectively reduce the generation of white dots and black dots without affecting the sharpening effect.

[0122] In a preferred embodiment, the first sharpening coefficient is 1 / 4, and the second sharpening coefficient is 1 / 2. Since 1 / 4 and 1 / 2 can be implemented only by shifting, such a setting is more conducive to using programmable logic circuits to implement, and can effectively reduce the generation of white dots and black dots without affecting the sharpening effect of the final image.

[0123] For step 108, perform a sharpening process on the image to be sharpened according to the target parameter corresponding to the sharpening direction and the sharpening coefficient to obtain a sharpened image, including:

[0124] For each boundary pixel, perform the following:

[0125] Determine the initial Y luminance component of this boundary pixel in the image to be sharpened;

[0126] Calculate the target Y luminance component according to the initial Y luminance component, the target parameter corresponding to the sharpening direction, and the sharpening coefficient;

[0127] Update the initial Y luminance component to the target Y luminance component to complete the sharpening process.

[0128] Specifically, the target Y luminance component is calculated using the following formula:

[0129] Y out = Y in + f max * α (7)

[0130] where Y out is used to represent the target Y luminance component; Y in is used to represent the initial Y luminance component; f max is used to represent the target parameter corresponding to the sharpening direction; α is used to represent the sharpening coefficient.

[0131] In the present invention, based on the human visual characteristics, only the Y luminance component is sharpened, and the sum of the product of the target parameter corresponding to the sharpening direction and the sharpening coefficient and the initial Y luminance component is used as the Y luminance component of the boundary pixel point in the sharpened image after sharpening, which not only reduces the amount of calculation, but also effectively reduces the white points and black points generated by oversharpening, and improves the quality of the sharpened image.

[0132] To more clearly illustrate the technical solution and advantages of the present invention, as Figure 2 shown, a method for image sharpening provided by an embodiment of the present invention will be described in detail below, which specifically includes:

[0133] Step 200: When the color space of the image to be sharpened is in RGB format, convert the color space of the image to be sharpened into YUV format.

[0134] Step 201: Calculate the initial gradient magnitude of each pixel point in the image to be sharpened using a preset gradient operator.

[0135] Specifically, for each pixel point, the Sobel operator is used, and the preset gradient operator is

[0136]

[0137] Use the first preset gradient operator d x to calculate the horizontal gradient magnitude G x of this pixel point;

[0138] Use the second preset gradient operator d y to calculate the vertical gradient magnitude G y of this pixel point;

[0139] Take the sum of the absolute value of the horizontal gradient magnitude G x and the absolute value of the vertical gradient magnitude G y as the initial gradient magnitude G of this pixel point, and the calculation formula is formula (2).

[0140] Step 202: Screen out the target gradient magnitudes greater than the preset threshold from the initial gradient magnitudes of each pixel, and determine the pixels corresponding to the target gradient magnitudes as boundary pixels.

[0141] Step 203: The preset gradient angles include 0°, 45°, 90°, and 135°, and determine the sparse matrices corresponding to each preset gradient angle.

[0142] Specifically, the sparse matrix M0 corresponding to the preset gradient angle of 0° obtained by training with the sample set is:

[0143]

[0144] The sparse matrix M corresponding to the preset gradient angle of 45° 45 is:

[0145]

[0146] The sparse matrix M corresponding to the preset gradient angle of 90° 90 is:

[0147]

[0148] The sparse matrix M corresponding to the preset gradient angle of 135° 135 is:

[0149]

[0150] Step 204: For each boundary pixel, perform convolution on the image matrix where the boundary pixel is located according to the sparse matrix to obtain the target parameter of the boundary pixel.

[0151] Specifically, the image matrix is a 5*5 image block in the image to be sharpened centered on the boundary pixel. Perform convolution on the 5*5 image matrix where the boundary pixel is located according to the above four sparse matrices respectively, and obtain the four target parameters f0, f1, f2, and f3 of the boundary pixel from formulas (3) to (6) as described above.

[0152] Step 205: Perform an absolute value operation on the target parameters corresponding to each preset gradient angle and sort them to determine the target parameter with the largest absolute value.

[0153] Step 206: Determine the preset gradient angle corresponding to the target parameter with the largest absolute value as the sharpening direction.

[0154] Step 207: Determine whether the target parameter with the largest absolute value is greater than zero. If so, execute Step 208; otherwise, execute Step 209.

[0155] Step 208: Determine the sharpening coefficient as the first sharpening coefficient 1 / 4.

[0156] Step 209: Determine that the sharpening coefficient is 1 / 2 of the second sharpening coefficient.

[0157] Step 210: Determine the initial Y luminance component of the boundary pixel point in the image to be sharpened.

[0158] Step 211: Calculate the target Y luminance component based on the initial Y luminance component, the target parameters corresponding to the sharpening direction, and the sharpening coefficient.

[0159] Step 212: Update the initial Y luminance component to the target Y luminance component to complete the sharpening process of the boundary pixel point.

[0160] Specifically, repeat steps 204 to 212 to complete the sharpening process of all boundary pixel points, and then obtain the sharpened image.

[0161] In the embodiment of the present invention, the lenna original image (as Figure 3 shown) is used as the image to be sharpened, and the Laplace image sharpening algorithm is used to sharpen it, and the sharpened image as shown in Figure 4 is obtained; while using the image sharpening method as shown in Figure 2 to sharpen it, the sharpened image as shown in Figure 5 is obtained. By comparing Figure 4 and Figure 5 , it can be found that the quality of the sharpened image obtained by using the image sharpening method provided by the present invention is higher, and basically no white points and black points are generated during sharpening.

[0162] As shown in Figure 6 , Figure 7 shown, the embodiment of the present invention provides an image sharpening device. The device embodiment can be implemented by software, or by hardware or a combination of software and hardware. From the hardware level, as shown in Figure 6 , it is a hardware architecture diagram of a computing device where the image sharpening device provided by the embodiment of the present invention is located. In addition to Figure 6 the shown processor, memory, network interface, and non-volatile memory, the computing device where the device is located in the embodiment usually may also include other hardware, such as a forwarding chip responsible for processing packets, and so on. Taking software implementation as an example, as shown in Figure 7 , as a logically meaningful device, it is formed by the CPU of the computing device where it is located reading the corresponding computer program in the non-volatile memory into the memory and running. An image sharpening device provided in this embodiment includes: a detection module 700, an acquisition module 702, a convolution module 704, a determination module 706, and a sharpening module 708;

[0163] The detection module 700 is configured to perform edge detection on the image to be sharpened to obtain boundary pixel points;

[0164] An acquisition module 702, configured to determine a sparse matrix corresponding to a preset gradient angle;

[0165] A convolution module 704, configured to perform convolution on an image matrix where boundary pixel points are located according to the sparse matrix to obtain target parameters of the boundary pixel points; wherein, the sparse matrix and the image matrix have the same number of rows and columns;

[0166] A determination module 706, configured to determine a sharpening direction and a sharpening coefficient according to the target parameters;

[0167] A sharpening module 708, configured to perform a sharpening process on an image to be sharpened according to the target parameters corresponding to the sharpening direction and the sharpening coefficient to obtain a sharpened image.

[0168] In some specific embodiments, the detection module 700 may be configured to execute the above-mentioned step 100, the acquisition module 702 may be configured to execute the above-mentioned step 102, the convolution module 704 may be configured to execute the above-mentioned step 104, the determination module 706 may be configured to execute the above-mentioned step 106, and the sharpening module 708 may be configured to execute the above-mentioned step 108.

[0169] In some specific embodiments, the detection module 700 is configured to perform the following operations:

[0170] Calculating an initial gradient magnitude of each pixel point in the image to be sharpened by using a preset gradient operator, including:

[0171] For each pixel point, calculating a horizontal gradient magnitude of the pixel point by using a first preset gradient operator;

[0172] Calculating a vertical gradient magnitude of the pixel point by using a second preset gradient operator;

[0173] Taking the sum of the absolute value of the horizontal gradient magnitude and the absolute value of the vertical gradient magnitude as the initial gradient magnitude of the pixel point;

[0174] Judging whether there is a target gradient magnitude greater than a preset threshold among the initial gradient magnitudes of each pixel point;

[0175] If so, determining the pixel point corresponding to the target gradient magnitude as a boundary pixel point.

[0176] In some specific embodiments, the determination module 706 is configured to perform the following operations:

[0177] For each boundary pixel point, performing an absolute value operation on the target parameters corresponding to each preset gradient angle and sorting them to determine the target parameter with the largest absolute value;

[0178] Determining the preset gradient angle corresponding to the target parameter with the largest absolute value as the sharpening direction;

[0179] Determine whether the target parameter with the largest absolute value is greater than zero;

[0180] If so, determine the sharpening coefficient as the first sharpening coefficient;

[0181] If not, determine the sharpening coefficient as the second sharpening coefficient; wherein, the second sharpening coefficient is greater than the first sharpening coefficient.

[0182] In some specific embodiments, the sharpening module 708 is used to perform the following operations:

[0183] For each boundary pixel point, perform:

[0184] Determine the initial Y luminance component of the boundary pixel point in the image to be sharpened;

[0185] Calculate the target Y luminance component according to the initial Y luminance component, the target parameter corresponding to the sharpening direction, and the sharpening coefficient;

[0186] Update the initial Y luminance component to the target Y luminance component to complete the sharpening process.

[0187] It can be understood that the structure illustrated in the embodiments of the present invention does not constitute a specific limitation on an image sharpening device. In other embodiments of the present invention, an image sharpening device may include more or fewer components than those illustrated, or combine certain components, or split certain components, or have different component arrangements. The illustrated components can be implemented in hardware, software, or a combination of software and hardware.

[0188] Regarding the information interaction, execution process, etc. between the modules in the above device, since they are based on the same concept as the method embodiments of the present invention, the specific content can be referred to the description in the method embodiments of the present invention and will not be elaborated here.

[0189] The embodiments of the present invention also provide a computing device, including a memory and a processor, where a computer program is stored in the memory, and when the processor executes the computer program, an image sharpening method in any one of the embodiments of the present invention is implemented.

[0190] The embodiments of the present invention also provide a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the processor is enabled to execute an image sharpening method in any one of the embodiments of the present invention.

[0191] Specifically, a system or device equipped with a storage medium can be provided, on which software program code for implementing the functions in any one of the above embodiments is stored, and the computer (or CPU or MPU) of the system or device is enabled to read and execute the program code stored in the storage medium.

[0192] In this case, the program code read from the storage medium itself can implement the functions of any one of the above embodiments. Therefore, the program code and the storage medium storing the program code constitute a part of the present invention.

[0193] Examples of the storage medium for providing the program code include floppy disks, hard disks, magneto-optical disks, optical disks (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), magnetic tapes, non-volatile memory cards, and ROMs. Optionally, the program code can be downloaded from a server computer via a communication network.

[0194] In addition, it should be clear that not only can the functions of any one of the above embodiments be realized by executing the program code read by the computer, but also by causing an operating system or the like operating on the computer based on the instructions of the program code to complete part or all of the actual operations.

[0195] In addition, it can be understood that the program code read from the storage medium is written into the memory provided in an expansion board inserted into the computer or into the memory provided in an expansion module connected to the computer, and then based on the instructions of the program code, a CPU or the like installed on the expansion board or the expansion module is caused to execute part or all of the actual operations, thereby realizing the functions of any one of the above embodiments.

[0196] It should be noted that in this document, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising one..." does not exclude the presence of additional identical elements in the process, method, article or device comprising the element.

[0197] Those of ordinary skill in the art can understand that all or part of the steps for implementing the above method embodiments can be completed by hardware related to program instructions. The foregoing program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps including the above method embodiments; and the foregoing storage medium includes various media such as ROM, RAM, magnetic disks, or optical disks that can store program code.

[0198] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the various embodiments of the present invention.

Claims

1. An image sharpening method, characterized in that, Including: Performing edge detection on the image to be sharpened to obtain boundary pixel points; Determining a sparse matrix corresponding to a preset gradient angle; Convolving the image matrix where the boundary pixel points are located according to the sparse matrix to obtain target parameters of the boundary pixel points; wherein, the sparse matrix and the image matrix have the same number of rows and columns; Determining a sharpening direction and a sharpening coefficient according to the target parameters; Performing a sharpening process on the image to be sharpened according to the target parameters corresponding to the sharpening direction and the sharpening coefficient to obtain a sharpened image; The determining the sharpening direction and the sharpening coefficient according to the target parameters includes: For each boundary pixel point, performing an absolute value operation on the target parameters corresponding to each preset gradient angle and sorting them to determine the target parameter with the largest absolute value; Determining the preset gradient angle corresponding to the target parameter with the largest absolute value as the sharpening direction; Judging whether the target parameter with the largest absolute value is greater than zero; If so, determining the sharpening coefficient as a first sharpening coefficient; If not, determining the sharpening coefficient as a second sharpening coefficient; wherein, the second sharpening coefficient is greater than the first sharpening coefficient.

2. The method according to claim 1, wherein The color space of the image to be sharpened is in YUV format.

3. The method according to claim 1, wherein The performing edge detection on the image to be sharpened to obtain boundary pixel points includes: Calculating the initial gradient magnitude of each pixel point in the image to be sharpened by using a preset gradient operator; Judging whether there is a target gradient magnitude greater than a preset threshold among the initial gradient magnitudes of each pixel point; If there is, determining the pixel point corresponding to the target gradient magnitude as the boundary pixel point.

4. The method according to claim 3, wherein The calculating the initial gradient magnitude of each pixel point in the image to be sharpened by using a preset gradient operator includes: For each pixel point, calculating the horizontal gradient magnitude of the pixel point by using a first preset gradient operator; Calculating the vertical gradient magnitude of the pixel point by using a second preset gradient operator; Taking the sum of the absolute value of the horizontal gradient magnitude and the absolute value of the vertical gradient magnitude as the initial gradient magnitude of the pixel point.

5. The method according to claim 1, wherein Both the sparse matrix and the image matrix are 5*5 matrices; The central pixel point of the image matrix is the boundary pixel point.

6. The method according to claim 1, wherein The preset gradient angles include 0°, 45°, 90°, 135°.

7. The method according to claim 2, wherein The performing a sharpening process on the image to be sharpened according to the target parameters corresponding to the sharpening direction and the sharpening coefficient to obtain a sharpened image includes: For each of the boundary pixel points, performing: Determining the initial Y luminance component of the boundary pixel point in the image to be sharpened; Calculating a target Y luminance component according to the initial Y luminance component, the target parameter corresponding to the sharpening direction, and the sharpening coefficient; Updating the initial Y luminance component to the target Y luminance component to complete the sharpening process.

8. The method according to any one of claims 1 to 7, wherein The sparse matrix is obtained by training with at least two sets of sample sets. Each set of sample sets includes the image to be sharpened as the input, and the sharpened image and the sparse matrix as the output.

9. An image sharpening device, characterized in that, Comprising: A detection module, configured to perform edge detection on the image to be sharpened to obtain boundary pixel points; An acquisition module, configured to determine a sparse matrix corresponding to a preset gradient angle; A convolution module, which convolves the image matrix where the boundary pixel points are located according to the sparse matrix to obtain target parameters of the boundary pixel points; wherein, the sparse matrix and the image matrix have the same number of rows and columns; A determination module, configured to determine a sharpening direction and a sharpening coefficient according to the target parameters; A sharpening module, which sharpens the image to be sharpened according to the target parameters corresponding to the sharpening direction and the sharpening coefficient to obtain a sharpened image; The determination module is further configured to perform the following operations: For each boundary pixel point, perform an absolute value operation on the target parameters corresponding to each preset gradient angle and sort them to determine the target parameter with the largest absolute value; Determine the preset gradient angle corresponding to the target parameter with the largest absolute value as the sharpening direction; Judge whether the target parameter with the largest absolute value is greater than zero; If so, determine the sharpening coefficient as the first sharpening coefficient; If not, determine the sharpening coefficient as the second sharpening coefficient; wherein, the second sharpening coefficient is greater than the first sharpening coefficient.

10. A computing device, comprising a memory and a processor. A computer program is stored in the memory. When the processor executes the computer program, the method according to any one of claims 1-8 is implemented.

11. A computer-readable storage medium, on which a computer program is stored. When the computer program is executed on a computer, the computer is made to execute the method according to any one of claims 1-8.

Citation Information

Patent Citations

  • Adaptive image sharpening method for gradient correlation detection and storage medium

    CN108038833A

  • Underwater image color enhancement method based on potential low-rank representation and image fusion

    CN111968054A