Image processing method and device, computer readable storage medium and electronic equipment
Through global brightness processing and contrast enhancement processing, the problem of poor quality of low-light image processing is solved, image details are maintained, and processing quality is improved.
Patent Information
- Application Number
- CN202411544845.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-02-25
AI Technical Summary
When processing low-light images, the prior art can easily lead to too dark images and it is difficult to see objects in the dark. The conventional brightness improvement process will lose image details, resulting in unsatisfactory processing.
By obtaining the initial brightness value of the pixel points in the initial image, global brightness processing is performed to determine the intermediate brightness value, the target brightness value is determined based on the intermediate brightness value, and the contrast enhancement process is performed to generate the target image.
Maintain image details after global processing, improve image processing quality, and solve the problem of poor low-light image processing quality.
Smart Images

Figure CN119515749A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing, and more specifically, to an image processing method, device, computer-readable storage medium, and electronic device. Background Art
[0002] At present, with the widespread use of mobile phones, cameras, and other tools for taking photos or videos, the requirements for image quality are gradually increasing. Especially at night or in poor lighting conditions, the images obtained are often too dark, making it difficult to see objects in the dark, affecting the user experience. In related technologies, brightness enhancement processing is performed, which will lead to loss of image details after global image processing, and there is a problem that the image processing effect of dark light images is not ideal.
[0003] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0004] The embodiments of the present application provide an image processing method, an apparatus, a computer-readable storage medium, and an electronic device to at least solve the technical problem of unsatisfactory image processing quality in the related art.
[0005] According to one aspect of an embodiment of the present application, an image processing method is provided, including: obtaining initial brightness values of pixels in an initial image; performing global brightness processing on the pixels to determine intermediate brightness values of the pixels; based on the intermediate brightness values, determining a target brightness value for performing contrast enhancement processing on the pixels; and determining a target image based on the target brightness value.
[0006] Optionally, based on the intermediate brightness value, a target brightness value for contrast enhancement processing of the pixel point is determined, including: based on the intermediate brightness value, determining a brightness adjustment strategy corresponding to the pixel point; according to the brightness adjustment strategy, adjusting the intermediate brightness value to determine the target brightness value for contrast enhancement processing of the pixel point.
[0007] Optionally, based on the intermediate brightness value, a brightness adjustment strategy corresponding to the pixel point is determined, including: sorting the intermediate brightness values of the pixel points included in the initial image in ascending order, selecting a first brightness threshold and a second brightness threshold in the middle of the sorting, wherein the first brightness threshold is less than the second brightness threshold; when the intermediate brightness value is less than or equal to the first brightness threshold, determining the brightness adjustment strategy to reduce the intermediate brightness value to a first predetermined brightness value; when the intermediate brightness value is greater than the second brightness threshold, determining the brightness adjustment strategy to increase the intermediate brightness value to a second predetermined brightness value.
[0008] Optionally, the method includes: when the intermediate brightness value is greater than the first brightness threshold and the intermediate brightness value is less than or equal to the second brightness threshold, determining the brightness adjustment strategy as follows: determining a first difference between the intermediate brightness value and the first brightness threshold, and a second difference between the first brightness threshold and the second brightness threshold; determining an adjustment ratio based on the ratio of the first difference to the second difference; determining a brightness adjustment value according to the adjustment ratio; and adjusting the intermediate brightness value to the brightness adjustment value.
[0009] Optionally, based on the target brightness value, determining the target image includes: determining a brightness gain value according to the target brightness value and the initial pixel value of the pixel in the initial image; performing brightness culling processing on the pixel based on the initial pixel value to obtain a saturation retention value; performing weighted summation of the brightness gain value and the saturation retention value to determine the target pixel value of the pixel; and generating the target image according to the target pixel value.
[0010] Optionally, before performing global brightness processing on the pixel points and determining the intermediate brightness value of the pixel points, the method also includes: determining a first brightness feature distribution based on initial brightness values corresponding to multiple pixel points included in the initial image; and allowing global brightness processing of the pixel points when the first brightness feature distribution satisfies a first image processing condition.
[0011] Optionally, before determining the target brightness value for contrast enhancement processing of the pixel point based on the intermediate brightness value, the method also includes: determining a second brightness characteristic distribution based on the intermediate brightness values corresponding to multiple pixel points included in the initial image; and allowing the target brightness value to be generated when the second brightness characteristic distribution satisfies the second image processing condition.
[0012] Optionally, global brightness processing is performed on the pixel points to determine the intermediate brightness value of the pixel points, including: determining the logarithmic mean brightness value based on the initial brightness values corresponding to the multiple pixel points included in the initial image, wherein the logarithmic mean brightness value is used to characterize the global brightness level of the initial image; and adjusting the initial brightness values corresponding to the multiple pixel points according to the logarithmic mean brightness value to obtain the intermediate brightness values corresponding to the multiple pixel points, so that the brightness adjustment amplitude corresponding to the pixel points whose corresponding initial brightness value is less than the logarithmic mean brightness value is greater than the brightness adjustment amplitude corresponding to the pixel points whose corresponding initial brightness value is greater than the logarithmic mean brightness value.
[0013] Optionally, based on the logarithmic mean brightness value, the initial brightness values corresponding to the multiple pixel points are adjusted to obtain intermediate brightness values corresponding to the multiple pixel points, including: determining first ratio values corresponding to the multiple pixel points according to the initial brightness values corresponding to the multiple pixel points and the logarithmic mean brightness value, wherein the first ratio value is used to represent the brightness deviation of the initial brightness value of the corresponding pixel point relative to the global brightness level; determining a second ratio value according to the maximum brightness in the initial image and the logarithmic mean brightness value, wherein the second ratio value is used to represent the maximum brightness deviation in the initial image; determining intermediate brightness values corresponding to the multiple pixel points based on the first ratio values corresponding to the multiple pixel points and the second ratio value.
[0014] According to another aspect of an embodiment of the present application, an image processing device is provided, including: an information acquisition module, used to acquire initial brightness values of pixels in an initial image; a global processing module, used to perform global brightness processing on the pixels and determine intermediate brightness values of the pixels; an enhancement module, used to determine, based on the intermediate brightness values, a target brightness value for performing contrast enhancement processing on the pixels; and an image output module, used to determine a target image based on the target brightness value.
[0015] According to another aspect of an embodiment of the present application, a computer-readable storage medium is provided, the computer-readable storage medium including a stored executable program, wherein when the executable program is executed, the device where the computer-readable storage medium is located is controlled to execute any one of the image processing methods.
[0016] According to another aspect of an embodiment of the present application, an electronic device includes: a memory storing an executable program; and a processor for running the program, wherein the program executes any one of the image processing methods when running.
[0017] According to another aspect of an embodiment of the present application, a computer program product includes a computer program, and when the computer program is executed by a processor, the steps of any one of the image processing methods are implemented.
[0018] In the embodiment of the present application, the contrast enhancement method is adopted, by obtaining the initial brightness value of the pixel points in the initial image; performing global brightness processing on the pixel points to determine the intermediate brightness value of the pixel points; based on the intermediate brightness value, determining the target brightness value for contrast enhancement processing on the pixel points; and determining the target image based on the target brightness value. The purpose of maintaining the image details after global processing is achieved, and the technical effect of improving the image processing quality is achieved, thereby solving the technical problem of unsatisfactory image processing quality in the related art. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0020] Figure 1 is a flowchart of an optional image processing method provided according to an embodiment of the present application;
[0021] Figure 2 is a first schematic histogram of an optional image processing method provided according to an embodiment of the present application;
[0022] Figure 3 is a logarithmic function diagram of an optional image processing method provided according to an embodiment of the present application;
[0023] Figure 4 is a second schematic histogram of an optional image processing method provided according to an embodiment of the present application;
[0024] Figure 5 is a schematic flow chart of an optional image processing method provided according to an embodiment of the present application;
[0025] Figure 6 is a schematic diagram of the effect of an optional image processing method provided according to an embodiment of the present application;
[0026] Figure 7 is a schematic diagram of an optional image processing device provided according to an embodiment of the present application. DETAILED DESCRIPTION
[0027] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0029] For the convenience of description, some nouns or terms involved in the embodiments of the present application are explained below:
[0030] The brightness histogram is a tool that counts the frequency of occurrence of different brightness levels in an image. It distributes the brightness values of the image in a series of intervals and then counts the number of pixels in each interval. The x-axis of the histogram represents the brightness level, and the y-axis represents the number of pixels at that brightness level. The brightness histogram helps analyze the brightness distribution characteristics of an image. For example, it can help determine whether the image is dark or bright, and the distribution of dark and bright parts in the image.
[0031] RGB (Red Green Blue) is a color model that represents various colors through different combinations of red (R), green (G), and blue (B). In computer graphics, the RGB model is widely used in displays, digital cameras, and other devices. By adjusting the brightness and saturation of red, green, and blue, a variety of different colors can be produced. The RGB model is an additive color mixing mode, that is, new colors are produced by superimposing different colors of light together.
[0032] The pixel value reflects the intensity of the red, green, and blue colors of each pixel in the image in the RGB color model. In an 8-bit image, the intensity range of each color is 0 to 255; in a normalized image, the intensity range is 0 to 1, as the different value ranges of pixels.
[0033] The brightness value is obtained by adding the RGB color intensities according to certain weights, reflecting the brightness of the pixel.
[0034] Saturation is the purity or intensity of color, reflecting the degree to which the color deviates from grayscale. In color science, saturation refers to the proportion of pure color in a color, which, together with brightness and hue, constitutes the three basic properties of color.
[0035] Logarithmic transformation is used to process images with a large dynamic range. It can compress the dynamic range of brightness values, making dark details more obvious, and help evaluate the average brightness of images under low light conditions. Since the human eye's perception of brightness is based on logarithms, it can better reflect the human eye's perception of brightness.
[0036] Gamma curve is a nonlinear correction technology commonly used in image processing. It is used to correct the brightness response of the display to make the image more natural to the human eye. Based on the fact that the human eye is more sensitive to dark details than bright details, the visual effect of the image is optimized by adjusting the power of the grayscale value.
[0037] The Retinex algorithm is an image enhancement method designed to simulate the way the human visual system processes light changes. It is based on the assumption that the color of an object is determined by its ability to reflect light of different wavelengths, rather than by the absolute intensity of the light. By decomposing illumination and reflection, the Retinex algorithm can effectively enhance the contrast and color constancy of an image, especially for low-light and uneven illumination scenes.
[0038] LIME (Low-light Image Enhancement) algorithm, LIME algorithm focuses on image enhancement under low-light conditions, estimates the illumination intensity by analyzing the RGB channels of the image, and then applies structural priors to improve the accuracy of illumination estimation, and finally generates an image with enhanced brightness and contrast. LIME algorithm can effectively improve the visual quality of images in low-light environments.
[0039] MBLLEN (Multi-Scale Bilateral Learning for Low-light Image Enhancement) algorithm is a deep learning method specifically used for low-light image enhancement. It combines multi-scale analysis and bilateral filtering techniques to train a neural network to learn the relationship between the low-light and high-light parts of a low-light image, thereby achieving natural and high-quality image enhancement.
[0040] KinD (Learning to Enhance Low-Light Images) algorithm is a low-light image enhancement technology based on deep learning. By learning the representation of images under different lighting conditions, it can automatically adjust and enhance images to improve their visual effects in low-light conditions and provide more natural colors and details.
[0041] IPC (Internet Protocol Camera) is a device that converts video images into digital signals and transmits them through a network (such as the Internet or a local area network). Unlike traditional analog cameras, IPC can be directly connected to the network without going through an intermediate analog-to-digital conversion device, which makes video monitoring and image acquisition more flexible and convenient.
[0042] In order to perform image enhancement, the main method in related technologies is to enhance dark light images by designing neural networks, which is achieved by connecting a supervised enhancement network and an unsupervised enhancement network in series, and obtaining the enhanced image through a series of post-processing tasks. Related technologies are implemented through data-driven models, and have the following defects: When the training samples in related technologies are insufficient, the effect cannot be guaranteed. The deployment cost is high, and the algorithm of the artificial intelligence model requires both device computing power and memory, and it is difficult to deploy on edge devices with poor performance.
[0043] In another related technology, the RGB gains are calculated separately depending on the brightness control factor to finally obtain the enhanced image. The adjustment of the size of the brightness control factor requires human participation and judgment, and adaptive brightness adjustment cannot be achieved. In addition, the related technology cannot be used in the video stream.
[0044] In response to the above problems, an embodiment of the present application provides an embodiment of an image processing method. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0045] Figure 1 is a flowchart of an optional image processing method according to an embodiment of the present application. Figure 1 As shown, the method comprises the following steps:
[0046] Step S102, obtaining the initial brightness value of the pixel in the initial image;
[0047] It can be understood that traversing each pixel in the initial image and determining the initial brightness value before being processed provides a basis for subsequent global brightness processing.
[0048] Step S104, performing global brightness processing on the pixel points to determine the middle brightness value of the pixel points;
[0049] It can be understood that by adjusting the brightness gain, the dark part of the initial image is enhanced while the bright part is not over-brightened, thereby determining the intermediate brightness value. Through global brightness processing, the initial image in the dark scene is brightened as a whole, and the intermediate brightness value of the pixel is determined, which provides a global reference value for brightness adjustment.
[0050] Optionally, the global brightness processing method may be multiple, for example: brightness correction through a gamma curve, a Retinex algorithm, a LIME algorithm, brightness processing using features of a logarithmic function, or an image enhancement algorithm based on deep learning.
[0051] Changing brightness through the gamma curve can be integrated into a software component and embedded in the processing modules of various video and photo devices. The above software component is used to convert the grayscale perceived by the human eye into the real grayscale in nature. The correction method of the gamma curve is predefined according to the nature of the imaging device.
[0052] The Retinex algorithm uses the fact that the color of an object is determined by its ability to reflect long-wave (red), medium-wave (green), and short-wave (blue) light, rather than by the absolute value of the reflected light intensity. The color of an object is not affected by the non-uniformity of illumination and is consistent, that is, Retinex is based on color consistency (color constancy). Unlike linear and nonlinear methods that can only enhance a certain type of image feature, Retinex can achieve a balance in three aspects: dynamic range compression, edge enhancement, and color constancy, so it can adaptively enhance various types of images.
[0053] The LIME algorithm estimates the illumination of each pixel individually by finding the maximum value in the R (red), G (green), and B (blue) channels, and refines it by imposing a structural prior on the initial illumination map as the final illumination map. The final enhanced image can be generated based on the illumination map, which depends on the selection of the structural prior.
[0054] The deep learning method is to design a specific network structure, train it based on a certain scale of pictures, and obtain the corresponding deep model. Optional deep learning algorithms such as MBLLEN algorithm and KinD algorithm have the advantage of achieving higher image processing quality when inputting pictures with the same distribution as the training pictures.
[0055] In an optional embodiment, before performing global brightness processing on the pixel points and determining the intermediate brightness value of the pixel points, the method also includes: determining a first brightness feature distribution based on the initial brightness values corresponding to multiple pixel points included in the initial image; and allowing global brightness processing of the pixel points when the first brightness feature distribution satisfies the first image processing condition.
[0056] It can be understood that by traversing all pixel points in the initial image and statistically analyzing the initial brightness values in the initial image, a first brightness feature distribution is obtained, which shows the distribution of the number of pixel points at different brightness levels in the image and helps to quantify the overall brightness of the image. The first image processing condition refers to that the brightness feature distribution of the image needs to conform to the typical features of a low-light image. For an image with sufficient or over-bright brightness, blindly increasing the brightness may cause negative effects such as overexposure and color distortion of the image. The implementation of the first image processing condition judgment can effectively avoid this negative optimization and ensure that the quality of the output image is not lower than that of the input image. Since any image processing algorithm will change some attributes of the image, if the image does not need to be corrected, it can remain unchanged. By initially screening the initial image, it is ensured that only the low-light images that truly need brightness enhancement will be further processed, thus avoiding unnecessary adjustment of images with sufficient or over-bright brightness and causing unnecessary degradation of image quality.
[0057] Optionally, the above first brightness feature distribution is a statistical distribution representing the occurrence frequency of each brightness level in the image. The horizontal axis can use the brightness interval, and the vertical axis can use the number of pixel points to describe the overall distribution of the image brightness characteristics. For the initial pixel value of a pixel point in an initial image, it can be expressed as I(x, y, c), where 0 ≤ x < m, 0 ≤ y < n, c ∈ (r, g, b), and its size is (m * n). Here, x represents the abscissa of the pixel point position, y represents the ordinate of the pixel point position, c represents the color channel, and r, g, b respectively represent the red, green, and blue color component values, and m and n respectively represent the maximum abscissa and maximum ordinate in the initial image.
[0058] The first brightness feature distribution can be in the form of a brightness histogram or a brightness mean method, and the statistical tool is determined according to the specific application scenario. In the embodiment of the present application, determining whether the first brightness feature distribution meets the first image processing condition can be the following methods: threshold judgment based on the brightness mean or dark part percentage judgment based on the brightness histogram. The above brightness histogram can be obtained by reading or by calculation, and can be the brightness histogram data sent together with the processing frame by the chip performing image processing. Based on the above two methods, it can be verified whether the input initial picture is in a low-light state and needs to be enhanced.
[0059] Optionally, for the first brightness feature distribution, the threshold judgment for the brightness mean can be the following method. Traverse the image pixels. For each pixel point, calculate the initial brightness value lum(x, y) from the RGB values, and record the brightness sum l sum and the three values of the brightness maximum l_max and the brightness minimum l_min.
[0060] lum(x,y)=0.299×I(x,y,0)+0.578×I(x,y,1)+0.114×I(x,y,2)
[0061] l sum =∑lum(x,y),l max =max(lum(x,y)),l min =min(lum(x,y))
[0062] The average brightness of the initial brightness value can be expressed as l average ,pass To make a judgment, where I(x,y,0) represents the red component in the pixel value, I(x,y,1) represents the green component in the pixel value, and I(x,y,2) represents the blue component in the pixel value. Threshold1 can be an empirical value, which is used as the first predetermined threshold. For example, threshold1 is 0.3 (when the image pixels are normalized to the range of 0-1), or threshold1 is 0.3*255 (when the image pixel value range is 0-255). Threshold1 can also be set by historical data of brightness statistics of multiple dark light images and normal exposure images.
[0063] According to different settings of the first brightness feature distribution, the corresponding first image processing condition will also have corresponding settings. For the brightness mean, the first image processing condition can be: if the brightness mean is less than the first predetermined threshold, then subsequent image processing is allowed to be performed, and the target brightness value can continue to be generated. If the brightness mean is greater than the first predetermined threshold, then the initial image is kept without processing.
[0064] It should be noted that in the above formula for calculating lum(x,y), 0.299, 0.578, and 0.114 are weight values of the red component, green component, and blue component, respectively. The specific values are for illustration only and are not specifically limited. The above weight values are designed based on the different sensitivities of the human eye to different colors. For example, the human eye is most sensitive to green, so the weight of the green component is the largest.
[0065] Optionally, the judgment on the brightness histogram can be made in the following manner, defining the level of the brightness histogram as k, which reflects the division of the pixel value domain into k intervals. The level of the brightness histogram defines the resolution of the histogram, that is, how many intervals the brightness value is divided into, and the selection of the level directly affects the detail level of the histogram and the complexity of the calculation.
[0066] For example, if the pixel value range of the initial image is in the range of 0-255, the histogram level k means dividing 0-255 into k equally spaced intervals, namely (0, 256 / k), (256 / k, 256 / k*2), ... (256 / k*(k-1), 255). The significance of the brightness histogram is to count the frequency of all pixels in the initial image falling into these intervals, that is, the number of pixels in each interval.
[0067] The total pixel value range of image display technology is 0 to 255 (8-bit grayscale image), so k will determine the fineness of the histogram. A smaller k value means a coarser interval division, while a larger k value means a finer interval division, which can provide more detailed brightness distribution information. If the pixel value range of the initial image is 0 to 255, Figure 2 is a first schematic histogram of an optional image processing method provided according to an embodiment of the present application, such as Figure 2 As shown, assuming that k=10 is set, the intervals are divided as follows: the first interval: [0,25.6], the second interval: (25.6,51.2], the third interval: (51.2,76.8], the fourth interval: (76.8,102.4], the fifth interval: (102.4,128.0], the sixth interval: (128.0,153.6], the seventh interval: (153.6, 179.2], the 8th interval: (179.2, 204.8], the 9th interval: (204.8, 230.4], the 10th interval: (230.4, 255] can indicate how many pixels in the image have brightness values between 0 and 25.6, how many are between 25.6 and 51.2, and so on, until 230.4 to 255, which helps to understand the brightness distribution of the image. Figure 2 The specific data are for illustration only and are not intended to be limiting.
[0068] According to the above method, all pixels of the initial image are traversed, and the frequency of pixels in k intervals is counted, that is, hist[i], i = 1, 2, ..., k, i represents the identifier of the interval, and the array hist[i] is the brightness histogram.
[0069] Assuming that the acquired or calculated histogram level is k, and threshold1 is the first predetermined threshold, whether the image needs dark light enhancement is determined in the following manner:
[0070] threshold2=round(threshold1*k), when the pixel value range is 0-1; or,
[0071] threshold2=round(threshold1*k / 256), when the pixel value range is 0-255;
[0072]
[0073] Among them, round(·) means rounding the content in the brackets, threshold2 means the second predetermined threshold, and i and j are the identifiers of different intervals in the brightness histogram. Threshold3 calculated by threshold2 means the proportion of darker pixels in the initial image to the entire image. This proportion can more accurately reflect the brightness of the image. It can be determined whether the initial image is a dark light image according to whether the proportion is greater than the first predetermined proportion value, for example, the first predetermined proportion value can be 0.5, that is, the initial image has a problem of insufficient brightness and needs to perform global brightness processing.
[0074] In an optional embodiment, when the first brightness feature distribution does not satisfy the first image processing condition, the initial image is retained.
[0075] It can be understood that if the first brightness characteristic distribution of the initial brightness value fails to meet the first image processing condition, it is considered that the image does not need brightness processing and keeps the original state unchanged. Through the above processing, unnecessary image processing processes can be effectively reduced and image processing efficiency can be improved.
[0076] In an optional embodiment, global brightness processing is performed on the pixel points to determine the intermediate brightness value of the pixel points, including: determining the logarithmic mean brightness value based on the initial brightness values corresponding to the multiple pixel points included in the initial image, wherein the logarithmic mean brightness value is used to characterize the global brightness level of the initial image; and adjusting the initial brightness values corresponding to the multiple pixel points according to the logarithmic mean brightness value to obtain the intermediate brightness values corresponding to the multiple pixel points, so that the brightness adjustment amplitude corresponding to the pixel points whose corresponding initial brightness value is less than the logarithmic mean brightness value is greater than the brightness adjustment amplitude corresponding to the pixel points whose corresponding initial brightness value is greater than the logarithmic mean brightness value.
[0077] It can be understood that the global brightness processing of the pixels is performed to determine the middle brightness value of the pixels to achieve effective enhancement of the dark light image. Global brightness processing is different from local processing. It focuses on the brightness distribution of the entire initial image and ensures the uniformity and adaptability of image enhancement by calculating the logarithmic mean brightness value. The logarithmic mean brightness value is calculated by counting the brightness values of all pixels in the image, applying a logarithmic function to transform these brightness values, and then calculating the average value, which is used to avoid the excessive influence of extremely bright or extremely dark pixels in the image on the average value, thereby more accurately reflecting the overall brightness characteristics of the image. According to the logarithmic mean brightness value, the initial brightness values corresponding to multiple pixels are adjusted, and the middle brightness values corresponding to multiple pixels can be obtained. This logarithmic adjustment method utilizes the characteristics of the logarithmic function so that the brightness adjustment amplitude corresponding to the pixel whose initial brightness value is less than the logarithmic mean brightness value is greater than the brightness adjustment amplitude corresponding to the pixel whose initial brightness value is greater than the logarithmic mean brightness value. The characteristic of the above logarithmic function is that the change rate is higher in the part with lower brightness and lower in the part with higher brightness.
[0078] In other words, the pixel points whose corresponding initial brightness values are less than the logarithmic mean brightness value can be regarded as the darker part (i.e., dark part) of the initial image, and the pixel points whose corresponding initial brightness values are greater than the logarithmic mean brightness value can be regarded as the brighter part (i.e., bright part) of the initial image. It can be understood that in order to avoid the occurrence of overexposure problems as much as possible, the brightness adjustment amplitude of the dark pixel points needs to be greater than the brightness adjustment amplitude of the bright pixel points. By using the logarithmic mean brightness value to adapt to images under different lighting conditions, whether in extremely dark scenes or in environments with local bright light, the logarithmic mean brightness value can accurately reflect the global brightness level, which can ensure that the brightness adjustment is more uniform during image enhancement, avoiding the problem of local overexposure or too dark, and effectively ensuring that the dark part of the initial image is fully enhanced, while preventing the bright part of the initial image from being over-brightened.
[0079] In an optional embodiment, initial brightness values corresponding to multiple pixel points are adjusted according to the logarithmic mean brightness value to obtain intermediate brightness values corresponding to the multiple pixel points, including: determining first ratio values corresponding to the multiple pixel points according to the initial brightness values corresponding to the multiple pixel points and the logarithmic mean brightness value, wherein the first ratio value is used to represent the brightness deviation of the initial brightness value of the corresponding pixel point relative to the global brightness level; determining a second ratio value according to the maximum brightness in the initial image and the logarithmic mean brightness value, wherein the second ratio value is used to represent the maximum brightness deviation in the initial image; determining intermediate brightness values corresponding to the multiple pixel points based on the first ratio values corresponding to the multiple pixel points and the second ratio value.
[0080] It can be understood that for each pixel in the initial image, the first ratio value is calculated according to the difference between its initial brightness value and the logarithmic mean brightness value. The first ratio value can represent the initial brightness value of each pixel, and the measure of the relative deviation between the logarithmic mean brightness value, which is used to determine the magnitude of the brightness increase of the pixel in subsequent adjustments. The second ratio value is calculated based on the relationship between the maximum brightness value and the logarithmic mean brightness value in the initial image. The second ratio value measures the deviation between the brightest part of the initial image and the global average brightness, and provides an upper limit of the deviation to control the magnitude of the overall brightness increase to avoid overexposure. Based on the first ratio value of each pixel and the global second ratio value, the intermediate brightness value of each pixel can be calculated. The above brightness adjustment not only takes into account the local brightness deviation, but also the overall brightness control, thereby achieving a smooth and uniform enhancement effect. The adjustment method based on the ratio value avoids visual discomfort caused by drastic changes in brightness.
[0081] Optionally, there are multiple ways to determine the intermediate brightness value, for example, by performing global adaptive brightness calculation in the following way to obtain a first expected brightness value (ie, the intermediate brightness value), denoted as lum expe1 (x,y).
[0082] Determine the logarithmic mean brightness value, denoted as l avg_log :
[0083]
[0084] Wherein, δ is used to avoid the numerical overflow problem caused by pure black pixels, and the first expected brightness value of each pixel after brightening is calculated based on the logarithmic average brightness.
[0085]
[0086] Figure 3 is a logarithmic function schematic diagram of an optional image processing method provided in an embodiment of the present application. According to the characteristics of the logarithmic function, such as Figure 3 The increase of the dependent variable shown increases as the independent variable gradually increases. The independent variable can be understood as the initial brightness value, and the dependent variable can be understood as the intermediate brightness value (i.e., the first expected brightness value). The scene with low logarithmic mean brightness value can restore the brightness better than the scene with high logarithmic mean brightness value, and the overall brightness adjustment of the scene with low logarithmic mean brightness value is larger. In the same image, the increase in low brightness will be slightly greater than that in the high brightness part, which will avoid the distortion of bright areas that may appear in the picture with distinct light and dark areas to a certain extent.
[0087] Step S106, determining a target brightness value for performing contrast enhancement processing on the pixel point based on the intermediate brightness value;
[0088] It can be understood that contrast enhancement ensures that while the image is brightened, it is processed based on the intermediate brightness value to determine the target brightness value (i.e., the second expected brightness value) used for contrast enhancement processing of the pixel points, thereby maintaining a clear boundary between dark and bright areas, avoiding the problem of disappearance of image details caused by brightness uniformity, and improving the visual appeal of the image and the recognizability of details.
[0089] In an optional embodiment, before determining the target brightness value for contrast enhancement processing of the pixel point based on the intermediate brightness value, the method also includes: determining a second brightness characteristic distribution based on the intermediate brightness values corresponding to multiple pixel points included in the initial image; and allowing the target brightness value to be generated when the second brightness characteristic distribution satisfies the second image processing condition.
[0090] It can be understood that the introduction of the second brightness feature distribution (i.e., the distribution of intermediate brightness values) as a further basis for judgment is to ensure that the contrast enhancement processing is more accurate and applicable, and to avoid enhancement under inappropriate circumstances, which may result in loss of image details or unnatural visual effects.
[0091] After the initial image is subjected to preliminary dark light enhancement processing, each pixel will have a corresponding intermediate brightness value. The second brightness characteristic distribution refers to the distribution of the intermediate brightness values of all pixels. The second image processing condition is the evaluation standard for the second brightness characteristic distribution to prevent overexposure of the initial image after global processing. Only when the second brightness characteristic distribution meets the second image processing condition will the target brightness value be generated for the next step of contrast enhancement processing. Through the above processing, it can be ensured that each step of dark light image enhancement processing meets the brightness requirements, avoiding unnecessary processing steps.
[0092] In an optional embodiment, when the second brightness characteristic distribution does not satisfy the second image processing condition, the initial image is retained.
[0093] It is understandable that after global image processing, there is a possibility of overexposure of the image. In order to avoid negative improvement of image processing, it is necessary to determine whether the second image processing condition is met according to the second brightness characteristic distribution of the intermediate brightness value. If the second brightness characteristic distribution does not meet the second image processing condition, the global image processing of the initial image is canceled, and the initial image is kept as the output to avoid invalid optimization or even negative optimization.
[0094] Optionally, the second brightness characteristic distribution can be in the form of a brightness histogram or a brightness mean value, and the statistical tool is determined according to the specific application scenario. In the embodiment of the present application, whether the second brightness characteristic distribution meets the second image processing condition can be determined in the following ways: based on a threshold judgment of the brightness mean value, or based on a dark portion percentage judgment of the brightness histogram.
[0095] Optionally, for the second brightness feature distribution, the threshold value for the brightness mean may be determined in the following manner: summing up the intermediate brightness values corresponding to each pixel to obtain sum(lum expe1 (x,y)). The average brightness of the intermediate brightness values can be l_expe average ,pass To make a judgment, wherein threshold4 is a fourth predetermined threshold value, which is used to judge whether the image is overexposed, and threshold4 can be set as a reference according to the upper limit of the brightness of a normal image.
[0096] According to different settings of the second brightness characteristic distribution, the corresponding first image processing condition will also have corresponding settings. For the brightness mean, the second image processing condition can be: if the brightness mean is less than the fourth predetermined threshold, the initial image is kept without processing; if the brightness mean is greater than the fourth predetermined threshold, subsequent image processing is allowed to be performed, and the target brightness value can continue to be generated.
[0097] Optionally, for the above-mentioned second brightness characteristic distribution, the judgment on the brightness histogram can be similarly performed in the following manner. Assuming that the acquired or calculated histogram level is k, threshold5 is the fifth predetermined threshold, and threshold6 is the sixth predetermined threshold, then the following method is used to judge whether the image after global processing will have an overexposure problem:
[0098] threshold5=round(threshold4*k), when the pixel value range is 0-1; or,
[0099] threshold5=round(threshold4*k / 256), when the pixel value range is 0-255;
[0100]
[0101] Among them, threshold6 calculated by threshold5 represents the proportion of darker pixels in the initial image after global processing to the entire image, which is used to determine whether global processing will cause overexposure. Whether the ratio is greater than a second predetermined ratio value, for example, the second predetermined ratio value may be 0.5, can be used to determine whether the initial image after global processing will have an overexposure problem.
[0102] In an optional embodiment, based on the intermediate brightness value, a target brightness value for contrast enhancement processing of the pixel point is determined, including: based on the intermediate brightness value, determining a brightness adjustment strategy corresponding to the pixel point; according to the brightness adjustment strategy, adjusting the intermediate brightness value to determine the target brightness value for contrast enhancement processing of the pixel point.
[0103] It can be understood that the intermediate brightness value is obtained based on the global adaptive brightness calculation, which reflects the brightness of each pixel in the initial image after the preliminary processing of dark light enhancement. However, relying solely on global adjustment may cause the image contrast to decrease, especially in images with uneven brightness distribution, the details of the dark and bright parts may become blurred. To solve this problem, the embodiment of the present application introduces a brightness adjustment strategy, which performs contrast adaptive enhancement based on different intermediate brightness values, and further optimizes the image contrast by determining the target brightness value. Through the brightness adjustment strategy in the embodiment, the brightness adjustment of the pixel point is no longer a fixed gain, but is processed based on its relative position in the second brightness feature distribution, which makes the brightness enhancement of the dark light image more accurate.
[0104] In an optional embodiment, based on the intermediate brightness value, a brightness adjustment strategy corresponding to the pixel point is determined, including: sorting the intermediate brightness values of the pixel points included in the initial image in ascending order, selecting a first brightness threshold and a second brightness threshold in the middle of the sorting, wherein the first brightness threshold is less than the second brightness threshold; when the intermediate brightness value is less than or equal to the first brightness threshold, determining the brightness adjustment strategy to reduce the intermediate brightness value to a first predetermined brightness value; when the intermediate brightness value is greater than the second brightness threshold, determining the brightness adjustment strategy to increase the intermediate brightness value to a second predetermined brightness value.
[0105] It can be understood that the intermediate brightness values of the pixels included in the initial image are sorted in order from small to large, and the first brightness threshold and the second brightness threshold in the middle of the sorting are selected, the brightness of the first brightness threshold is smaller, and the brightness of the second brightness threshold is larger. The pixels can be divided into at least two parts according to the brightness value, wherein the brightness range in which the intermediate brightness value is less than the first brightness threshold can be regarded as a brightness range with darker brightness, and the brightness range in which the intermediate brightness value is greater than the second brightness threshold can be regarded as a brightness range with brighter brightness. When the intermediate brightness value is less than or equal to the first brightness threshold, the brightness adjustment strategy is determined to reduce the intermediate brightness value to a fixed threshold, that is, the first predetermined brightness value. When the intermediate brightness value is greater than the second brightness threshold, the brightness adjustment strategy is determined to increase the intermediate brightness value to another fixed threshold, that is, the second predetermined brightness value. Through the above processing, adaptive adjustment can be performed according to the actual second brightness feature distribution, avoiding a single gain or reduction operation on the entire image, thereby maintaining the details and contrast of the image. When calculating the target brightness value, two threshold intervals with relatively low and high brightness are found through the first brightness threshold and the second brightness threshold. The brightness gain is adjusted within these two intervals to make the dark part of the image darker while ensuring that the bright part of the image is brighter, which is to perform image contrast enhancement processing.
[0106] Optionally, the first brightness threshold is recorded as Cut low , the second brightness threshold is recorded as Cut high , the target brightness value (i.e. the second desired brightness) is recorded as lum expe2 (x,y).
[0107]
[0108] Among them, when the pixel value range is between 0 and 255, the first predetermined brightness value is 0, that is, the minimum brightness value in the pixel value range, and the second predetermined brightness value is 255, that is, the maximum brightness value in the pixel value range. Similarly, when the pixel value range is between 0 and 1, the first predetermined brightness value is 0, and the second predetermined brightness value is 1.
[0109] In an optional embodiment, the initial image includes a plurality of pixels, and the plurality of pixels belong to corresponding intervals according to the corresponding intermediate brightness values. According to the brightness order of the plurality of intervals from small to large, the number of pixels in the plurality of intervals is accumulated in sequence; until the accumulation process of the number of pixels in the first interval is completed, so that the accumulated number of pixels reaches a predetermined number threshold, then the first interval and the interval before the first interval where the accumulation is performed belong to the first brightness range (i.e., the brightness range formed by the brightness interval less than the first brightness threshold); according to the brightness order of the plurality of intervals from large to small, the number of pixels corresponding to the plurality of intervals are accumulated in sequence; until the accumulation process of the number of pixels in the second interval is completed, so that the accumulated number of pixels reaches the number threshold, then the second interval and the interval before the second interval where the accumulation is performed belong to the second brightness range (i.e., the brightness range formed by the brightness interval greater than the second brightness threshold); and other intervals between the first interval and the second interval in the plurality of intervals are determined to belong to the third brightness range (i.e., the brightness range formed by the brightness interval greater than or equal to the first brightness threshold and less than or equal to the second brightness threshold).
[0110] Optionally, the second brightness feature distribution of the intermediate brightness value is in the form of a brightness histogram, and the multiple intervals are respectively recorded as hist exp1 [i], i = 1, 2, ..., k, i and j are different identifiers of the interval. The brightness order of multiple intervals is from small to large as the positive order. According to the positive order preposition method, the pixel points in multiple intervals are accumulated to obtain the number of pixel points after positive order accumulation, that is, hist sum_pos [i], can be expressed as: i=1,2,…,k.
[0111] The brightness order of multiple intervals is from large to small as the reverse order. According to the reverse order pre-position method, the pixel points in multiple intervals are accumulated to obtain the number of pixel points after reverse order accumulation, that is, histsum_rev [i], can be expressed as: i=k,k-1,…,1.
[0112] Define the number threshold limit to calculate the range of contrast adjustment, recorded as threshold6. The specific value of threshold6 can be set according to personal requirements for the image style. Based on the threshold6 threshold calculation, the following methods can be used:
[0113]
[0114] Traverse hist separately sum_pos and hist sum_rev These two arrays, the hist sum_pos and hist sum_rev The data in the table are arranged in non-decreasing order, so the following method is used to accumulate the number of pixels in positive order: hist sum_pos [i] finds the first index value a. The first index value a is the first value that meets the conditions when traversing the histogram cumulative sum array from low brightness to high brightness. It represents the upper limit of the brightness of the dark area in the image. That is, all pixels below this brightness value are considered dark areas and need to further reduce the brightness to improve the contrast. The number of pixels after reverse accumulation histogram sum_rev [i] finds the second index value b. The second index value b is the first value that meets the conditions when traversing the histogram cumulative sum array from high brightness to low brightness. It represents the lower limit of the brightness of the bright area in the image. That is, all pixels with a brightness value higher than this value are considered bright and need to be further increased to improve the contrast:
[0115] hist sum_pos [a]≤limit<hist sum_pos [a+1]
[0116] hist sum_rev [b]≤limit<hist sum_rev [b+1]
[0117] According to the brightness order of multiple intervals from small to large, the sum of the number of pixel points pre-accumulated in positive order to the ath interval does not exceed the number threshold, and the first index value a is determined to be regarded as the upper limit of the dark part in the second brightness characteristic distribution. According to the brightness order of multiple intervals from large to small, the sum of the number of pixel points pre-accumulated in reverse order to the bth interval does not exceed the number threshold, and the second index value b is determined to be regarded as the lower limit of the bright part in the second brightness characteristic distribution.
[0118] According to the first index value a, the pixel range mapping process is performed, and the first brightness threshold (denoted as Cut) is determined in the following manner.low ): According to the second index value b, the pixel range mapping process is performed, and the second brightness threshold (denoted as Cut) is determined in the following manner. high ): Cut high =(kb)*256 / k. By finding the first index value a and the second index value b, the boundary between the darker part and the brighter part in the second brightness characteristic distribution can be determined, that is, the first brightness threshold and the second brightness threshold, and then the brightness of the image is selectively enhanced based on these two boundaries to avoid image quality degradation caused by overexposure or over-brightening of the dark part.
[0119] To facilitate understanding, we will give a specific example. Figure 4 It is a second schematic histogram of an optional image processing method provided in an embodiment of the present application. Table 1 is a schematic table of brightness distribution. Assuming that there are 10 intervals, i.e., k=10, the number threshold limit is set to 100. According to the order of interval numbers 1 to 10, the brightness is in ascending order. Starting from the first interval, the number of pixels is accumulated to obtain the number of pixels after positive order accumulation, i.e., hist sum_pos [i] It can be determined that the number of pixels accumulated in the second interval is 900, and the number of pixels accumulated in the third interval is 1400. sum_pos [2]≤limit<hist sum_pos [3], it can be determined that the first index value a is 2.
[0120] Similarly, according to the order of interval numbers 10 to 1, the brightness is in descending order. Starting from the tenth interval, the number of pixels is accumulated to obtain the number of pixels after reverse accumulation, that is, hist sum_rev [i] It can be determined that the number of pixels accumulated to the seventh interval (i.e., the fourth interval in reverse order) is 670, and the number of pixels accumulated to the sixth interval (i.e., the fifth interval in reverse order) is 2170. sum_rev [4]≤limit<hist sum_rev [5], it can be determined that the second index value b is 4.
[0121] Table 1
[0122]
[0123]
[0124] according to a=2, get Cut low =51.2, as the first brightness threshold. high =(kb)*256 / k, b=4, get Cut high=153.6, as the second brightness threshold.
[0125] Assume the middle brightness value lum expe1 The value of (x, y) is 30, and the middle brightness value is less than the first brightness threshold. The value of the middle brightness value is set to 0 as the target middle value.
[0126] Assume the middle brightness value lum expe1 The value of (x, y) is 230, and the middle brightness value is greater than the second brightness threshold. The value of the middle brightness value is set to 255 as the target middle value.
[0127] In an optional embodiment, the method includes: when the intermediate brightness value is greater than the first brightness threshold and the intermediate brightness value is less than or equal to the second brightness threshold, determining the brightness adjustment strategy as follows: determining a first difference between the intermediate brightness value and the first brightness threshold, and a second difference between the first brightness threshold and the second brightness threshold; determining an adjustment ratio based on the ratio of the first difference to the second difference; determining a brightness adjustment value according to the adjustment ratio; and adjusting the intermediate brightness value to the brightness adjustment value.
[0128] It can be understood that in order to ensure that the brightness value does not exceed the control range in the step of contrast adaptive enhancement, the gain, i.e., the brightness adjustment value, of each pixel can be adjusted based on its relative position between the first brightness threshold and the second brightness threshold. The intermediate brightness range between the first brightness threshold and the second brightness threshold represents the span of the defined brightness adjustment range, which contains a large amount of detail information in the image. By finely adjusting this part of the brightness, the overall texture of the image can be significantly improved. The adjustment ratio is obtained based on the ratio of the first difference to the second difference, indicating the position of the intermediate brightness value of the pixel point in the intermediate brightness range. The inherent contrast information of the image is utilized to ensure that the brightness improvement is within the original contrast range, rather than increasing the brightness without limit. Through the above processing, the brightness adjustment value obtained is determined according to the second brightness feature distribution, and is adaptive to the second brightness feature distribution, avoiding the brightness adjustment in the related art, and making a rough adjustment to the brightness of the entire image, resulting in overexposure or underexposure of certain areas, destroying the image details and texture.
[0129] It should be noted that there is no need to perform brightness calibration for the target brightness value (i.e., the second expected brightness), and it will not cause overexposure. The calculation of the target brightness value is actually based on the intermediate brightness value, that is, on the basis of global brightness improvement, contrast adaptive enhancement is added. Its main purpose is to maintain the overall contrast of the image and avoid the problem of image quality degradation that may be caused by a single brightness improvement.
[0130] Optionally, for the case where the intermediate brightness value is between the first brightness threshold and the second brightness threshold, it can be represented by the following method:
[0131]
[0132] Cut low ≤lum expe1 (x,y), or lum expe1 (x,y)≥Cut high
[0133] Among them, the first difference is lum expe1 (x,y)-Cut low , the second difference is Cut high -Cut low , the brightness adjustment value is In the case where the pixel value range is 0 to 1, by adjusting the ratio You can know the middle brightness value of the pixel in Cut low To Cut high If the adjustment ratio is close to 0, it means the middle brightness value is close to Cut. low If the adjustment ratio is close to 1, it means the middle brightness value is close to Cut. high .
[0134] For ease of understanding, a specific example is given. According to the example data in Table 1, it is assumed that the middle brightness value lum expe1 (x, y) takes a value of 100, and the middle brightness value is between the first brightness threshold of 51.2 and the second brightness threshold of 153.6. Determine the target brightness value lum expe2 (x,y) is 122.
[0135] In an optional embodiment, a target image is determined based on a target brightness value, including: determining a brightness gain value according to the target brightness value and an initial pixel value of a pixel in an initial image; performing brightness culling processing on the pixel based on the initial pixel value to obtain a saturation retention value; performing weighted summation of the brightness gain value and the saturation retention value to determine a target pixel value of the pixel; and generating a target image according to the target pixel value.
[0136] It can be understood that the target brightness value represents an adjustment method in which both brightness and contrast meet the requirements. Based on the target brightness value and the initial brightness value of each pixel, a brightness gain value is obtained to adjust the brightness of the image. The brightness gain value is assigned to the RGB channel. In the related art, the brightness gain is directly applied to the RGB channel equally, resulting in excessive attenuation of the saturation of the image. In this embodiment, a saturation retention value is introduced to remove the brightness information from the initial pixel value of each pixel to obtain a value containing only color information, i.e., a saturation retention value. By separating color and brightness, it is avoided that the saturation of the color may be affected by directly adjusting the brightness, thereby causing color distortion. The brightness gain value and the saturation retention value are weighted and summed in a certain proportion to obtain the target pixel value to ensure that the saturation is reasonably maintained while the brightness is improved. The target pixel value of each pixel is applied to generate a target image in which the brightness, contrast, and saturation meet the requirements.
[0137] Optionally, the target brightness value is denoted by lum expe2 (x, y), that is, the second expected brightness value, can be obtained by the following method based on the ratio with the initial brightness value: gain (x,y):lum gain (x,y)=lum expe2 (x,y) / lum(x,y).
[0138] By the following expression: gain (x,y)*(I(x,y,c)+lum(x,y)) to get the gain adjustment value, which means that the brightness is adjusted by increasing or decreasing the value of each color channel using the brightness gain value.
[0139] The target pixel value I is determined by ′ (x,y,c):
[0140]
[0141] Among them, lum gain (x,y)*(I(x,y,c)+lum(x,y)) represents the gain adjustment value, I(x,y,c)-lum(x,y) represents the saturation retention value, The weight value is the weighted sum. The gain adjustment value and the saturation retention value can be adjusted separately according to specific needs. It should be noted that the gain adjustment value and the saturation retention value can be different weight values.
[0142] It can be understood that the gain adjustment value is responsible for changing the brightness, while the saturation preservation value attempts to offset the effect of the brightness adjustment on the saturation by subtracting and re-adding the brightness value (weighted summation according to a predetermined weight). By combining the strategies of brightness adjustment and saturation preservation, the negative impact on the image saturation can be minimized while adjusting the image brightness.
[0143] Step S108, determining the target image based on the target brightness value.
[0144] It can be understood that the original image is adjusted according to the target brightness value to generate an enhanced image. This ensures that the enhanced image is bright and colorful, avoiding the color whitening or over-saturation caused by the common brightness increase. The comprehensive application of brightness gain and saturation retention makes the image enhancement effect in low-light conditions both natural and realistic, significantly improving the user's visual experience in low-light environments.
[0145] In an optional embodiment, the method is used to process a plurality of continuous image frames captured from an initial video stream to obtain a target video stream.
[0146] It can be understood that the above-mentioned image processing method is applied to video stream processing, that is, to perform real-time enhancement on continuous image frames obtained from a video source. Based on multiple continuous image frames, an initial image that needs to be processed is determined, and the image is subjected to brightness verification under dark light conditions, global adaptive brightness processing, contrast adaptive enhancement, and saturation retention processing provided in any of the above-mentioned embodiments. After the frame enhancement is completed, the enhanced image frame is reinserted into the video stream to form a target video stream. The above-mentioned image processing method is not only applicable to the processing of a single image, but also to the real-time processing of a video stream, which can enhance the visual effect of the video, especially in application scenarios that are sensitive to low light conditions such as outdoor live broadcast, video conferencing, and night monitoring, which can effectively enhance the video viewing experience, enhance the visual effect of live broadcast or conference, and enhance the clarity and security of night monitoring.
[0147] It should be noted that since invalid image processing is avoided as much as possible when processing single-frame images, the processing speed is fast and can adapt to real-time processing of video streams. Even in high-resolution and high-frame rate videos, it can maintain a good response speed without causing video delays.
[0148] In an optional embodiment, the method further includes: using a smoothing method to process the image frames that are in transition in the updated continuous image frames to obtain a target video stream.
[0149] It is understandable that brightness jumps may occur in continuous image frames in a video stream, especially in continuous image frames after dark light image enhancement. Brightness jumps, that is, there is a significant difference in brightness between adjacent frames, which may cause flickering or unnatural visual effects when the video is played. In order to avoid reducing the viewing experience or causing visual fatigue, inter-frame smoothing is introduced when processing the video stream to ensure the continuity and stability of the output video stream.
[0150] Optionally, for example, an inter-frame smoothing algorithm is used to ensure a smooth transition of brightness between adjacent frames to avoid flickering or unnatural brightness jumps caused by sudden changes in inter-frame brightness gain. In addition, video frame rate, resolution and other parameters can be adjusted to adapt to different processing speeds and display requirements.
[0151] Assume that the brightness gains of two consecutive frames in the video stream are G1 and G2 respectively. If there is a significant difference between the first frame gain G1 and the second frame gain G2, smoothing needs to be performed. This brightness difference can come from a sudden change in scene light. Calculate the brightness difference ΔG between G1 and G2, ΔG = G2-G1. Set an allowable brightness change range ΔG_max. If |ΔG|>ΔG_max, adjust G2 to near G1 to obtain the adjusted second frame gain G2′, for example, G2′ = G1+sign(ΔG)*ΔG_max, to reduce the brightness jump problem.
[0152] Optionally, a smoothing filter, such as a median filter, a mean filter or a Gaussian filter, may be used to process the brightness value to reduce rapid changes in brightness and suppress high-frequency noise in brightness changes, thereby making the target video stream visually present a smoother transition effect.
[0153] Through the above step S102, the initial brightness value of the pixel in the initial image is obtained; in step S104, the pixel is subjected to global brightness processing to determine the intermediate brightness value of the pixel; in step S106, based on the intermediate brightness value, the target brightness value for contrast enhancement processing of the pixel is determined; in step S108, the target image is determined based on the target brightness value. The purpose of maintaining the image details after global processing can be achieved, and the technical effect of improving the image processing quality is achieved, thereby solving the technical problem of unsatisfactory image processing quality in the related art.
[0154] Based on the above embodiments and optional embodiments, the present application proposes an optional implementation mode: Figure 5 is a schematic flow chart of an optional image processing method provided according to an embodiment of the present application, such as Figure 5As shown, the input picture (i.e., the initial image) is a picture I(x, y, c) obtained for an IPC, where 0 ≤ x < m, 0 ≤ y < n, and c ∈ (r, g, b), and its size is (m * n). Here, x represents the abscissa of the pixel position, y represents the ordinate of the pixel position, c represents the color channel, r, g, and b respectively represent the red, green, and blue color component values, and m and n respectively represent the maximum abscissa and maximum ordinate in the initial image.
[0155] First, picture verification is mainly to judge the initial image to determine whether it can be regarded as a low-light image and whether it needs to be further brightened, so as to avoid the low-light enhancement of some pictures that do not require processing. This is because any image processing algorithm will change some attributes of the image. If the picture does not need to be corrected, it can remain unchanged.
[0156] According to the first brightness feature distribution of the initial image, there are two optional ways to verify the initial image: ① Threshold judgment based on the brightness mean value, ② Judgment of the dark part percentage based on the brightness histogram. When the first brightness feature distribution meets the first image processing condition, global brightness processing of pixel points is allowed. According to different setting methods of the first brightness feature distribution, the corresponding first image processing conditions will also have corresponding settings.
[0157] ① Threshold judgment based on the brightness mean value. For the first brightness feature distribution, the threshold judgment for the brightness mean value can be the following method. Traverse the image pixels. For each pixel point, calculate the initial brightness value lum(x, y) from the RGB values and record the three values of the brightness sum l sum and the brightness maximum value l_max and the minimum value l_min.
[0158] lum(x, y) = 0.299×I(x, y, 0) + 0.578×I(x, y, 1) + 0.114×I(x, y, 2)
[0159] l sum = ∑lum(x, y), l max = max(lum(x, y)), l min = min(lum(x, y))
[0160] The brightness mean value of the initial brightness value can be expressed as l average , through To make a judgment, where I(x,y,0) represents the red component in the pixel value, I(x,y,1) represents the green component in the pixel value, and I(x,y,2) represents the blue component in the pixel value. Threshold1 can be an empirical value, which is used as the first predetermined threshold. For example, threshold1 is 0.3 (when the image pixels are normalized to the range of 0-1), or threshold1 is 0.3*255 (when the image pixel value range is 0-255). Threshold1 can also be set by historical data of brightness statistics of multiple dark light images and normal exposure images.
[0161] For the brightness mean, the first image processing condition may be: if the brightness mean is less than the first predetermined threshold, subsequent image processing is allowed to continue to generate the target brightness value. If the brightness mean is greater than the first predetermined threshold, the initial image is kept without processing.
[0162] ② Based on the percentage of dark parts of the brightness histogram, the judgment based on the brightness histogram is often more accurate. If the calculation burden is acceptable, or the input itself contains a statistical histogram (in some image processing chips, the histogram data will be sent with the frame), it is preferred to use the brightness histogram method for judgment. The brightness histogram information can be obtained by reading or calculating. If the histogram needs to be calculated, it can be calculated as follows:
[0163] The level of the brightness histogram is defined as k, which reflects the intervals of the pixel value range. The pixel value range of the initial image is in the range of 0-255, and the histogram level k means that 0-255 is equally spaced into k intervals, which are (0, 256 / k), (256 / k, 256 / k*2), ... (256 / k*(k-1), 255), respectively, and the brightness histogram is used to count the frequency of all pixels in the initial image falling into these intervals, that is, the number of pixels in each interval. According to the above method, all pixels of the initial image are traversed, and the frequency of pixels in k intervals is counted, that is, hist[i], i=1,2,...,k, i represents the interval identifier, and the array hist[i] is the brightness histogram.
[0164] Assuming that the acquired or calculated histogram level is k, and threshold1 is the first predetermined threshold, whether the image needs dark light enhancement is determined in the following manner:
[0165] threshold2=round(threshold1*k), when the pixel value range is 0-1; or,
[0166] threshold2=round(threshold1*k / 256), when the pixel value range is 0-255;
[0167]
[0168] Among them, round(·) means rounding the content in the brackets, threshold2 means the second predetermined threshold, and i and j are the identifiers of different intervals in the brightness histogram. Threshold3 calculated by threshold2 means the proportion of darker pixels in the initial image to the entire image. This proportion can more accurately reflect the brightness of the image. It can be determined whether the initial image is a dark light image according to whether the proportion is greater than the first predetermined proportion value, for example, the first predetermined proportion value can be 0.5, that is, the initial image has a problem of insufficient brightness and needs to perform global brightness processing.
[0169] Based on the above two optional judgment methods, it is possible to check whether the input initial image is in a dark light state and whether enhancement is required.
[0170] Then, a global adaptive brightness calculation method is used to obtain the first expected brightness (i.e., the middle brightness value) based on the initial image that has passed the above verification, which is recorded as lum. expe1 (x,y).
[0171] Determine the logarithmic mean brightness value, denoted as l avg_log :
[0172]
[0173] Wherein, δ is used to avoid the numerical overflow problem caused by pure black pixels, and the first expected brightness value of each pixel after brightening is calculated based on the logarithmic average brightness.
[0174]
[0175] According to the characteristics of the logarithmic function, compared with the image scenes with higher logarithmic average brightness values, the image scenes with lower logarithmic average brightness values have a greater brightness increase, are more sensitive to brightness changes, and show a more obvious brightness recovery ability. In the same image, the increase in the low-brightness part will be slightly greater than the high-brightness part, which will to some extent avoid the distortion of bright areas that may appear in images with distinct light and dark areas.
[0176] After calculating the first expected brightness value, the following conditions are met:
[0177]
[0178] Then, it is judged whether the brightness is excessively increased. For the second brightness feature distribution, the threshold judgment for the brightness mean can be as follows: the middle brightness value corresponding to each pixel is summed to obtain sum(lum expe1 (x,y)). The average brightness of the intermediate brightness values can be l_expe average , where threshold4 is the fourth predetermined threshold, used to determine whether the image is overexposed, and threshold4 can be set as a reference according to the upper limit of the brightness of a normal image. If it is greater than the fourth predetermined threshold, contrast enhancement is not performed, and the original image (i.e., initial image) is directly returned.
[0179] Since the dark light image after global brightness processing brightens the image as a whole, which means that the image dynamic range and contrast are reduced, the contrast can be adaptively enhanced after global brightness processing to obtain the second desired brightness, and the desired brightness can be further processed to obtain a better image effect.
[0180] According to the first expected brightness value of the pixel (i.e., the middle brightness value), a second brightness feature distribution is generated, which can be represented by a brightness histogram, and multiple intervals are recorded as hist exp1 [i], i = 1, 2, ..., k, i and j are different identifiers of the interval.
[0181] The brightness order of multiple intervals is from small to large as the positive order. According to the positive order pre-position method, the pixel points in multiple intervals are accumulated to obtain the number of pixel points after positive order accumulation, that is, hist sum_pos [i], can be expressed as: i=1,2,…,k.
[0182] The brightness order of multiple intervals is from large to small as the reverse order. According to the reverse order pre-position method, the pixel points in multiple intervals are accumulated to obtain the number of pixel points after reverse order accumulation, that is, hist sum_rev [i], can be expressed as: i=k,k-1,…,1.
[0183] Define the number threshold limit to calculate the range of contrast adjustment, recorded as threshold6. The specific value of threshold6 can be set according to personal requirements for the image style. Based on the threshold6 threshold calculation, the following methods can be used:
[0184]
[0185] Traverse hist separately sum_pos and hist sum_rev These two arrays, the hist sum_pos and histsum_rev The data in the table are arranged in non-decreasing order, so the following method is used to accumulate the number of pixels in positive order: hist sum_pos [i] finds the first index value a. The first index value a is the first value that meets the conditions when traversing the histogram cumulative sum array from low brightness to high brightness. It represents the upper limit of the brightness of the dark area in the image. That is, all pixels below this brightness value are considered dark areas and need to further reduce the brightness to improve the contrast. The number of pixels after reverse accumulation histogram sum_rev [i] finds the second index value b. The second index value b is the first value that meets the conditions when traversing the histogram cumulative sum array from high brightness to low brightness. It represents the lower limit of the brightness of the bright area in the image. That is, all pixels with a brightness value higher than this value are considered bright and need to be further increased to improve the contrast:
[0186] hist sum_pos [a]≤limit<hist sum_pos [a+1]
[0187] hist sum_rev [b]≤limit<hist sum_rev [b+1]
[0188] According to the brightness order of multiple intervals from small to large, the sum of the number of pixel points pre-accumulated in positive order to the ath interval does not exceed the number threshold, and the first index value a is determined to be regarded as the upper limit of the dark part in the second brightness characteristic distribution. According to the brightness order of multiple intervals from large to small, the sum of the number of pixel points pre-accumulated in reverse order to the bth interval does not exceed the number threshold, and the second index value b is determined to be regarded as the lower limit of the bright part in the second brightness characteristic distribution.
[0189] According to the first index value a, the pixel range mapping process is performed, and the first brightness threshold (denoted as Cut) is determined in the following manner. low ): According to the second index value b, the pixel range mapping process is performed, and the second brightness threshold (denoted as Cut) is determined in the following manner. high ): Cut high =(kb)*256 / k. By finding the first index value a and the second index value b, the boundary between the darker part and the brighter part in the second brightness characteristic distribution can be determined, that is, the first brightness threshold and the second brightness threshold, and then the brightness of the image is selectively enhanced based on these two boundaries to avoid image quality degradation caused by overexposure or over-brightening of the dark part.
[0190] The target brightness value (i.e. the second desired brightness) is denoted as lum expe2 (x,y).
[0191]
[0192] When the pixel value range is between 0 and 255, the first predetermined brightness value is 0, i.e., the minimum brightness value in the pixel value range, and the second predetermined brightness value is 255, i.e., the maximum brightness value in the pixel value range. Similarly, when the pixel value range is between 0 and 1, the first predetermined brightness value is 0, and the second predetermined brightness value is 1. Assuming that the intermediate brightness value is less than the first brightness threshold, the intermediate brightness value is set to 0 as the target intermediate value. Assuming that the intermediate brightness value is greater than the second brightness threshold, the intermediate brightness value is set to 255 as the target intermediate value.
[0193] Assuming that the intermediate brightness value is between the first brightness threshold and the second brightness threshold, according to Adaptively determine the target brightness value. lum expe1 (x,y)-Cut low is the first difference, Cut high -Cut low is the second difference, The brightness adjustment value. When the pixel value range is from 0 to 1, the ratio is adjusted You can know the middle brightness value of the pixel in Cut low To Cut high If the adjustment ratio is close to 0, it means the middle brightness value is close to Cut. low If the adjustment ratio is close to 1, it means the middle brightness value is close to Cut. high .
[0194] The calculation of the target brightness value is actually based on the intermediate brightness value, that is, on the basis of global brightness improvement, contrast adaptive enhancement processing is added. Its main purpose is to maintain the overall contrast of the image and avoid the problem of image quality degradation that may be caused by a single brightness improvement.
[0195] The second desired brightness value (i.e., target brightness value) obtained by calculation can be used to obtain the brightness gain value lum according to the ratio with the initial brightness value in the following manner: gain (x,y):
[0196] lum gain (x,y)=lum expe2 (x,y) / lum(x,y)
[0197] Then the brightness gain value is assigned to the RGB channels. In the related art, the brightness gain value is directly applied to the RGB channels equally, which may cause the saturation of the image to decay too much. In order to avoid the above problem, the RGB gain is calculated as follows to maintain the saturation:
[0198]
[0199] Among them, lum gain (x,y)*(I(x,y,c)+lum(x,y)) represents the gain adjustment value, I(x,y,c)-lum(x,y) represents the saturation retention value, The weight value is the weighted sum. The gain adjustment value and the saturation retention value can be adjusted separately according to specific needs. Based on this method, the saturation loss can be reduced to a certain extent.
[0200] The present application also provides an optional implementation manner, in which the above-mentioned initial image comes from multiple continuous image frames captured from the initial video stream. For the video, the processing principle is basically the same as that for the picture. Multiple video frames can be smoothed as needed to obtain a better experience and finally obtain the target video stream.
[0201] After testing on the PC side, taking a general image size as an example, such as a 720*480*3 image, its enhancement process only takes 14ms (milliseconds), and a 2560*1440*3 image only takes about 140ms. Due to the short processing time and short processing delay, its real-time performance can match the playback requirements of video streams.
[0202] Figure 6 is a schematic diagram of the effect of an optional image processing method provided in an embodiment of the present application, Figure 6 a1, b1, c1, d1 are the initial input images. It can be seen that a1, b1, c1 are the darker types of the original images and need to be brightened. The obtained a2, b2, c2 are the output target images. The brightness enhancement is based on the logarithmic average brightness, which can achieve the enhancement of the dark parts without over-brightening the bright parts, ensuring that the image can be seen clearly in both the bright and dark parts after enhancement. As for d1, which is the type of original image with sufficient brightness, after two-step verification, it can be ruled out that there is no need for brightening or the brightness is increased too much, ensuring that the input image does not degrade in quality. It can be seen that d2 and d1 are the same image.
[0203] The above optional implementation achieves at least the following effects: the visual effect of the image is effectively improved through global brightness processing and contrast enhancement processing. The global brightness processing is based on the logarithmic mean brightness value to ensure the reasonable adjustment of the overall brightness of the image, while the contrast enhancement processing enhances the detail contrast of the image through the brightness adjustment strategy, making the image more vivid and clear. In addition, for the processing of video streams, the sudden change of brightness between frames is avoided through smoothing processing, which ensures the smoothness and viewing experience of the video, and has good adaptability to various image processing application scenarios.
[0204] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0205] In this embodiment, an image processing device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the terms "module" and "device" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0206] According to an embodiment of the present application, a device embodiment for implementing the image processing method is also provided. Figure 7 is a schematic diagram of an image processing device according to an embodiment of the present application, such as Figure 7 As shown, the above-mentioned image processing device includes: an information acquisition module 702, a global processing module 704, an enhancement module 706, and an image output module 708. The device is described below.
[0207] The information acquisition module 702 is used to acquire the initial brightness value of the pixel in the initial image;
[0208] The global processing module 704 is connected to the information acquisition module 702 and is used to perform global brightness processing on the pixel points to determine the intermediate brightness value of the pixel points;
[0209] The enhancement module 706 is connected to the global processing module 704 and is used to determine a target brightness value for performing contrast enhancement processing on the pixel based on the intermediate brightness value;
[0210] The image output module 708 is connected to the enhancement module 706 and is used to determine the target image based on the target brightness value.
[0211] In an image processing device provided by an embodiment of the present application, an information acquisition module 702 is set to obtain the initial brightness value of the pixel in the initial image; a global processing module 704 is connected to the information acquisition module 702 and is used to perform global brightness processing on the pixel to determine the intermediate brightness value of the pixel; an enhancement module 706 is connected to the global processing module 704 and is used to determine the target brightness value for contrast enhancement processing of the pixel based on the intermediate brightness value; an image output module 708 is connected to the enhancement module 706 and is used to determine the target image based on the target brightness value. The purpose of maintaining the image details after global processing is achieved, and the technical effect of improving the image processing quality is achieved, thereby solving the technical problem of unsatisfactory image processing quality in the related art.
[0212] It should be noted that the above modules can be implemented by software or hardware. For example, for the latter, it can be implemented in the following ways: the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.
[0213] It should be noted that the above information acquisition module 702, global processing module 704, enhancement module 706, and image output module 708 correspond to steps S102 to S108 in the embodiment, and the examples and application scenarios implemented by the above modules and the corresponding steps are the same, but are not limited to the contents disclosed in the above embodiments. It should be noted that the above modules can be run in a computer terminal as part of the device.
[0214] It should be noted that the optional or preferred implementation of this embodiment can refer to the relevant description in the embodiment, which will not be repeated here.
[0215] The above-mentioned image processing device may also include a processor and a memory. The information acquisition module 702, the global processing module 704, the enhancement module 706, the image output module 708, etc. are all stored in the memory as program units, and the processor executes the above-mentioned program units stored in the memory to realize the corresponding functions.
[0216] The processor includes a kernel, which retrieves the corresponding program unit from the memory. There can be one or more kernels. The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one storage chip.
[0217] An embodiment of the present application provides a non-volatile storage medium on which a program is stored, and when the program is executed by a processor, an image processing method is implemented.
[0218] The embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program stored in the memory and can be run on the processor. When the processor executes the program, the following steps are implemented: obtaining the initial brightness value of the pixel in the initial image; performing global brightness processing on the pixel to determine the intermediate brightness value of the pixel; determining the target brightness value for contrast enhancement processing of the pixel based on the intermediate brightness value; and determining the target image based on the target brightness value. The device in the present application can be a server, a PC, etc.
[0219] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program that is initialized with the following method steps: obtaining initial brightness values of pixels in an initial image; performing global brightness processing on the pixels to determine an intermediate brightness value of the pixels; based on the intermediate brightness value, determining a target brightness value for performing contrast enhancement processing on the pixels; and determining a target image based on the target brightness value.
[0220] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0221] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0222] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0223] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0224] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0225] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0226] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0227] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0228] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0229] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. An image processing method, characterized in that: include: Get the initial brightness value of the pixel in the initial image; Performing global brightness processing on the pixel points to determine the intermediate brightness value of the pixel points; Based on the intermediate brightness value, determining a target brightness value for performing contrast enhancement processing on the pixel point; Based on the target brightness value, a target image is determined.
2. The method according to claim 1, characterized in that: The determining, based on the intermediate brightness value, a target brightness value for performing contrast enhancement processing on the pixel point comprises: Based on the intermediate brightness value, determining a brightness adjustment strategy corresponding to the pixel point; According to the brightness adjustment strategy, the intermediate brightness value is adjusted to determine the target brightness value for performing contrast enhancement processing on the pixel point.
3. The method according to claim 2, characterized in that The determining, based on the intermediate brightness value, a brightness adjustment strategy corresponding to the pixel point includes: sorting the middle brightness values of the pixels in the initial image in ascending order, and selecting a first brightness threshold and a second brightness threshold in the middle of the sorting, wherein the first brightness threshold is smaller than the second brightness threshold; When the intermediate brightness value is less than or equal to the first brightness threshold, determining the brightness adjustment strategy is to reduce the intermediate brightness value to a first predetermined brightness value; In the case where the intermediate brightness value is greater than the second brightness threshold, the brightness adjustment strategy is determined to be increasing the intermediate brightness value to a second predetermined brightness value.
4. The method according to claim 3, characterized in that The method comprises: When the intermediate brightness value is greater than the first brightness threshold and the intermediate brightness value is less than or equal to the second brightness threshold, the brightness adjustment strategy is determined as follows: determining a first difference between the intermediate brightness value and the first brightness threshold, and a second difference between the first brightness threshold and the second brightness threshold; determining an adjustment ratio based on a ratio of the first difference to the second difference; determining a brightness adjustment value according to the adjustment ratio; and adjusting the intermediate brightness value to the brightness adjustment value.
5. The method according to claim 1, characterized in that The step of determining a target image based on the target brightness value comprises: Determine a brightness gain value according to the target brightness value and the initial pixel value of the pixel point in the initial image; Performing brightness culling processing on the pixel point based on the initial pixel value to obtain a saturation retention value; Performing a weighted summation on the brightness gain value and the saturation retention value to determine a target pixel value of the pixel point; The target image is generated according to the target pixel value.
6. The method according to claim 1, characterized in that Before performing global brightness processing on the pixel points to determine the intermediate brightness values of the pixel points, the method further includes: Determining a first brightness feature distribution based on initial brightness values respectively corresponding to a plurality of pixel points included in the initial image; When the first brightness feature distribution satisfies a first image processing condition, global brightness processing is allowed for the pixel point.
7. The method according to claim 1, characterized in that Before determining the target brightness value for performing contrast enhancement processing on the pixel point based on the intermediate brightness value, the method further includes: Determining a second brightness feature distribution based on intermediate brightness values respectively corresponding to a plurality of pixel points included in the initial image; In the case where the second brightness feature distribution satisfies a second image processing condition, the target brightness value is allowed to be generated.
8. The method according to claim 1, characterized in that The performing global brightness processing on the pixel points to determine the intermediate brightness value of the pixel points includes: Determine a logarithmic average brightness value based on initial brightness values respectively corresponding to a plurality of pixel points included in the initial image, wherein the logarithmic average brightness value is used to represent a global brightness level of the initial image; According to the logarithmic mean brightness value, the initial brightness values corresponding to the multiple pixel points are adjusted to obtain the intermediate brightness values corresponding to the multiple pixel points, so that the brightness adjustment amplitude corresponding to the pixel points whose corresponding initial brightness values are less than the logarithmic mean brightness value is greater than the brightness adjustment amplitude corresponding to the pixel points whose corresponding initial brightness values are greater than the logarithmic mean brightness value.
9. The method according to claim 8, characterized in that The step of adjusting the initial brightness values respectively corresponding to the plurality of pixel points according to the logarithmic average brightness value to obtain the intermediate brightness values respectively corresponding to the plurality of pixel points comprises: Determine, according to the initial brightness values respectively corresponding to the multiple pixel points and the logarithmic average brightness value, first proportional values respectively corresponding to the multiple pixel points, wherein the first proportional value is used to represent the brightness deviation of the initial brightness value of the corresponding pixel point relative to the global brightness level; Determine a second ratio value according to the maximum brightness in the initial image and the logarithmic mean brightness value, wherein the second ratio value is used to represent the maximum brightness deviation in the initial image; Based on the first ratio values respectively corresponding to the plurality of pixel points and the second ratio value, intermediate brightness values respectively corresponding to the plurality of pixel points are determined.
10. An image processing device, characterized in that: include: An information acquisition module, used to acquire initial brightness values of pixels in an initial image; A global processing module, used to perform global brightness processing on the pixel points to determine the intermediate brightness value of the pixel points; An enhancement module, used to determine a target brightness value for performing contrast enhancement processing on the pixel point based on the intermediate brightness value; The image output module is used to determine a target image based on the target brightness value.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored executable program, wherein when the executable program is executed, the device where the computer-readable storage medium is located is controlled to execute the image processing method according to any one of claims 1 to 9.
12. An electronic device, characterized in that: include: A memory storing an executable program; A processor is used to run the program, wherein the program executes the image processing method according to any one of claims 1 to 9 when running.
13. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the image processing method according to any one of claims 1 to 9 are implemented.