Image enhancement method, device and storage medium
By acquiring the image to be processed in the electronic device, determining the mean value of the central pixel point and its neighborhood pixels, and performing corresponding image enhancement processing, the problem of image quality improvement in the prior art is solved and significant image quality improvement is achieved.
Patent Information
- Application Number
- CN202011043862.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-28
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2040-09-28
AI Technical Summary
The prior art is difficult to effectively improve image quality, especially in images taken in electronic devices, the quality of the image directly affects the user's evaluation of the device.
By acquiring the image to be processed, the mean value of the central pixel point and its neighborhood pixels are determined, and the first and second image enhancement processes are performed according to the size of the pixel values to improve the image quality.
This method can realize image enhancement processing based on the central pixel point, significantly improve image quality, and improve user evaluation of electronic devices.
Smart Images

Figure CN112419167B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to an image enhancement method, device and storage medium. Background Art
[0002] With the rapid development of electronic technology, taking pictures has become a standard technology for electronic devices (such as mobile phones, tablets, etc.). When taking pictures, users have higher and higher requirements for image quality. The quality of the image also affects users' evaluation of electronic devices to a certain extent. Therefore, the problem of how to improve image quality needs to be solved urgently. Summary of the invention
[0003] The embodiments of the present application provide an image enhancement method, device and storage medium, which can improve image quality.
[0004] In a first aspect, an embodiment of the present application provides an image enhancement method, the method comprising:
[0005] Get the image to be processed;
[0006] Determine a central pixel point in the image to be processed, where the central pixel point is at least one pixel point in the image to be processed;
[0007] Determine the mean value of the neighborhood pixels of the central pixel;
[0008] When the pixel value of the central pixel point is greater than the neighborhood pixel mean value, performing a first image enhancement process on the central pixel point;
[0009] When the pixel value of the central pixel point is less than or equal to the neighborhood pixel mean value, a second image enhancement process is performed on the central pixel point.
[0010] In a second aspect, an embodiment of the present application provides an image enhancement device, the device comprising: an acquisition unit, a first determination unit, a second determination unit and an image enhancement unit, wherein:
[0011] The acquisition unit is used to acquire the image to be processed;
[0012] The first determining unit is used to determine a central pixel point in the image to be processed, where the central pixel point is at least one pixel point in the image to be processed;
[0013] The second determining unit is used to determine the mean value of the neighborhood pixels of the central pixel;
[0014] The image enhancement unit is used to perform a first image enhancement process on the central pixel when the pixel value of the central pixel is greater than the neighborhood pixel mean value;
[0015] The image enhancement unit is further configured to perform a second image enhancement process on the central pixel when the pixel value of the central pixel is less than or equal to the neighborhood pixel mean.
[0016] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the program includes instructions for executing the steps of any method in the first aspect of the embodiment of the present application.
[0017] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program for electronic data exchange, wherein the computer program enables a computer to execute part or all of the steps described in any method of the first aspect of the embodiment of the present application.
[0018] In a fifth aspect, an embodiment of the present application provides a computer program product, wherein the computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute some or all of the steps described in any method of the first aspect of the embodiment of the present application. The computer program product may be a software installation package.
[0019] The embodiments of the present application have the following beneficial effects:
[0020] It can be seen that the image enhancement method, device and storage medium described in the embodiments of the present application are applied to an electronic device to obtain an image to be processed, determine a central pixel in the image to be processed, where the central pixel is at least one pixel in the image to be processed, determine the mean of the neighborhood pixels of the central pixel, and perform a first image enhancement processing on the central pixel when the pixel value of the central pixel is greater than the mean of the neighborhood pixels; and perform a second image enhancement processing on the central pixel when the pixel value of the central pixel is less than or equal to the mean of the neighborhood pixels. Image enhancement processing can be achieved based on the central pixel, which helps to improve image quality. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0022] Figure 1A It is a structural schematic diagram of an electronic device provided in an embodiment of the present application;
[0023] Figure 1B is a flow chart of an image enhancement method provided in an embodiment of the present application;
[0024] Figure 1C is a flow chart of another image enhancement method provided in an embodiment of the present application;
[0025] Figure 2 is a flowchart of another image enhancement method provided in an embodiment of the present application;
[0026] Figure 3 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application;
[0027] Figure 4 It is a block diagram of the functional units of an image enhancement device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0028] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0029] The terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.
[0030] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0031] The electronic devices involved in the embodiments of the present application may be electronic devices with communication capabilities or electronic devices without communication capabilities. The electronic devices may include various handheld devices with wireless communication functions (such as mobile phones, tablet computers, etc.), vehicle-mounted devices, wearable devices (smart glasses, smart bracelets, smart watches, etc.), smart cameras, smart cameras, computing devices or other processing devices connected to wireless modems, as well as various forms of user equipment (UE), mobile stations (MS), terminal devices, etc.
[0032] See also Figure 1A , Figure 1A 1 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device includes a processor, a memory, a signal processor, a transceiver, a display screen, a speaker, a microphone, a random access memory (RAM), a camera, a sensor, and a communication module, etc. Among them, the memory, the signal processor, the display screen, the speaker, the microphone, the RAM, the camera, the sensor, and the communication module are connected to the processor, and the transceiver is connected to the signal processor.
[0033] The display screen may be a liquid crystal display (LCD), an organic or inorganic light-emitting diode (OLED), an active matrix organic light-emitting diode panel (AMOLED), etc.
[0034] The camera may be a common camera or an infrared camera, which is not limited here. The camera may be a front camera or a rear camera, which is not limited here.
[0035] Among them, the sensor includes at least one of the following: a light sensor, a gyroscope, an infrared proximity sensor, a fingerprint sensor, a pressure sensor, and the like. Among them, the light sensor, also known as an ambient light sensor, is used to detect the brightness of ambient light. The light sensor may include a photosensitive element and an analog-to-digital converter. Among them, the photosensitive element is used to convert the collected light signal into an electrical signal, and the analog-to-digital converter is used to convert the above electrical signal into a digital signal. Optionally, the light sensor may also include a signal amplifier, which may amplify the electrical signal converted by the photosensitive element and output it to the analog-to-digital converter. The above-mentioned photosensitive element may include at least one of a photodiode, a phototransistor, a photoresistor, and a silicon photocell.
[0036] Among them, the processor is the control center of the electronic device, which uses various interfaces and lines to connect the various parts of the entire electronic device, and performs various functions of the electronic device and processes data by running or executing software programs and / or modules stored in the memory, and calling data stored in the memory, thereby monitoring the electronic device as a whole.
[0037] The processor may integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the modem processor may not be integrated into the processor, wherein the processor may be at least one of the following: ISP, CPU, GPU, NPU, etc., which are not limited here.
[0038] The memory is used to store software programs and / or modules, and the processor executes various functional applications and data processing of the electronic device by running the software programs and / or modules stored in the memory. The memory may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, a software program required for at least one function, etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0039] Among them, the communication module can be used to realize the communication function, and the communication module can be at least one of the following: infrared module, Bluetooth module, mobile communication module, NFC module, Wi-Fi module, etc., which is not limited here.
[0040] The following is a detailed description of the embodiments of the present application.
[0041] See also Figure 1B , Figure 1B The present application provides a flowchart of an image enhancement method, which is applied to Figure 1A The electronic device shown in the figure, as shown in the figure, the image enhancement method includes the following operations.
[0042] 101. Obtain an image to be processed.
[0043] The image to be processed may be one or more frames of images in the video to be processed, and the image to be processed may be a dark vision image or an exposure image, or any randomly captured image.
[0044] 102. Determine a central pixel point in the image to be processed, where the central pixel point is at least one pixel point in the image to be processed.
[0045] The central pixel point can be understood as the pixel point corresponding to the center of the image to be processed. The central pixel point can be one or more pixels. For example, in a specific implementation, the electronic device can perform target extraction on the image to be processed to obtain the target, and use the center of the target as the central pixel point.
[0046] In a possible example, in determining the central pixel point in the image to be processed, the above step 102 may include the following steps:
[0047] 21. Divide the image to be processed into P regions, where P is an integer greater than 1;
[0048] 22. Determine an image quality evaluation value for each of the P regions to obtain P image quality evaluation values;
[0049] 23. Selecting an image quality evaluation value that is less than a preset threshold from the P image quality evaluation values to obtain Q image quality evaluation values, and obtaining target areas corresponding to the Q image quality evaluation values to obtain Q target areas;
[0050] 24. Determine the central pixel point of each of the Q target areas to obtain the central pixel point of the image to be processed.
[0051] In a specific implementation, the above preset threshold can be set by the user or by the system default. The electronic device can divide the image to be processed into P regions, where P is an integer greater than 1, and the area size of each region is the same or different. Furthermore, the electronic device can also use at least one image quality evaluation index to evaluate the image quality of each of the P regions to obtain P image quality evaluation values. The image quality evaluation index can be at least one of the following: mean square error, average gradient, information entropy, signal-to-noise ratio, etc., which are not limited here.
[0052] Furthermore, the electronic device can select an image quality evaluation value that is less than a preset threshold from P image quality evaluation values to obtain Q image quality evaluation values, and obtain the target areas corresponding to the Q image quality evaluation values to obtain Q target areas. Then, the central pixel point of each of the Q target areas can be determined to obtain the central pixel point of the image to be processed. In this way, the area that needs to be enhanced can be selected, and the central pixel point of the area can also be determined. Image enhancement processing can be implemented based on the central pixel point, which helps to improve image quality.
[0053] In a possible example, the above step 22, determining the image quality evaluation value of each of the P regions to obtain P image quality evaluation values, may include the following steps:
[0054] A1. Perform multi-scale feature decomposition on region i to obtain low-frequency feature components and high-frequency feature components, where region i is any region among the P regions;
[0055] A2, dividing the low-frequency characteristic component into multiple regions;
[0056] A3. Determine a signal-to-noise ratio corresponding to each of the multiple regions to obtain multiple signal-to-noise ratios;
[0057] A4. Determine an average signal-to-noise ratio and a first mean square error according to the multiple signal-to-noise ratios;
[0058] A5. Determine a target adjustment coefficient corresponding to the first mean square error;
[0059] A6. adjusting the average signal-to-noise ratio according to the target adjustment coefficient to obtain a target signal-to-noise ratio;
[0060] A7. Determine a first evaluation value corresponding to the target signal-to-noise ratio according to a preset mapping relationship between the signal-to-noise ratio and the evaluation value;
[0061] A8. Obtain target shooting parameters corresponding to the image to be processed;
[0062] A9. Determine a target low-frequency weight corresponding to the target shooting parameter according to a preset mapping relationship between the shooting parameter and the low-frequency weight, and determine a target high-frequency weight according to the target low-frequency weight;
[0063] A10, determining the distribution density of target feature points according to the high-frequency feature components;
[0064] A11. Determine a second evaluation value corresponding to the target feature point distribution density according to a preset mapping relationship between the feature point distribution density and the evaluation value;
[0065] A12. Perform a weighted operation according to the first evaluation value, the second evaluation value, the target low-frequency weight, and the target high-frequency weight to obtain an image quality evaluation value of the region i.
[0066] In a specific implementation, the electronic device can use a multi-scale decomposition algorithm to perform multi-scale feature decomposition on region i to obtain low-frequency feature components and high-frequency feature components. The multi-scale decomposition algorithm can be at least one of the following: pyramid transform algorithm, wavelet transform, contourlet transform, non-subsampled contourlet transform, shearlet transform, etc., which are not limited here. Further, the low-frequency feature component can be divided into multiple regions, and the area size of each region is the same or different. The low-frequency feature component reflects the main features of the image, and the high-frequency feature component reflects the detailed information of the image.
[0067] Furthermore, the electronic device can determine the signal-to-noise ratio corresponding to each of the multiple regions, obtain multiple signal-to-noise ratios, and determine the average signal-to-noise ratio and the first mean square error based on the multiple signal-to-noise ratios. The signal-to-noise ratio reflects the amount of image information to a certain extent, and the mean square error can reflect the stability of the image information. The electronic device can pre-store a mapping relationship between a preset mean square error and an adjustment coefficient, and then, the target adjustment coefficient corresponding to the first mean square error can be determined based on the mapping relationship. In the embodiment of the present application, the value range of the pre-stored adjustment coefficient can be set by the user or the system, for example, the value range can be -0.115 to 0.115.
[0068] Furthermore, the electronic device may adjust the average signal-to-noise ratio according to the target adjustment coefficient to obtain the target signal-to-noise ratio, where target signal-to-noise ratio=(1+target adjustment coefficient)*average signal-to-noise ratio. The electronic device may pre-store a mapping relationship between a preset signal-to-noise ratio and an evaluation value, and further, may determine a first evaluation value corresponding to the target signal-to-noise ratio according to the mapping relationship between the preset signal-to-noise ratio and the evaluation value.
[0069] In addition, the electronic device can obtain the target shooting parameters corresponding to the image to be processed, and the target shooting parameters can be at least one of the following: sensitivity ISO, area of the region of interest, exposure time, white balance parameter, focus parameter, etc., which are not limited here. The electronic device can also pre-store the mapping relationship between the preset shooting parameters and the low-frequency weights, and then, according to the mapping relationship between the preset shooting parameters and the low-frequency weights, the target low-frequency weights corresponding to the target shooting parameters can be determined, and the target high-frequency weights can be determined based on the target low-frequency weights, and the target low-frequency weights + target high-frequency weights = 1.
[0070] Furthermore, the electronic device can determine the target feature point distribution density based on the high-frequency feature component, and the target feature point distribution density = the total number of feature points of the high-frequency feature component / the area of the region. The electronic device can also pre-store a mapping relationship between a preset feature point distribution density and an evaluation value, and then, according to the mapping relationship between the preset feature point distribution density and the evaluation value, determine the second evaluation value corresponding to the target feature point distribution density, and finally, perform a weighted operation based on the first evaluation value, the second evaluation value, the target low-frequency weight, and the target high-frequency weight to obtain the target image quality evaluation value of region i, as follows:
[0071] Image quality evaluation value of region i = first evaluation value * target low frequency weight + second evaluation value * target high frequency weight
[0072] In this way, image quality evaluation can be performed based on the two dimensions of low-frequency components and high-frequency components of the image, and an evaluation value suitable for the shooting environment can be accurately obtained.
[0073] 103. Determine a neighborhood pixel mean of the central pixel.
[0074] Among them, the image to be processed can be one or more frames of images in the video to be processed. In a specific implementation, the electronic device can take the pixel points within a preset range as the neighborhood pixel points based on the central pixel point as the center, and the preset range can be set by the user or by the system default. The preset range can be K*K, where K is a positive integer, for example, K is 5, 7, 8, 13, etc., which is not limited here. Furthermore, the pixel values corresponding to the neighborhood pixel points can be averaged to obtain the neighborhood pixel mean.
[0075] 104. When the pixel value of the central pixel point is greater than the neighborhood pixel mean value, perform a first image enhancement process on the central pixel point.
[0076] The image to be processed may be one or more frames of images in the video to be processed. In a specific implementation, the electronic device may perform a first image enhancement process on the central pixel when the pixel value of the central pixel is greater than the average value of the neighboring pixels.
[0077] In a possible example, the above step 104, performing the first image enhancement process on the central pixel point, may include the following steps:
[0078] 41. Determine a target difference between the pixel value of the central pixel and the mean value of the neighborhood pixels;
[0079] 42. Determine a first image enhancement processing parameter corresponding to the target difference value according to a preset mapping relationship between the difference value and the image enhancement processing parameter;
[0080] 43. Determine a target mean square error between the pixel value of the central pixel and the pixel values of its neighboring pixels;
[0081] 44. Determine the target optimization coefficient corresponding to the target mean square error according to the preset mapping relationship between the mean square error and the optimization coefficient;
[0082] 45. Optimize the first image enhancement processing parameter according to the target optimization coefficient to obtain a second image enhancement processing parameter;
[0083] 46. Perform image enhancement processing on the central pixel according to the second image enhancement processing parameter.
[0084] In a specific implementation, the electronic device may pre-store a mapping relationship between a preset difference and an image enhancement processing parameter, wherein the image enhancement processing parameter may include an image enhancement processing algorithm and corresponding control parameters, wherein the image enhancement processing algorithm may be at least one of the following: grayscale stretching, wavelet transform, pyramid transform, neural network algorithm, histogram equalization, etc., which are not limited here. The control parameter may be understood as an adjustment parameter of the image enhancement processing algorithm, which may control the degree of enhancement of the image enhancement processing algorithm, and different image enhancement processing algorithms may correspond to different control parameters. The electronic device may determine a target difference between the pixel value of the central pixel and the mean value of the neighborhood pixels, and determine a first image enhancement processing parameter corresponding to the target difference according to the mapping relationship between the preset difference and the image enhancement processing parameter.
[0085] Furthermore, the electronic device also determines a target mean square error between the pixel value of the central pixel and the pixel value of its neighboring pixel points. The electronic device may pre-store a mapping relationship between a preset mean square error and an optimization coefficient. Then, according to the mapping relationship between the preset mean square error and the optimization coefficient, a target optimization coefficient corresponding to the target mean square error may be determined, and the first image enhancement processing parameter is optimized according to the target optimization coefficient to obtain a second image enhancement processing parameter. The target optimization parameter mainly optimizes the control parameter of the first image enhancement processing parameter, for example, as follows:
[0086] Control parameter of the second image enhancement processing parameter = (1 + target optimization coefficient) * control parameter of the first image enhancement processing parameter
[0087] Among them, in the embodiment of the present application, the specific value range of the optimization coefficient can be -1 to 1, for example, -0.15 to 0.15.
[0088] Furthermore, the electronic device can perform image enhancement processing on the central pixel according to the second image enhancement processing parameter. Specifically, image enhancement processing can be performed on pixels within a specified range centered on the central pixel. The specified range can be set by the user or by the system default. For example, the specified range can be the entire image to be processed, or an area centered on the central pixel.
[0089] 105. When the pixel value of the central pixel is less than or equal to the neighborhood pixel mean, perform a second image enhancement process on the central pixel.
[0090] In a specific implementation, the image enhancement algorithms corresponding to the first image enhancement processing and the second image enhancement processing may be the same or different.
[0091] In the specific implementation, Figure 1CAs shown, the electronic device can determine the area to be enhanced centered on the central pixel, determine the enhancement coefficient of the area, attenuate it to suppress noise, and perform contrast enhancement processing, as follows:
[0092] 1. Calculate the local contrast enhancement coefficient using the following formula:
[0093]
[0094] Among them, Y GC (i,j) represents the area to be enhanced, B GC (i,j) represents Y GC (i, j) is the image after being filtered by the first filter, C is a constant representing the contrast intensity of the high grayscale image, and the first filter can be at least one of the following: guided filtering, curvature filtering, WLS filter, domain transformation RF filter, LEP filter, etc., which are not limited here.
[0095] 2. Suppress the enhancement coefficient by the following formula:
[0096] The noise of the image is suppressed by attenuating the low segment value of the beta curve, as follows:
[0097]
[0098] Among them, K0, K1 and K3 represent the contrast enhancement strength; T1 is the noise suppression level; T2 is the excessive threshold to prevent abnormal grayscale points from appearing in the image; and T3 is the bias.
[0099] 3. Perform local contrast enhancement using the following formula:
[0100] The normalized brightness mapping function of local contrast is as follows:
[0101]
[0102] Among them, Y GC (i,j) represents the area to be enhanced, B GC (i,j) represents Y GC (i, j) is the pixel after LEP filtering, Y out (i, j) represents the pixel value after contrast enhancement.
[0103] In a possible example, the above step 105, performing the second image enhancement process on the central pixel point, may include the following steps:
[0104] 51. Determine the energy value of the central pixel to obtain a first energy value;
[0105] 52. Determine energy values of neighboring pixels of the central pixel to obtain a plurality of second energy values;
[0106] 53. Determine an energy ratio between the first energy value and the plurality of second energy values to obtain a plurality of energy ratios;
[0107] 54. Sorting the multiple energy ratios, and projecting the sorted multiple energy ratios to a coordinate system;
[0108] 55. Fitting the multiple energy ratios based on the coordinate system to obtain a fitting straight line;
[0109] 56. Determine the target slope of the fitted straight line;
[0110] 57. Determine the target image enhancement processing parameter corresponding to the target slope according to the mapping relationship between the preset slope and the image enhancement processing parameter;
[0111] 58. Perform a second image enhancement process on the central pixel according to the target image enhancement process parameter.
[0112] In a specific implementation, the electronic device can determine the energy value of the central pixel to obtain a first energy value, and can also determine the energy values of the neighborhood pixels of the central pixel to obtain multiple second energy values. Furthermore, the energy ratio between the first energy value and the multiple second energy values can be determined to obtain multiple energy ratios. The multiple energy ratios are sorted, and the sorted multiple energy ratios are projected to a coordinate system. Specifically, the multiple energy ratios can be numbered, for example, 1, 2, 3, etc., and the horizontal axis of the coordinate system is the sequential position, and the vertical axis is the energy ratio. Furthermore, the multiple energy ratios can be fitted based on the coordinate system to obtain a fitting straight line.
[0113] Furthermore, the electronic device can determine the target slope of the fitted line, and the mapping relationship between the slope and the image enhancement processing parameters can be pre-stored in the electronic device, wherein the image enhancement processing parameters can include an image enhancement processing algorithm and corresponding control parameters, wherein the image enhancement processing algorithm can be at least one of the following: grayscale stretching, wavelet transform, pyramid transform, neural network algorithm, histogram equalization, etc., which are not limited here. The control parameter can be understood as an adjustment parameter of the image enhancement processing algorithm, which can control the enhancement degree of the image enhancement processing algorithm, and different image enhancement processing algorithms can correspond to different control parameters. Furthermore, the target image enhancement processing parameters corresponding to the target slope can be determined according to the mapping relationship between the preset slope and the image enhancement processing parameters, and the second image enhancement processing is performed on the central pixel point according to the target image enhancement processing parameters. Specifically, the image enhancement processing can be performed on the pixels within a specified range centered on the central pixel point, and the specified range can be set by the user or by the system default. For example, the specified range can be the entire image to be processed, or an area centered on the central pixel point.
[0114] In a possible exemplary embodiment, the following steps may be further included between the above steps 101 and 102:
[0115] B1, performing image segmentation on the image to be processed to obtain a target area image and a background area image;
[0116] B2. Determine the distribution density of the first feature points corresponding to the target area image;
[0117] B3, determining the distribution density of the second feature points of the background area image;
[0118] B4. When the ratio between the first feature point distribution density and the second feature point distribution density is within a preset ratio range, executing the step of determining the central pixel point in the image to be processed.
[0119] The preset ratio range may be set by the user or by the system as a default. The preset ratio range may indicate that the contrast difference between the background and the target is large, and image enhancement processing may be performed.
[0120] In a specific implementation, the electronic device can perform image segmentation on the image to be processed to obtain the target area image and the background area image, and can determine the first feature point distribution density corresponding to the target area image. Specifically, the target area image can be feature extracted to obtain a feature point set, and the area of the target area image can also be determined. The first feature point distribution density = the number of feature points in the feature point set / the area of the target area image. Similarly, the electronic device can also determine the second feature point distribution density of the background area image. Then, the electronic device can execute step 102 when the ratio between the first feature point distribution density and the second feature point distribution density is within a preset ratio range. Otherwise, the subsequent steps can be omitted.
[0121] It can be seen that the image enhancement method described in the embodiment of the present application is applied to an electronic device, obtains an image to be processed, determines a central pixel in the image to be processed, where the central pixel is at least one pixel in the image to be processed, determines the mean of the neighborhood pixels of the central pixel, and performs a first image enhancement processing on the central pixel when the pixel value of the central pixel is greater than the mean of the neighborhood pixels; and performs a second image enhancement processing on the central pixel when the pixel value of the central pixel is less than or equal to the mean of the neighborhood pixels. Image enhancement processing can be achieved based on the central pixel, which helps to improve image quality.
[0122] With the above Figure 1B For details on the embodiments shown in the drawings, please refer to Figure 2 , Figure 2 It is a flow chart of an image enhancement method provided in an embodiment of the present application, which is applied to an electronic device. As shown in the figure, the image enhancement method includes the following steps.
[0123] 201. Obtain an image to be processed.
[0124] 202. Perform image segmentation on the image to be processed to obtain a target area image and a background area image.
[0125] 203. Determine a first feature point distribution density corresponding to the target area image.
[0126] 204. Determine a second feature point distribution density of the background area image.
[0127] 205. When the ratio between the first feature point distribution density and the second feature point distribution density is within a preset ratio range, determine a central pixel point in the image to be processed, where the central pixel point is at least one pixel point in the image to be processed.
[0128] 206. Determine a neighborhood pixel mean of the central pixel.
[0129] 207. When the pixel value of the central pixel point is greater than the neighborhood pixel mean value, perform a first image enhancement process on the central pixel point.
[0130] 208. When the pixel value of the central pixel is less than or equal to the neighborhood pixel mean, perform a second image enhancement process on the central pixel.
[0131] The detailed description of the above steps 201 to 208 can be found in the above Figure 1B The corresponding steps of the described image enhancement method will not be repeated here.
[0132] It can be seen that the image enhancement method described in the embodiment of the present application can implement image enhancement processing based on the central pixel when the contrast difference between the target and the background is large, which helps to improve the image quality.
[0133] With the above Figure 1B , Figure 2 For details on the embodiments shown in the drawings, please refer to Figure 3 , Figure 3 3 is a schematic diagram of the structure of an electronic device 300 provided in an embodiment of the present application. As shown in the figure, the electronic device 300 includes a processor 310, a memory 320, a communication interface 330, and one or more programs 321, wherein the one or more programs 321 are stored in the above-mentioned memory 320 and are configured to be executed by the above-mentioned processor 310, and the one or more programs 321 include instructions for executing any step in the above-mentioned method embodiment:
[0134] Get the image to be processed;
[0135] Determine a central pixel point in the image to be processed, where the central pixel point is at least one pixel point in the image to be processed;
[0136] Determine the mean value of the neighborhood pixels of the central pixel;
[0137] When the pixel value of the central pixel point is greater than the neighborhood pixel mean value, performing a first image enhancement process on the central pixel point;
[0138] It can be seen that the electronic device described in the embodiment of the present application obtains an image to be processed, determines a central pixel in the image to be processed, where the central pixel is at least one pixel in the image to be processed, determines the mean of the neighborhood pixels of the central pixel, and performs a first image enhancement processing on the central pixel when the pixel value of the central pixel is greater than the mean of the neighborhood pixels; and performs a second image enhancement processing on the central pixel when the pixel value of the central pixel is less than or equal to the mean of the neighborhood pixels. Image enhancement processing can be achieved based on the central pixel, which helps to improve image quality.
[0139] When the pixel value of the central pixel point is less than or equal to the neighborhood pixel mean value, a second image enhancement process is performed on the central pixel point.
[0140] In a possible example, in determining the central pixel point in the image to be processed, the one or more programs 321 are used to:
[0141] Dividing the image to be processed into P regions, where P is an integer greater than 1;
[0142] Determine an image quality evaluation value of each of the P regions to obtain P image quality evaluation values;
[0143] Selecting an image quality evaluation value less than a preset threshold from the P image quality evaluation values to obtain Q image quality evaluation values, and acquiring target areas corresponding to the Q image quality evaluation values to obtain Q target areas;
[0144] The central pixel point of each of the Q target areas is determined to obtain the central pixel point of the image to be processed.
[0145] In a possible example, in the aspect of performing the first image enhancement processing on the central pixel point, the one or more programs 321 are used to:
[0146] Determine a target difference between the pixel value of the central pixel and the mean value of the neighborhood pixels;
[0147] Determining a first image enhancement processing parameter corresponding to the target difference value according to a preset mapping relationship between the difference value and the image enhancement processing parameter;
[0148] Determine a target mean square error between the pixel value of the central pixel and the pixel values of its neighboring pixels;
[0149] According to a preset mapping relationship between the mean square error and the optimization coefficient, a target optimization coefficient corresponding to the target mean square error is determined;
[0150] Optimizing the first image enhancement processing parameter according to the target optimization coefficient to obtain a second image enhancement processing parameter;
[0151] Perform image enhancement processing on the central pixel according to the second image enhancement processing parameter.
[0152] In a possible example, in the aspect of performing the second image enhancement processing on the central pixel point, the one or more programs 321 are used to:
[0153] Determine the energy value of the central pixel to obtain a first energy value;
[0154] Determine energy values of neighboring pixels of the central pixel to obtain a plurality of second energy values;
[0155] determining an energy ratio between the first energy value and the plurality of second energy values to obtain a plurality of energy ratios;
[0156] Sorting the multiple energy ratios, and projecting the sorted multiple energy ratios to a coordinate system;
[0157] Fitting the multiple energy ratios based on the coordinate system to obtain a fitting straight line;
[0158] Determining a target slope of the fitted straight line;
[0159] Determining the target image enhancement processing parameters corresponding to the target slope according to the mapping relationship between the preset slope and the image enhancement processing parameters;
[0160] A second image enhancement process is performed on the central pixel according to the target image enhancement process parameter.
[0161] In one possible example, the one or more programs 321 are further used to:
[0162] Performing image segmentation on the image to be processed to obtain a target area image and a background area image;
[0163] Determine the first feature point distribution density corresponding to the target area image;
[0164] Determine the second feature point distribution density of the background area image;
[0165] When the ratio between the first feature point distribution density and the second feature point distribution density is within a preset ratio range, the step of determining the central pixel point in the image to be processed is performed.
[0166] The above mainly introduces the scheme of the embodiment of the present application from the perspective of the execution process on the method side. It is understandable that, in order to realize the above functions, the electronic device includes a hardware structure and / or software module corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiment provided herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present application.
[0167] The embodiment of the present application can divide the electronic device into functional units according to the above method example. For example, each functional unit can be divided according to each function, or two or more functions can be integrated into one processing unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional units. It should be noted that the division of units in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0168] Figure 4 4 is a functional unit block diagram of an image enhancement device 400 involved in an embodiment of the present application. The image enhancement device 400 is applied to an electronic device, and the device 400 includes: an acquisition unit 401, a first determination unit 402, a second determination unit 403 and an image enhancement unit 404, wherein:
[0169] The acquisition unit 401 is used to acquire the image to be processed;
[0170] The first determining unit 402 is used to determine a central pixel point in the image to be processed, where the central pixel point is at least one pixel point in the image to be processed;
[0171] The second determining unit 403 is used to determine the neighborhood pixel mean of the central pixel;
[0172] The image enhancement unit 404 is configured to perform a first image enhancement process on the central pixel when the pixel value of the central pixel is greater than the neighborhood pixel mean value;
[0173] The image enhancement unit 404 is further configured to perform a second image enhancement process on the central pixel when the pixel value of the central pixel is less than or equal to the neighborhood pixel mean value.
[0174] It can be seen that the image enhancement device described in the embodiment of the present application is applied to an electronic device, obtains an image to be processed, determines a central pixel in the image to be processed, where the central pixel is at least one pixel in the image to be processed, determines the mean of the neighborhood pixels of the central pixel, and performs a first image enhancement processing on the central pixel when the pixel value of the central pixel is greater than the mean of the neighborhood pixels; and performs a second image enhancement processing on the central pixel when the pixel value of the central pixel is less than or equal to the mean of the neighborhood pixels. Image enhancement processing can be implemented based on the central pixel, which helps to improve image quality.
[0175] In a possible example, in determining the central pixel point in the image to be processed, the first determining unit 402 is specifically configured to:
[0176] Dividing the image to be processed into P regions, where P is an integer greater than 1;
[0177] Determine an image quality evaluation value of each of the P regions to obtain P image quality evaluation values;
[0178] Selecting an image quality evaluation value less than a preset threshold from the P image quality evaluation values to obtain Q image quality evaluation values, and acquiring target areas corresponding to the Q image quality evaluation values to obtain Q target areas;
[0179] The central pixel point of each of the Q target areas is determined to obtain the central pixel point of the image to be processed.
[0180] In a possible example, in the aspect of performing the first image enhancement processing on the central pixel point, the image enhancement unit 404 is specifically configured to:
[0181] Determine a target difference between the pixel value of the central pixel and the mean value of the neighborhood pixels;
[0182] Determining a first image enhancement processing parameter corresponding to the target difference value according to a preset mapping relationship between the difference value and the image enhancement processing parameter;
[0183] Determine a target mean square error between the pixel value of the central pixel and the pixel values of its neighboring pixels;
[0184] According to a preset mapping relationship between the mean square error and the optimization coefficient, a target optimization coefficient corresponding to the target mean square error is determined;
[0185] Optimizing the first image enhancement processing parameter according to the target optimization coefficient to obtain a second image enhancement processing parameter;
[0186] Perform image enhancement processing on the central pixel according to the second image enhancement processing parameter.
[0187] In a possible example, in the aspect of performing the second image enhancement processing on the central pixel point, the image enhancement unit 404 is specifically configured to:
[0188] Determine the energy value of the central pixel to obtain a first energy value;
[0189] Determine energy values of neighboring pixels of the central pixel to obtain a plurality of second energy values;
[0190] determining an energy ratio between the first energy value and the plurality of second energy values to obtain a plurality of energy ratios;
[0191] Sorting the multiple energy ratios, and projecting the sorted multiple energy ratios to a coordinate system;
[0192] Fitting the multiple energy ratios based on the coordinate system to obtain a fitting straight line;
[0193] Determining a target slope of the fitted straight line;
[0194] Determining the target image enhancement processing parameters corresponding to the target slope according to the mapping relationship between the preset slope and the image enhancement processing parameters;
[0195] A second image enhancement process is performed on the central pixel according to the target image enhancement process parameter.
[0196] In a possible example, the device 400 is further specifically configured to:
[0197] Performing image segmentation on the image to be processed to obtain a target area image and a background area image;
[0198] Determine the first feature point distribution density corresponding to the target area image;
[0199] Determine the second feature point distribution density of the background area image;
[0200] When the ratio between the first feature point distribution density and the second feature point distribution density is within a preset ratio range, the step of determining the central pixel point in the image to be processed is performed.
[0201] An embodiment of the present application also provides a computer storage medium, wherein the computer storage medium stores a computer program for electronic data exchange, wherein the computer program enables a computer to execute part or all of the steps of any method described in the above method embodiments, and the above computer includes an electronic device.
[0202] The embodiment of the present application also provides a computer program product, the computer program product includes a non-transitory computer-readable storage medium storing a computer program, the computer program is operable to cause a computer to execute some or all of the steps of any method described in the method embodiment. The computer program product may be a software installation package, and the computer includes an electronic device.
[0203] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0204] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0205] In the several embodiments provided in the present application, it should be understood that the disclosed device can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of the above-mentioned units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple 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 or other forms.
[0206] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0207] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0208] If the above-mentioned 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 memory. Based on this understanding, the technical solution of the present application is essentially or the part that contributes 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 memory, including a number of instructions to enable a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the above-mentioned methods of each embodiment of the present application. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or CD-ROM and other media that can store program codes.
[0209] A person skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable memory, and the memory can include: a flash drive, a read-only memory (English: Read-Only Memory, abbreviated as: ROM), a random access memory (English: Random Access Memory, abbreviated as: RAM), a magnetic disk or an optical disk, etc.
[0210] The embodiments of the present application are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of the present application. At the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. An image enhancement method, characterized in that: The method comprises: Get the image to be processed; Determine a central pixel point in the image to be processed, where the central pixel point is at least one pixel point in the image to be processed; Determine the mean value of the neighborhood pixels of the central pixel; When the pixel value of the central pixel point is greater than the neighborhood pixel mean value, performing a first image enhancement process on the central pixel point; When the pixel value of the central pixel is less than or equal to the neighborhood pixel mean, performing a second image enhancement process on the central pixel; The performing of a first image enhancement process on the central pixel point includes: Determine a target difference between the pixel value of the central pixel and the mean value of the neighborhood pixels; Determining a first image enhancement processing parameter corresponding to the target difference value according to a preset mapping relationship between the difference value and the image enhancement processing parameter; Determine a target mean square error between the pixel value of the central pixel and the pixel values of its neighboring pixels; According to a preset mapping relationship between the mean square error and the optimization coefficient, a target optimization coefficient corresponding to the target mean square error is determined; Optimizing the first image enhancement processing parameter according to the target optimization coefficient to obtain a second image enhancement processing parameter; performing image enhancement processing on the central pixel point according to the second image enhancement processing parameter; The performing of the second image enhancement processing on the central pixel point includes: Determine the energy value of the central pixel to obtain a first energy value; Determine energy values of neighboring pixels of the central pixel to obtain a plurality of second energy values; determining an energy ratio between the first energy value and the plurality of second energy values to obtain a plurality of energy ratios; Sorting the multiple energy ratios, and projecting the sorted multiple energy ratios to a coordinate system; Fitting the multiple energy ratios based on the coordinate system to obtain a fitting straight line; Determining a target slope of the fitted straight line; Determining the target image enhancement processing parameters corresponding to the target slope according to the mapping relationship between the preset slope and the image enhancement processing parameters; A second image enhancement process is performed on the central pixel according to the target image enhancement process parameter.
2. The method according to claim 1, characterized in that The step of determining a central pixel point in the image to be processed includes: Dividing the image to be processed into P regions, where P is an integer greater than 1; Determine an image quality evaluation value of each of the P regions to obtain P image quality evaluation values; Selecting an image quality evaluation value less than a preset threshold from the P image quality evaluation values to obtain Q image quality evaluation values, and acquiring target areas corresponding to the Q image quality evaluation values to obtain Q target areas; The central pixel point of each of the Q target areas is determined to obtain the central pixel point of the image to be processed.
3. The method according to claim 1 or 2, characterized in that: The method further comprises: Performing image segmentation on the image to be processed to obtain a target area image and a background area image; Determine the first feature point distribution density corresponding to the target area image; Determine the second feature point distribution density of the background area image; When the ratio between the first feature point distribution density and the second feature point distribution density is within a preset ratio range, the step of determining the central pixel point in the image to be processed is performed.
4. An image enhancement device, characterized in that: The device comprises: an acquisition unit, a first determination unit, a second determination unit and an image enhancement unit, wherein the acquisition unit is used to acquire an image to be processed; The first determining unit is used to determine a central pixel point in the image to be processed, where the central pixel point is at least one pixel point in the image to be processed; The second determining unit is used to determine the mean value of the neighborhood pixels of the central pixel; The image enhancement unit is used to perform a first image enhancement process on the central pixel when the pixel value of the central pixel is greater than the neighborhood pixel mean value; The image enhancement unit is further configured to perform a second image enhancement process on the central pixel when the pixel value of the central pixel is less than or equal to the neighborhood pixel mean value; Wherein, in the aspect of performing the first image enhancement processing on the central pixel point, the image enhancement unit is specifically used for: Determine a target difference between the pixel value of the central pixel and the mean value of the neighborhood pixels; Determining a first image enhancement processing parameter corresponding to the target difference value according to a preset mapping relationship between the difference value and the image enhancement processing parameter; Determine a target mean square error between the pixel value of the central pixel and the pixel values of its neighboring pixels; According to a preset mapping relationship between the mean square error and the optimization coefficient, a target optimization coefficient corresponding to the target mean square error is determined; Optimizing the first image enhancement processing parameter according to the target optimization coefficient to obtain a second image enhancement processing parameter; performing image enhancement processing on the central pixel point according to the second image enhancement processing parameter; Wherein, in the aspect of performing the second image enhancement processing on the central pixel point, the image enhancement unit is specifically used for: Determine the energy value of the central pixel to obtain a first energy value; Determine energy values of neighboring pixels of the central pixel to obtain a plurality of second energy values; determining an energy ratio between the first energy value and the plurality of second energy values to obtain a plurality of energy ratios; Sorting the multiple energy ratios, and projecting the sorted multiple energy ratios to a coordinate system; Fitting the multiple energy ratios based on the coordinate system to obtain a fitting straight line; Determining a target slope of the fitted straight line; Determining the target image enhancement processing parameters corresponding to the target slope according to the mapping relationship between the preset slope and the image enhancement processing parameters; A second image enhancement process is performed on the central pixel according to the target image enhancement process parameter.
5. The device according to claim 4, characterized in that In terms of determining the central pixel point in the image to be processed, the first determining unit is specifically configured to: Dividing the image to be processed into P regions, where P is an integer greater than 1; Determine an image quality evaluation value of each of the P regions to obtain P image quality evaluation values; Selecting an image quality evaluation value less than a preset threshold from the P image quality evaluation values to obtain Q image quality evaluation values, and acquiring target areas corresponding to the Q image quality evaluation values to obtain Q target areas; The central pixel point of each of the Q target areas is determined to obtain the central pixel point of the image to be processed.
6. An electronic device, characterized in that: The method comprises a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the programs include instructions for executing the steps in the method according to any one of claims 1 to 3.
7. A computer-readable storage medium, characterized in that: A computer program for electronic data exchange is stored, wherein the computer program enables a computer to execute the method according to any one of claims 1 to 3.
Citation Information
Patent Citations
Image enhancement method and device
CN104123697A
Image noise removing method and device
CN111325694A