Contrast enhancement method, computer program product, storage medium and electronic device

By automatically generating and traversing parameter value combinations, and automatically selecting the optimal parameter value combination for contrast enhancement, this method solves the problem of time-consuming and laborious manual parameter tuning in existing technologies, and achieves automatic optimization of contrast enhancement effects and improved execution efficiency.

CN114549340BActive Publication Date: 2025-12-19YUANLI TUXIN (CHONGQING) TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210016097.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-07
Publication Date
2025-12-19
Estimated Expiration
2042-01-07

AI Technical Summary

Technical Problem

Existing contrast enhancement algorithms require users to manually adjust parameters, which is time-consuming, laborious, and ineffective, failing to achieve good visual results.

Method used

By acquiring an evaluation image of the image to be enhanced, multiple parameter value combinations are automatically generated and iterated, and the optimal parameter value combination is automatically selected. This is combined with non-machine learning algorithms to achieve contrast enhancement. The optimal parameter value combination is selected using an evaluation image smaller than the image to be enhanced, avoiding manual parameter tuning.

Benefits of technology

Automatic optimization of contrast enhancement effect is achieved, improving execution efficiency, avoiding the burden of manual parameter adjustment, and ensuring improved image quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114549340B_ABST
    Figure CN114549340B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of image processing, and provides a contrast enhancement method, a computer program product, a storage medium and an electronic device. The contrast enhancement method comprises the following steps: obtaining an image to be enhanced, and determining an evaluation image according to the image to be enhanced, wherein the size of the evaluation image is smaller than that of the image to be enhanced; determining a value set of each parameter in a contrast enhancement algorithm, and constructing a plurality of parameter value combinations; respectively processing the evaluation image by using the contrast enhancement algorithm based on each parameter value combination, obtaining a corresponding evaluation result image, and determining a parameter value combination corresponding to an evaluation result image with the optimal contrast enhancement effect as an optimal parameter value combination; and processing the image to be enhanced by using the contrast enhancement algorithm based on the optimal parameter value combination, and obtaining an enhanced result image. The method avoids the burden of manual parameter adjustment of a user, is beneficial to improving the contrast enhancement effect, and has a high execution speed.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of image processing, in particular to a contrast enhancement method, a computer program product, a storage medium and an electronic device. BACKGROUND

[0002] Image contrast refers to the measurement of different brightness levels between the brightest white and the darkest black in a light and dark area of an image, and the contrast reflects the size of the gray scale contrast in an image. Generally speaking, the greater the contrast, the brighter and more prominent the image tends to look, and the stronger the sense of permeability; the smaller the contrast, the less clear the image tends to look, and the more gray and foggy the image tends to look. Contrast enhancement refers to a class of image processing algorithms, which can appropriately increase the contrast of an image, thereby removing or weakening the phenomenon of image grayness, foggy and misty, and achieving good visual effects.

[0003] The existing contrast enhancement algorithm is mostly dependent on some algorithm parameters for the good or bad of the contrast enhancement effect, and the user often needs to select appropriate parameter values by manual adjustment, otherwise the contrast enhancement effect is poor and good visual effects cannot be achieved, but manual parameter adjustment is time-consuming and laborious. SUMMARY

[0004] The purpose of the embodiments of the present application is to provide a contrast enhancement method, a computer program product, a storage medium and an electronic device to improve the above technical problems.

[0005] To achieve the above purpose, the present application provides the following technical solutions:

[0006] In a first aspect, the embodiments of the present application provide a contrast enhancement method, comprising: obtaining a to-be-enhanced image, and determining an evaluation image for evaluating the contrast enhancement effect according to the to-be-enhanced image, wherein the size of the evaluation image is smaller than the size of the to-be-enhanced image; determining a value set of each parameter in a contrast enhancement algorithm, and selecting a value from each value set of the parameters to form a parameter value combination, thereby obtaining a plurality of parameter value combinations; processing the evaluation image based on each parameter value combination in the plurality of parameter value combinations by using the contrast enhancement algorithm to obtain a corresponding evaluation result image, and determining a parameter value combination corresponding to an evaluation result image with the optimal contrast enhancement effect as an optimal parameter value combination; and processing the to-be-enhanced image based on the optimal parameter value combination by using the contrast enhancement algorithm to obtain an enhanced result image.

[0007] The above method can automatically select the parameter value combination that can make the enhancement effect optimal for the contrast enhancement algorithm for different to-be-enhanced images (i.e., the selection of parameters has self-adaptability), thereby avoiding the burden of manual parameter adjustment by the user.

[0008] And the method automatically generates and traverses multiple parameter value combinations, selects the optimal parameter value combination from them, thereby avoiding the problem of missing parameter value combinations when manually adjusting parameters, and further improving the contrast enhancement effect.

[0009] In addition, the method selects the optimal parameter value combination using an evaluation image smaller in size than the image to be enhanced, so that the parameter selection process does not consume too many computing resources, thereby improving the execution efficiency of the entire method.

[0010] In an implementation form of the first aspect, the contrast enhancement algorithm is a non-machine learning algorithm.

[0011] There are mainly two types of existing contrast enhancement algorithms: one is a non-machine learning algorithm (also known as a traditional algorithm), and the other is a machine learning algorithm. The non-machine learning algorithm has a faster execution speed, but cannot adaptively select algorithm parameters; the machine learning algorithm can autonomously learn part of the algorithm parameters, but has a slower execution speed.

[0012] Since the method introduced in the first aspect introduces a mechanism for adaptively selecting algorithm parameters, if the method is combined with a non-machine learning algorithm, it can ensure the efficiency of contrast enhancement and avoid various problems caused by manual parameter adjustment.

[0013] In an implementation form of the first aspect, the evaluation image for evaluating the contrast enhancement effect is determined according to the image to be enhanced, comprising: determining an image obtained by downsampling the image to be enhanced as the evaluation image; or determining a partial image cut from the image to be enhanced as the evaluation image.

[0014] Downsampling or cutting the image to be enhanced can obtain an evaluation image with a smaller size. Downsampling is more conducive to retaining information of the image to be enhanced in the evaluation image, while cutting the evaluation image is more flexible.

[0015] In an implementation form of the first aspect, the partial image cut from the image to be enhanced is determined as the evaluation image, comprising: determining a partial image cut from the image to be enhanced according to a region of interest as the evaluation image.

[0016] The evaluation image in the implementation manner corresponds to a region of interest in the image to be enhanced, which means that in this implementation manner, the optimal parameter value combination is selected according to the contrast enhancement effect of the region of interest in the image to be enhanced. The region of interest is likely to be a region that a user focuses on in the image to be enhanced, for example, a face or a human body in a picture. Therefore, it is reasonable to select the parameter value combination according to the contrast enhancement effect in the region of interest, and it is beneficial to obtain an enhanced result image with a visual effect that satisfies the user.

[0017] In an implementation manner of the first aspect, the parameter value combination corresponding to the evaluation result image with the optimal contrast enhancement effect is determined as the optimal parameter value combination, including: calculating a target metric corresponding to each evaluation result image, to obtain a plurality of target metrics; wherein the target metric represents the contrast enhancement effect of the evaluation result image, and the greater the target metric is, the worse the contrast enhancement effect of the evaluation result image is, and the smaller the target metric is, the better the contrast enhancement effect of the evaluation result image is; and determining the parameter value combination corresponding to the minimum target metric in the plurality of target metrics as the optimal parameter value combination.

[0018] In the implementation manner, the contrast enhancement effect of the evaluation result image is represented by a quantitative index, that is, the target metric. By comparing the sizes of the target metrics, it can be quickly determined that the contrast enhancement effect of the evaluation result image is optimal under which parameter value combination, and then the selection of the optimal parameter value combination is completed.

[0019] In addition, the target metric is an objective index calculated according to the evaluation result image, rather than a subjective evaluation result obtained by the user through the naked eye. Therefore, the selection of the optimal parameter value combination according to the value of the target metric has the advantages of objectivity and accuracy.

[0020] In an implementation manner of the first aspect, calculating the target metric corresponding to the evaluation result image includes: calculating a contrast metric corresponding to the evaluation result image, and determining the target metric corresponding to the evaluation result image according to the contrast metric; wherein the contrast metric represents the contrast of the evaluation result image, and the contrast metric is negatively correlated with the target metric.

[0021] In the implementation manner, the contrast metric represents the contrast of the evaluation result image, and therefore directly reflects the contrast enhancement effect of the evaluation result image (the greater the contrast is, the better the contrast enhancement effect is), so that it can be used as a basic component of the target metric.

[0022] In an implementation form of the first aspect, the calculating the contrast metric corresponding to the evaluation result image comprises: determining a plurality of local windows on the evaluation result image, and calculating a fluctuation index of pixel values in each local window to obtain a plurality of fluctuation indexes; and determining a mean value of the plurality of fluctuation indexes as the contrast metric corresponding to the evaluation result image.

[0023] The implementation form above provides a possible calculation manner of the contrast metric, and the calculated contrast metric has locality, and thus can well reflect the contrast enhancement effect of the contrast enhancement algorithm on the evaluation image.

[0024] In an implementation form of the first aspect, the calculating the contrast metric corresponding to the evaluation result image and determining the target metric corresponding to the evaluation result image according to the contrast metric comprises: calculating the contrast metric corresponding to the evaluation result image and an information loss metric, and determining the target metric corresponding to the evaluation result image according to the contrast metric and the information loss metric; wherein the information loss metric represents information loss in the evaluation result image caused by executing the contrast enhancement algorithm, and the information loss metric is positively correlated with the target metric.

[0025] The greater the contrast metric is, the greater the contrast of the evaluation result image represented by the contrast metric is, but too large contrast may cause image quality to decrease, for example, details of many bright or dark parts in the image will disappear, that is, information loss is caused. Therefore, a good contrast enhancement algorithm does not blindly increase the contrast of the image.

[0026] In the implementation form above, the information loss metric represents information loss in the evaluation result image caused by executing the contrast enhancement algorithm, and since the information loss metric is positively correlated with the target metric and the contrast metric is negatively correlated with the target metric, for calculating the target metric, the information loss metric can be regarded as a restriction on the contrast metric, so that the method does not blindly select a parameter value combination that makes the contrast metric larger as the optimal parameter value combination, because the parameter value combination increases the contrast of the image while causing greater information loss to the image.

[0027] In other words, after the information loss metric is added to the target metric, the optimal parameter value combination selected can make the contrast enhancement degree of the evaluation image more reasonable, that is, the contrast of the evaluation result image is improved compared with the evaluation image, and the information loss is less, and the image quality does not decrease obviously.

[0028] In an implementation form of the first aspect, the information loss metric corresponding to the evaluation result image is calculated by: counting the total number of pixel values beyond the normal value range in the evaluation result image, and determining the total number as the information loss metric; or for each pixel value beyond the normal value range in the evaluation result image, calculating the deviation of the pixel value from the boundary value of the normal value range, and determining the sum of the obtained deviations as the information loss metric.

[0029] The above implementation form gives possible calculation methods of the information loss metric, which are divided into two schemes. The first scheme only considers the total number of abnormal pixel values (pixel values beyond the normal value range in the evaluation result image), and the second scheme considers both the total number of abnormal pixel values (because of the summation operation) and the abnormal severity of the abnormal pixel values (the deviation of the abnormal pixel value from the boundary value of the normal value range).

[0030] In the second aspect, the embodiments of the present application provide a contrast enhancement device, which comprises: an image acquisition module, configured to acquire a to-be-enhanced image, and determine an evaluation image for evaluating the contrast enhancement effect according to the to-be-enhanced image, wherein the size of the evaluation image is smaller than the size of the to-be-enhanced image; a parameter combination module, configured to determine a value set of each parameter in a contrast enhancement algorithm, and select one value from each value set to form a parameter value combination, thereby obtaining a plurality of parameter value combinations; a parameter selection module, configured to process the evaluation image based on each parameter value combination in the plurality of parameter value combinations by using the contrast enhancement algorithm, obtain a corresponding evaluation result image, and determine the parameter value combination corresponding to the evaluation result image with the optimal contrast enhancement effect as an optimal parameter value combination; and an enhancement processing module, configured to process the to-be-enhanced image based on the optimal parameter value combination by using the contrast enhancement algorithm, and obtain an enhanced result image.

[0031] In the third aspect, the embodiments of the present application provide a computer program product, which comprises computer program instructions. When the computer program instructions are read and run by a processor, the method provided in the first aspect or any possible implementation form of the first aspect is executed.

[0032] In the fourth aspect, the embodiments of the present application provide a computer readable storage medium, which stores computer program instructions. When the computer program instructions are read and run by a processor, the method provided in the first aspect or any possible implementation form of the first aspect is executed.

[0033] Fifthly, embodiments of this application provide an electronic device, including: a memory and a processor, wherein the memory stores computer program instructions, and the computer program instructions are read and executed by the processor to perform the method provided in the first aspect or any possible implementation of the first aspect. Attached Figure Description

[0034] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0035] Figure 1 The flowchart of a contrast enhancement method provided in an embodiment of this application is shown;

[0036] Figure 2 (A) and Figure 2 (B) shows the image to be enhanced and the execution respectively. Figure 1 The enhanced image obtained after the method;

[0037] Figure 3 This application illustrates the functional modules included in a contrast enhancement device according to an embodiment of the present application;

[0038] Figure 4 The structure of an electronic device provided in an embodiment of this application is shown. Detailed Implementation

[0039] In recent years, significant progress has been made in research on technologies based on artificial intelligence, such as computer vision, deep learning, machine learning, image processing, and image recognition. Artificial intelligence (AI) is an emerging science and technology that studies and develops theories, methods, technologies, and application systems to simulate and extend human intelligence. AI is a comprehensive discipline involving numerous technologies, including chips, big data, cloud computing, the Internet of Things, distributed storage, deep learning, machine learning, and neural networks. Computer vision, as an important branch of AI, specifically enables machines to recognize the world. Computer vision technologies typically include face recognition, liveness detection, fingerprint recognition and anti-counterfeiting verification, biometric recognition, face detection, pedestrian detection, object detection, pedestrian recognition, image processing, image recognition, image semantic understanding, image retrieval, text recognition, video processing, video content recognition, behavior recognition, 3D reconstruction, virtual reality, augmented reality, simultaneous localization and mapping (SLAM), computational photography, and robot navigation and localization. With the research and advancement of artificial intelligence technology, this technology has been applied in numerous fields, such as security, urban management, traffic management, building management, park management, facial recognition access control, facial recognition attendance, logistics management, warehouse management, robotics, intelligent marketing, computational photography, mobile imaging, cloud services, smart homes, wearable devices, autonomous driving, autonomous driving, smart healthcare, facial payment, facial unlocking, fingerprint unlocking, identity verification, smart screens, smart TVs, cameras, mobile internet, live streaming, beautification, makeup, medical aesthetics, and intelligent temperature measurement. The contrast enhancement method in this application embodiment also falls under the category of image processing.

[0040] The technical solutions of the embodiments of this application will now be described with reference to the accompanying drawings. It should be noted that similar reference numerals and letters in the following drawings indicate similar items; therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings.

[0041] The terms “comprising,” “including,” or any other variations thereof are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase “comprising one…” does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0042] Figure 1 The flowchart illustrates a contrast enhancement method provided in an embodiment of this application. This method can be, but is not limited to, [the method described above]. Figure 4The electronic device in the method is executed, and the possible structure of the electronic device can be referred to the description of the electronic device in the method Figure 4 The contrast enhancement method comprises the following steps. Figure 1 The contrast enhancement method comprises the following steps.

[0043] Step S110: An image to be enhanced is acquired, and an evaluation image is determined according to the image to be enhanced.

[0044] The image to be enhanced is an image to be subjected to contrast enhancement, and the acquisition manner of the image to be enhanced is not limited, for example, the image to be enhanced can be acquired in real time by a camera, or the image to be enhanced can be stored in a storage medium in the electronic device, and the like.

[0045] The evaluation image is an image obtained by performing certain processing on the image to be enhanced, and the size of the evaluation image is smaller than that of the image to be enhanced, and the specific processing manner is not limited, for example, the processing manner can be down-sampling, image cropping, and the like, which will be further introduced hereinafter. The evaluation image will be used to evaluate the contrast enhancement effect in step S130, which will be described hereinafter.

[0046] Step S120: A value set of each parameter in a contrast enhancement algorithm is determined, and one value is selected from each value set of the parameter to form a parameter value combination, and a plurality of parameter value combinations are obtained.

[0047] The contrast enhancement algorithm generally refers to an algorithm with a contrast enhancement function, but it should be noted that the contrast enhancement method provided by the embodiments of the present application is not regarded as a contrast enhancement algorithm. The contrast enhancement algorithm can be generally divided into two categories: one is a non-machine learning algorithm, and the other is a machine learning algorithm. The contrast enhancement algorithm in step S120 can be a non-machine learning algorithm or a machine learning algorithm.

[0048] The non-machine learning algorithm is also called a traditional algorithm, for example, the algorithm can be linear stretching, histogram equalization, exponential transformation, logarithmic transformation, and the like. Taking linear stretching as an example, the main steps of the algorithm can be summarized by the following formula:

[0049] f(pixel) = ((pixel / 255.0-0.5) x alpha + 0.5) x 255 (1)

[0050] wherein, pixel represents a pixel value of an arbitrary pixel in an input image (input of the contrast enhancement algorithm, the algorithm processes each pixel in the same way), f represents a function corresponding to the linear stretching algorithm, f(pixel) represents the result of linear stretching of pixel. pixel / 255.0 represents normalizing the pixel value pixel, i.e., mapping the value range of the pixel value from [0, 255] to [0, 1], and the last x 255 represents denormalizing the result of the previous operation. alpha represents an enhancement coefficient of the linear stretching algorithm, the value range of the coefficient can be [1, +∞), and alpha is also the parameter of the contrast enhancement algorithm in step S120. In the prior art, the value of alpha needs to be manually set by the user.

[0051] Regarding formula (1), two points are further explained:

[0052] Firstly, f(pixel) is not necessarily a pixel value in an output image (output of the contrast enhancement algorithm), because after linear stretching, f(pixel) can exceed the normal value range of the pixel value [0, 255], and one possible processing method is: if f(pixel) > 255, the corresponding pixel value in the output image is set to 255, if f(pixel) < 0, the corresponding pixel value in the output image is set to 0, and if 0 ≤ f(pixel) ≤ 255, the corresponding pixel value in the output image is set to f(pixel) (possibly after rounding operation).

[0053] Secondly, formula (1) is for the case that the input image is a single-channel image, and if the input image is a multi-channel image (for example, an RGB image), formula (1) can be applied on each channel respectively to achieve contrast enhancement.

[0054] The machine learning algorithm is an algorithm that uses a trained machine learning model to perform contrast enhancement. The machine learning model can be a neural network model, a decision tree model, a support vector machine model, etc. Compared with the non-machine learning algorithm, the machine learning algorithm mainly adds the step of training the model.

[0055] The machine learning model has two types of parameters, one is a normal parameter, and the other is a hyperparameter. The value of the normal parameter can be automatically determined in the process of model training (this process is also called “learning”), and the value of the hyperparameter needs to be manually set by the user. For example, for a convolutional neural network (a kind of neural network model, which is very suitable for processing images), the normal parameters can be weight, bias, etc., and the hyperparameters can be the number of convolution kernels, the step of convolution, the number of convolution layers, etc. For the machine learning algorithm, the parameter of the contrast enhancement algorithm in step S120 should be understood as a hyperparameter rather than a normal parameter.

[0056] Having introduced the contrast enhancement algorithm and the meaning of its parameters, the following continues to explain how to determine the value set of each parameter in the contrast enhancement algorithm:

[0057] First, consider the case where the contrast enhancement algorithm has only one parameter. For example, the parameter alpha in the linear stretching algorithm, whose value range is known to be [1, +∞), but the contrast enhancement effect will become poor when alpha takes a too large value, so [1, +∞) is only a theoretical value range. It is not difficult to consider a more reasonable value range, for example, [1, 2]. By setting a proper step size, such as step1 = 0.2, the value set of parameter alpha can be obtained as {1, 1.2, 1.4, 1.6, 1.8, 2}.

[0058] Next, consider the case where the contrast enhancement algorithm has two parameters, which are beta and gamma, respectively. The value range of beta is [0, 1], and the value range of gamma is [-1, 1]. By setting a proper step size, step2 = 0.2 and step3 = 0.5, for beta and gamma, respectively, the value set of parameter beta can be obtained as {0, 0.2, 0.4, 0.6, 0.8, 1}, and the value set of parameter gamma can be obtained as {-1, 0, 1}. If the contrast enhancement algorithm has more parameters, the analysis can be similar, and will not be elaborated here.

[0059] After obtaining the value set of each parameter, a parameter value combination can be formed by selecting a value from each parameter value set, respectively. In this way, multiple parameter value combinations can be obtained.

[0060] For example, given the value set of parameter alpha as {1, 1.2, 1.4, 1.6, 1.8, 2}, a value can be selected from it each time, and 6 parameter value combinations can be obtained: (1), (1.2), (1.4), (1.6), (1.8), (2).

[0061] For another example, given the value set of parameter beta as {0, 0.2, 0.4, 0.6, 0.8, 1} and the value set of parameter gamma as {-1, 0, 1}, a value can be selected from each of the two value sets each time, and 6 x 3 = 18 parameter value combinations can be obtained: (0, -1), (0.2, -1), (0.4, -1), (0.6, -1), (0.8, -1), (1, -1), (0, 0), …, (1, 1).

[0062] Of course, it is not necessary to generate all possible parameter value combinations in step S120 (although the above two examples do exhaust all possible parameter value combinations), for example, if it can be determined according to prior knowledge that the contrast enhancement effect is very poor when beta = 0 and gamma = 0, and thus (0, 0) cannot be selected as the optimal parameter value combination in step S130, this parameter value combination can be excluded in step S120.

[0063] As will be known from the content of step S130 (see later), an optimal parameter value combination will be selected from the multiple parameter value combinations obtained in step S120, and thus the multiple parameter value combinations obtained in step S120 can be regarded as candidates for the optimal parameter value combination.

[0064] For step S120, the following points need to be noted:

[0065] Firstly, the number of discrete values in the parameter value set is controlled by the step size when determining the parameter value set. The step size can be set according to requirements, and the smaller the step size, the more discrete values in the parameter value set, and theoretically more parameter value combinations can be generated, which increases the number of candidates for the optimal parameter value combination in step S130, and thus a parameter value combination that produces a better contrast enhancement effect can be selected, but the amount of computation will also increase, and thus the step size can be determined by considering the amount of computation and the contrast enhancement effect and other factors.

[0066] Secondly, the discrete values can also be selected randomly or by other means, and not necessarily by the step size.

[0067] Thirdly, the parameter value set can also contain only one value, but at least one parameter value set in the contrast enhancement algorithm should contain multiple values, otherwise the multiple parameter value combinations cannot be obtained in step S120. For example, if the parameter value set of beta is {0.4} in the contrast enhancement algorithm with two parameters beta and gamma, the parameter value set of gamma must contain multiple values, such as {-1, 0, 1}. This principle also means that if the contrast enhancement algorithm has only one parameter, the parameter value set of this parameter must contain multiple values.

[0068] It is possible that the set of values of a parameter contains only one value: for example, although the value of a certain parameter can be adjusted, according to experience, the effect is best when the parameter takes a certain specific value, and there is no need to deliberately select other values; for another example, a certain parameter taking a certain specific value determines that the output image of the contrast enhancement algorithm has a certain specific style (for example, bright), and if it is desired that the enhanced result image obtained in step S140 has this style, the parameter can only take this specific value, and so on.

[0069] Fourthly, the execution order of step S120 and the execution order of step S110 are not limited, and they can be executed in sequence (S110 first or S120 first), or they can be executed in parallel.

[0070] Step S130: Based on each parameter value combination in the plurality of parameter value combinations, the evaluation image is processed using the contrast enhancement algorithm to obtain a corresponding evaluation result image, and the parameter value combination corresponding to the evaluation result image with the best contrast enhancement effect is determined as the optimal parameter value combination.

[0071] Step S140: Based on the optimal parameter value combination, the to-be-enhanced image is processed using the contrast enhancement algorithm to obtain an enhanced result image.

[0072] Steps S130 and S140 are described together. For example, for a linear stretching algorithm, it is assumed that in step S120, 6 parameter value combinations are obtained: (1), (1.2), (1.4), (1.6), (1.8), and (2). In step S130, the evaluation image should be processed using the linear stretching algorithm under the condition that alpha = 1, 1.2, 1.4, 1.6, 1.8, and 2, respectively, and each processing obtains a corresponding evaluation result image, and a total of 6 evaluation result images are obtained. Then, the contrast enhancement effects of the 6 evaluation result images are compared (specific examples will be given later), and it is assumed that the third one has the best effect, so it can be determined that alpha = 1.4 is the optimal parameter value combination, and then the to-be-enhanced image is processed using the linear stretching algorithm under the condition that alpha = 1.4 to obtain the final enhanced result image.

[0073] The principles of steps S130 and S140 can be understood as follows: Since the evaluation image is calculated based on the to-be-enhanced image, it contains part of the information of the to-be-enhanced image, and therefore the evaluation image can represent the to-be-enhanced image to a certain extent. In other words, if the contrast enhancement algorithm has a good contrast enhancement effect on the evaluation image under a certain parameter value combination, it can be very reasonably inferred that the contrast enhancement algorithm also has a good contrast enhancement effect on the to-be-enhanced image under this parameter value combination. Therefore, the optimal parameter value combination obtained based on the evaluation image can be directly used to process the to-be-enhanced image.

[0074] For the evaluation image and the evaluation result image, since they are only intermediate data for selecting the optimal parameter value combination, after the enhanced result image is obtained in step S140, the evaluation image and the evaluation result image can be deleted to avoid occupying storage space.

[0075] In addition, it should be noted that, although the contrast enhancement algorithm is executed in steps S130 and S140, there can be some differences in the steps of the algorithm in addition to the difference in the objects of the algorithm (one is the evaluation image and the other is the image to be enhanced).

[0076] Taking the linear stretching algorithm as an example, in step S140, the complete linear stretching algorithm should be executed, that is, formula (1) and the subsequent mapping of f(pixel) are executed, but in S130, since the purpose of calculating the evaluation result image is only to evaluate the contrast enhancement effect, the complete linear stretching algorithm does not necessarily be executed, and it is not necessary to continue to execute the subsequent steps after the calculation result obtained when executing a certain step can play an evaluation role. For example, only the following formula can be executed:

[0077] f(pixel)=(pixel / 255.0-0.5)×alpha+0.5 (2)

[0078] Wherein, pixel represents the pixel value of any pixel in the evaluation image, f(pixel) represents the pixel value corresponding to it in the evaluation result image, formula (2) is compared with formula (1) without performing inverse normalization, and after executing formula (2), there is no step of mapping f(pixel).

[0079] In summary, Figure 1 The contrast enhancement method in the method can automatically select the parameter value combination that can make the enhancement effect optimal for the contrast enhancement algorithm for different images to be enhanced, that is, the method has the ability of self-adaptive selection of parameters, thereby avoiding the burden of manual parameter adjustment of the user.

[0080] In addition, the method automatically generates and traverses a plurality of parameter value combinations to select the optimal parameter value combination, thereby avoiding the problem of missing parameter value combinations when manually adjusting parameters, and further improving the contrast enhancement effect.

[0081] In addition, the method uses the evaluation image with a size smaller than the image to be enhanced to select the optimal parameter value combination, so that the parameter selection process does not consume too many computing resources, which is beneficial to improve the execution efficiency of the entire method.

[0082] Figure 2 (A) andFigure 2 (B) respectively shows the image to be enhanced and the enhanced result image obtained after performing the method of the present application (Note that blocks 1 and 2 are not the content of the image itself, which will be introduced later). It is not difficult to see that, Figure 1 the image of (A) is gray and unclear in picture level, Figure 2 the image of (B) is clear and transparent, and the boundaries between different objects are distinct, that is, it has a good contrast enhancement effect. Figure 2

[0083] Further, the inventors found after studying existing contrast enhancement algorithms that:

[0084] Non-machine learning algorithms have faster execution speed (for example, the formula of the linear stretching algorithm is very simple), and different algorithms have good effects in their respective application scenarios, but non-machine learning algorithms cannot adaptively select algorithm parameters and can only rely on user manual adjustment of parameter values, which is not only time-consuming and laborious, but also the parameter values that perform well on one image may not perform well on another image, and it is not realistic to let the user manually adjust the parameter values once for each image.

[0085] Machine learning algorithms can autonomously learn part of the algorithm parameters (for example, the general parameters mentioned above) and have a certain generalization ability, so they can achieve good processing effects for different images, but their execution speed is slower (for example, the structure of a neural network model can be very complex), so they are difficult to apply in some scenarios that require high real-time performance. In addition, training a machine learning model also consumes a lot of time and computing resources.

[0086] In an implementation manner, Figure 1 The contrast enhancement algorithm in the method can use a non-machine learning algorithm. According to the previous analysis, since the method introduces a mechanism for adaptively selecting algorithm parameters, combining it with a non-machine learning algorithm can ensure the execution efficiency of contrast enhancement, so that the method can be applied in some scenarios that require high real-time performance, while avoiding the low efficiency and other problems caused by manual adjustment of parameters.

[0087] Next, based on the above embodiments, how to determine the evaluation image based on the image to be enhanced in step S110 is introduced as follows:

[0088] In an implementation manner, determining the evaluation image includes at least two ways:

[0089] Way 1: The image obtained by downsampling the image to be enhanced is determined as the evaluation image.

[0090] ​The downsampling factor in Method 1 is unlimited, for example, it can be 2x, 4x, etc.; the downsampling algorithm is also unlimited, for example, it can be the nearest neighbor algorithm, the bilinear algorithm, the bicubic algorithm, etc. Intuitively, the evaluation image and the image to be enhanced obtained after downsampling are the same in terms of image content, only the image size is smaller. Therefore, using downsampling to obtain the evaluation image is more conducive to preserving the information of the image to be enhanced in the evaluation image. Thus, the contrast enhancement effect of the downsampling result image evaluated in step S130 can largely represent the contrast enhancement effect of the image to be enhanced. Consequently, the optimal parameter combination selected in step S130 is also likely to be optimal for the image to be enhanced.

[0091] Method 2: Select a portion of the image to be enhanced as the evaluation image.

[0092] Method 2 does not restrict the rules for cropping the image; for example, it can crop the center of the image, the upper left corner, etc. The size of the cropped portion is also unrestricted (of course, it must be smaller than the image to be enhanced). It can be an absolute size (e.g., 100×100 pixels) or a relative size (e.g., 1 / 4 of the total area of ​​the image to be enhanced), etc. Using cropping to obtain the evaluation image is more flexible, and the cropped portion also retains some information from the image to be enhanced.

[0093] Optionally, when cropping a portion of the image, it can also be done according to a pre-determined region of interest (ROI). The ROI might be the area in the image that the user is particularly interested in, such as the center of the image. Figure 2 (A) As shown in box 1), the face in the picture, the human body in the picture ( Figure 2 (A) As shown in box 2, etc., faces and bodies can be obtained through object detection algorithms. It is reasonable to select the optimal parameter combination based on the contrast enhancement effect within the region of interest: users are more concerned about how well the contrast enhancement algorithm performs within the region of interest, and it is acceptable for the contrast enhancement effect to be slightly worse in other areas.

[0094] Furthermore, it's possible that multiple images are extracted in method 2, resulting in multiple evaluation images. In this case, when evaluating the contrast enhancement effect of the contrast enhancement algorithm under a certain parameter value combination in step S130, the contrast enhancement algorithm can be applied to each evaluation image separately, resulting in multiple corresponding evaluation result images. Then, the overall contrast enhancement effect of these evaluation result images under that parameter value combination can be evaluated. For simplicity, the following text will not specifically elaborate on the case of multiple evaluation images, but this situation can be easily deduced from the case of only one evaluation image.

[0095] Based on the above embodiments, how to compare the contrast enhancement effects of the evaluation result images obtained under different parameter value combinations in step S130 is described as follows:

[0096] To realize the comparison of the contrast enhancement effects, the contrast enhancement effects need to be quantitatively represented first. In an implementation, a target metric can be used to quantitatively represent the contrast enhancement effect of an evaluation result image. The greater the target metric, the worse the contrast enhancement effect of the evaluation result image, and the smaller the target metric, the better the contrast enhancement effect of the evaluation result image (obviously, in an alternative, the greater the target metric, the better the contrast enhancement effect of the evaluation result image, and the smaller the target metric, the worse the contrast enhancement effect of the evaluation result image).

[0097] According to the foregoing content, an evaluation result image is obtained under each parameter value combination in step S130. After the target metric is defined, the target metric corresponding to each evaluation result image can be calculated according to the content of the evaluation result image, and thus multiple target metrics are calculated. Since the smaller the target metric, the better the contrast enhancement effect of the evaluation result image, the parameter value combination corresponding to the smallest target metric in the multiple target metrics can be determined as the optimal parameter value combination.

[0098] By defining the target metric, the abstract contrast enhancement effect is specified to a numerical size comparison, so that it can be quickly determined under which parameter value combination the contrast enhancement effect of the evaluation result image is optimal, and thus the selection of the optimal parameter value combination is completed.

[0099] In addition, the target metric is an objective index calculated according to the evaluation result image, rather than a subjective evaluation result obtained by the user through the naked eye, so the selection of the optimal parameter value combination according to the value of the target metric also has the advantages of objectivity and accuracy.

[0100] The possible calculation method of the target metric is described as follows:

[0101] In an implementation, the contrast metric corresponding to the evaluation result image can be calculated, and the target metric corresponding to the evaluation result image can be determined according to the contrast metric.

[0102] wherein the contrast metric represents the contrast of the evaluation result image, and the target metric is negatively correlated with the contrast metric. For example, the target metric is denoted as target_metric, the contrast metric is denoted as contrast_metric, and contrast_metric≥0, and the relationship between them can be target_metric=-contrast_metric, target_metric=1 / contrast_metric, etc.

[0103] In the above implementation, since the contrast metric represents the contrast of the evaluation result image, it directly reflects the contrast enhancement effect of the evaluation result image: within a certain range, the greater the contrast, the better the contrast enhancement effect, so that the contrast metric can be used as a basic component of the target metric.

[0104] Optionally, the contrast metric can be calculated in the following manner:

[0105] Step A: determine a plurality of local windows on the evaluation result image, and calculate the fluctuation index of the pixel values in each local window, to obtain a plurality of fluctuation indexes.

[0106] Step B: determine the mean value of the plurality of fluctuation indexes as the contrast metric corresponding to the evaluation result image.

[0107] For example, the plurality of local windows can be determined on the evaluation result image by using the sliding window method, and there can be an overlap between adjacent local windows (for example, each window has an overlap of 1 / 2 area with the adjacent window), or there can be no overlap. For another example, a plurality of rectangular frames can be randomly generated on the evaluation result image as the local windows, etc. The sizes of the local windows can be the same or different.

[0108] The fluctuation index represents the fluctuation condition of the pixel values in the window, and can be an index such as variance, standard deviation, etc. The greater the value of the fluctuation index, the greater the contrast of the part of the evaluation result image in the window, and the mean value of the plurality of fluctuation indexes represents the contrast of the entire evaluation result image. Note that the mean value in Step B can be an arithmetic mean or a weighted mean, for example, the local windows near the center of the image can be given a higher weight, because the user can be more concerned about the contrast enhancement effect of this part.

[0109] It should be understood that there are other ways to calculate the contrast metric, such as directly calculating the fluctuation index of the whole evaluation result image, but the contrast metric calculated according to steps A-B has a certain locality, and thus can better represent the contrast enhancement effect of the evaluation result image in each local area. In addition, there are other formulas for calculating image contrast, and it is not necessary to calculate it through fluctuation indicators such as variance and standard deviation.

[0110] Further, if the target metric is calculated only according to the contrast metric, since the target metric and the contrast metric are negatively correlated, according to the method logic, the parameter value combination that maximizes the contrast metric will be selected as the optimal parameter value combination. The greater the contrast metric is, the greater the contrast of the evaluation result image it represents will be, but too large contrast will cause the image quality to decrease, for example, many bright or dark details in the image will disappear as the contrast increases, that is, information loss occurs. Therefore, a good contrast enhancement algorithm will not blindly increase the contrast of the image.

[0111] To solve the above problems, a factor can be introduced in the target metric as a counterweight to the contrast metric to prevent it from blindly increasing. The specific method is:

[0112] For the evaluation result image, not only its corresponding contrast metric is calculated, but also its corresponding information loss metric is calculated, and then the target metric corresponding to the evaluation result image is determined according to the contrast metric and the information loss metric. Among them, the information loss metric represents the information loss in the evaluation result image caused by executing the contrast enhancement algorithm, and the information loss metric is positively correlated with the target metric.

[0113] For example, the information loss metric is denoted as information_loss_metric, information_loss_metric≥0, and the calculation formula of the target metric can be target_metric=lambda×information_loss_metric-contrast_metric, target_metric=lambda1×information_loss_metric-lambda2×contrast_metric, etc., where lambda, lambda1, lambda2 are all coefficients for weighted summation, and these coefficients are all greater than 0.

[0114] The role of the information loss metric is analyzed as follows: since the information loss metric is positively correlated with the target metric, and the contrast metric is negatively correlated with the target metric, after the information loss metric is added, the method will not blindly select those parameter value combinations that make the contrast metric larger as the optimal parameter value combination, because these parameter value combinations, while increasing the contrast of the image, are likely to cause greater information loss to the image, resulting in an increase in the value of the information loss metric, thereby causing the target metric to not decrease but increase (i.e., the so-called "check and balance" mentioned above).

[0115] In other words, after the information loss metric is added to the target metric, the optimal parameter value combination selected can make the contrast enhancement degree of the evaluation image more reasonable, on the one hand improving the contrast in the evaluation image, and on the other hand causing less information loss, and the image quality of the evaluation result image is not significantly reduced compared with the evaluation image.

[0116] There are various ways to calculate the information loss metric, two of which are listed below:

[0117] Method 1: Count the total number of pixel values that exceed the normal value range in the evaluation result image, and determine the total number as the information loss metric.

[0118] For example, the evaluation result image calculated by the formula (2) of the linear stretching algorithm should have pixel values in the normal range of [0, 1], and if the pixel value of a pixel is less than 0 or greater than 1, it is considered to have exceeded the normal value range. Assuming that there are 100 such pixels, the information loss metric is 100.

[0119] If the pixel value is less than 0 or greater than 1, after the inverse normalization (x 255) in formula (1), the pixel value will be less than 0 or greater than 255. According to the foregoing description, for the complete linear stretching algorithm (introduced in step S120), the pixel value less than 0 will be forced to be set to 0, and the pixel value greater than 255 will be forced to be set to 255, i.e., there is information loss, so the total number counted in method 1 and the definition of the information loss metric are consistent.

[0120] Method 2: For each pixel value that exceeds the normal value range in the evaluation result image, calculate the deviation of the pixel value from the boundary value of the normal value range, and determine the sum of the obtained deviations as the information loss metric.

[0121] For example, the evaluation result image calculated by formula (2) using the linear stretching algorithm, the pixel value of which should be in [0, 1] under normal circumstances, the boundary value is 0 and 1 at this time, if the pixel value of a certain pixel is less than 0, the deviation between the pixel value and 0 (the boundary value closest to the pixel value) can be calculated, if the pixel value of a certain pixel is greater than 1, the deviation between the pixel value and 1 (the boundary value closest to the pixel value) can be calculated. For example, when the deviation is a square deviation, the calculation formula can be expressed as follows:

[0122]

[0123] Where x represents the pixel value of any pixel in the evaluation result image (that is, f(pixel) calculated by formula (2)), and diff(x) represents the deviation of x. In the formula, x is in [0, 1] for unified description, but in fact, the deviation of x does not need to be calculated (equivalent to the deviation being 0) at this time. It should be understood that in addition to the square deviation, the deviation can also be calculated in other ways, such as absolute value, etc.

[0124] The information loss measure can be represented as the sum of all calculated deviations, that is:

[0125]

[0126] It should be understood that in the alternative, the summation in the formula can be changed to weighted summation, averaging, weighted averaging, etc. Similar to method 1, the sum of the deviations calculated in method 2 is consistent with the definition of information loss measure.

[0127] Now let's compare method 1 and method 2: method 1 only considers the total number of abnormal pixel values (i.e. pixel values in the evaluation result image that exceed the normal value range), and its steps are relatively simple and efficient. The implicit meaning of method 1 is that the selected parameter value combination should make the number of abnormal pixel values in the evaluation result image as small as possible.

[0128] Method 2 considers both the total number of abnormal pixel values (because there is a summation operation in method 2, which implicitly considers the total number) and the severity of the abnormal pixel values (the deviation of the abnormal pixel value from the boundary value of the normal value range). The steps of method 2 are slightly more complex, but the description of information loss is more complete. The implicit meaning of method 2 is that the selected parameter value combination should make the number of abnormal pixel values in the evaluation result image as small as possible, and the severity of the abnormal pixel values as light as possible.

[0129] It should also be noted that the information loss metric can not be calculated if it can be determined in advance that the contrast enhancement algorithm will not cause information loss (e.g., only fine-tuning the algorithm parameters in a small range).

[0130] Figure 3 A possible structure of the contrast enhancement device 200 provided by the embodiments of the present application is shown. Referring to Figure 3 The contrast enhancement device 200 includes:

[0131] The image acquisition module 210 is configured to acquire a to-be-enhanced image, and determine an evaluation image for evaluating a contrast enhancement effect according to the to-be-enhanced image, wherein the size of the evaluation image is smaller than the size of the to-be-enhanced image.

[0132] The parameter combination module 220 is configured to determine a value set of each parameter in the contrast enhancement algorithm, and select a value from each value set of the parameters to form a parameter value combination, thereby obtaining a plurality of parameter value combinations.

[0133] The parameter selection module 230 is configured to process the evaluation image by using the contrast enhancement algorithm based on each of the plurality of parameter value combinations, respectively, to obtain a corresponding evaluation result image, and determine a parameter value combination corresponding to an evaluation result image with the optimal contrast enhancement effect as an optimal parameter value combination.

[0134] The enhancement processing module 240 is configured to process the to-be-enhanced image by using the contrast enhancement algorithm based on the optimal parameter value combination to obtain an enhanced result image.

[0135] In an implementation form of the contrast enhancement device 200, the contrast enhancement algorithm is a non-machine learning algorithm.

[0136] In an implementation form of the contrast enhancement device 200, the image acquisition module 210 determines the evaluation image for evaluating the contrast enhancement effect according to the to-be-enhanced image, including: determining an image obtained by downsampling the to-be-enhanced image as the evaluation image; or determining a partial image cropped from the to-be-enhanced image as the evaluation image.

[0137] In an implementation form of the contrast enhancement device 200, the image acquisition module 210 determines the partial image cropped from the to-be-enhanced image as the evaluation image, including: determining a partial image cropped from the to-be-enhanced image according to a region of interest as the evaluation image.

[0138] In an implementation of the contrast enhancement device 200, the parameter selection module 230 determines the parameter value combination corresponding to the evaluation result image with the best contrast enhancement effect as the optimal parameter value combination, including: calculating a target metric corresponding to each evaluation result image, obtaining a plurality of target metrics; wherein the target metric represents the contrast enhancement effect of the evaluation result image, and the greater the target metric, the worse the contrast enhancement effect of the evaluation result image, and the smaller the target metric, the better the contrast enhancement effect of the evaluation result image; and determining the parameter value combination corresponding to the minimum target metric in the plurality of target metrics as the optimal parameter value combination.

[0139] In an implementation of the contrast enhancement device 200, the parameter selection module 230 calculates the target metric corresponding to the evaluation result image, including: calculating a contrast metric corresponding to the evaluation result image, and determining the target metric corresponding to the evaluation result image according to the contrast metric; wherein the contrast metric represents the contrast of the evaluation result image, and the contrast metric is negatively correlated with the target metric.

[0140] In an implementation of the contrast enhancement device 200, the parameter selection module 230 calculates the contrast metric corresponding to the evaluation result image, including: determining a plurality of local windows on the evaluation result image, and calculating a fluctuation index of pixel values in each local window, obtaining a plurality of fluctuation indexes; and determining the mean of the plurality of fluctuation indexes as the contrast metric corresponding to the evaluation result image.

[0141] In an implementation of the contrast enhancement device 200, the parameter selection module 230 calculates the contrast metric corresponding to the evaluation result image, and determines the target metric corresponding to the evaluation result image according to the contrast metric, including: calculating the contrast metric corresponding to the evaluation result image and an information loss metric, and determining the target metric corresponding to the evaluation result image according to the contrast metric and the information loss metric; wherein the information loss metric represents the information loss in the evaluation result image caused by executing the contrast enhancement algorithm, and the information loss metric is positively correlated with the target metric.

[0142] In an implementation of the contrast enhancement device 200, the parameter selection module 230 calculates the information loss metric corresponding to the evaluation result image, including: counting the total number of pixel values in the evaluation result image that exceed the normal value range, and determining the total number as the information loss metric; or for each pixel value in the evaluation result image that exceeds the normal value range, calculating the deviation amount of the pixel value from the boundary value of the normal value range, and determining the sum of the obtained deviation amounts as the information loss metric.

[0143] The contrast enhancement device 200 provided by the embodiments of the present application has the implementation principle and the technical effects described in the foregoing method embodiments. For brief description, the part not mentioned in the device embodiments can be referred to the corresponding content in the method embodiments.

[0144] Figure 4 A possible structure of the electronic device 300 provided by the embodiments of the present application is shown. Referring to Figure 4 The electronic device 300 includes a processor 310, a memory 320 and a communication interface 330, which are interconnected and communicate with each other through a communication bus 340 and / or other forms of connection mechanism (not shown).

[0145] The processor 310 includes one or more (only one is shown in the figure), which can be an integrated circuit chip with signal processing capability. The processor 310 described above can be a general-purpose processor, including a central processing unit (CPU), a micro controller unit (MCU), a network processor (NP) or other conventional processors; it can also be a special-purpose processor, including a graphics processing unit (GPU), a neural network processing unit (NPU), 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. And when the processor 310 is multiple, part of them can be general-purpose processors, and the other part can be special-purpose processors.

[0146] The memory 320 includes one or more (only one is shown in the figure), which can be, but are not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), etc.

[0147] The processor 310 and other possible components can access the memory 320 to read and / or write data therefrom. In particular, one or more computer program instructions can be stored in the memory 320, and the processor 310 can read and execute the computer program instructions to implement the contrast enhancement method provided by the embodiments of the present application.

[0148] The communication interface 330 includes one or more (only one is shown in the figure), which can be used to communicate with other devices directly or indirectly to interact data. The communication interface 330 can include an interface for wired and / or wireless communication.

[0149] It can be understood that, Figure 4 The structure shown is only schematic, and the electronic device 300 can also include more or less components than those shown in the figure, or have a different configuration from that shown in the figure. For example, the electronic device 300 can also include an image acquisition module (e.g., a camera) for taking images or videos, and the images or frames in the videos taken can all be used as the image to be enhanced in step S110. Figure 4 Figure 4 The components shown in the figure can be implemented in hardware, software or a combination thereof. The electronic device 300 can be a physical device, such as a mobile phone, a video camera, a camera, a PC, a notebook computer, a tablet computer, a server, a robot, etc., or a virtual device, such as a virtual machine, a container, etc. Moreover, the electronic device 300 is not limited to a single device, but can also be a combination of multiple devices or a cluster of a large number of devices.

[0150] Figure 4

[0151] ​​This application also provides a computer-readable storage medium storing computer program instructions. These computer program instructions are read and executed by a processor to perform the contrast enhancement method provided in this application. For example, the computer-readable storage medium can be implemented as follows: Figure 4 The memory 320 in the electronic device 300.

[0152] This application also provides a computer program product, which includes computer program instructions. These computer program instructions are read and executed by a processor to perform the contrast enhancement method provided in this application.

[0153] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.

Claims

1. A contrast enhancement method, characterized by, The method comprises: obtaining a to-be-enhanced image, and determining an evaluation image for evaluating a contrast enhancement effect according to the to-be-enhanced image, wherein the size of the evaluation image is smaller than the size of the to-be-enhanced image; determining a value set of each parameter in a contrast enhancement algorithm, and selecting one value from each value set to form a parameter value combination, thereby obtaining a plurality of parameter value combinations; processing the evaluation image based on each of the plurality of parameter value combinations by using the contrast enhancement algorithm, obtaining a corresponding evaluation result image, and determining a parameter value combination corresponding to an evaluation result image with the optimal contrast enhancement effect as an optimal parameter value combination; processing the to-be-enhanced image based on the optimal parameter value combination by using the contrast enhancement algorithm, and obtaining an enhanced result image. The method further comprises: calculating a target metric corresponding to each evaluation result image, thereby obtaining a plurality of target metrics; wherein the target metric represents the contrast enhancement effect of the evaluation result image, and the greater the target metric, the worse the contrast enhancement effect of the evaluation result image, and the smaller the target metric, the better the contrast enhancement effect of the evaluation result image; and determining a parameter value combination corresponding to the minimum target metric in the plurality of target metrics as the optimal parameter value combination. Or, calculating a target metric corresponding to each evaluation result image, thereby obtaining a plurality of target metrics; wherein the target metric represents the contrast enhancement effect of the evaluation result image, and the smaller the target metric, the worse the contrast enhancement effect of the evaluation result image, and the greater the target metric, the better the contrast enhancement effect of the evaluation result image; and determining a parameter value combination corresponding to the maximum target metric in the plurality of target metrics as the optimal parameter value combination.

2. The contrast enhancement method of claim 1, wherein, The method further comprises: determining an image obtained by down-sampling the to-be-enhanced image as the evaluation image; or determining a partial image cut out from the to-be-enhanced image according to a region of interest as the evaluation image.

3. The contrast enhancement method of claim 1, wherein, If the greater the target metric, the worse the contrast enhancement effect of the evaluation result image, and the smaller the target metric, the better the contrast enhancement effect of the evaluation result image, the method further comprises: calculating a contrast metric corresponding to the evaluation result image, and determining a target metric corresponding to the evaluation result image according to the contrast metric; wherein the contrast metric represents the contrast of the evaluation result image, and the contrast metric is negatively correlated with the target metric.

4. The contrast enhancement method of claim 3, wherein, The method further comprises: determining a plurality of local windows on the evaluation result image, and calculating a fluctuation index of pixel values in each local window, thereby obtaining a plurality of fluctuation indices. The mean value of the plurality of fluctuation indexes is determined as a contrast metric corresponding to the evaluation result image.

5. The contrast enhancement method of claim 3, wherein, The calculating the contrast metric corresponding to the evaluation result image and determining a target metric corresponding to the evaluation result image according to the contrast metric comprises: The calculating the contrast metric corresponding to the evaluation result image and determining a target metric corresponding to the evaluation result image according to the contrast metric comprises:

6. The contrast enhancement method of claim 5, wherein, The calculating the contrast metric corresponding to the evaluation result image and determining a target metric corresponding to the evaluation result image according to the contrast metric comprises: The calculating the information loss metric corresponding to the evaluation result image comprises: The total number of pixel values exceeding the normal value range in the evaluation result image is counted, and the total number is determined as the information loss metric; or, 7. A computer program product, characterised in that, For each pixel value exceeding the normal value range in the evaluation result image, a deviation amount of the pixel value from a boundary value of the normal value range is calculated, and a sum of the obtained deviation amounts is determined as the information loss metric.

8. A computer-readable storage medium, characterized in that, The computer program instructions are read and run by a processor to perform the method in any one of claims 1-6.

9. An electronic device, comprising: The computer program instructions are read and run by a processor to perform the method in any one of claims 1-6. The computer program instructions are read and run by a processor to perform the method in any one of claims 1-6. The computer program instructions are read and run by a processor to perform the method in any one of claims 1-6. The computer program instructions are read and run by a processor to perform the method in any one of claims 1-6.

Citation Information

Patent Citations

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

    CN112019762A

  • Method and device for enhancing image contrast, electronic equipment, storage medium and computer program product

    CN113870142A