Image enhancement methods, apparatus, devices and storage media
By acquiring the initial image and target pixels, normalizing them to obtain the target histogram, and calculating the target brightness and shadow coefficient, the problem of poor image enhancement effect in low visibility environment is solved, and the stability and adaptability of image enhancement effect are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-03
- Publication Date
- 2026-03-13
AI Technical Summary
Existing image enhancement methods perform poorly in low-visibility environments, have low quality and poor adaptability, and their performance is unstable after changing the scene.
By acquiring the initial image and target pixels, the target histogram is obtained through normalization. The target gray levels and inter-class variance are calculated, and the target brightness coefficient and shadow coefficient are determined to perform image enhancement.
It improves image enhancement effects and quality, enhances image stability, and adapts to image enhancement in various scenarios.
Smart Images

Figure CN116957983B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of image processing technology, and in particular to image enhancement methods, apparatus, devices and storage media. Background Technology
[0002] With the rapid development of computer vision processing technology, improving the accuracy of target object recognition and promoting the integration of vision processing technology with practical applications have become core research areas. To enhance the accuracy of target object recognition, in addition to improving hardware performance, research from a visual perception perspective has also become a key approach. Image processing technology is closely related to computer vision processing technology; improving image clarity can enhance the accuracy of target object recognition.
[0003] In existing technologies, commonly used image sharpness enhancement methods are divided into two categories: spatial domain and frequency domain. Spatial domain methods include grayscale transformation, algebraic operations, histogram equalization, and spatial domain filtering, while frequency domain methods include low-pass filters, high-pass filters, and homomorphic filters. Spatial domain methods are mainly used to improve the contrast of high-brightness images, eliminate image noise, and extract regions of interest in images, while frequency domain methods are mainly used to remove image edges and noise, filter out smooth areas of low-frequency images, and effectively enhance objects of interest.
[0004] However, existing image sharpness enhancement methods have poor image enhancement effects and low image enhancement quality in low visibility environments, and the adaptability of image enhancement methods is low, with extremely unstable image enhancement effects after changing scenes. Summary of the Invention
[0005] The present invention provides an image enhancement method, apparatus, device, and storage medium, which solves the problems of poor image enhancement effect, low image enhancement quality, low adaptability, and extremely unstable image enhancement effect after scene change in existing image enhancement methods in low visibility environments.
[0006] According to one aspect of the present invention, an image enhancement method is provided, comprising:
[0007] Acquire an initial image and target pixels, and normalize the initial image based on the target pixels to obtain a target histogram;
[0008] Obtain the target gray level, and determine the inter-class variance of the gray level in the target histogram based on the target histogram and the target gray level;
[0009] The target brightness coefficient and target shadow coefficient of the target histogram are determined based on the inter-class variance of gray levels.
[0010] The target pixels are enhanced based on the gray-level inter-class variance of the target histogram, the target brightness coefficient, and the target shadow coefficient to obtain the target image.
[0011] According to another aspect of the present invention, an image enhancement apparatus is provided, the image enhancement apparatus comprising:
[0012] The first obtaining module is used to acquire an initial image and target pixels, and to normalize the initial image based on the target pixels to obtain a target histogram;
[0013] The first determining module is used to obtain the target gray level and determine the gray-level inter-class variance of the target histogram based on the target histogram and the target gray level.
[0014] The second determining module is used to determine the target brightness coefficient and target shadow coefficient of the target histogram based on the gray-level inter-class variance.
[0015] The second obtaining module is used to enhance the target pixels based on the gray-level inter-class variance of the target histogram, the target brightness coefficient, and the target shadow coefficient to obtain the target image.
[0016] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0017] At least one processor; and
[0018] A memory communicatively connected to the at least one processor; wherein,
[0019] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the image enhancement method according to any embodiment of the present invention.
[0020] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the image enhancement method according to any embodiment of the present invention.
[0021] This invention addresses the problems of poor image enhancement effects, low image enhancement quality, low adaptability, and highly unstable image enhancement effects in low-visibility environments by existing image enhancement methods. It can adapt to image enhancement in various scenarios, improve image enhancement effects and quality, and enhance the stability of image enhancement effects.
[0022] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0023] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0024] Figure 1 This is a flowchart of an image enhancement method according to Embodiment 1 of the present invention;
[0025] Figure 2 This is a schematic diagram of the structure of an image enhancement device according to Embodiment 2 of the present invention;
[0026] Figure 3 This is a schematic diagram of the structure of an electronic device according to Embodiment 3 of the present invention. Detailed Implementation
[0027] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0028] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0029] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.
[0030] Example 1
[0031] Figure 1 This is a flowchart of an image enhancement method according to Embodiment 1 of the present invention. This embodiment is applicable to situations where image data is enhanced. The method can be executed by the image enhancement device in this embodiment of the invention, which can be implemented in software and / or hardware, such as... Figure 1 As shown, the method specifically includes the following steps:
[0032] S110: Obtain the initial image and target pixels, and normalize the initial image based on the target pixels to obtain the target histogram.
[0033] The initial image can be any image from any scene; for example, it could be a low-contrast image from a foggy scene. The target pixels are pixels in the initial image that meet preset conditions. These preset conditions can be set according to actual needs. If the preset conditions are all pixels in the initial image, then the target pixels are all pixels in the initial image. If the preset conditions are pixels in the initial image whose grayscale value is greater than or equal to the minimum grayscale value and whose grayscale value is less than or equal to the maximum grayscale value, then the target pixels are all pixels in the initial image that meet these conditions. The target histogram is the histogram obtained after normalizing the initial image.
[0034] Specifically, the method for obtaining the initial image and target pixels, and then normalizing the initial image based on the target pixels to obtain the target histogram can be as follows: obtain the initial image and all pixels in the initial image, filter all pixels in the initial image according to preset conditions to obtain the target pixels, and then normalize the initial image based on the target pixels to obtain the target histogram.
[0035] S120: Obtain the target gray level, and determine the inter-class variance of the gray level in the target histogram based on the target histogram and the target gray level.
[0036] The target gray level is the image pixel gray level set according to actual needs. The gray-level inter-class variance of the target histogram can be calculated based on the target histogram and the target gray level. The gray-level inter-class variance of the target histogram serves as a criterion for segmented enhancement of the image data in brightness and shadow segments.
[0037] Specifically, the method for obtaining the target gray level and determining the inter-class variance of the target histogram based on the target histogram and the target gray level can be as follows: Define the target gray level, determine the adaptive parameters related to the target histogram based on the target histogram and the target gray level, wherein the adaptive parameters can be used to adjust the inter-class differences of pixels, and determine the inter-class variance of the target histogram based on the adaptive parameters related to the target histogram.
[0038] S130, determine the target brightness coefficient and target shadow coefficient of the target histogram based on the inter-class variance of grayscale.
[0039] Among them, the target brightness coefficient of the target histogram can reflect the highest brightness of the image under different scenes, and the target shadow coefficient can reflect the highest darkness of the image under different scenes. Determining different brightness and shadow coefficients for calculation based on images under different scenes has a better driving force for image grayscale enhancement.
[0040] Specifically, the method for determining the target brightness coefficient and target shadow coefficient of the target histogram based on the gray-level inter-class variance can be as follows: use the gray-level inter-class variance as a condition for segmented enhancement of image brightness, and determine the target brightness coefficient of different segments based on the gray-level inter-class variance; at the same time, determine the target shadow coefficient based on the maximum and minimum values of the inter-class variance of all target gray levels in the acquired image.
[0041] S140: Enhance the target pixels based on the gray-level inter-class variance of the target histogram, the target brightness coefficient, and the target shadow coefficient to obtain the target image.
[0042] The target image is the image obtained by enhancing the initial image, and the target image is clearer than the initial image.
[0043] Specifically, the target image is obtained by enhancing the target pixels based on the gray-level variance between target histograms, the target brightness coefficient, and the target shadow coefficient. The method is as follows: the brightness difference between image gray-level classes is determined by the target brightness coefficient and the target shadow coefficient; normalization is performed by combining the gray-level variance between target histograms and the brightness difference between image gray-level classes; the target pixels are then enhanced to obtain the enhanced initial image; and the enhanced initial image is determined as the target image.
[0044] Optionally, the process involves acquiring an initial image and target pixels, and normalizing the initial image based on the target pixels to obtain a target histogram, including:
[0045] Obtain the grayscale value of each pixel in the initial image;
[0046] Pixels whose gray values are greater than or equal to the minimum gray value of the initial image and whose gray values are less than or equal to the maximum gray value of the initial image are identified as target pixels;
[0047] Generate a target recombined pixel matrix based on the target pixels;
[0048] The target histogram is obtained by normalizing the initial image based on the target reconstructed pixel matrix.
[0049] In this context, a pixel, also known as a pixel point, is the smallest unit that makes up an image. The grayscale value of a pixel is its color depth. The minimum grayscale value of the initial image can be the minimum grayscale value corresponding to the red channel in the initial image, and the maximum grayscale value of the initial image can be the maximum grayscale value corresponding to the red channel in the initial image. The target reconstructed pixel matrix is the pixel matrix obtained by reconstructing the target pixels.
[0050] Specifically, the method for obtaining the grayscale value of each pixel in the initial image can be as follows: process the initial image to obtain the grayscale value of each pixel in the initial image. At the same time, obtain the maximum grayscale value of the red channel in the three channels of the initial image as the maximum grayscale value of the initial image, and obtain the minimum grayscale value of the red channel in the three channels of the initial image as the minimum grayscale value of the initial image.
[0051] Specifically, the method for determining the target pixels as those with gray values greater than or equal to the minimum gray value and gray values less than or equal to the maximum gray value of the initial image can be as follows: For each pixel, the gray value is compared with the minimum gray value and the maximum gray value of the initial image, and the pixels with gray values greater than or equal to the minimum gray value and simultaneously less than or equal to the maximum gray value of the initial image are determined as the target pixels.
[0052] Specifically, the method for generating a target recombined pixel matrix based on the target pixel can be: recombining the elements of the target pixel to generate the target recombined pixel matrix.
[0053] Specifically, the method for normalizing the initial image based on the target reconstructed pixel matrix to obtain the target histogram can be as follows: normalize the initial image based on the target reconstructed pixel matrix, that is, extract the histogram information in the target reconstructed pixel matrix to obtain the target histogram.
[0054] For example, the calculation method for obtaining the target histogram by normalizing the initial image based on the target reconstructed pixel matrix can be as follows:
[0055]
[0056] The initial image can be defined with gray levels ranging from 0 to 255. Here, `map` represents the gray levels of the initial image, `i` represents a pixel, `p(i)` represents the gray value corresponding to the pixel, `max(R)` represents the maximum gray value of the initial image, `min(R)` represents the minimum gray value of the initial image, `i++` indicates jumping to the next pixel, and `data` represents the target pixel to be stored. The target pixel is defined as a pixel whose gray value is greater than or equal to the minimum gray value of the initial image or whose gray value is less than or equal to the maximum gray value of the initial image. It should be noted that pixels with gray values greater than the maximum gray value of the initial image are defined as gray level 255, and pixels with gray values less than the minimum gray value of the initial image are defined as gray level 0. The stored target pixels can be reorganized into a matrix as follows:
[0057] Data = reshape(data, m, n);
[0058] Where Data represents the pixel matrix after the initial image grayscale is reconstructed based on the target pixels, i.e., the target reconstructed pixel matrix; reshape represents the element reconstructing function; data represents the stored target pixels; and (m,n) represents the pixel matrix of size m×n after reconstructing the elements. The target histogram is obtained by normalizing the initial image based on the target reconstructed pixel matrix, which can be:
[0059] DataR=imshist(Data) / (m×n);
[0060] Where DataR represents the histogram, i.e. the target histogram, Data represents the target reconstructed pixel matrix, and imshist represents the function for extracting histogram information.
[0061] By acquiring the grayscale value of each pixel in the initial image, pixels whose grayscale value is greater than or equal to the minimum grayscale value of the initial image and whose grayscale value is less than or equal to the maximum grayscale value of the initial image are identified as target pixels. A target reconstructed pixel matrix is generated based on the target pixels. The initial image is then normalized based on the target reconstructed pixel matrix to obtain a target histogram. This process can filter out pixels whose grayscale value is greater than or equal to the minimum grayscale value of the initial image and whose grayscale value is less than or equal to the maximum grayscale value of the initial image, and obtain the target histogram based on the target pixels, thereby reducing the computational load in image enhancement operations and improving the operation speed.
[0062] Optionally, determining the inter-class variance of the target histogram based on the target histogram and the target gray levels includes:
[0063] Determine the inter-class coefficients and inter-class difference parameter sets of the target gray level based on the target histogram and target gray level;
[0064] The inter-class variance of the target histogram is determined based on the inter-class coefficients and the inter-class difference parameter set of the target grayscale.
[0065] Among them, the target gray-level inter-class coefficient and the target gray-level inter-class difference parameter group are both adaptive parameters related to the target histogram. The target gray-level inter-class coefficient can be the gray-level coefficient of the gray level in the range of the minimum gray level to the maximum gray level in the target gray level. The target gray-level inter-class difference parameter group includes at least one gray-level inter-class difference parameter, which can be used to adjust the inter-class difference of pixels.
[0066] Specifically, the method for determining the target gray-level inter-class coefficients and target gray-level inter-class difference parameter group of the target histogram based on the target histogram and target gray-level can be as follows: calculate the target gray-level inter-class coefficients of the target histogram based on the target histogram and target gray-level, and simultaneously, adaptively determine the target difference parameters in the target gray-level inter-class difference parameter group based on the target histogram and target gray-level.
[0067] Specifically, the method for determining the gray-level inter-class variance of the target histogram based on the target gray-level inter-class coefficients and the target gray-level inter-class difference parameter set can be as follows: calculate the gray-level inter-class variance of the target histogram based on the target gray-level inter-class coefficients and at least one target difference parameter from the target gray-level inter-class difference parameter set. For example, the calculation method for determining the gray-level inter-class variance of the target histogram can be:
[0068] σ FF =α1×(μ1-μ T ) 2 +α2×(μ2-μ T ) 2 ;
[0069] Where, σ FFμ represents the inter-class variance of the grayscale values in the target histogram. T The target grayscale inter-class coefficients are represented by α1, α2, μ1, and μ2, which are all target difference parameters. The target grayscale inter-class difference parameter group can be constructed based on α1, α2, μ1, and μ2.
[0070] Optionally, based on the target histogram and target gray levels, determine the target gray-level inter-class coefficients and target gray-level inter-class difference parameter set, including:
[0071] Obtain the initial gray-level inter-class coefficients, and determine the target gray-level inter-class coefficients of the target histogram based on the initial gray-level inter-class coefficients, the target histogram, and the target gray level;
[0072] Obtain the first initial difference parameter, the second initial difference parameter, and the third initial difference parameter from the target grayscale class difference parameter group;
[0073] The first target difference parameter is determined based on the first initial difference parameter, the target histogram, and the first gray level parameter corresponding to the target gray level.
[0074] Determine the second target difference parameter based on the first target difference parameter;
[0075] If the second gray level parameter corresponding to the target gray level is less than the third gray level parameter, then the third target difference parameter is determined based on the second initial difference parameter, the second gray level parameter corresponding to the target gray level, and the target histogram.
[0076] If the second gray level parameter corresponding to the target gray level is greater than or equal to the third gray level parameter, then the fourth target difference parameter is determined based on the third initial difference parameter, the second gray level parameter corresponding to the target gray level, and the target histogram.
[0077] The fifth objective difference parameter is determined based on the first objective difference parameter and the third objective difference parameter;
[0078] The sixth objective difference parameter is determined based on the difference parameters of the second and fourth objectives.
[0079] The target grayscale class difference parameter group is determined based on the first target difference parameter, the second target difference parameter, the fifth target difference parameter, and the sixth target difference parameter.
[0080] The initial grayscale inter-class coefficients are preset values for the grayscale inter-class coefficients during the initial calculation.
[0081] Among them, the first initial difference parameter, the second initial difference parameter, and the third initial difference parameter are all initial values preset when calculating the difference parameter between each target gray level in the target gray level difference parameter group. The first target difference parameter, the second target difference parameter, the third target difference parameter, the fourth target difference parameter, the fifth target difference parameter, and the sixth target difference parameter are all values associated with each target gray level difference parameter in the calculation process. It should be noted that the calculation process is cyclical according to the target gray level, therefore, the first target difference parameter, the second target difference parameter, the third target difference parameter, the fourth target difference parameter, the fifth target difference parameter, and the sixth target difference parameter are not fixed values.
[0082] Among them, the first grayscale parameter, the second grayscale parameter, and the third grayscale parameter corresponding to the target grayscale level are all preset grayscale parameters according to actual needs.
[0083] Specifically, the method for obtaining the initial gray-level inter-class coefficients and determining the target gray-level inter-class coefficients of the target histogram based on the initial gray-level inter-class coefficients, the target histogram, and the target gray-level can be as follows: determine the initial gray-level inter-class coefficients, and calculate the target gray-level inter-class coefficients of the target histogram based on the initial gray-level inter-class coefficients, the target histogram, and each gray-level in the target gray-level.
[0084] Specifically, the method for obtaining the first initial difference parameter, the second initial difference parameter, and the third initial difference parameter in the target grayscale class difference parameter group can be: preset the first initial difference parameter, the second initial difference parameter, and the third initial difference parameter.
[0085] Specifically, the method for determining the first target difference parameter based on the first initial difference parameter, the target histogram, and the first gray level parameter corresponding to the target gray level can be as follows: the first target difference parameter is calculated iteratively based on the first initial difference parameter, the target histogram, and the first gray level parameter corresponding to the target gray level.
[0086] Specifically, the method for determining the second target difference parameter based on the first target difference parameter can be as follows: the second target difference parameter is obtained by the difference between the first target difference parameter obtained by iterative calculation and the preset value, wherein the preset value can be set according to actual needs.
[0087] Specifically, if the second gray-level parameter corresponding to the target gray level is less than the third gray-level parameter, the third target difference parameter can be determined based on the second initial difference parameter, the second gray-level parameter corresponding to the target gray level, and the target histogram. If the second gray-level parameter is less than the third gray-level parameter, the third target difference parameter can be calculated iteratively based on the second initial difference parameter, the target histogram, and the second gray-level parameter.
[0088] Specifically, if the second gray-level parameter corresponding to the target gray level is greater than or equal to the third gray-level parameter, the fourth target difference parameter can be determined based on the third initial difference parameter, the second gray-level parameter corresponding to the target gray level, and the target histogram. If the second gray-level parameter is greater than or equal to the third gray-level parameter, the fourth target difference parameter can be calculated iteratively based on the third initial difference parameter, the target histogram, and the second gray-level parameter.
[0089] Specifically, the method for determining the fifth target difference parameter based on the first target difference parameter and the third target difference parameter can be as follows: the fifth target difference parameter is determined based on the quotient of the first target difference parameter and the third target difference parameter.
[0090] Specifically, the method for determining the sixth target difference parameter based on the second target difference parameter and the fourth target difference parameter can be as follows: the sixth target difference parameter is determined based on the quotient of the second target difference parameter and the fourth target difference parameter.
[0091] Specifically, the target gray-level inter-class difference parameter group is determined based on the first target difference parameter, the second target difference parameter, the fifth target difference parameter, and the sixth target difference parameter. For example, the formulas for calculating the target gray-level inter-class coefficients and target difference parameters in the target gray-level inter-class difference parameter group of the target histogram can be:
[0092] μ T =μ T +colorlevel(j)×DataR(j);
[0093] Where, μ T This represents the target grayscale inter-class coefficient, with the initial grayscale inter-class coefficient set to 0. `colorlevel` represents the target grayscale level, where `colorlevel = 256`. `j` indicates the grayscale level ranges from 0 to 255. `DataR` represents the target histogram. The target grayscale inter-class coefficient is calculated based on the initial grayscale inter-class coefficient, the target histogram, and the target grayscale level. To achieve adaptive grayscale enhancement, the target difference parameters in the target grayscale inter-class difference parameter group need to be adaptively determined based on the target grayscale level to adjust the inter-class pixel differences. For the initial calculation, the calculation method for each target difference parameter is as follows:
[0094]
[0095] In the equation α1=α1+DataR(j1), α1 on the left side represents the first target difference parameter, and α1 on the right side represents the first initial difference parameter; α2 represents the second target difference parameter; in the equation μ1=μ1+(j2-1)×DataR(j2), μ1 on the left side represents the third target difference parameter, and μ1 on the right side represents the second initial difference parameter; in the equation μ2=μ2+(j2-1)×DataR(j2), μ2 on the left side represents the fourth target difference parameter, and μ2 on the right side represents the third initial difference parameter; in the equation μ1=μ1 / α1, μ1 on the left side represents the fifth target difference parameter, and μ1 on the right side represents the third target difference parameter. α1 is the first target difference parameter; μ2 = μ2 / α2, where μ2 on the left side of the equation is the sixth target difference parameter, and μ2 on the right side can represent the fourth target difference parameter. α2 is the second target difference parameter. Based on the first, second, fifth, and sixth target difference parameters, the target gray-level inter-class difference parameter set is determined. j1 is the first gray-level parameter corresponding to the target gray-level, j2 is the second gray-level parameter corresponding to the target gray-level, and Th is the third gray-level parameter. Here, j1 = 1 ~ (Th-1) (Th = colorlevel-1), j2 = 1 ~ colorlevel, and iterative calculations can be performed. It should be noted that the initial difference parameters corresponding to α1, μ1, and μ2 are all 0. When calculating the target difference parameters, multiple sets of target gray-level inter-class difference parameter sets can be obtained.
[0096] By acquiring initial gray-level inter-class coefficients and determining the target gray-level inter-class coefficients of the target histogram based on the initial gray-level inter-class coefficients, the target histogram, and the target gray-level, and by determining the target gray-level inter-class difference parameter set based on the first, second, fifth, and sixth target difference parameters, and by determining the gray-level inter-class variance of the target histogram based on the target gray-level inter-class coefficients and the target gray-level inter-class difference parameter set, the inter-class information of image gray-level can be fully analyzed. This solves the problem of insignificant image enhancement effect and lack of prominent target features caused by simply normalizing values after traditional pixel segmentation. It can construct the target gray-level inter-class coefficients and the target gray-level inter-class difference parameter set to determine the final enhancement effect of each pixel, improve the integrity of image pixel gray-level enhancement, and enhance visualization.
[0097] Optionally, determining the target brightness coefficient and target shadow coefficient of the target histogram based on the gray-level inter-class variance includes:
[0098] If the inter-class variance of grayscale is greater than or equal to the first threshold and the inter-class variance of grayscale is less than the second threshold, then the target brightness coefficient is determined based on the inter-class variance of grayscale and the first correction parameter, wherein the first threshold is less than the second threshold;
[0099] If the inter-class variance of grayscale is greater than or equal to the second threshold, the target brightness coefficient is determined based on the inter-class variance of grayscale and the second correction parameter.
[0100] If the inter-class variance of grayscale is less than the first threshold, the target brightness coefficient is determined based on the inter-class variance of grayscale and the third correction parameter, wherein the second correction parameter is greater than the third correction parameter, and the third correction parameter is greater than the first correction parameter.
[0101] Obtain the maximum and minimum inter-class variance of gray levels corresponding to the target gray level;
[0102] The target shadow coefficient of the target histogram is determined based on the maximum and minimum inter-class variance of gray levels.
[0103] The first threshold, second threshold, first correction parameter, second correction parameter, and third correction parameter can all be preset according to actual needs. When preset, it must be specified that the first threshold is less than the second threshold, the second correction parameter is greater than the third correction parameter, and the third correction parameter is greater than the first correction parameter. The first threshold, second threshold, first correction parameter, second correction parameter, and third correction parameter are mainly used for segmented gray-level enhancement based on the inter-class variance of gray levels.
[0104] Among them, the maximum inter-class variance of grayscale is the maximum value among all inter-class variances of grayscale, and the minimum inter-class variance of grayscale is the minimum value among all inter-class variances of grayscale.
[0105] Specifically, if the grayscale inter-class variance is greater than or equal to the first threshold and less than the second threshold, the target brightness coefficient can be determined based on the grayscale inter-class variance and the first correction parameter as follows: if the grayscale inter-class variance is greater than or equal to the first threshold and less than the second threshold, the target brightness coefficient is determined based on the product of the grayscale inter-class variance and the first correction parameter.
[0106] Specifically, if the inter-class variance of grayscale is greater than or equal to the second threshold, the target brightness coefficient can be determined by multiplying the inter-class variance of grayscale and the second correction parameter.
[0107] Specifically, if the inter-class variance of grayscale is less than the first threshold, the target brightness coefficient can be determined by multiplying the inter-class variance of grayscale and the third correction parameter.
[0108] Specifically, the method to obtain the maximum and minimum inter-class variance of gray levels corresponding to the target gray level can be as follows: obtain the inter-class variance of all gray levels corresponding to the target gray level, and filter out the maximum and minimum values among all inter-class variances of gray levels.
[0109] Specifically, the target shading coefficient of the target histogram can be determined by the ratio of the maximum and minimum inter-class variances of gray levels.
[0110] For example, the formula for determining the target brightness coefficient could be:
[0111]
[0112] Where 100 is the preset first threshold, 150 is the preset second threshold, 1.5 is the first correction parameter, 4.5 is the second correction parameter, 4 is the third correction parameter, and σ FF This represents the variance between grayscale classes, and Highlight represents the target brightness coefficient.
[0113] For example, the formula for determining the target shadow coefficient could be:
[0114]
[0115] Where, all(σ) FF ) represents the variance between all grayscale classes, ceil represents the rounding function, and Shadow represents the target shadow coefficient.
[0116] If the gray-level inter-class variance is greater than or equal to a first threshold and less than a second threshold, the target brightness coefficient is determined based on the gray-level inter-class variance and a first correction parameter, where the first threshold is less than the second threshold. If the gray-level inter-class variance is greater than or equal to the second threshold, the target brightness coefficient is determined based on the gray-level inter-class variance and a second correction parameter. If the gray-level inter-class variance is less than the first threshold, the target brightness coefficient is determined based on the gray-level inter-class variance and a third correction parameter, where the second correction parameter is greater than the third correction parameter, and the third correction parameter is greater than the first correction parameter. The maximum and minimum gray-level inter-class variances corresponding to the target gray level are obtained. The target shadow coefficient of the target histogram is determined based on the maximum and minimum gray-level inter-class variances. This allows for the determination of different target brightness coefficients based on correction parameters under different scenarios, improving the applicability of the image enhancement method. Furthermore, it can reflect the shadow characteristics between different gray levels in the image by reflecting the differences in brightness and darkness, and uses the target brightness coefficient and target shadow coefficient to enhance the image, thereby improving the image enhancement effect.
[0117] Optionally, the target pixels are enhanced based on the gray-level inter-class variance of the target histogram, the target brightness coefficient, and the target shadow coefficient to obtain a target image, including:
[0118] Determine the target fine-tuning coefficient based on the target brightness coefficient;
[0119] The target pixels are enhanced based on the target fine-tuning coefficient, the gray-level inter-class variance of the target histogram, the target brightness coefficient, and the target shadow coefficient to obtain the target image.
[0120] The target fine-tuning coefficient can be set according to different target brightness coefficients to fine-tune the image enhancement effect.
[0121] Specifically, the method for determining the target fine-tuning coefficient based on the target brightness coefficient can be as follows: set the target fine-tuning coefficient in segments based on the target brightness coefficient.
[0122] Specifically, the target image can be obtained by enhancing the target pixels based on the target fine-tuning coefficient, the gray-level inter-class variance of the target histogram, the target brightness coefficient, and the target shadow coefficient. When enhancing the target pixels, the target fine-tuning coefficient, the gray-level inter-class variance of the target histogram, the target brightness coefficient, and the target shadow coefficient need to be combined and normalized to obtain the target image.
[0123] For example, the formula for calculating the target fine-tuning coefficient based on the target brightness coefficient could be:
[0124]
[0125] Here, MiT represents the target fine-tuning coefficient. It should be noted that in foggy scenes, the difference in gray levels between individual pixels is small, so the target fine-tuning coefficient MiT should be set much less than 1. In nighttime scenes, when detecting objects, the gray level of the pixel corresponding to the object differs significantly from the overall image background. Therefore, it is necessary to increase the target fine-tuning coefficient to enhance the color gradation recovery effect and thus improve the image enhancement effect. In this case, the target fine-tuning coefficient can be defined as 1.
[0126] Optionally, the target pixels are enhanced based on the target fine-tuning coefficients, the gray-level inter-class variance of the target histogram, the target brightness coefficient, and the target shadow coefficient to obtain the target image, including:
[0127] If the gray value of the target pixel is greater than or equal to the minimum gray value of the image corresponding to the target pixel and less than or equal to the maximum gray value of the image corresponding to the target pixel, then the brightness difference of the target pixel is obtained according to the target brightness coefficient and the inter-class variance of gray values, and the average gray value difference of the target pixel is obtained according to the gray value of the target pixel and the inter-class variance of gray values.
[0128] If the gray value of the target pixel is less than the minimum gray value of the image corresponding to the target pixel or greater than the maximum gray value of the image corresponding to the target pixel, then the brightness difference of the target pixel is obtained according to the target brightness coefficient and the target shadow coefficient, and the average gray value difference of the target pixel is obtained according to the gray value of the target pixel and the target shadow coefficient.
[0129] The target pixel is enhanced based on the brightness difference of the target pixel, the average gray level difference of the target pixel, and the target fine-tuning coefficient to obtain the enhanced pixel;
[0130] Generate the target image based on the enhanced pixels.
[0131] The image corresponding to the target pixel can be represented by the vector of the target pixel stored when the target pixel was acquired.
[0132] The brightness difference of the target pixels can be obtained through different calculation methods depending on the actual situation.
[0133] Specifically, if the gray value of the target pixel is greater than or equal to the minimum gray value of the image corresponding to the target pixel and less than or equal to the maximum gray value of the image corresponding to the target pixel, the brightness difference of the target pixel is obtained based on the target brightness coefficient and the inter-class variance of gray values. The average gray value difference of the target pixel is obtained based on the gray value of the target pixel and the inter-class variance of gray values. The method is as follows: If the gray value of the target pixel is greater than or equal to the minimum gray value of the image corresponding to the target pixel and less than or equal to the maximum gray value of the image corresponding to the target pixel, the brightness difference of the target pixel is calculated based on the target brightness coefficient, the inter-class variance of gray values, and the set gray level. The average gray value difference of the target pixel is calculated based on the gray value of the target pixel, the inter-class variance of gray values, and the set gray level.
[0134] Specifically, if the gray value of the target pixel is less than the minimum gray value of the image corresponding to the target pixel or greater than the maximum gray value of the image corresponding to the target pixel, the brightness difference of the target pixel can be obtained based on the target brightness coefficient and the target shadow coefficient. The average gray value difference of the target pixel can be obtained based on the gray value of the target pixel and the target shadow coefficient.
[0135] Specifically, the enhanced pixel can be obtained by enhancing the target pixel based on the brightness difference of the target pixel, the average gray level difference of the target pixel, and the target fine-tuning coefficient.
[0136] Specifically, the method for generating a target image based on the enhanced pixels can be as follows: enhance the initial image based on each enhanced pixel to obtain the target image.
[0137] For example, the formula for calculating the enhanced pixels could be:
[0138]
[0139] Where p(v,w) represents the gray value corresponding to any target pixel, and (v,w) represents the coordinate position of this target pixel. It should be noted that p(v,w) can also be the gray value corresponding to a pixel in the target reconstructed pixel matrix. min[data(:)] represents the minimum gray value of the image corresponding to the target pixel, and max[data(:)] represents the maximum gray value of the image corresponding to the target pixel. Here, data(:) represents the vector corresponding to the target pixel. Highlight represents the target brightness coefficient, Shadow represents the target shadow coefficient, and σ... FF D(v,w) represents the inter-class variance of gray levels, and D(v,w) represents the brightness difference corresponding to the target pixel. r (v,w) represents the average gray level difference corresponding to the target pixel, and Result(v,w) represents the enhancement result after enhancing the pixel. The target image is obtained after enhancing each target pixel.
[0140] By enhancing target pixels based on target fine-tuning coefficients, gray-level inter-class variance of target histogram, target brightness coefficient, and target shadow coefficient, a target image is obtained. This method can perform gray-level auto-adjustment of images in low-visibility environments, enhance image clarity and the discernibility of target objects in the image, and improve the recognition accuracy of target objects in low-visibility environments.
[0141] The technical solution of this embodiment obtains an initial image and target pixels, and normalizes the initial image based on the target pixels to obtain a target histogram; obtains target gray levels, and determines the gray-level inter-class variance of the target histogram based on the target histogram and the target gray levels; determines the target brightness coefficient and target shadow coefficient of the target histogram based on the gray-level inter-class variance; and enhances the target pixels based on the gray-level inter-class variance of the target histogram, the target brightness coefficient, and the target shadow coefficient to obtain a target image. This solution solves the problems of poor image enhancement effect, low image enhancement quality, low adaptability, and extremely unstable image enhancement effect after scene change in existing image enhancement methods. It can adapt to image enhancement in various scenarios, improve the image enhancement effect and quality, and enhance the stability of the image enhancement effect.
[0142] Example 2
[0143] Figure 2This is a schematic diagram of an image enhancement device according to Embodiment 2 of the present invention. This embodiment is applicable to situations involving image data enhancement processing. The device can be implemented using software and / or hardware, and can be integrated into any device that provides image enhancement functionality, such as… Figure 2 As shown, the image enhancement device specifically includes: a first obtaining module 210, a first determining module 220, a second determining module 230, and a second obtaining module 240.
[0144] The first obtaining module 210 is used to obtain an initial image and target pixels, and to normalize the initial image based on the target pixels to obtain a target histogram.
[0145] The first determining module 220 is used to obtain the target gray level and determine the gray-level inter-class variance of the target histogram based on the target histogram and the target gray level.
[0146] The second determining module 230 is used to determine the target brightness coefficient and target shadow coefficient of the target histogram based on the gray-level inter-class variance.
[0147] The second obtaining module 240 is used to enhance the target pixels based on the gray-level inter-class variance of the target histogram, the target brightness coefficient, and the target shadow coefficient to obtain the target image.
[0148] Optionally, the first module is specifically used for:
[0149] Obtain the grayscale value of each pixel in the initial image;
[0150] Pixels whose gray values are greater than or equal to the minimum gray value of the initial image and whose gray values are less than or equal to the maximum gray value of the initial image are identified as target pixels;
[0151] Generate a target recombined pixel matrix based on the target pixels;
[0152] The target histogram is obtained by normalizing the initial image based on the target reconstructed pixel matrix.
[0153] Optionally, the first determining module is specifically used for:
[0154] Determine the inter-class coefficients and inter-class difference parameter sets of the target gray level based on the target histogram and target gray level;
[0155] The inter-class variance of the target histogram is determined based on the inter-class coefficients and the inter-class difference parameter set of the target grayscale.
[0156] Optionally, the first determining module is specifically used for:
[0157] Obtain the initial gray-level inter-class coefficients, and determine the target gray-level inter-class coefficients of the target histogram based on the initial gray-level inter-class coefficients, the target histogram, and the target gray level;
[0158] Obtain the first initial difference parameter, the second initial difference parameter, and the third initial difference parameter from the target grayscale class difference parameter group;
[0159] The first target difference parameter is determined based on the first initial difference parameter, the target histogram, and the first gray level parameter corresponding to the target gray level.
[0160] Determine the second target difference parameter based on the first target difference parameter;
[0161] If the second gray level parameter corresponding to the target gray level is less than the third gray level parameter, then the third target difference parameter is determined based on the second initial difference parameter, the second gray level parameter corresponding to the target gray level, and the target histogram.
[0162] If the second gray level parameter corresponding to the target gray level is greater than or equal to the third gray level parameter, then the fourth target difference parameter is determined based on the third initial difference parameter, the second gray level parameter corresponding to the target gray level, and the target histogram.
[0163] The fifth objective difference parameter is determined based on the first objective difference parameter and the third objective difference parameter;
[0164] The sixth objective difference parameter is determined based on the difference parameters of the second and fourth objectives.
[0165] The target grayscale class difference parameter group is determined based on the first target difference parameter, the second target difference parameter, the fifth target difference parameter, and the sixth target difference parameter.
[0166] Optionally, the second determining module is specifically used for:
[0167] If the inter-class variance of grayscale is greater than or equal to the first threshold and the inter-class variance of grayscale is less than the second threshold, then the target brightness coefficient is determined based on the inter-class variance of grayscale and the first correction parameter, wherein the first threshold is less than the second threshold;
[0168] If the inter-class variance of grayscale is greater than or equal to the second threshold, the target brightness coefficient is determined based on the inter-class variance of grayscale and the second correction parameter.
[0169] If the inter-class variance of grayscale is less than the first threshold, the target brightness coefficient is determined based on the inter-class variance of grayscale and the third correction parameter, wherein the second correction parameter is greater than the third correction parameter, and the third correction parameter is greater than the first correction parameter.
[0170] Obtain the maximum and minimum inter-class variance of gray levels corresponding to the target gray level;
[0171] The target shadow coefficient of the target histogram is determined based on the maximum and minimum inter-class variance of gray levels.
[0172] Optionally, the second module is specifically used for:
[0173] Determine the target fine-tuning coefficient based on the target brightness coefficient;
[0174] The target pixels are enhanced based on the target fine-tuning coefficient, the gray-level inter-class variance of the target histogram, the target brightness coefficient, and the target shadow coefficient to obtain the target image.
[0175] Optionally, the second module is specifically used for:
[0176] If the gray value of the target pixel is greater than or equal to the minimum gray value of the image corresponding to the target pixel and less than or equal to the maximum gray value of the image corresponding to the target pixel, then the brightness difference of the target pixel is obtained according to the target brightness coefficient and the inter-class variance of gray values, and the average gray value difference of the target pixel is obtained according to the gray value of the target pixel and the inter-class variance of gray values.
[0177] If the gray value of the target pixel is less than the minimum gray value of the image corresponding to the target pixel or greater than the maximum gray value of the image corresponding to the target pixel, then the brightness difference of the target pixel is obtained according to the target brightness coefficient and the target shadow coefficient, and the average gray value difference of the target pixel is obtained according to the gray value of the target pixel and the target shadow coefficient.
[0178] The target pixel is enhanced based on the brightness difference of the target pixel, the average gray level difference of the target pixel, and the target fine-tuning coefficient to obtain the enhanced pixel;
[0179] Generate the target image based on the enhanced pixels.
[0180] The above-described products can perform the methods provided in any embodiment of the present invention, and have the corresponding functional modules and beneficial effects for performing the methods.
[0181] Example 3
[0182] Figure 3 This is a schematic diagram of an electronic device according to Embodiment 3 of the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0183] like Figure 3 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0184] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0185] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as image enhancement methods.
[0186] In some embodiments, the image enhancement method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the image enhancement method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the image enhancement method by any other suitable means (e.g., by means of firmware).
[0187] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0188] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0189] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0190] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0191] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0192] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0193] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0194] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. An image enhancement method characterized by, The method comprises the following steps: obtaining an initial image and a target pixel, and normalizing the initial image according to the target pixel to obtain a target histogram; obtaining a target gray level, and determining an inter-class variance of the target histogram according to the target histogram and the target gray level; determining a target brightness coefficient and a target shadow coefficient of the target histogram according to the inter-class variance; enhancing the target pixel according to the inter-class variance, the target brightness coefficient and the target shadow coefficient of the target histogram to obtain a target image; the step of enhancing the target pixel according to the inter-class variance, the target brightness coefficient and the target shadow coefficient of the target histogram to obtain a target image comprises the following steps: determining a target fine-tuning coefficient according to the target brightness coefficient; if the gray value of the target pixel is greater than or equal to the minimum gray value of the image corresponding to the target pixel and less than or equal to the maximum gray value of the image corresponding to the target pixel, then obtaining a brightness difference of the target pixel according to the target brightness coefficient and the inter-class variance, and obtaining an average gray difference of the target pixel according to the gray value of the target pixel and the inter-class variance; if the gray value of the target pixel is less than the minimum gray value of the image corresponding to the target pixel or greater than the maximum gray value of the image corresponding to the target pixel, then obtaining a brightness difference of the target pixel according to the target brightness coefficient and the target shadow coefficient, and obtaining an average gray difference of the target pixel according to the gray value of the target pixel and the target shadow coefficient; enhancing the target pixel according to the brightness difference of the target pixel, the average gray difference of the target pixel and the target fine-tuning coefficient to obtain an enhanced pixel; generating the target image according to the enhanced pixel.
2. The image enhancement method of claim 1, wherein, The method comprises the following steps: obtaining the gray value of each pixel in the initial image; determining the target pixel as the pixel whose gray value is greater than or equal to the minimum gray value of the initial image and less than or equal to the maximum gray value of the initial image; generating a target reorganized pixel matrix according to the target pixel; normalizing the initial image according to the target reorganized pixel matrix to obtain the target histogram.
3. The image enhancement method of claim 1, wherein, The method comprises the following steps: determining a target inter-class coefficient and a target inter-class difference parameter group of the target histogram according to the target histogram and the target gray level; determining the inter-class variance of the target histogram according to the target inter-class coefficient and the target inter-class difference parameter group.
4. The image enhancement method of claim 3, wherein, The method comprises the following steps: obtaining an initial inter-class coefficient, and determining the target inter-class coefficient of the target histogram according to the initial inter-class coefficient, the target histogram and the target gray level; obtaining a first initial difference parameter, a second initial difference parameter and a third initial difference parameter in the target inter-class difference parameter group; determining a first target difference parameter according to the first initial difference parameter, a first gray parameter corresponding to the target histogram and the target gray level; determining the second target difference parameter according to the first target difference parameter; determining a third target difference parameter according to the second target difference parameter. if the second gray parameter corresponding to the target gray level is less than the third gray parameter, determining a third target difference parameter according to the second initial difference parameter, the second gray parameter corresponding to the target gray level and the target histogram; if the second gray parameter corresponding to the target gray level is greater than or equal to the third gray parameter, determining a fourth target difference parameter according to the third initial difference parameter, the second gray parameter corresponding to the target gray level and the target histogram; determining a fifth target difference parameter according to the first target difference parameter and the third target difference parameter; determining a sixth target difference parameter according to the second target difference parameter and the fourth target difference parameter; determining a target gray class difference parameter group according to the first target difference parameter, the second target difference parameter, the fifth target difference parameter and the sixth target difference parameter.
5. The image enhancement method of claim 1, wherein, determining a target brightness coefficient and a target shadow coefficient of the target histogram according to the gray class difference, comprising: if the gray class difference is greater than or equal to a first threshold and the gray class difference is less than a second threshold, determining the target brightness coefficient according to the gray class difference and a first correction parameter, wherein the first threshold is less than the second threshold; if the gray class difference is greater than or equal to the second threshold, determining the target brightness coefficient according to the gray class difference and a second correction parameter; if the gray class difference is less than the first threshold, determining the target brightness coefficient according to the gray class difference and a third correction parameter, wherein the second correction parameter is greater than the third correction parameter, and the third correction parameter is greater than the first correction parameter; obtaining a maximum gray class difference and a minimum gray class difference corresponding to the target gray level; determining the target shadow coefficient of the target histogram according to the maximum gray class difference and the minimum gray class difference.
6. An image enhancement device, characterized by comprising: a first obtaining module, configured to obtain an initial image and a target pixel, and normalize the initial image according to the target pixel to obtain a target histogram; a first determining module, configured to obtain a target gray level, and determine a gray class difference of the target histogram according to the target histogram and the target gray level; a second determining module, configured to determine a target brightness coefficient and a target shadow coefficient of the target histogram according to the gray class difference; a second obtaining module, configured to enhance the target pixel according to the gray class difference of the target histogram, the target brightness coefficient and the target shadow coefficient to obtain a target image; the second obtaining module is specifically configured to: determine a target fine tuning coefficient according to the target brightness coefficient; if the gray value of the target pixel is greater than or equal to the minimum gray value of the image corresponding to the target pixel and less than or equal to the maximum gray value of the image corresponding to the target pixel, obtain a brightness difference of the target pixel according to the target brightness coefficient and the gray class difference, and obtain an average gray difference of the target pixel according to the gray value of the target pixel and the gray class difference; if the gray value of the target pixel is less than the minimum gray value of the image corresponding to the target pixel or greater than the maximum gray value of the image corresponding to the target pixel, obtain a brightness difference of the target pixel according to the target brightness coefficient and the target shadow coefficient, and obtain an average gray difference of the target pixel according to the gray value of the target pixel and the target shadow coefficient; The target pixel is enhanced according to the brightness difference of the target pixel, the average gray difference of the target pixel and the target fine tuning coefficient, to obtain an enhanced pixel; A target image is generated according to the enhanced pixel.
7. An electronic device, comprising: The electronic device comprises: at least one processor; and a memory connected to the at least one processor in communication; wherein the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the image enhancement method of any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer instructions for enabling the processor to implement the image enhancement method of any one of claims 1-5 when executed.
Citation Information
Patent Citations
Image enhancement method based on space domain
CN105139366A
Image segmentation method and device, electronic equipment and computer storage medium
CN114240989A