Image contrast enhancement method and device for non-uniform exposure
By calculating the global brightness histogram and adaptively determining the multi-sub-exposure threshold, combined with grayscale range allocation and histogram equalization, the insufficient contrast enhancement of non-uniform exposure images in existing technologies is solved, and precise improvement of image quality and contrast is achieved.
Patent Information
- Application Number
- CN202510941125.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-08
- Publication Date
- 2025-10-17
AI Technical Summary
Existing image contrast enhancement techniques have limitations, including problems such as reduced image gray levels, high computational complexity, uneven brightness balance, and noise amplification, especially insufficient improvement in local details in non-uniform exposure areas.
By calculating the global brightness histogram, brightness histogram mean and variance of the original image, multiple sub-exposure thresholds are determined. Histogram construction, grayscale mean calculation and segmentation are performed, combined with grayscale range allocation and redefinition, and finally histogram equalization is performed to achieve refined contrast enhancement of different exposure areas.
It improves image contrast enhancement, enhances image quality, reduces calculation errors, improves the accuracy of exposure area division and the coordination of brightness and contrast, and preserves local image details.
Smart Images

Figure CN120807377A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image processing, and in particular to a method and device for image contrast enhancement for non-uniform exposure. BACKGROUND
[0002] Image contrast enhancement technology is one of the common means of digital image processing. By obtaining the original brightness information of an input image, the insufficient or overexposed part of the image is processed. The image after contrast enhancement can improve the clarity of local details such as brightness of the input image, thereby improving the image quality. The main purpose of contrast enhancement is to improve the visual effect of the image, so that it is more suitable for human eyes or machines to analyze and process.
[0003] The conventional technical means for image contrast enhancement in the existing industry include: 1. Histogram adjustment method: including histogram equalization and histogram matching; histogram equalization redistributes the pixel values of an image to make the gray histogram uniformly distributed in the full gray scale range, thereby enhancing the contrast; histogram matching adjusts and matches the histogram of one image to the histogram shape of another image. 2. Gray scale transformation method: including linear transformation, logarithmic transformation and exponential transformation; linear transformation changes the gray scale range of an image by adjusting the coefficient; logarithmic transformation and exponential transformation expand or compress the gray scale range by using nonlinear functions. 3. Nonlinear transformation method: such as gamma transformation, which adjusts the gray scale range of an image by using nonlinear functions such as logarithmic and exponential transformations.
[0004] Compared with the prior art, the existing image contrast enhancement techniques have certain limitations. It is embodied in that: the contrast enhancement method based on histogram adjustment generally includes image global brightness histogram equalization, which has the disadvantage that the gray scale of the enhanced image will be reduced, and part of the details will be lost; the adaptive histogram equalization has the disadvantage of causing image distortion; the adaptive histogram equalization with contrast limitation has the disadvantages of high computational complexity and uneven brightness balance. The gray scale transformation method and the nonlinear transformation method are prone to amplify image noise during contrast enhancement, and do not have good improvement in the local detail contrast of the image. SUMMARY
[0005] The present application provides a method and device for image contrast enhancement for non-uniform exposure, which can realize fine contrast enhancement of different exposure areas, present more image local details, and improve the contrast enhancement effect and image quality of the image.
[0006] The first aspect of the present application discloses a method for image contrast enhancement for non-uniform exposure, the method comprising: performing a first image processing operation on the obtained original image to obtain a first image processing result corresponding to the original image; the original image is an image to be subjected to an image contrast enhancement operation; the first image processing operation at least includes a global brightness histogram calculation operation, a brightness histogram mean value calculation operation, and a brightness histogram variance calculation operation; According to the first image processing result, a target exposure threshold corresponding to the original image is determined, and a second image processing operation is performed on the first image processing result according to the target exposure threshold to obtain a second image processing result corresponding to the first image processing result; the target exposure threshold includes a plurality of sub-exposure thresholds; the second image processing operation includes a histogram construction operation, a gray mean value calculation operation, and a histogram segmentation operation; the second image processing result includes a plurality of target sub-histograms. performing a third image processing operation on the second image processing result to obtain a third image processing result corresponding to the second image processing result; the third image processing operation includes a gray scale range allocation operation, a redefinition for the target exposure threshold, and a histogram equalization operation; the third image processing result is an image that completes the image contrast enhancement operation.
[0007] As an optional implementation, in the first aspect of the present application, performing a first image processing operation on the obtained original image to obtain a first image processing result corresponding to the original image includes: performing a gray scale conversion processing on the obtained original image to obtain a gray scale image for the original image; performing a histogram calculation operation and an image drawing operation on the gray scale image in sequence according to a preset global brightness histogram calculation function and a histogram drawing function to obtain a histogram calculation result for the gray scale image and a corresponding drawing image; the histogram calculation result is a multi-dimensional array; calculating a mean value calculation result and a variance calculation result corresponding to the histogram calculation result according to a preset mean value calculation formula and a variance calculation formula; determining the histogram calculation result, the drawing image, the mean value calculation result, and the variance calculation result as the first image processing result corresponding to the original image.
[0008] As an optional implementation, in the first aspect of the present application, determining a target exposure threshold corresponding to the original image according to the first image processing result includes: determining a target exposure threshold for the original image, the target exposure threshold including a plurality of sub-exposure thresholds; and determining a threshold calculation formula corresponding to each of the sub-exposure thresholds, the plurality of sub-exposure thresholds including a low exposure threshold, a proper exposure threshold, and an overexposure threshold. According to the mean calculation result, the variance calculation result, and in combination with a threshold calculation formula corresponding to each of the sub-exposure thresholds, a threshold settlement result corresponding to each of the sub-exposure thresholds is calculated to update the target exposure threshold.
[0009] As an optional implementation, in the first aspect of the present application, the second image processing operation performed on the first image processing result according to the target exposure threshold to obtain a second image processing result corresponding to the first image processing result comprises: A first image segmentation operation is performed on the drawing image by taking all the sub-exposure thresholds as first segmentation thresholds to obtain a plurality of initial sub-histograms corresponding to the drawing image; and a gray mean value corresponding to each of the initial sub-histograms is calculated according to a preset gray mean value calculation formula. A second image segmentation operation is performed on the drawing image by taking all the gray mean values as second segmentation thresholds to obtain a plurality of target sub-histograms corresponding to the drawing image. All the target sub-histograms are determined as the second image processing result.
[0010] As an optional implementation, in the first aspect of the present application, the third image processing operation performed on the second image processing result to obtain a third image processing result corresponding to the second image processing result comprises: A dynamic gray scale calculation operation is performed on each of the target sub-histograms to obtain a dynamic gray scale calculation result corresponding to each of the target sub-histograms; the dynamic gray scale calculation operation comprises a gray scale span calculation operation based on a preset gray scale span formula, a weight calculation operation based on a preset weight calculation formula, and a gray scale range calculation operation based on a preset gray scale range formula; and the dynamic gray scale calculation result at least comprises a dynamic gray scale range corresponding to each of the target sub-histograms. A preset redefinition operation is performed on all the target sub-histograms to obtain a redefinition result corresponding to all the target sub-histograms as the third image processing result; wherein the redefinition operation comprises a threshold calculation operation based on a preset accumulation calculation formula, a region re-segmentation operation, and a histogram equalization operation.
[0011] As an optional implementation, in the first aspect of the present application, the dynamic gray scale calculation operation performed on each of the target sub-histograms to obtain a dynamic gray scale calculation result corresponding to each of the target sub-histograms comprises: For each of the target sub-histograms, a gray scale span result corresponding to the target sub-histogram is calculated according to a preset gray scale span formula; the gray scale span formula is used to calculate a numerical span between a maximum gray value and a minimum gray value corresponding to the target sub-histogram. According to a preset weight calculation formula, a weight calculation result corresponding to the target sub-histogram is calculated in combination with the gray scale span result corresponding to the target sub-histogram; According to a preset gray scale range formula, a dynamic gray scale range corresponding to the target sub-histogram is calculated in combination with the weight calculation result corresponding to the target sub-histogram.
[0012] As an optional implementation, in the first aspect of the present application, the performing of the preset redefinition operation on all the target sub-histograms to obtain the redefinition result corresponding to all the target sub-histograms as the third image processing result comprises: According to a preset accumulation calculation formula, a new target exposure threshold corresponding to all the target sub-histograms is calculated in combination with the dynamic gray scale range corresponding to each target sub-histogram; Performing a region re-segmentation operation on the second image processing result according to all the new target exposure thresholds to obtain a region re-segmentation result corresponding to the second image processing result; the region re-segmentation result comprises a plurality of new target sub-histograms; Performing a preset histogram equalization operation on each new target sub-histogram to obtain an equalization result corresponding to all the new target sub-histograms as the third image processing result.
[0013] The second aspect of the present application discloses an image contrast enhancement device for non-uniform exposure, which comprises: A first image processing module is configured to perform a first image processing operation on an obtained original image to obtain a first image processing result corresponding to the original image; the original image is an image to be subjected to an image contrast enhancement operation; the first image processing operation comprises at least a global brightness histogram calculation operation, a brightness histogram mean value calculation operation and a brightness histogram variance calculation operation; A threshold determination module is configured to determine a target exposure threshold corresponding to the original image according to the first image processing result; the target exposure threshold comprises a plurality of sub-exposure thresholds; A second image processing module is configured to perform a second image processing operation on the first image processing result according to the target exposure threshold to obtain a second image processing result corresponding to the first image processing result; the second image processing operation comprises a histogram construction operation, a gray value mean calculation operation and a histogram segmentation operation; the second image processing result comprises a plurality of target sub-histograms; a third image processing module, configured to perform a third image processing operation on the second image processing result to obtain a third image processing result corresponding to the second image processing result; the third image processing operation comprises a gray scale range assignment operation, a redefinition for the target exposure threshold, and a histogram equalization operation; and the third image processing result is an image after the image contrast enhancement operation is completed.
[0014] As an optional implementation, in the second aspect of the present application, the manner in which the first image processing module performs a first image processing operation on the obtained original image to obtain a first image processing result corresponding to the original image specifically comprises: performing a gray scale conversion processing on the obtained original image to obtain a gray scale image for the original image; performing a histogram calculation operation and an image drawing operation on the gray scale image in sequence according to a preset global brightness histogram calculation function and a histogram drawing function to obtain a histogram calculation result for the gray scale image and a corresponding drawn image; the histogram calculation result is a multi-dimensional array; calculating a mean calculation result and a variance calculation result corresponding to the histogram calculation result according to preset mean calculation formula and variance calculation formula; determining the histogram calculation result, the drawn image, the mean calculation result, and the variance calculation result as the first image processing result corresponding to the original image.
[0015] As an optional implementation, in the second aspect of the present application, the manner in which the threshold value determination module determines a target exposure threshold corresponding to the original image according to the first image processing result specifically comprises: determining a target exposure threshold for the original image, the target exposure threshold comprising a plurality of sub-exposure thresholds; and determining a threshold calculation formula corresponding to each of the sub-exposure thresholds, the plurality of sub-exposure thresholds comprising a low exposure threshold, a proper exposure threshold, and an overexposure threshold; calculating a threshold calculation result corresponding to each of the sub-exposure thresholds according to the mean calculation result, the variance calculation result, and the threshold calculation formula corresponding to each of the sub-exposure thresholds to update the target exposure threshold.
[0016] As an optional implementation, in the second aspect of the present application, the manner in which the second image processing module performs a second image processing operation on the first image processing result according to the target exposure threshold to obtain a second image processing result corresponding to the first image processing result specifically comprises: performing a first image segmentation operation on the rendering image by taking all the sub-exposure thresholds as first segmentation thresholds, to obtain a plurality of initial sub-histograms corresponding to the rendering image; and calculating a gray mean value corresponding to each of the initial sub-histograms according to a preset gray mean value calculation formula; performing a second image segmentation operation on the rendering image by taking all the gray mean values as second segmentation thresholds, to obtain a plurality of target sub-histograms corresponding to the rendering image; determining all the target sub-histograms as the second image processing result.
[0017] As an optional implementation, in the second aspect of the present application, the third image processing module performs a third image processing operation on the second image processing result to obtain a third image processing result corresponding to the second image processing result, and the manner specifically includes: performing a dynamic gray scale calculation operation on each of the target sub-histograms to obtain a dynamic gray scale calculation result corresponding to each of the target sub-histograms; the dynamic gray scale calculation operation includes a gray scale span calculation operation based on a preset gray scale span formula, a weight calculation operation based on a preset weight calculation formula, and a gray scale range calculation operation based on a preset gray scale range formula; the dynamic gray scale calculation result at least includes a dynamic gray scale range corresponding to each of the target sub-histograms; performing a preset redefinition operation on all the target sub-histograms to obtain a redefinition result corresponding to all the target sub-histograms as the third image processing result; wherein the redefinition operation includes a threshold calculation operation based on a preset accumulation calculation formula, a region re-segmentation operation, and a histogram equalization operation.
[0018] As an optional implementation, in the second aspect of the present application, the third image processing module performs a dynamic gray scale calculation operation on each of the target sub-histograms to obtain a dynamic gray scale calculation result corresponding to each of the target sub-histograms, and the manner specifically includes: for each of the target sub-histograms, calculating a gray scale span result corresponding to the target sub-histogram according to a preset gray scale span formula; the gray scale span formula is used to calculate the numerical span between the maximum gray value and the minimum gray value corresponding to the target sub-histogram; calculating a weight calculation result corresponding to the target sub-histogram according to a preset weight calculation formula in combination with the gray scale span result corresponding to the target sub-histogram; calculating a dynamic gray scale range corresponding to the target sub-histogram according to a preset gray scale range formula in combination with the weight calculation result corresponding to the target sub-histogram.
[0019] As an optional implementation, in the second aspect of the present application, the third image processing module performs a preset redefinition operation on all the target sub-histograms to obtain a redefinition result corresponding to all the target sub-histograms as the third image processing result. According to a preset accumulation calculation formula, a new target exposure threshold corresponding to each target sub-histogram is calculated based on the dynamic gray scale range corresponding to each target sub-histogram. According to all the new target exposure thresholds, a region re-segmentation operation is performed on the second image processing result to obtain a region re-segmentation result corresponding to the second image processing result; the region re-segmentation result includes a plurality of new target sub-histograms. A preset histogram equalization operation is performed on each new target sub-histogram to obtain an equalization result corresponding to all the new target sub-histograms as the third image processing result.
[0020] The third aspect of the present application discloses another device for enhancing the contrast of an image with non-uniform exposure, which comprises: a memory storing executable program codes; a processor coupled to the memory; The processor calls the executable program codes stored in the memory to execute part or all of the steps of the method for enhancing the contrast of an image with non-uniform exposure according to any one of the first aspect of the present application.
[0021] The fourth aspect of the present application discloses a computer storage medium storing computer instructions, which when called, is used to execute part or all of the steps of the method for enhancing the contrast of an image with non-uniform exposure according to any one of the first aspect of the present application.
[0022] Compared with the prior art, the present application has the following beneficial effects: In the embodiment of the present application, a method for image contrast enhancement of non-uniform exposure is provided, which comprises: performing a first image processing operation on an obtained original image to obtain a first image processing result corresponding to the original image; the original image is an image to be subjected to an image contrast enhancement operation; the first image processing operation at least comprises a global brightness histogram calculation operation, a brightness histogram mean value calculation operation and a brightness histogram variance calculation operation; a target exposure threshold corresponding to the original image is determined according to the first image processing result, and a second image processing operation is performed on the first image processing result according to the target exposure threshold to obtain a second image processing result corresponding to the first image processing result; the target exposure threshold comprises a plurality of sub-exposure thresholds; the second image processing operation comprises a histogram construction operation, a gray mean value calculation operation and a histogram segmentation operation; the second image processing result comprises a plurality of target sub-histograms; a third image processing operation is performed on the second image processing result to obtain a third image processing result corresponding to the second image processing result; the third image processing operation comprises a gray scale range allocation operation, a redefinition for the target exposure threshold and a histogram equalization operation; and the third image processing result is an image subjected to the image contrast enhancement operation. It can be seen that, by implementing the present application, the image brightness distribution is comprehensively understood through the first image processing operation; the target exposure threshold comprising a plurality of sub-exposure thresholds is adaptively determined, thereby improving the division precision of the exposure region; the second image processing operation refines the histogram processing and generates a plurality of target sub-histograms, thereby reducing the calculation error existing in the global processing and improving the subsequent processing precision and pertinence; in the third image processing operation, the gray scale range is reasonably allocated, thereby improving the coordination of the enhanced image in brightness and contrast; the exposure threshold is redefined to further optimize the division of the exposure region; and finally, the histogram equalization operation further enhances the image contrast on the basis of fully utilizing the histogram features of each region. Through the above refined process, the image contrast is precisely enhanced, and the image quality of the finally obtained contrast enhanced image is improved. BRIEF DESCRIPTION OF DRAWINGS
[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without any creative effort.
[0024] Figure 1 is a flowchart of a method for image contrast enhancement of non-uniform exposure disclosed by the embodiment of the present application; Figure 2 is a flowchart of another method for image contrast enhancement of non-uniform exposure disclosed by the embodiment of the present application; Figure 3 is a structural schematic diagram of an image contrast enhancement device for non-uniform exposure disclosed by an embodiment of the present application; Figure 4 is a structural schematic diagram of another image contrast enhancement device for non-uniform exposure disclosed by an embodiment of the present application; Figure 5 is a result schematic diagram corresponding to a plurality of initial sub-histograms obtained by performing a first image segmentation operation on a drawing image disclosed by an embodiment of the present application; Figure 6 is a result schematic diagram corresponding to a plurality of target sub-histograms obtained by performing a second image segmentation operation on a drawing image disclosed by an embodiment of the present application; Figure 7 is a result schematic diagram corresponding to a region re-segmentation result corresponding to a second image processing result disclosed by an embodiment of the present application; Figure 8 is a result schematic diagram corresponding to a result of equalization corresponding to all new target sub-histograms disclosed by an embodiment of the present application. DETAILED DESCRIPTION
[0025] In order to make the personnel in the art better understand the present application scheme, the technical scheme in the embodiments of the present application will be described clearly and completely below in combination with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by the person skilled in the art without creative labor fall within the scope of protection of the present application.
[0026] The terms "first", "second", and the like in the specification and claims of the present application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, device, product, or end including a series of steps or units is not limited to the listed steps or units, but can optionally include steps or units not listed, or can optionally include other steps or units inherent to the process, method, product, or end.
[0027] Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the present application. The appearance of the phrase in various places in the specification does not necessarily all refer to the same embodiment, nor is it necessarily mutually exclusive or alternative to other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0028] The application discloses an image contrast enhancement method and device for non-uniform exposure, comprehensively understands image brightness distribution through a first image processing operation; target exposure thresholds including multiple sub-exposure thresholds are adaptively determined, and the division precision of exposure regions is improved; a second image processing operation refines histogram processing and generates multiple target sub-histograms, reduces calculation errors existing in global processing, and improves subsequent processing precision and pertinence; in a third image processing operation, the coordination of an enhanced image in brightness and contrast is improved by reasonably allocating a gray scale range, redefining exposure thresholds further optimizes the division of exposure regions, and a final histogram equalization operation further enhances image contrast on the basis of fully utilizing histogram features of regions. Through the above fine process, accurate enhancement of image contrast is realized, and the image quality of a contrast-enhanced image obtained finally is improved. The following is described in detail.
[0029] Embodiment one Please refer to Figure 1 , Figure 1 is a flowchart of an image contrast enhancement method for non-uniform exposure disclosed by the embodiment of the application. Wherein, Figure 1 The image contrast enhancement method for non-uniform exposure described can be applied to an image contrast enhancement device for non-uniform exposure, and the embodiment of the application is not limited. As shown in the figure, Figure 1 The image contrast enhancement method for non-uniform exposure can include the following operations: 101. Perform a first image processing operation on an obtained original image to obtain a first image processing result corresponding to the original image.
[0030] In the embodiment of the application, the original image is an image to be subjected to an image contrast enhancement operation; the first image processing operation at least includes a global brightness histogram calculation operation, a brightness histogram mean value calculation operation and a brightness histogram variance calculation operation.
[0031] In the embodiment of the application, the first image processing operation performed on the original image can comprehensively understand the overall brightness distribution of the image, providing basic data for subsequent processing. Through calculation of the mean value and the variance, the brightness characteristics of the image can be more accurately grasped.
[0032] 102. Determine a target exposure threshold corresponding to the original image according to the first image processing result.
[0033] In the embodiment of the application, the target exposure threshold includes multiple sub-exposure thresholds.
[0034] The adaptive threshold determination manner in the embodiment of the application can fully consider exposure differences of different regions of an image, accurately divide different exposure regions according to actual brightness distribution, and improve the accuracy of image segmentation.
[0035] 103. Perform a second image processing operation on the first image processing result according to the target exposure threshold to obtain a second image processing result corresponding to the first image processing result.
[0036] In the embodiment of the application, the second image processing operation includes a histogram construction operation, a gray mean value calculation operation, and a histogram segmentation operation; and the second image processing result is a plurality of target sub-histograms.
[0037] In the embodiment of the application, the features of different exposure regions of an image can be better mined by constructing a new histogram, calculating a gray mean value, and accurately segmenting a histogram. The generation of the plurality of target sub-histograms enables subsequent processing to be more personalized in contrast enhancement for different regions, and avoids problems caused by global processing.
[0038] 104. Perform a third image processing operation on the second image processing result to obtain a third image processing result corresponding to the second image processing result.
[0039] In the embodiment of the application, the third image processing operation includes a gray scale range allocation operation, a redefinition for the target exposure threshold, and a histogram equalization operation; and the third image processing result is an image on which a contrast enhancement operation is completed.
[0040] In the embodiment of the application, the gray scale range allocation operation can reasonably allocate a gray scale range according to exposure conditions of different regions, so that the enhanced image is more coordinated in brightness and contrast. The redefinition for the target exposure threshold further optimizes the division of exposure regions, and ensures the accuracy of contrast enhancement. Finally, through the histogram equalization operation, effective enhancement of image contrast is realized on the basis of fully utilizing the histogram features of each region, and finally a high-quality contrast-enhanced image is obtained.
[0041] It can be seen that, by implementing the method, the exposure difference of different regions of an image can be fully considered, different exposure regions can be accurately divided according to actual brightness distribution, the accuracy of image segmentation can be improved, and the accuracy of contrast enhancement can be improved. Figure 1The described image contrast enhancement method for non-uniform exposure comprehensively understands the image brightness distribution through the first image processing operation; the target exposure threshold including multiple sub-exposure thresholds is adaptively determined, the division accuracy of the exposure area is improved; the second image processing operation refines the histogram processing and generates multiple target sub-histograms, reduces the calculation error existing in the global processing, and improves the subsequent processing accuracy and pertinence; in the third image processing operation, the coordination of the enhanced image in brightness and contrast is improved by reasonably allocating the gray scale range, the exposure area division is further optimized by redefining the exposure threshold, and the final histogram equalization operation further enhances the image contrast on the basis of fully utilizing the histogram characteristics of each area. Through the above fine process, the image contrast is accurately enhanced, and the image quality of the finally obtained contrast enhanced image is improved.
[0042] In an optional embodiment, the manner of performing the first image processing operation on the obtained original image to obtain the first image processing result corresponding to the original image in the step 101 specifically includes: Performing a gray scale conversion processing on the obtained original image to obtain a gray scale image corresponding to the original image; According to a preset global brightness histogram calculation function and a histogram drawing function, sequentially performing a histogram calculation operation and an image drawing operation on the gray scale image to obtain a histogram calculation result corresponding to the gray scale image and a drawing image corresponding to the histogram calculation result; the histogram calculation result is a multi-dimensional array; According to a preset mean value calculation formula and a variance calculation formula, calculating a mean value calculation result and a variance calculation result corresponding to the histogram calculation result; The histogram calculation result, the drawing image, the mean value calculation result, and the variance calculation result are determined as the first image processing result corresponding to the original image.
[0043] In this optional embodiment, the global brightness histogram calculation function can adopt the conventional histogram calculation function cv2.calcHist() of the OpenCV library, and the histogram drawing function can adopt the histogram drawing function plt.bar() and show() of the Matplotlib library. The application of the global brightness histogram calculation function and the histogram drawing function can refer to the conventional usage of the two functions, which will not be described here.
[0044] In this optional embodiment, the mean value calculation formula corresponds to the formula:
[0045] The variance calculation formula corresponds to the formula:
[0046] In the mean calculation formula and the variance calculation formula, is a global brightness histogram, corresponding to the histogram result described above, i is a histogram gray scale; is a mean calculation result; is a variance calculation result.
[0047] It can be seen that in the optional embodiment, first, the original image is subjected to grayscale conversion to remove color interference and make the brightness analysis more accurate; second, the histogram calculation and drawing are combined to intuitively display the grayscale pixel distribution and provide support for subsequent strategy formulation; third, the mean and variance are calculated to accurately reflect the brightness distribution characteristics and provide a reference for contrast enhancement; and finally, multiple results are integrated as the first image processing result, thereby improving the detail and accuracy of the first image processing result.
[0048] In another optional embodiment, the manner in which the step 102 determines the target exposure threshold corresponding to the original image according to the first image processing result specifically includes: determining a target exposure threshold for the original image, the target exposure threshold including multiple sub-exposure thresholds; and determining a threshold calculation formula corresponding to each sub-exposure threshold, the multiple sub-exposure thresholds including a low exposure threshold, a suitable exposure threshold, and an overexposure threshold; According to the mean calculation result, the variance calculation result, and the threshold calculation formula corresponding to each sub-exposure threshold, a threshold calculation result corresponding to each sub-exposure threshold is calculated to update the target exposure threshold.
[0049] In the optional embodiment, the threshold calculation formula corresponding to the low exposure threshold is:
[0050] The threshold calculation formula corresponding to the suitable exposure threshold is:
[0051] The threshold calculation formula corresponding to the overexposure threshold is:
[0052] wherein U_t is the low exposure threshold, M_t is the suitable exposure threshold, O_t is the overexposure threshold, V_a is the brightness mean, corresponding to the mean calculation result described above, and V_d is the brightness variance, corresponding to the variance calculation result described above.
[0053] It can be seen that, in the optional embodiment, by dividing the target exposure threshold into multiple sub-exposure thresholds, the division accuracy of the exposure threshold is improved compared with the single fixed defect existing in the conventional threshold setting; by customizing the threshold calculation formula for each sub-exposure threshold, the scientificity and accuracy of the threshold setting are improved; and by dynamically calculating the threshold in combination with image features such as mean value and variance, the calculation accuracy and scientificity of the target exposure threshold are further improved.
[0054] In yet another optional embodiment, the manner in which the above-mentioned step 103 performs a second image processing operation on the first image processing result according to the target exposure threshold to obtain a second image processing result corresponding to the first image processing result specifically comprises: performing a first image segmentation operation on the drawing image with all the sub-exposure thresholds as first segmentation thresholds to obtain multiple initial sub-histograms corresponding to the drawing image; and calculating a gray mean value corresponding to each initial sub-histogram according to a preset gray mean value calculation formula; performing a second image segmentation operation on the drawing image with all the gray mean values as second segmentation thresholds to obtain multiple target sub-histograms corresponding to the drawing image; determining all the target sub-histograms as the second image processing result.
[0055] In this optional embodiment, please refer to Figure 5 and Figure 6 , Figure 5 is a result schematic diagram corresponding to the multiple initial sub-histograms obtained by performing the first image segmentation operation on the drawing image according to the embodiment of the application; Figure 6 is a result schematic diagram corresponding to the multiple target sub-histograms obtained by performing the second image segmentation operation on the drawing image according to the embodiment of the application. Figure 5 and Figure 6 In the above-mentioned Figure 6 , it should be noted that Figure 6 In the above-mentioned M_u, M_w, M_h, M_o are the second segmentation thresholds, G1, G2, G3, G4, G5 are segmentation regions, and the multiple target sub-histograms are obtained by performing the second image segmentation operation. Figure 6 In the above-mentioned Figure 6 , span_G1, span_G2, span_G3, span_G4, span_G5 are the gray scale spans of each region / target sub-histogram. On this basis, the regions mentioned in the following text correspond to a target sub-histogram, and the following text will not be described again.
[0056] In this optional embodiment, the gray mean value calculation formula used is:
[0057]
[0058]
[0059]
[0060] wherein M_u, M_w, M_h, M_o are the average gray values corresponding to the low exposure threshold, the appropriate exposure threshold, the high exposure threshold and the overexposure threshold respectively; 、 、 、 are the histograms corresponding to the four exposure thresholds respectively, and i is the gray scale of the histogram.
[0061] It can be seen that in the optional embodiment, the multi-stage segmentation threshold setting is adopted, the preliminary segmentation is performed by the sub-exposure threshold, and the secondary segmentation is performed by the average gray value, so that the accuracy of segmentation is improved; the multi-level segmentation strategy is implemented, the image brightness features are deeply mined, and the fine processing demand can be met.
[0062] Embodiment Two Please refer to Figure 2 , Figure 2 is another flow diagram of the image contrast enhancement method for non-uniform exposure disclosed by the embodiment of the present application. Wherein, Figure 2 The image contrast enhancement method for non-uniform exposure described can be applied to an image contrast enhancement device for non-uniform exposure, and the embodiment of the present application is not limited. As Figure 2 shown, the image contrast enhancement method for non-uniform exposure can include the following operations: 201, performing a first image processing operation on the obtained original image to obtain a first image processing result corresponding to the original image.
[0063] 202, determining a target exposure threshold corresponding to the original image according to the first image processing result.
[0064] 203, performing a second image processing operation on the first image processing result according to the target exposure threshold to obtain a second image processing result corresponding to the first image processing result.
[0065] 204, performing a dynamic gray scale calculation operation on each target sub-histogram to obtain a dynamic gray scale calculation result corresponding to each target sub-histogram.
[0066] In the embodiment of the present application, the dynamic gray scale calculation operation includes a gray scale span calculation operation based on a preset gray scale span formula, a weight calculation operation based on a preset weight calculation formula, and a gray scale range calculation operation based on a preset gray scale range formula. The dynamic gray scale calculation result includes at least a dynamic gray scale range corresponding to each target sub-histogram.
[0067] In the embodiment of the present application, the gray scale span calculation can understand the gray scale distribution width of each region, the weight calculation can determine the importance of different regions in the image, and the gray scale range calculation can determine the appropriate dynamic gray scale range according to the results of the previous two, so that the gray scale processing of each region is more accurate, and the detail information of the image is effectively preserved.
[0068] 205. Perform a preset redefinition operation on all target sub-histograms to obtain a redefinition result corresponding to all target sub-histograms as a third image processing result.
[0069] In the embodiment of the present application, the redefinition operation includes a threshold calculation operation based on a preset accumulation calculation formula, a region re-segmentation operation, and a histogram equalization operation.
[0070] In the embodiment of the present application, the threshold calculation operation of the accumulation calculation formula can further optimize the threshold setting and provide more accurate basis for subsequent processing. The region re-segmentation operation performs more fine division of the image region according to the dynamic gray scale calculation result and the threshold calculation result in the early stage, to ensure that the characteristics of different regions are fully reflected. The histogram equalization operation is performed on the basis of the previous steps, which can more effectively enhance the contrast of the image, while avoiding the problems caused by simple histogram equalization.
[0071] In the embodiment of the present application, for other descriptions of steps 201-203, please refer to other specific descriptions of steps 101-103 in Embodiment One. The embodiment of the present application will not be repeated here.
[0072] It can be seen that the implementation Figure 2 The described image contrast enhancement method for non-uniform exposure can better adapt to the characteristics of non-uniform exposure images through dynamic gray scale calculation and comprehensive redefinition operation, fully preserve the detail information of the image, highlight the important regions in the image, enhance the contrast of the image, while avoiding problems such as noise amplification and detail blur, making the processed image more clear and natural in vision, and improving the overall quality of the image.
[0073] In an optional embodiment, the manner of performing the dynamic gray scale calculation operation on each target sub-histogram in step 204 specifically includes: For each target sub-histogram, a gray scale span result corresponding to the target sub-histogram is calculated according to a preset gray scale span formula; the gray scale span formula is used to calculate a numerical span between a maximum gray scale value and a minimum gray scale value corresponding to the target sub-histogram; According to a preset weight calculation formula, a weight calculation result corresponding to the target sub-histogram is calculated in combination with the gray scale span result corresponding to the target sub-histogram; According to a preset gray scale range formula, a dynamic gray scale range corresponding to the target sub-histogram is calculated in combination with the weight calculation result corresponding to the target sub-histogram.
[0074] In the optional embodiment, the gray scale span formula is specially used to calculate a numerical span between a maximum gray scale value and a minimum gray scale value corresponding to the target sub-histogram. Through such accurate calculation for each sub-histogram, the gray scale distribution characteristics of different exposure regions can be fully considered, thereby providing accurate basic data for subsequent weight calculation and gray scale range determination.
[0075] In the optional embodiment, the gray scale span result reflects the gray scale variation range of the region, and the weight calculation formula reasonably allocates the weight according to the variation range. A region with a large gray scale span usually contains more detailed information and is more important in the image, and is correspondingly given a higher weight. Through scientific weight calculation, important regions in the image can be highlighted, so that the image after contrast enhancement has more levels and focuses, thereby improving the contrast enhancement effect and the visual effect of the image.
[0076] In the optional embodiment, the dynamic gray scale range can be adaptively adjusted according to the importance and gray scale characteristics of different regions, thereby avoiding the unreasonable gray scale range setting in the prior art, so that the image can achieve the best contrast effect in different regions, thereby improving the contrast enhancement effect.
[0077] In the optional embodiment, the gray scale range of all target sub-histograms is redistributed by entropy, so that there is a larger balanced range in a region with a relatively concentrated gray scale, which helps to reduce the interval between output gray levels in the gray scale mapping process, reduce the abrupt change between brightness, and maximize the preservation of image details.
[0078] In the optional embodiment, the gray scale span formula used above is as follows:
[0079] wherein, is the gray scale span of the i-th target sub-histogram; , are the maximum gray scale value and the minimum gray scale value of the i-th target sub-histogram, respectively.
[0080] In the optional embodiment, the weight calculation formula used above is:
[0081] wherein, is an entropy factor, is the number of non-zero gray scale bins in the region, and N is the total number of gray scale bins in the region, is the weight calculation result corresponding to the i-th target sub-histogram, which can also be referred to as a region weight factor.
[0082] In addition, the entropy factor corresponds to the following calculation formula:
[0083]
[0084] wherein, is the entropy of the i-th target sub-histogram, and L is the gray scale range of the region, is the probability density function of the region.
[0085] In the optional embodiment, the gray scale range formula used above is:
[0086] wherein, is the dynamic gray scale range corresponding to the i-th target sub-histogram under the control of the entropy, and L is the total gray scale corresponding to the i-th target sub-histogram, is the region weight factor corresponding to the i-th target sub-histogram, and k is the number of all target sub-histograms.
[0087] As can be seen, in the optional embodiment, through accurate gray scale span calculation, scientific weight calculation and dynamic gray scale range determination, the contrast enhancement effect and visual quality of the image are significantly improved.
[0088] In another optional embodiment, the manner in which the step 205 performs the preset redefinition operation on all target sub-histograms to obtain the redefinition results corresponding to all target sub-histograms as the third image processing result includes: According to a preset accumulation calculation formula, the new target exposure threshold values corresponding to all target sub-histograms are calculated in combination with the dynamic gray scale ranges corresponding to each target sub-histogram; According to all new target exposure threshold values, a region re-segmentation operation is performed on the second image processing result to obtain a region re-segmentation result corresponding to the second image processing result; the region re-segmentation result includes a plurality of new target sub-histograms; The preset histogram equalization operation is performed on each new target sub-histogram to obtain an equalization result corresponding to all new target sub-histograms as a third image processing result.
[0089] In the optional embodiment, the dynamic gray scale range reflects the gray scale characteristic change of each target sub-histogram in the processing process, and the cumulative calculation formula calculates the new exposure threshold based on the changes. This dynamic updating of the exposure threshold can timely adapt to the change of the exposure characteristics of different regions in the image processing process, so that the subsequent regional re-segmentation and histogram equalization operation can be more accurately processed according to the exposure of different regions, thereby improving the accuracy and uniformity of the image contrast enhancement.
[0090] In the optional embodiment, the new target exposure threshold considers the dynamic change in the image processing process, and the regional re-segmentation based on these thresholds can more accurately divide the regions with different exposure characteristics, so that each new target sub-histogram can better represent the actual exposure of the region.
[0091] In the optional embodiment, since the new target sub-histograms are obtained based on the dynamically updated exposure threshold and regional re-segmentation, they can more accurately reflect the characteristics of different regions of the image. The histogram equalization operation based on this can make full use of these dynamic information, and perform contrast enhancement according to the actual situation of each region, thereby avoiding the problems caused by the simple isolation of the traditional histogram equalization processing, effectively improving the contrast and visual effect of the image, and reducing noise and detail loss.
[0092] In the optional embodiment, the cumulative calculation formula used above is:
[0093] Wherein, the value of i is [1, 4], and further, M1, M2, M3 and M4 correspond to the four exposure thresholds of the original histogram redefined according to the allocated gray scale range, that is, the new target exposure threshold. The dynamic gray scale range calculated by the gray scale range formula.
[0094] In the optional embodiment, please refer to Figure 7 , Figure 7 is a result diagram corresponding to the regional re-segmentation result corresponding to the second image processing result disclosed in the embodiment of the present application. As shown in Figure 7 , Figure 7The two parts include an upper part and a lower part. The upper part is a schematic diagram of the segmentation result corresponding to the plurality of target sub-histograms obtained by performing the second image segmentation operation on the drawing image. The lower part is a schematic diagram of the segmentation result corresponding to the plurality of new target sub-histograms obtained by performing the region re-segmentation operation on the second image processing result through the new target exposure threshold.
[0095] In the optional embodiment, Figure 7 In the formula, Gr1, Gr2, Gr3, Gr4, and Gr5 are five regions after re-segmentation (corresponding to the new target sub-histograms), and span_Gr1, span_Gr2, span_Gr3, span_Gr4, and span_Gr5 are the gray scale ranges of the regions. By comparing Figure 7 In the upper and lower two parts of the image, it can be determined that, on the histogram of non-uniform exposure, the high-frequency and low-frequency bin region ranges are better balanced and distributed, and the regions with concentrated pixels have a larger balanced range after re-segmentation.
[0096] In the optional embodiment, the specific manner of performing the preset histogram equalization operation on each new target sub-histogram to obtain the equalization result corresponding to all the new target sub-histograms includes the following steps. First, for each new target sub-histogram, a probability density function PDF corresponding to the new target sub-histogram is calculated. The calculation formula of the probability density function PDF is as follows:
[0097] In the formula, PDFi is the probability density function corresponding to the i-th new target sub-histogram, is the probability density function corresponding to the i-th new target sub-histogram, is the original brightness histogram corresponding to the i-th new target sub-histogram (corresponding to the global brightness histogram), is the number of histogram pixels corresponding to the i-th new target sub-histogram, L is the maximum gray scale corresponding to the original brightness histogram, and n is the number of all new target sub-histograms, is the new target exposure threshold calculated by using the accumulation calculation formula.
[0098] Secondly, a cumulative distribution function CDF is calculated. The calculation formula of the cumulative distribution function CDF is as follows:
[0099] In the formula, CDFi and PDFi are the cumulative distribution function and the probability density function corresponding to the i-th new target sub-histogram, respectively.
[0100] Finally, a global mapping curve T is obtained according to the cumulative distribution function CDF corresponding to each new target sub-histogram. G The global mapping curve TG The corresponding calculation formula is as follows:
[0101] Wherein, is the global mapping curve corresponding to the i-th new target sub-histogram, is the cumulative distribution function corresponding to the i-th new target sub-histogram.
[0102] In this optional embodiment, the cumulative distribution function CDF and the global mapping curve T G The parameters of , L, and n are described above in relation to the corresponding parameters in the probability density function PDF, and are not repeated here.
[0103] In this optional embodiment, please refer to Figure 8 , Figure 8 is the result diagram corresponding to the equalization result of all new target sub-histograms disclosed in the embodiments of the present application; as shown in Figure 8 , Figure 8 includes two parts, wherein the upper half is a result diagram corresponding to the region redivision result obtained by performing a region redivision operation on the second image processing result according to all new target exposure thresholds; and the lower half is a result diagram corresponding to the equalization result obtained by performing a histogram equalization operation on each new target sub-histogram. By comparing the upper and lower diagrams in Figure 8 , it can be clearly seen that the histogram gray scale distribution after contrast enhancement obtained through the above complete process is uniform, and the low exposure and overexposure regions have good equalization effect.
[0104] As can be seen, in this optional embodiment, through dynamic exposure threshold updating, dynamic region resegmentation based on new thresholds, and histogram equalization combined with dynamic information, the image processing effect and quality are significantly improved.
[0105] Embodiment Three Please refer to Figure 3 , Figure 3 is a structural diagram of an image contrast enhancement device for non-uniform exposure disclosed in the embodiments of the present application. The image contrast enhancement device for non-uniform exposure can be an image contrast enhancement terminal, device, system or server for non-uniform exposure. The server can be a local server, a remote server, or a cloud server (also known as a cloud server). When the server is a non-cloud server, the non-cloud server can be connected to the cloud server for communication. The embodiments of the present application are not limited. As shown in Figure 3As shown, the image contrast enhancement device for non-uniform exposure can include a first image processing module 301, a threshold determination module 302, a second image processing module 303, and a third image processing module 304, wherein: The first image processing module 301 is configured to perform a first image processing operation on the obtained original image to obtain a first image processing result corresponding to the original image; the original image is an image to be subjected to an image contrast enhancement operation; the first image processing operation at least includes a global brightness histogram calculation operation, a brightness histogram mean value calculation operation, and a brightness histogram variance calculation operation.
[0106] The threshold determination module 302 is configured to determine a target exposure threshold corresponding to the original image according to the first image processing result; the target exposure threshold includes a plurality of sub-exposure thresholds.
[0107] The second image processing module 303 is configured to perform a second image processing operation on the first image processing result according to the target exposure threshold to obtain a second image processing result corresponding to the first image processing result; the second image processing operation includes a histogram construction operation, a gray mean value calculation operation, and a histogram segmentation operation; the second image processing result includes a plurality of target sub-histograms.
[0108] The third image processing module 304 is configured to perform a third image processing operation on the second image processing result to obtain a third image processing result corresponding to the second image processing result; the third image processing operation includes a gray scale range allocation operation, a redefinition for the target exposure threshold, and a histogram equalization operation; the third image processing result is an image subjected to the image contrast enhancement operation.
[0109] It can be seen that the implementation Figure 3 The described image contrast enhancement device for non-uniform exposure can comprehensively understand the image brightness distribution through the first image processing operation; the target exposure threshold including a plurality of sub-exposure thresholds can be adaptively determined to improve the division accuracy of the exposure region; the second image processing operation refines the histogram processing and generates a plurality of target sub-histograms to reduce the calculation error of global processing and improve the subsequent processing accuracy and pertinence; in the third image processing operation, the gray scale range is reasonably allocated to improve the coordination of the enhanced image in brightness and contrast, the exposure threshold is redefined to further optimize the division of the exposure region, and finally the histogram equalization operation further enhances the image contrast on the basis of fully utilizing the histogram features of each region. Through the above fine process, the image contrast is accurately enhanced, and the image quality of the finally obtained contrast enhanced image is improved.
[0110] In an optional embodiment, the first image processing module 301 performs a first image processing operation on the obtained original image to obtain a first image processing result corresponding to the original image, and the manner specifically includes: performing a gray scale conversion processing on the obtained original image to obtain a gray scale image for the original image; performing a histogram calculation operation and an image drawing operation on the gray scale image in sequence according to a preset global brightness histogram calculation function and a histogram drawing function to obtain a histogram calculation result for the gray scale image and a corresponding drawing image; the histogram calculation result is a multi-dimensional array; calculating a mean value calculation result and a variance calculation result corresponding to the histogram calculation result according to preset mean value calculation formula and variance calculation formula; determining the histogram calculation result, the drawing image, the mean value calculation result, and the variance calculation result as the first image processing result corresponding to the original image.
[0111] As can be seen, in this optional embodiment, the original image is first converted to a gray scale image to remove color interference and make the brightness analysis more accurate; secondly, the histogram calculation and drawing are combined to intuitively show the gray scale pixel distribution and provide support for subsequent strategy making; then, the mean value and variance are calculated to accurately reflect the brightness distribution characteristics and provide a reference for contrast enhancement; finally, the multiple results are comprehensively determined as the first image processing result, thereby improving the detail and accuracy of the first image processing result.
[0112] In another optional embodiment, the threshold determination module 302 determines a target exposure threshold corresponding to the original image according to the first image processing result, and the manner specifically includes: determining a target exposure threshold for the original image, the target exposure threshold including multiple sub-exposure thresholds; and determining a threshold calculation formula corresponding to each sub-exposure threshold, the multiple sub-exposure thresholds including a low exposure threshold, a suitable exposure threshold, and an overexposure threshold; calculating a threshold settlement result corresponding to each sub-exposure threshold according to the mean value calculation result, the variance calculation result, and the threshold calculation formula corresponding to each sub-exposure threshold to update the target exposure threshold.
[0113] As can be seen, in this optional embodiment, by dividing the target exposure threshold into multiple sub-exposure thresholds, the division accuracy of the exposure threshold is improved compared to the single fixed defect of the conventional threshold setting; by customizing a threshold calculation formula for each sub-exposure threshold, the scientificity and accuracy of the threshold setting are improved; and by dynamically calculating the threshold in combination with the mean value, variance, and other image features, the calculation accuracy and scientificity of the target exposure threshold are further improved.
[0114] In yet another optional embodiment, the second image processing module 303 performs a second image processing operation on the first image processing result according to the target exposure threshold, and the manner in which the second image processing result corresponding to the first image processing result is obtained specifically includes: performing a first image segmentation operation on the drawing image with all the sub-exposure thresholds as the first segmentation threshold to obtain a plurality of initial sub-histograms corresponding to the drawing image; and calculating a gray mean value corresponding to each initial sub-histogram according to a preset gray mean value calculation formula; performing a second image segmentation operation on the drawing image with all the gray mean values as the second segmentation threshold to obtain a plurality of target sub-histograms corresponding to the drawing image; determining all the target sub-histograms as the second image processing result.
[0115] It can be seen that in this optional embodiment, a multi-stage segmentation threshold setting is adopted, i.e., preliminary segmentation with the sub-exposure threshold and secondary segmentation with the gray mean value, which improves the accuracy of segmentation; and a multi-level segmentation strategy is implemented to deeply explore the image brightness features, which can meet the fine processing requirements.
[0116] In another optional embodiment, the third image processing module 304 performs a third image processing operation on the second image processing result, and the manner in which the third image processing result corresponding to the second image processing result is obtained specifically includes: performing a dynamic gray scale calculation operation on each target sub-histogram to obtain a dynamic gray scale calculation result corresponding to each target sub-histogram; the dynamic gray scale calculation operation includes a gray scale span calculation operation based on a preset gray scale span formula, a weight calculation operation based on a preset weight calculation formula, and a gray scale range calculation operation based on a preset gray scale range formula; the dynamic gray scale calculation result at least includes a dynamic gray scale range corresponding to each target sub-histogram; performing a preset redefinition operation on all the target sub-histograms to obtain a redefinition result corresponding to all the target sub-histograms as the third image processing result; wherein the redefinition operation includes a threshold calculation operation based on a preset accumulation calculation formula, a region re-segmentation operation, and a histogram equalization operation.
[0117] It can be seen that in this optional embodiment, through the dynamic gray scale calculation and comprehensive redefinition operation, the characteristics of the non-uniform exposure image can be better adapted to, the details of the image can be fully preserved, the important regions in the image can be highlighted, the contrast of the image can be enhanced, and at the same time, problems such as noise amplification and detail blurring can be avoided, so that the processed image is more clear and natural in vision, and the overall quality of the image is improved.
[0118] In yet another optional embodiment, the third image processing module 304 performs a dynamic gray scale calculation operation on each target sub-histogram in a manner that specifically includes: For each target sub-histogram, a gray scale span result corresponding to the target sub-histogram is calculated according to a preset gray scale span formula; the gray scale span formula is used to calculate a numerical span between a maximum gray scale value and a minimum gray scale value corresponding to the target sub-histogram; A weight calculation result corresponding to the target sub-histogram is calculated according to a preset weight calculation formula in combination with the gray scale span result corresponding to the target sub-histogram; A dynamic gray scale range corresponding to the target sub-histogram is calculated according to a preset gray scale range formula in combination with the weight calculation result corresponding to the target sub-histogram.
[0119] It can be seen that, in this optional embodiment, through accurate gray scale span calculation, scientific weight calculation, and dynamic gray scale range determination, the contrast enhancement effect and visual quality of the image are significantly improved.
[0120] In another optional embodiment, the third image processing module 304 performs a preset redefinition operation on all target sub-histograms in a manner that specifically includes: A new target exposure threshold corresponding to all target sub-histograms is calculated according to a preset accumulation calculation formula in combination with the dynamic gray scale range corresponding to each target sub-histogram; A region re-segmentation result corresponding to the second image processing result is obtained by performing a region re-segmentation operation on the second image processing result according to all new target exposure thresholds; the region re-segmentation result includes a plurality of new target sub-histograms; A histogram equalization result corresponding to all new target sub-histograms is obtained by performing a preset histogram equalization operation on each new target sub-histogram, as the third image processing result.
[0121] It can be seen that, in this optional embodiment, through dynamic exposure threshold updating, dynamic region re-segmentation based on new thresholds, and histogram equalization in combination with dynamic information, the effect and quality of image processing are significantly improved.
[0122] Embodiment Four Please refer to Figure 4 , Figure 4 is another structure diagram of the image contrast enhancement device for non-uniform exposure disclosed by the embodiments of the present application. As shown in Figure 4 , the image contrast enhancement device for non-uniform exposure can include: a memory 401 storing executable program codes; a processor 402 coupled to the memory 401; The processor 402 invokes the executable program code stored in the memory 401 to execute any one of the steps described in the embodiment one or the embodiment two of the present application.
[0123] Embodiment five The embodiment of the present application discloses a computer storage medium, which stores computer instructions, when invoked, for executing any one of the steps described in the embodiment one or the embodiment two of the present application.
[0124] The above described device embodiments are only schematic, wherein the modules described as separate components can or can not be physically separate, and the components displayed as modules can or can not be physical modules, i.e. can be located in one place, or can be distributed to multiple network modules. Part or all of the modules can be selected according to actual needs to achieve the purpose of the present embodiment. Those skilled in the art can understand and implement without creative labor.
[0125] Those skilled in the art can clearly understand the technical solutions of the various embodiments through the above specific description of the embodiments, and the various embodiments can be realized by means of software and necessary universal hardware platforms, and of course, can also be realized by hardware. Based on such understanding, the above technical solutions, essentially or in terms of contribution to the prior art, can be embodied in the form of a software product. The computer software product can be stored in a computer readable storage medium, which includes a Read-Only Memory (ROM), a Random Access Memory (RAM), a Programmable Read-only Memory (PROM), an Erasable Programmable Read Only Memory (EPROM), a One-time Programmable Read-Only Memory (OTPROM), an Electrically-Erasable Programmable Read-Only Memory (EEPROM), a Compact Disc Read-Only Memory (CD-ROM), or other optical disk storage, magnetic disk storage, magnetic tape storage, or any other medium that can be used to carry or store computer readable instructions.
[0126] Finally, it should be noted that: the above-mentioned embodiments disclosed only the preferred embodiments of the present application, only for the description of the technical solutions of the present application, and not limited; although the present application is described in detail with reference to the foregoing embodiments, those skilled in the art should understand; it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part of the technical features; and these modifications or replacements do not make the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for enhancing image contrast for non-uniform exposure, characterized in that: The method comprises: Performing a first image processing operation on the acquired original image to obtain a first image processing result corresponding to the original image; the original image is an image on which an image contrast enhancement operation is to be performed; the first image processing operation includes at least a global brightness histogram calculation operation, a brightness histogram mean calculation operation, and a brightness histogram variance calculation operation; Determining a target exposure threshold corresponding to the original image based on the first image processing result, and performing a second image processing operation on the first image processing result based on the target exposure threshold to obtain a second image processing result corresponding to the first image processing result; the target exposure threshold includes a plurality of sub-exposure thresholds; the second image processing operation includes a histogram construction operation, a grayscale mean calculation operation, and a histogram segmentation operation; the second image processing result includes a plurality of target sub-histograms; A third image processing operation is performed on the second image processing result to obtain a third image processing result corresponding to the second image processing result; the third image processing operation includes a grayscale range allocation operation, a redefinition of the target exposure threshold, and a histogram equalization operation; and the third image processing result is an image that completes the image contrast enhancement operation.
2. The image contrast enhancement method for non-uniform exposure according to claim 1, characterized in that: The performing a first image processing operation on the acquired original image to obtain a first image processing result corresponding to the original image includes: Performing grayscale conversion processing on the acquired original image to obtain a grayscale image of the original image; According to a preset global brightness histogram calculation function and a preset histogram drawing function, a histogram calculation operation and an image drawing operation are sequentially performed on the grayscale image to obtain a histogram calculation result for the grayscale image and a corresponding drawn image; the histogram calculation result is a multidimensional array; Calculate the mean value and the variance value corresponding to the histogram calculation result according to the preset mean value and variance calculation formula; The histogram calculation result, the drawn image, the mean calculation result, and the variance calculation result are determined as a first image processing result corresponding to the original image.
3. The image contrast enhancement method for non-uniform exposure according to claim 2, characterized in that: The determining, based on the first image processing result, a target exposure threshold corresponding to the original image includes: determining a target exposure threshold for the original image, the target exposure threshold including a plurality of sub-exposure thresholds; and determining a threshold calculation formula corresponding to each of the sub-exposure thresholds, the plurality of sub-exposure thresholds including an underexposure threshold, a proper exposure threshold, and an overexposure threshold; According to the mean calculation result and the variance calculation result, combined with the threshold calculation formula corresponding to each sub-exposure threshold, the threshold settlement result corresponding to each sub-exposure threshold is calculated to update the target exposure threshold.
4. The image contrast enhancement method for non-uniform exposure according to claim 3, characterized in that: The performing a second image processing operation on the first image processing result according to the target exposure threshold to obtain a second image processing result corresponding to the first image processing result includes: performing a first image segmentation operation on the drawn image using all the sub-exposure thresholds as first segmentation thresholds to obtain a plurality of initial sub-histograms corresponding to the drawn image; and calculating a grayscale mean corresponding to each of the initial sub-histograms according to a preset grayscale mean calculation formula; performing a second image segmentation operation on the drawn image using the mean of all the grayscale values as a second segmentation threshold, to obtain a plurality of target subhistograms corresponding to the drawn image; All the target subhistograms are determined as the second image processing result.
5. The method for enhancing image contrast for non-uniform exposure according to any one of claims 1 to 4, characterized in that: The performing a third image processing operation on the second image processing result to obtain a third image processing result corresponding to the second image processing result includes: Performing a dynamic grayscale calculation operation on each of the target subhistograms to obtain a dynamic grayscale calculation result corresponding to each of the target subhistograms; the dynamic grayscale calculation operation includes a grayscale span calculation operation based on a preset grayscale span formula, a weight calculation operation based on a preset weight calculation formula, and a grayscale range calculation operation based on a preset grayscale range formula; the dynamic grayscale calculation result includes at least a dynamic grayscale range corresponding to each of the target subhistograms; A preset redefinition operation is performed on all the target subhistograms to obtain redefinition results corresponding to all the target subhistograms as the third image processing result; wherein the redefinition operation includes a threshold calculation operation based on a preset cumulative calculation formula, a region re-segmentation operation, and a histogram equalization operation.
6. The image contrast enhancement method for non-uniform exposure according to claim 5, characterized in that: The performing of a dynamic grayscale calculation operation on each of the target subhistograms to obtain a dynamic grayscale calculation result corresponding to each of the target subhistograms includes: For each of the target subhistograms, a grayscale span result corresponding to the target subhistogram is calculated according to a preset grayscale span formula; the grayscale span formula is used to calculate the numerical span between the grayscale maximum value and the grayscale minimum value corresponding to the target subhistogram; According to a preset weight calculation formula, combined with the grayscale span result corresponding to the target subhistogram, a weight calculation result corresponding to the target subhistogram is calculated; According to the preset grayscale range formula, combined with the weight calculation result corresponding to the target subhistogram, the dynamic grayscale range corresponding to the target subhistogram is calculated.
7. The image contrast enhancement method for non-uniform exposure according to claim 5 or 6, characterized in that: The performing of a preset redefinition operation on all the target subhistograms to obtain redefinition results corresponding to all the target subhistograms as a third image processing result includes: According to a preset cumulative calculation formula, combined with the dynamic grayscale range corresponding to each target sub-histogram, a new target exposure threshold value corresponding to all the target sub-histograms is calculated; performing a region re-segmentation operation on the second image processing result according to all the new target exposure thresholds to obtain a region re-segmentation result corresponding to the second image processing result; the region re-segmentation result includes a plurality of new target sub-histograms; A preset histogram equalization operation is performed on each of the new target subhistograms to obtain equalization results corresponding to all the new target subhistograms as the third image processing result.
8. An image contrast enhancement device for non-uniform exposure, characterized in that: The device comprises: a first image processing module, configured to perform a first image processing operation on the acquired original image to obtain a first image processing result corresponding to the original image; the original image is an image on which an image contrast enhancement operation is to be performed; the first image processing operation includes at least a global brightness histogram calculation operation, a brightness histogram mean calculation operation, and a brightness histogram variance calculation operation; a threshold determination module, configured to determine a target exposure threshold corresponding to the original image based on the first image processing result; the target exposure threshold includes a plurality of sub-exposure thresholds; a second image processing module, configured to perform a second image processing operation on the first image processing result according to the target exposure threshold, to obtain a second image processing result corresponding to the first image processing result; the second image processing operation includes a histogram construction operation, a grayscale mean calculation operation, and a histogram segmentation operation; the second image processing result includes a plurality of target subhistograms; a third image processing module configured to perform a third image processing operation on the second image processing result to obtain a third image processing result corresponding to the second image processing result; the third image processing operation comprising a grayscale range allocation operation, a redefinition of the target exposure threshold, and a histogram equalization operation; and the third image processing result being an image that has undergone the image contrast enhancement operation.
9. An image contrast enhancement device for non-uniform exposure, characterized in that: The device comprises: a memory storing executable program code; a processor coupled to the memory; The processor calls the executable program code stored in the memory to execute the image contrast enhancement method for non-uniform exposure according to any one of claims 1 to 7.
10. A computer storage medium, characterized in that The computer storage medium stores computer instructions, and when the computer instructions are called, they are used to execute the image contrast enhancement method for non-uniform exposure according to any one of claims 1 to 7.
Citation Information
Patent Citations
Histogram local image contrast enhancing method and histogram local image contrast enhancing device
CN104299204A
Image processing method and image processing system
CN114549670A
Uniform exposure image contrast enhancement method based on histogram transformation
CN114998165A
Image enhancement method and system based on double histogram equalization
CN116402729A
Adaptive enhancement method for non-uniform illumination image
CN120125489A