Image enhancement method and device and storage medium

By extracting brightness information, calculating gradients and low-frequency signal coefficients, and distinguishing edges and textures in the image enhancement algorithm, the problems of poor texture information enhancement and poor edge information retention in the existing technology are solved, and better image enhancement effects are achieved. and halo reduction.

CN118674664AActive Publication Date: 2024-09-20ZHEJIANG DAHUA TECH CO LTD

Patent Information

Application Number
CN202411166379.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-23
Publication Date
2024-09-20
Estimated Expiration
2044-08-23

AI Technical Summary

Technical Problem

Existing image enhancement algorithms have poor texture information enhancement effects and insufficient edge information retention, resulting in halo problems in enhanced images.

Method used

By extracting the brightness information of each pixel in the original image, setting the gradient threshold, calculating the pixel gradient from the preset gradient direction, counting the number of gradients not less than the threshold, calculating the low-frequency signal coefficient, using the low-frequency signal to enhance the image, distinguishing edges and Texture to improve image enhancement.

Benefits of technology

Effectively distinguish edges and textures in images, extract more accurate low-frequency information, improve image enhancement effects, and reduce the occurrence of halos.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118674664A
    Figure CN118674664A
Patent Text Reader

Abstract

The invention discloses an image enhancement method and device and a storage medium, and the method comprises the steps: extracting the brightness information of each pixel in an original image, obtaining the image brightness, and setting a gradient threshold value based on the image brightness; performing difference calculation on the pixel value of each pixel in the original image from a preset gradient direction to obtain a pixel gradient; counting the number of pixel gradients not less than a gradient threshold to obtain a gradient number; calculating a low-frequency signal coefficient based on the gradient number, and performing low-frequency signal extraction on the original image by using the low-frequency signal coefficient to obtain a low-frequency signal; and performing image enhancement processing on the original image based on the low-frequency signal to obtain an image enhancement result. According to the method, noise gradient elimination can be carried out according to image brightness, edges and textures are distinguished from the gradient number, the edges and the textures in the image can be effectively distinguished, more accurate low-frequency information is extracted, and the image enhancement effect is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to an image enhancement method, device and storage medium. Background Art

[0002] There are many problems with images obtained by image sensors, such as lack of prominent details and blurred images, which are not conducive to subsequent scientific research and also affect people's visual experience. Therefore, image enhancement, as an important branch of image processing, continues to attract the attention of many scientific workers.

[0003] Existing image enhancement algorithms can be roughly divided into: statistics-based image enhancement algorithms, such as global histogram enhancement methods, local histogram enhancement methods, Contrast Limited Adaptive Histogram Equalization (CLAHE) algorithm, etc.; layered image enhancement methods, such as the Retinex algorithm, methods that use filtering or equation optimization to extract high frequencies for image enhancement, etc.; learning-based image enhancement algorithms, such as sparse coding methods, deep learning methods, etc.

[0004] The current image enhancement algorithms still have the problems of poor texture information enhancement effect and insufficient edge information retention, resulting in halo problems in the enhanced images. Summary of the invention

[0005] In order to solve the above technical problems, the present application at least provides an image enhancement method, device and storage medium.

[0006] The first aspect of the present application provides an image enhancement method, which includes: extracting brightness information of each pixel in an original image to obtain image brightness, and setting a gradient threshold based on the image brightness; performing difference calculation on pixel values ​​of each pixel in the original image from a preset gradient direction to obtain pixel gradient; counting the number of pixel gradients that are not less than the gradient threshold to obtain the number of gradients; calculating a low-frequency signal coefficient based on the number of gradients, and extracting a low-frequency signal from the original image using the low-frequency signal coefficient to obtain a low-frequency signal; performing image enhancement processing on the original image based on the low-frequency signal to obtain an image enhancement result.

[0007] In one embodiment, before performing difference calculation on the pixel values ​​of each pixel in the original image from a preset gradient direction to obtain the pixel gradient, it also includes: performing noise filtering processing on the original image to obtain an image denoising result; performing difference calculation on the pixel values ​​of each pixel in the original image from a preset gradient direction to obtain the pixel gradient, including: performing difference calculation on the pixel values ​​of each pixel in the image denoising result from the preset gradient direction to obtain the pixel gradient.

[0008] In one embodiment, the preset gradient direction includes a row direction and a column direction; the pixel value of each pixel in the image denoising result is difference calculated from the preset gradient direction to obtain a pixel gradient, including: calculating the pixel value difference between adjacent pixels in the row direction to obtain an initial row gradient; and calculating the pixel value difference between adjacent pixels in the column direction to obtain an initial column gradient; the initial row gradient and the initial column gradient are used as the pixel gradient.

[0009] In one embodiment, the number of pixel gradients not less than a gradient threshold is counted to obtain the gradient number, including: obtaining the gradient threshold, initial row gradient, and initial column gradient corresponding to the current pixel; if the initial row gradient or initial column gradient of the current pixel is less than the gradient threshold, the initial row gradient or initial column gradient of the current pixel is set to zero to obtain a target row gradient or target column gradient; if the initial row gradient or initial column gradient of the current pixel is not less than the gradient threshold, the absolute value of the initial row gradient or initial column gradient is used as a new gradient value to obtain the target row gradient or target column gradient; the target row gradient and target column gradient corresponding to the current pixel are summed to obtain the gradient sum corresponding to the current pixel; and the number of pixels whose gradient sum is not zero is counted to obtain the gradient number.

[0010] In one embodiment, calculating the low-frequency signal coefficient based on the gradient quantity includes: performing variance calculation on the original image to obtain the image variance; substituting the image variance and the gradient quantity into a preset coefficient calculation formula to obtain the low-frequency signal coefficient.

[0011] In one embodiment, low-frequency signal coefficients are used to extract low-frequency signals from the original image, including: performing noise filtering on the original image to obtain an image denoising result; performing mean filtering on the image denoising result to obtain an image filtering result; and performing weighted summation of the image denoising result and the image filtering result using the low-frequency signal coefficients to obtain a low-frequency signal.

[0012] In one embodiment, low-frequency signal extraction is performed on an original image using low-frequency signal coefficients, including: using the low-frequency signal coefficients corresponding to the original image to extract the low-frequency signal from the original image to obtain a first low-frequency signal; performing gradient quantity statistics on the first low-frequency signal, and calculating the low-frequency signal coefficient corresponding to the first low-frequency signal according to the counted gradient quantity; using the low-frequency signal coefficients corresponding to the first low-frequency signal to extract the low-frequency signal from the first low-frequency signal to obtain a second low-frequency signal; and using the first low-frequency signal and / or the second low-frequency signal as the extracted low-frequency signal.

[0013] In one embodiment, the first low-frequency signal and the second low-frequency signal are used as extracted low-frequency signals; image enhancement processing is performed on the original image based on the extracted low-frequency signal to obtain an image enhancement result, including: performing noise filtering processing on the original image to obtain an image denoising result; calculating the difference between the image denoising result and the first low-frequency signal to obtain a first frequency band difference; and, calculating the difference between the first low-frequency signal and the second low-frequency signal to obtain a second frequency band difference; and, calculating the difference between the original image and the image denoising result to obtain a denoising value; substituting the first frequency band difference and the second frequency band difference into a preset enhancement formula respectively to obtain a first enhancement value and a second enhancement value; and summing the denoising value, the first enhancement value, the second enhancement value and the second low-frequency signal to obtain an image enhancement result.

[0014] The second aspect of the present application provides an image enhancement device, which includes: a threshold setting module, which is used to extract the brightness information of each pixel in the original image to obtain the image brightness, and set the gradient threshold based on the image brightness; a gradient calculation module, which is used to perform difference calculation on the pixel value of each pixel in the original image from a preset gradient direction to obtain the pixel gradient; a gradient quantity statistics module, which is used to count the number of pixel gradients that are not less than the gradient threshold to obtain the gradient quantity; a low-frequency signal extraction module, which is used to calculate the low-frequency signal coefficient based on the gradient quantity, and use the low-frequency signal coefficient to extract the low-frequency signal of the original image to obtain the low-frequency signal; an image enhancement module, which is used to perform image enhancement processing on the original image based on the low-frequency signal to obtain an image enhancement result.

[0015] A third aspect of the present application provides an electronic device, including a memory and a processor, wherein the processor is used to execute program instructions stored in the memory to implement the above-mentioned image enhancement method.

[0016] A fourth aspect of the present application provides a computer-readable storage medium having program instructions stored thereon, which implement the above-mentioned image enhancement method when the program instructions are executed by a processor.

[0017] The above scheme obtains the image brightness by extracting the brightness information of each pixel in the original image, and sets the gradient threshold based on the image brightness; performs difference calculation on the pixel values ​​of each pixel in the original image from a preset gradient direction to obtain the pixel gradient; counts the number of pixel gradients that are not less than the gradient threshold to obtain the gradient number; calculates the low-frequency signal coefficient based on the gradient number, and uses the low-frequency signal coefficient to extract the low-frequency signal of the original image to obtain the low-frequency signal; performs image enhancement processing on the original image based on the low-frequency signal to obtain the image enhancement result, removes the noise gradient according to the image brightness, and distinguishes the edge and texture based on the gradient number, which can effectively distinguish the edge and texture in the image, extract more accurate low-frequency information, and improve the image enhancement effect.

[0018] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present application and are used together with the specification to illustrate the technical solution of the present application.

[0020] Figure 1 is a schematic diagram showing a comparison of grayscale value differences around an edge and a texture according to an exemplary embodiment of the present application; Figure 2 It is a schematic diagram of an implementation environment of a solution provided by an embodiment of the present application; Figure 3 is a flow chart of an image enhancement method shown in an exemplary embodiment of the present application; Figure 4 is a schematic diagram of gradient calculation shown in an exemplary embodiment of the present application; Figure 5 is a schematic diagram of a preset enhancement formula shown in an exemplary embodiment of the present application; Figure 6 is a schematic diagram of image enhancement shown in an exemplary embodiment of the present application; Figure 7 is a schematic diagram of image enhancement shown in another exemplary embodiment of the present application; Figure 8 is a block diagram of an image enhancement device shown in an exemplary embodiment of the present application; Fig. 9 is a schematic structural diagram of an electronic device shown in an exemplary embodiment of the present application; Fig.10 It is a schematic diagram of the structure of a computer-readable storage medium shown in an exemplary embodiment of the present application. DETAILED DESCRIPTION

[0021] The scheme of the embodiment of the present application is described in detail below in conjunction with the drawings of the specification.

[0022] In the following description, for the purpose of explanation rather than limitation, specific details such as specific system structures, interfaces, and technologies are provided to facilitate a thorough understanding of the present application.

[0023] The term "and / or" in this article is only an association information describing the associated objects, indicating that there may be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the previous and next associated objects are in an "or" relationship. In addition, "many" in this article means two or more than two. In addition, the term "at least one" in this article means any combination of at least two of any one or more of a plurality of, for example, including at least one of A, B, and C, can mean including any one or more elements selected from the set consisting of A, B, and C.

[0024] Image enhancement can be achieved by extracting low-frequency information from the original image. Low-frequency information needs to retain edge information as much as possible and remove texture information to avoid halo problems in the enhanced image. Therefore, it is necessary to effectively distinguish edges and textures. It is generally believed that the grayscale value difference around the edge is larger than the grayscale value difference around the texture, so the edge and texture can be distinguished from the perspective of grayscale value difference.

[0025] However, see Figure 1 , Figure 1 FIG. 1 is a schematic diagram showing a comparison of grayscale value differences around an edge and a texture according to an exemplary embodiment of the present application. Figure 1 As shown, the grayscale value difference around the edge may be larger than the grayscale value difference around the texture, and the grayscale value difference around the edge may also be smaller than the grayscale value difference around the texture. The accuracy of distinguishing edges and textures only by grayscale value difference is low.

[0026] Based on this, the present application provides an image enhancement method to effectively distinguish edges and textures during the low-frequency information extraction process.

[0027] The image enhancement method provided in the embodiments of the present application is described below.

[0028] Please refer to Figure 2 , which shows a schematic diagram of a solution implementation environment provided by an embodiment of the present application. The solution implementation environment may include a terminal 210 and a server 220, and the terminal 210 and the server 220 are connected to each other in communication.

[0029] The number of the terminal 210 may be one or more. The terminal 210 may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart watch, etc., but is not limited thereto.

[0030] Server 220 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), as well as big data and artificial intelligence platforms.

[0031] In one example, the server 220 may perform enhancement processing on the original image obtained from the terminal 210 to obtain an enhanced image. Of course, the server 220 may store the enhanced image locally, transmit it back to the terminal 210, or transmit it to other terminals 210.

[0032] In one example, a client running a target application is installed in the terminal 210, such as an application providing image enhancement function. The server 220 may be a background server of the target application, configured to provide background services for the client of the target application.

[0033] In the image enhancement method provided in the embodiment of the present application, the execution subject of each step can be the terminal 210, such as the client of the target application installed and running in the terminal 210, or the server 220, or the terminal 210 and the server 220 interact and cooperate to execute, that is, part of the steps of the method are executed by the terminal 210 and the other steps are executed by the server 220.

[0034] See also Figure 3 , Figure 3 is a flowchart of an image enhancement method shown in an exemplary embodiment of the present application. The image enhancement method can be applied to Figure 2 It should be understood that the method can also be applied to other exemplary implementation environments and be specifically executed by devices in other implementation environments, and this embodiment does not limit the implementation environment to which the method is applicable.

[0035] like Figure 3 As shown, the image enhancement method at least includes steps S310 to S350, which are described in detail as follows: Step S310: extracting brightness information of each pixel in the original image to obtain image brightness, and setting a gradient threshold based on the image brightness.

[0036] The image brightness can be obtained by performing guided filtering or mean filtering on the original image to extract the brightness information of each pixel in the original image.

[0037] Taking guided filtering as an example, the brightness information extraction formula can be the following formula 1: (Formula 1) Where I represents the original image; lum represents the brightness information of each pixel extracted, that is, the image brightness; represents the variance of the original image I; Represents the strength adjustment parameter of the guided filter. The larger the value, the stronger the filter.

[0038] The gradient threshold is set according to the image brightness. Specifically, the image brightness is positively correlated with the gradient threshold.

[0039] Exemplarily, the image brightness includes brightness information corresponding to each pixel, and according to the brightness information corresponding to each pixel, a gradient threshold is set for each pixel respectively.

[0040] Exemplarily, the image brightness is the average brightness of each pixel in the original image, and the gradient threshold is set according to the average brightness, and the gradient threshold is used as the gradient threshold of all pixels.

[0041] Step S320: performing difference calculation on the pixel value of each pixel in the original image from a preset gradient direction to obtain a pixel gradient.

[0042] Among them, the gradient of the image is used to characterize the amplitude of the image change. If the difference in the grayscale values ​​of adjacent pixels is large, the calculated gradient value is large and the amplitude of the image change is large; if the difference in the grayscale values ​​of adjacent pixels is small, the calculated gradient value is small and the amplitude of the image change is small.

[0043] The pixel value of each pixel in the original image is difference-calculated along a preset gradient direction to obtain a pixel gradient.

[0044] Exemplarily, the preset gradient direction includes but is not limited to a row direction, a column direction, a diagonal direction, etc.

[0045] In some embodiments, before performing difference calculation on the pixel values ​​of each pixel in the original image from a preset gradient direction to obtain the pixel gradient, the original image may be preprocessed, such as noise reduction processing, image cropping processing, etc., and then the difference calculation is performed on the preprocessed original image to obtain the pixel gradient.

[0046] It should be noted that the number of preset gradient directions may be one or more. If there are multiple preset gradient directions, for the same pixel, pixel gradients corresponding to the multiple preset gradient directions will be calculated.

[0047] It should be noted that the present application does not limit the execution order of step S310 and step S320, that is, step S310 and step S320 can be executed simultaneously; or step S310 can be executed first and step S320 can be executed later; or step S320 can be executed first and step S310 can be executed later.

[0048] Step S330: Count the number of pixel gradients that are not less than the gradient threshold to obtain the gradient number.

[0049] The present application takes into account that the extracted pixel gradients may contain gradients caused by noise. Therefore, the gradient threshold determined by the image brightness is used to count the number of pixel gradients that are not less than the gradient threshold to eliminate the gradients caused by noise and obtain a more accurate number of gradients.

[0050] Step S340: Calculate the low-frequency signal coefficient based on the gradient quantity, and use the low-frequency signal coefficient to extract the low-frequency signal from the original image to obtain the low-frequency signal.

[0051] Specifically, the gradient quantity is mapped to the low-frequency signal coefficient using a preset coefficient calculation formula, and then the low-frequency signal is extracted from the original image according to the low-frequency signal coefficient. The low-frequency signal coefficient is used to limit the frequency band and intensity of the low-frequency signal to be extracted.

[0052] Exemplarily, the low-frequency signal may be directly extracted from the original image according to the low-frequency signal coefficient.

[0053] Exemplarily, the original image may be preprocessed, and the low-frequency signal may be extracted from the preprocessed image according to the low-frequency signal coefficient.

[0054] Therein, a preset low-frequency signal extraction formula may be provided, and the low-frequency signal coefficient, the original image or the preprocessed image is input into the preset low-frequency signal extraction formula to obtain the low-frequency signal.

[0055] Step S350: performing image enhancement processing on the original image based on the low-frequency signal to obtain an image enhancement result.

[0056] The original image is enhanced according to the extracted low-frequency signal, in which edge information is retained and texture information is filtered out. The edge of the original image can be enhanced according to the low-frequency signal to obtain an edge-enhanced image, that is, an image enhancement result.

[0057] This application removes noise gradients according to image brightness and distinguishes edges and textures based on the number of gradients. It can effectively distinguish edges and textures in images, extract more accurate low-frequency information, and thus improve subsequent image enhancement effects.

[0058] Next, some embodiments of the present application are described in detail.

[0059] In some embodiments, before performing difference calculation on the pixel values ​​of each pixel in the original image from a preset gradient direction to obtain the pixel gradient, it also includes: performing noise filtering processing on the original image to obtain an image denoising result; performing difference calculation on the pixel values ​​of each pixel in the original image from a preset gradient direction to obtain the pixel gradient, including: performing difference calculation on the pixel values ​​of each pixel in the image denoising result from the preset gradient direction to obtain the pixel gradient.

[0060] First, the original image is subjected to noise filtering to reduce image noise and improve the accuracy of subsequent gradient quantity statistics.

[0061] Exemplarily, algorithms such as wavelet filtering, bilateral filtering, non-local mean filtering, and deep learning can be used to perform noise filtering on the original image to obtain an image denoising result.

[0062] Taking bilateral filtering as an example, the formula for performing noise filtering on the original image can be found in the following formulas 2 and 3: (Formula 2) (Formula 3) Among them, i and j represent the coordinates of the image; Represents the image denoising result corresponding to pixel i; and Represents the grayscale value of the pixel corresponding to coordinates j and i; and Respectively represent the noise reduction strength of the grayscale domain and the spatial domain of bilateral filtering. The larger the value, the stronger the noise reduction strength. It means that j is a coordinate point in a region with i as the center, and the size of the region is set according to actual needs.

[0063] After the image denoising result is obtained, the pixel value of each pixel in the image denoising result is difference calculated from the preset gradient direction to obtain the pixel gradient.

[0064] In some embodiments, the preset gradient direction includes a row direction and a column direction; in step S320, the pixel value of each pixel in the image denoising result is calculated from the preset gradient direction to obtain a pixel gradient, including: calculating the pixel value difference between adjacent pixels in the row direction to obtain an initial row gradient; and calculating the pixel value difference between adjacent pixels in the column direction to obtain an initial column gradient; the initial row gradient and the initial column gradient are used as the pixel gradient.

[0065] For example, see Figure 4 , Figure 4A schematic diagram of gradient calculation is shown for an exemplary embodiment of the present application, such as Figure 4 As shown, taking the calculation window size of 5*5 as an example, the calculation window is slid in the image denoising result, and the image content within the 6*6 range centered on Ide22 is obtained from the image denoising result.

[0066] For the image content within the 6*6 range centered on Ide22, the pixel value difference between adjacent pixels in the row direction is calculated to obtain the initial row gradient, such as the initial row gradient corresponding to Ide00 is Ide00-Ide01; and the pixel value difference between adjacent pixels in the column direction is calculated to obtain the initial column gradient, such as the initial column gradient corresponding to Ide00 is Ide00-Ide10.

[0067] Both the initial row gradient and the initial column gradient are taken as pixel gradients.

[0068] Of course, other preset gradient directions may be selected to calculate pixel gradients, for example, a diagonal direction may be selected to calculate pixel gradients, which is not limited in the present application.

[0069] Of course, the pixel gradient of the original image can also be calculated in the same way.

[0070] In some embodiments, in step S330, counting the number of pixel gradients that are not less than a gradient threshold to obtain the gradient number includes: obtaining the gradient threshold, initial row gradient, and initial column gradient corresponding to the current pixel; if the initial row gradient or initial column gradient of the current pixel is less than the gradient threshold, setting the initial row gradient or initial column gradient of the current pixel to zero to obtain a target row gradient or target column gradient; if the initial row gradient or initial column gradient of the current pixel is not less than the gradient threshold, using the absolute value of the initial row gradient or initial column gradient as a new gradient value to obtain the target row gradient or target column gradient; summing the target row gradient and target column gradient corresponding to the current pixel to obtain the gradient sum corresponding to the current pixel; counting the number of pixels whose gradient sum is not zero to obtain the gradient number.

[0071] Exemplarily, if the image brightness of the current pixel is lum, the gradient threshold can be set to Ethr*lum, where Ethr is a preset value, and the initial row gradient is defined as v, and the initial column gradient is defined as h. The target row gradient and the target column gradient can be calculated according to the following formulas 4, 5, and 6: (Formula 4) vthr=T(v) (Formula 5) hthr=T(h) (Formula 6) Among them, the value of x can be v or h; v or h represents the initial row gradient or initial column gradient corresponding to any pixel; vthr represents the target row gradient, whose value can be 0 or the absolute value of the initial row gradient; hthr represents the target column gradient, whose value can be 0 or the absolute value of the initial column gradient.

[0072] By filtering out pixel gradients less than the gradient threshold in the above manner, the formula for counting the number of gradients can be found in the following formulas 7 and 8: (Formula 7) (Formula 8) in, Represents the calculation window All pixels within the corresponding initial row gradient v, of course, can also be used , the pixels it contains are the same; i is the pixel coordinate; represents the target row gradient of pixel i, Represents the target column gradient of pixel i; NUM() is a number counter; Nedge represents the number of gradients obtained by statistics.

[0073] In some embodiments, if there are multiple preset gradient directions, the number of pixel gradients that are not less than the gradient threshold in each preset gradient direction may be counted separately to obtain multiple gradient quantity values, and then, the sum of the multiple gradient quantity values ​​may be divided according to the number of preset gradient directions, and the calculated average value may be used as the final gradient quantity; if there is one preset gradient direction, the number of pixel gradients that are not less than the gradient threshold may be directly counted to obtain the gradient quantity.

[0074] This application does not specifically limit the statistical method of the gradient quantity.

[0075] After obtaining the gradient quantity, the low-frequency signal coefficient is calculated according to the gradient quantity.

[0076] In some embodiments, calculating the low-frequency signal coefficient based on the gradient quantity in step S340 includes: performing variance calculation on the original image to obtain image variance; substituting the image variance and the gradient quantity into a preset coefficient calculation formula to obtain the low-frequency signal coefficient.

[0077] Image variance is one of the statistical characteristics of an image. The variance of an image is calculated by subtracting the sum of squares of the grayscale value of each pixel from the average grayscale value of the image and dividing it by the total number of pixels.

[0078] For example, the variance calculation for the original image may be specifically performed by referring to the following formula 9: (Formula 9) Among them, I is the original image; meanFilter represents mean filtering; Represents the calculation window; is the image variance.

[0079] The calculation window used for image variance calculation is the same size as the calculation window used for gradient quantity statistics.

[0080] Then, the image variance and gradient quantity are substituted into the preset coefficient calculation formula to obtain the low-frequency signal coefficient.

[0081] For example, the preset coefficient calculation formula may be the following formula 10: (Formula 10) Among them, Nedge represents the number of gradients obtained by statistics; is the image variance; is the preset value; a is the low-frequency signal coefficient.

[0082] Of course, other preset coefficient calculation formulas may also be used, and this application does not limit this.

[0083] The low-frequency signal coefficients are calculated by combining the gradient quantity and the image variance, thereby improving the accuracy of the calculated low-frequency signal coefficients.

[0084] Of course, in addition to calculating the low-frequency signal coefficient by combining the gradient quantity and the image variance in the above embodiment, the gradient quantity can also be directly mapped to the low-frequency signal coefficient, which is not limited in the present application.

[0085] In some embodiments, in step S340, low-frequency signal extraction is performed on the original image using the low-frequency signal coefficient, including: performing noise filtering on the original image to obtain an image denoising result; performing mean filtering on the image denoising result to obtain an image filtering result; and performing weighted summation of the image denoising result and the image filtering result using the low-frequency signal coefficient to obtain a low-frequency signal.

[0086] Specifically, the method of extracting the low-frequency signal can refer to the following formula 11: (Formula 11) Among them, a is the low-frequency signal coefficient; de is the image denoising result; meanFilter represents mean filtering; Represents the calculation window; basicLow is the low-frequency signal.

[0087] Ide preserves the edges and texture of the image, is the blurred image, which has almost no edges and textures. When a is in the texture area, the image variance will become smaller, the number of gradients Nedge will become larger, and the value of a will tend to 0, so basicLow will tend to ; When a is in the edge area, the image variance will become larger, the number of gradients Nedge will become smaller, and the value of a will tend to 1, so basicLow will tend to Ide.

[0088] Therefore, the edge can be well preserved while the texture can be removed. Preserving the edge means that the enhanced image has less halo. Removing the texture means that the enhanced image has stronger texture.

[0089] In some embodiments, in step S340, low-frequency signal extraction is performed on the original image using low-frequency signal coefficients, including: using the low-frequency signal coefficients corresponding to the original image to extract the low-frequency signal from the original image to obtain a first low-frequency signal; performing gradient quantity statistics on the first low-frequency signal, and calculating the low-frequency signal coefficient corresponding to the first low-frequency signal according to the counted gradient quantity; using the low-frequency signal coefficients corresponding to the first low-frequency signal to extract the low-frequency signal from the first low-frequency signal to obtain a second low-frequency signal; and using the first low-frequency signal and / or the second low-frequency signal as the extracted low-frequency signal.

[0090] For example, the first low-frequency signal is recorded as basicLow, and then steps S320 to S340 are re-executed with basicLow as input to perform gradient statistics on the first low-frequency signal, calculate the low-frequency signal coefficient corresponding to the first low-frequency signal according to the counted gradient quantity, perform low-frequency signal extraction on the first low-frequency signal using the low-frequency signal coefficient corresponding to the first low-frequency signal, and obtain a second low-frequency signal, and record the second low-frequency signal as finalLow.

[0091] Optionally, the second low-frequency signal may be further used as input to re-execute steps S320 to S340 to obtain a third low-frequency signal, and so on, to iteratively extract and obtain multiple low-frequency signals.

[0092] By extracting multiple low-frequency signals through the above iterative process, the accuracy of the extracted low-frequency signals can be improved.

[0093] Optionally, the number of extracted low-frequency signals can be determined based on the computing power resources of the current execution entity. For example, for a low-cost chip, the number of extracted low-frequency signals is 1, and for a chip with higher computing power, the number of extracted low-frequency signals is 3, so as to flexibly adjust the number of iterations and the number of low-frequency signals to balance the computing power and the enhancement effect.

[0094] When a low-frequency signal is extracted, the original image can be directly enhanced according to the low-frequency signal to obtain an image enhancement result; when multiple low-frequency signals are extracted, the original image can be enhanced according to the low-frequency signal extracted in the last iteration to obtain an image enhancement result; when multiple low-frequency signals are extracted, the original image can also be enhanced according to the low-frequency signal extracted in each iteration to obtain an image enhancement result.

[0095] For example, when the number of low-frequency signals considered for image enhancement is one, the following formula 12 may be used to implement image enhancement: (Formula 12) in, is the preset value; I is the original image; Ide is the image denoising result; I-Ide represents the denoising value; finalLow is the low-frequency signal; G is the preset enhancement formula; Ien is the image enhancement result.

[0096] For example, see Figure 5 , Figure 5 This is a schematic diagram of a preset enhancement formula shown in an exemplary embodiment of the present application, such as Figure 5 As shown, the x-axis is the input Ide-finalLow and the y-axis is the output The preset enhancement formula can be expressed as Formula 13: (Formula 13) Wherein, M is the number of bits of the image, such as the value of M can be 8, 10, 12, etc.; It is the preset image enhancement strength coefficient. The smaller the value, the greater the image enhancement strength.

[0097] For example, see Figure 6 , Figure 6 A schematic diagram of image enhancement is shown as an exemplary embodiment of the present application. Figure 6 As shown, brightness information extraction, noise filtering and image variance calculation are performed on the original image respectively. First, according to the image denoising result after noise filtering and the image brightness obtained by brightness information extraction, the gradient quantity statistics are performed. Then, the first low-frequency signal extraction is performed by combining the gradient quantity and the calculated image variance. Then, according to the low-frequency signal obtained by the first low-frequency signal extraction and the image brightness obtained by brightness information extraction, the gradient quantity statistics are performed. Then, according to the gradient quantity and the calculated image variance, the second low-frequency signal extraction is performed. Finally, the original image is enhanced according to the low-frequency signal obtained by the second low-frequency signal extraction.

[0098] It should be noted that since the value of Ide-finalLow may be greater than 0 or less than 0, when the value of Ide-finalLow is greater than 0, the above formula 13 is directly used to calculate the output of the preset enhancement formula; when the value of Ide-finalLow is less than 0, the absolute value of Ide-finalLow is taken as the input of formula 13, and the negative number of the output is taken as the final output of the preset enhancement formula.

[0099] Exemplarily, when the number of low-frequency signals considered for image enhancement is multiple, such as taking the first low-frequency signal and the second low-frequency signal as the extracted low-frequency signals; in step S350, image enhancement processing is performed on the original image based on the extracted low-frequency signals to obtain an image enhancement result, including: performing noise filtering processing on the original image to obtain an image denoising result; calculating the difference between the image denoising result and the first low-frequency signal to obtain a first frequency band difference; and, calculating the difference between the first low-frequency signal and the second low-frequency signal to obtain a second frequency band difference; and, calculating the difference between the original image and the image denoising result to obtain a denoised value; respectively substituting the first frequency band difference and the second frequency band difference into a preset enhancement formula to obtain a first enhancement value and a second enhancement value; summing the denoising value, the first enhancement value, the second enhancement value and the second low-frequency signal to obtain an image enhancement result.

[0100] For example, the following formula 14 can be used to achieve image enhancement: (Formula 14) in, , are different preset enhancement formulas, which control the enhancement strength of different frequency bands respectively; basicLow is the first low-frequency signal; finalLow is the second low-frequency signal; Ien is the image enhancement result.

[0101] Of course, Formula 14 is only an example of image enhancement with two low-frequency signals. In actual application scenarios, the number of low-frequency signals may be greater, and this application does not limit this.

[0102] For example, see Figure 7 , Figure 7 A schematic diagram of image enhancement is shown in another exemplary embodiment of the present application. Figure 7As shown, brightness information extraction, noise filtering and image variance calculation are performed on the original image respectively. First, according to the image denoising result after noise filtering and the image brightness obtained by brightness information extraction, the gradient quantity statistics are performed. Then, the first low-frequency signal extraction is performed by combining the gradient quantity and the calculated image variance. Then, according to the low-frequency signal obtained by the first low-frequency signal extraction and the image brightness obtained by brightness information extraction, the gradient quantity statistics are performed. Then, the second low-frequency signal extraction is performed by combining the gradient quantity and the calculated image variance. Finally, the original image is enhanced by combining the low-frequency signal obtained by the first low-frequency signal extraction and the low-frequency signal obtained by the second low-frequency signal extraction.

[0103] The image enhancement effect is improved by performing image enhancement in different frequency bands on different low-frequency signals.

[0104] The image enhancement method provided by the present application obtains the image brightness by extracting the brightness information of each pixel in the original image, and sets a gradient threshold based on the image brightness; performs difference calculation on the pixel values ​​of each pixel in the original image from a preset gradient direction to obtain a pixel gradient; counts the number of pixel gradients that are not less than the gradient threshold to obtain a gradient number; calculates a low-frequency signal coefficient based on the gradient number, and uses the low-frequency signal coefficient to extract the low-frequency signal of the original image to obtain a low-frequency signal; performs image enhancement processing on the original image based on the low-frequency signal to obtain an image enhancement result, removes the noise gradient according to the image brightness, and distinguishes the edge and texture based on the gradient number, which can effectively distinguish the edge and texture in the image, extract more accurate low-frequency information, and improve the image enhancement effect.

[0105] Figure 8 FIG. 1 is a block diagram of an image enhancement device shown in an exemplary embodiment of the present application. Figure 8 As shown, the exemplary image enhancement device 800 includes: a threshold setting module 810, a gradient calculation module 820, a gradient quantity statistics module 830, a low-frequency signal extraction module 840 and an image enhancement module 850. Specifically: A threshold setting module 810 is used to extract the brightness information of each pixel in the original image, obtain the image brightness, and set the gradient threshold based on the image brightness; A gradient calculation module 820 is used to perform difference calculation on the pixel value of each pixel in the original image from a preset gradient direction to obtain a pixel gradient; A gradient quantity statistics module 830 is used to count the number of pixel gradients that are not less than a gradient threshold to obtain a gradient quantity; A low-frequency signal extraction module 840 is used to calculate the low-frequency signal coefficient based on the gradient quantity, and use the low-frequency signal coefficient to extract the low-frequency signal from the original image to obtain the low-frequency signal; The image enhancement module 850 is used to perform image enhancement processing on the original image based on the low-frequency signal to obtain an image enhancement result.

[0106] It should be noted that the image enhancement device provided in the above embodiment and the image enhancement method provided in the above embodiment belong to the same concept, wherein the specific manner in which each module and unit performs the operation has been described in detail in the method embodiment, and will not be repeated here. In practical applications, the image enhancement device provided in the above embodiment can distribute the above functions to different functional modules as needed, that is, divide the internal structure of the device into different functional modules to complete all or part of the functions described above, and this is not limited here.

[0107] See also Fig. 9 , Fig. 9 9 is a schematic diagram of the structure of an embodiment of an electronic device of the present application. The electronic device 900 includes a memory 901 and a processor 902, and the processor 902 is used to execute program instructions stored in the memory 901 to implement the steps in any of the above-mentioned image enhancement method embodiments. In a specific implementation scenario, the electronic device 900 may include but is not limited to: a microcomputer, a server, and in addition, the electronic device 900 may also include a mobile device such as a laptop computer and a tablet computer, which is not limited here.

[0108] Specifically, the processor 902 is used to control itself and the memory 901 to implement the steps in any of the above-mentioned image enhancement method embodiments. The processor 902 can also be called a central processing unit (CPU). The processor 902 may be an integrated circuit chip with signal processing capabilities. The processor 902 can also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. In addition, the processor 902 can be implemented by an integrated circuit chip.

[0109] See also Fig.10 , Fig.10 The computer-readable storage medium 1000 stores program instructions 1010 that can be executed by a processor, and the program instructions 1010 are used to implement the steps in any of the above-mentioned image enhancement method embodiments.

[0110] In some embodiments, the functions or modules included in the device provided by the embodiments of the present disclosure can be used to execute the method described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.

[0111] The above description of various embodiments tends to emphasize the differences between the various embodiments. The same or similar aspects can be referenced to each other, and for the sake of brevity, they will not be repeated herein.

[0112] In the several embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation described above is only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation, such as units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.

[0113] In addition, each functional unit in each embodiment of the present application can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit. If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or part of the contribution to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (processor) to perform all or part of the steps of each implementation method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program code.

Claims

1. An image enhancement method, characterized in that: include: Extracting brightness information of each pixel in the original image to obtain image brightness, and setting a gradient threshold based on the image brightness; Performing difference calculation on the pixel value of each pixel in the original image from a preset gradient direction to obtain a pixel gradient; Counting the number of pixel gradients that are not less than the gradient threshold to obtain a gradient number; Calculate low-frequency signal coefficients based on the gradient quantity, and use the low-frequency signal coefficients to extract low-frequency signals from the original image to obtain low-frequency signals; The original image is subjected to image enhancement processing based on the low-frequency signal to obtain an image enhancement result.

2. The method according to claim 1, characterized in that: Before performing difference calculation on the pixel values ​​of each pixel in the original image from the preset gradient direction to obtain the pixel gradient, the method further includes: Performing noise filtering on the original image to obtain an image noise reduction result; The step of performing difference calculation on the pixel values ​​of each pixel in the original image from a preset gradient direction to obtain a pixel gradient includes: The pixel value of each pixel in the image denoising result is difference calculated from a preset gradient direction to obtain a pixel gradient.

3. The method according to claim 2, characterized in that The preset gradient direction includes a row direction and a column direction; performing difference calculation on the pixel value of each pixel in the image denoising result from the preset gradient direction to obtain the pixel gradient includes: Calculating the pixel value difference between adjacent pixels in the row direction to obtain an initial row gradient; and, Calculating the pixel value difference between adjacent pixels in the column direction to obtain an initial column gradient; The initial row gradient and the initial column gradient are used as pixel gradients.

4. The method according to claim 3, characterized in that: The counting of the number of pixel gradients not less than the gradient threshold to obtain the number of gradients includes: Get the gradient threshold, initial row gradient and initial column gradient corresponding to the current pixel; If the initial row gradient or the initial column gradient of the current pixel is less than the gradient threshold, the initial row gradient or the initial column gradient of the current pixel is set to zero to obtain a target row gradient or a target column gradient; If the initial row gradient or the initial column gradient of the current pixel is not less than the gradient threshold, taking the absolute value of the initial row gradient or the initial column gradient as a new gradient value to obtain a target row gradient or a target column gradient; Summing the target row gradient and the target column gradient corresponding to the current pixel to obtain the gradient sum corresponding to the current pixel; Count the gradient and the number of non-zero pixels to get the gradient number.

5. The method according to claim 1, characterized in that: The calculating of the low-frequency signal coefficient based on the gradient quantity comprises: Performing variance calculation on the original image to obtain image variance; Substituting the image variance and the gradient quantity into a preset coefficient calculation formula, a low-frequency signal coefficient is obtained.

6. The method according to claim 1, characterized in that The step of extracting the low-frequency signal from the original image by using the low-frequency signal coefficient comprises: Performing noise filtering on the original image to obtain an image noise reduction result; Performing mean filtering on the image denoising result to obtain an image filtering result; The low-frequency signal coefficient is used to perform weighted summation on the image denoising result and the image filtering result to obtain a low-frequency signal.

7. The method according to claim 1, characterized in that The step of extracting the low-frequency signal from the original image by using the low-frequency signal coefficient comprises: Using the low-frequency signal coefficients corresponding to the original image, extracting the low-frequency signal from the original image to obtain a first low-frequency signal; Performing gradient quantity statistics on the first low-frequency signal, and calculating a low-frequency signal coefficient corresponding to the first low-frequency signal according to the counted gradient quantity; Using a low-frequency signal coefficient corresponding to the first low-frequency signal, performing low-frequency signal extraction on the first low-frequency signal to obtain a second low-frequency signal; The first low-frequency signal and / or the second low-frequency signal is used as the extracted low-frequency signal.

8. The method according to claim 7, characterized in that The first low-frequency signal and the second low-frequency signal are used as extracted low-frequency signals; and the image enhancement processing is performed on the original image based on the extracted low-frequency signals to obtain an image enhancement result, including: Performing noise filtering on the original image to obtain an image noise reduction result; Calculating the difference between the image denoising result and the first low-frequency signal to obtain a first frequency band difference; and calculating the difference between the first low-frequency signal and the second low-frequency signal to obtain a second frequency band difference; and calculating the difference between the original image and the image denoising result to obtain a denoising value; Substituting the first frequency band difference value and the second frequency band difference value into a preset enhancement formula respectively to obtain a first enhancement value and a second enhancement value; The denoising value, the first enhancement value, the second enhancement value and the second low-frequency signal are summed to obtain an image enhancement result.

9. An electronic device, characterized in that: The electronic device comprises a memory and a processor, wherein the processor is configured to execute program instructions stored in the memory to implement the steps in the method according to any one of claims 1 to 8.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program instructions, and the program instructions can be executed by a processor to implement the steps in the method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Contrast enhancement method based on wavelet transform image decomposition

    CN106296600A

  • Underwater image enhancement method based on structure-texture layering

    CN107798665A

  • Image enhancement method and device and medium

    CN113256534A

  • Traffic sign recognition method based on UM enhancement and SIFT feature extraction

    CN113420633A

  • Low-quality LDR image enhancement method based on pseudo HDR image generation

    CN116245760A

Cited By

  • Multispectral image enhancement method and device, computer equipment and storage medium

    CN119107238A

  • Method and device for determining JND threshold value of image, electronic equipment and storage medium

    CN119722680A

  • Image processing method and device, electronic equipment and storage medium

    CN120976055A