Statistics-based image contrast enhancement method and system, electronic equipment, computer storage medium and program product
By segmenting large images into sub-images and performing overlapping region processing and statistical analysis, the problem of brightness and darkness separation in existing technologies is solved, achieving efficient contrast enhancement while reducing hardware overhead.
Patent Information
- Application Number
- CN202511877875.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-12
- Publication Date
- 2026-02-24
AI Technical Summary
Existing statistical image contrast enhancement methods can lead to the appearance of bright and dark boundaries after processing large images, affecting image display quality and increasing hardware costs.
Large images are segmented into sub-images and peripheral overlapping regions are added. Statistical analysis and low-frequency spatial filtering are performed, target enhancement parameters are calculated, and image processing is carried out using time-division multiplexing technology.
Without increasing hardware costs, improve image processing efficiency, avoid bright and dark boundaries, and ensure contrast enhancement.
Smart Images

Figure CN121563801A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a statistical image contrast enhancement method and system, electronic device, computer storage medium, and program product. Background Technology
[0002] With the development of imaging technology, people are pursuing high-quality display of large-sized images. To this end, a series of image processing steps must be performed on large-sized images, such as white balance correction, contrast enhancement, and depixelation, to ensure that the final displayed image meets expectations.
[0003] However, when the original image size is too large and exceeds the hardware requirements of the image processing system, the image processing system will be unable to process the original image. If the hardware of the image processing system is made to support large-sized images, it will undoubtedly increase the hardware cost.
[0004] To process large images without increasing hardware costs, the original image is typically divided into multiple patches, and then time-division multiplexing technology is used to input these patches into the image processing system for processing. Currently, contrast enhancement for large images is often based on statistics; however, this method divides the area that should have a single statistical value into multiple parts, resulting in obvious bright-dark boundaries in the contrast-enhanced image and affecting image display quality. Summary of the Invention
[0005] The purpose of this invention is to provide a statistical image contrast enhancement method and system, electronic device, computer storage medium and program product, so as to at least solve the problem that existing statistical image contrast enhancement methods cause the existence of bright and dark boundaries in the image.
[0006] To address the aforementioned technical problems, this invention provides a statistical image contrast enhancement method, comprising: Obtain the original image of the current frame, wherein the size of the original image of the current frame is W×H; The original image of the current frame is divided into M×N sub-images, and each sub-image is divided into I×J patches; Add overlapping regions around the perimeter of the subgraph; Statistical analysis is performed on the tiles of each sub-image to obtain contrast feature values and pixel arrays; The initial enhancement parameters are calculated based on the contrast feature values and the pixel array. Each sub-image is assigned initial enhancement parameters, and the initial enhancement parameters are subjected to low-frequency spatial filtering and the sub-images are subjected to boundary fusion processing to obtain the target enhancement parameters. The target enhancement parameters are used to perform contrast enhancement processing on the original image in the next frame.
[0007] Optionally, in the statistical image contrast enhancement method described above, the step of adding an overlapping region to the periphery of the sub-image includes: If at least one edge of the subgraph is the boundary of the original image of the current frame, then an overlapping region is added to the non-boundary edges of the subgraph. If the non-boundary edge of the subgraph is a vertical edge, then the width of the overlapping region added around the vertical edge is 2×W / (M×(I-2)); if the non-boundary edge of the subgraph is a horizontal edge, then the height of the overlapping region added around the horizontal edge is 2×H / (N×(J-2)). If none of the four sides of the sub-image are the boundaries of the original image of the current frame, then an overlapping region is added to the four sides of the sub-image. The width of the overlapping region added to the periphery of the vertical side of the sub-image is W / (M×(I-2)), and the height of the overlapping region added to the periphery of the horizontal side of the sub-image is H / (N×(J-2)).
[0008] Optionally, in the statistical image contrast enhancement method, the step of statistically analyzing the patches of each sub-image to obtain contrast feature values and pixel arrays includes: Histogram statistics and minimum value statistics are performed on all patches to obtain M×N×I×J contrast feature values; Based on the pixel value of each pixel, we obtain M×N×I×J pixel values for the image blocks; The contrast feature values are grouped into groups of M×N, and the minimum value in each group is selected to obtain I×J contrast feature values. The pixel values of the image are grouped into groups of M×N, and the pixel array corresponding to the maximum value in each group is selected to obtain I×J pixel arrays.
[0009] Optionally, in the statistical image contrast enhancement method described above, the step of performing histogram statistics and minimum value statistics on all image patches to obtain M×N×I×J contrast feature values includes: Perform histogram statistics and minimum value statistics on all patches to obtain the histogram and minimum value corresponding to each patch with several bins; Select the bin with the highest count in the histogram and obtain its left and right boundary values; If the minimum value is between the left and right boundary values, then the minimum value is used as the contrast feature value; otherwise, the left boundary value is used as the contrast feature value.
[0010] Optionally, in the statistical image contrast enhancement method described above, the step of obtaining M×N×I×J patch pixel values based on the pixel value of each pixel includes: Obtain the R, B, and G values of each pixel, and calculate the sum of the R, B, and G values to obtain the pixel value of each pixel; Select the maximum value of all pixel values in each tile as the tile pixel value of that tile, so as to obtain M×N×I×J tile pixel values; Save the R, B, and G values corresponding to the pixel values of each patch as a pixel array to obtain M×N×I×J pixel arrays.
[0011] Optionally, in the statistical image contrast enhancement method described above, the step of calculating the initial enhancement parameters based on contrast feature values and the pixel array includes: According to a preset method, several contrast feature values are extracted from I×J contrast feature values, and the three-channel pixel mean is calculated based on the pixel array of all the patches corresponding to the extracted contrast feature values. Low-frequency spatial filtering is performed on the I×J contrast feature values to obtain I×J contrast parameters; I×J initial enhancement parameters are calculated using the three-channel pixel mean and I×J contrast parameters.
[0012] Optionally, in the statistical image contrast enhancement method, the steps of assigning initial enhancement parameters to each sub-image, performing low-frequency spatial filtering on the initial enhancement parameters, and performing boundary fusion on the sub-images to obtain target enhancement parameters include: Distribute the I×J initial enhancement parameters equally among all the tiles; The initial enhancement parameters of I×J patches in each sub-graph are subjected to low-frequency spatial filtering. Boundary fusion processing is performed on the adjacent boundaries of M×N sub-images. The minimum value of the initial enhancement parameters corresponding to the adjacent boundaries is selected as the target enhancement parameter, and the average value of the three-channel pixels is used as the global brightness index.
[0013] Optionally, in the statistical image contrast enhancement method described above, the step of performing contrast enhancement processing on the original image of the next frame using target enhancement parameters includes: Using bilinear interpolation, the target enhancement parameters are interpolated to the sub-target enhancement parameters corresponding to the sub-image of the original image in the next frame; The enhancement parameters of the sub-targets are corrected by using the enhancement intensity to obtain the final enhancement parameters; Using the final enhancement parameters and the three-channel pixel mean, the three-channel pixel values of the next frame of the original image are contrast-enhanced.
[0014] Optionally, in the statistical image contrast enhancement method described above, the size of each sub-image is W / M×H / N; the size of each image patch is W / M / I×H / N / J; Where W and H are positive integers greater than or equal to 3, M and N are positive integers greater than 1, and I and J are positive integers greater than 2.
[0015] To address the aforementioned technical problems, the present invention also provides a statistical image contrast enhancement system, the statistical image contrast enhancement system comprising: The acquisition module is used to acquire the original image of the current frame; The segmentation module is used to segment the original image of the current frame into several sub-images, and each sub-image into multiple patches; The calculation module is used to add overlapping regions to the periphery of the sub-image; it is also used to perform statistics on the patches of each sub-image to obtain contrast feature values and pixel arrays; it is also used to calculate the initial enhancement parameters based on the contrast feature values and pixel arrays; and it is used to assign the initial enhancement parameters to each sub-image, and to perform low-frequency spatial domain filtering on the initial enhancement parameters and boundary fusion processing on the sub-images to obtain the target enhancement parameters. The enhancement module is used to perform contrast enhancement processing on the original image of the next frame using the target enhancement parameters.
[0016] To address the aforementioned technical problems, the present invention also provides an electronic device, including a memory, a processor, and an executable program stored in the memory and capable of being run by the processor; when the processor runs the executable program, it performs the statistical image contrast enhancement method as described in any of the preceding claims.
[0017] To address the aforementioned technical problems, the present invention also provides a computer storage medium storing an executable program; when the executable program is executed, it implements the statistical image contrast enhancement method as described in any of the preceding claims.
[0018] To address the aforementioned technical problems, the present invention also provides a computer program product, the computer program product comprising a computer program, which, when executed by a processor, implements the statistical image contrast enhancement method as described in any of the preceding claims.
[0019] The present invention provides a statistical image contrast enhancement method and system, electronic device, computer storage medium, and program product. The method includes: acquiring the original image of the current frame, wherein the original image of the current frame has a size of W×H; dividing the original image of the current frame into M×N sub-images, and dividing each sub-image into I×J patches; adding overlapping regions to the periphery of the sub-images; performing statistical analysis on the patches of each sub-image to obtain contrast feature values and pixel arrays; calculating initial enhancement parameters based on the contrast feature values and pixel arrays; assigning initial enhancement parameters to each sub-image, and performing low-frequency spatial domain filtering and boundary fusion processing on the initial enhancement parameters to obtain target enhancement parameters; and using the target enhancement parameters to perform contrast enhancement processing on the original image of the next frame. By segmenting the original image and adding overlapping regions around the sub-images, followed by statistical analysis, low-frequency spatial filtering, and boundary fusion, target enhancement parameters are obtained. This approach enables efficient collaborative processing of sub-images using time-division multiplexing technology while achieving good contrast enhancement with no bright-dark boundaries in the image. Furthermore, the target enhancement parameters calculated in the current frame are used to perform contrast enhancement processing on the next frame, effectively reducing hardware overhead while ensuring contrast enhancement. This solves the problem of bright-dark boundaries in existing statistical image contrast enhancement methods. Attached Figure Description
[0020] Figure 1 This is a flowchart of the statistical image contrast enhancement method provided in this embodiment; Figure 2 This is an example diagram showing the position of a sub-image in the original image of the current frame provided in this embodiment; Figure 3 This is a block diagram of the statistical image contrast enhancement system provided in this embodiment. Detailed Implementation
[0021] The statistical image contrast enhancement method and system, electronic device, computer storage medium, and program product proposed in this invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that the drawings are all in a very simplified form and use non-precise proportions, and are only used to facilitate and clarify the illustration of the embodiments of this invention. Furthermore, the structures shown in the drawings are often part of the actual structure. In particular, different proportions may be used in different drawings to illustrate different aspects.
[0022] It should be noted that the terms "first," "second," etc., used in the specification, claims, and drawings of this invention are used to distinguish similar objects in order to describe embodiments of the invention, and are not used to describe a specific order or sequence. It should be understood that such uses of terminology are interchangeable where appropriate. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0023] This embodiment provides a statistical image contrast enhancement method, such as... Figure 1 As shown, it includes: S1, Obtain the original image of the current frame, wherein the size of the original image of the current frame is W×H; S2, divide the original image of the current frame into M×N sub-images, and divide each sub-image into I×J patches; S3, add an overlapping area to the periphery of the subgraph; S4, perform statistical analysis on the patches of each sub-image to obtain contrast feature values and pixel arrays; S5, calculate the initial enhancement parameters based on the contrast feature values and the pixel array; S6. Assign initial enhancement parameters to each sub-image, and perform low-frequency spatial filtering on the initial enhancement parameters and boundary fusion on the sub-image to obtain the target enhancement parameters. S7, using the target enhancement parameters, performs contrast enhancement processing on the original image of the next frame.
[0024] The statistical image contrast enhancement method provided in this embodiment improves image processing efficiency by segmenting the original image, enabling hardware to process it collaboratively in a time-division multiplexing manner. Simultaneously, by adding overlapping regions around the sub-images and performing statistical analysis, low-frequency spatial filtering, and boundary fusion to obtain target enhancement parameters, a good contrast enhancement effect can be achieved using these parameters, eliminating bright-dark boundaries in the image. Furthermore, by using the target enhancement parameters calculated in the current frame to perform contrast enhancement processing on the next frame, the contrast enhancement effect can be guaranteed while effectively reducing hardware overhead, solving the problem of bright-dark boundaries in existing statistical image contrast enhancement methods.
[0025] Specifically, in this embodiment, step S1 involves obtaining the original image of the current frame.
[0026] In this embodiment, the size of the original image of the current frame is W×H, that is, the width of the original image of the current frame is W pixels and the height is H pixels, where W and H are positive integers greater than or equal to 3.
[0027] In practical applications, the original image of the current frame is a large image, such as 16384×12288, which exceeds the hardware processing limit. Therefore, it is necessary to segment the current frame image so that the hardware can process it using time-division multiplexing technology.
[0028] Furthermore, in this embodiment, step S2 involves dividing the original image of the current frame into several sub-images, and then dividing each sub-image into multiple patches.
[0029] Specifically, in this embodiment, firstly, the original image of the current frame is divided into M×N sub-images, where the size of each sub-image is W / M×H / N; then, each sub-image is divided into I×J patches, where the size of each patch is W / M / I×H / N / J; wherein M×N is greater than 1, and M and N are both positive integers, and I and J are both positive integers greater than 2. That is to say, in this embodiment, the size of each sub-image is the same, and the size of each patch is also the same, which facilitates subsequent image processing and ensures the image processing effect.
[0030] Of course, in other embodiments, the size of each sub-image can also be different. For example, when the size of the original image cannot be divided by a preset number of sub-images (W cannot be divided by M, and / or H cannot be divided by N), the remaining portion is evenly distributed to other sub-images in a single row or column and labeled accordingly for subsequent image processing recognition. For example, if the size of the original image of the current frame is 22×22, i.e., W=22, H=22; M is 3 and N is 4, i.e., the original image of the current frame needs to be divided into 3 blocks in width and 4 blocks in height. Since 22 cannot be divided by 3 and 4, the width of the first two blocks can be 10 and the width of the last block can be 2, or the width of the first two blocks can be 7 and the width of the last block can be 8; similarly, the height of the first three blocks can be 5 and the height of the last block can be 7, or the height of the first three blocks can be 7 and the height of the last block can be 1. Similarly, each tile can be of a different size and processed using the same method as the subgraph segmentation. This results in multiple rectangular subgraphs and tiles.
[0031] Ideally, in practical applications, the values of M, N, I, and J should meet the following requirements: M is divisible by W, N is divisible by H; I is divisible by W / M, and J is divisible by H / N. This ensures that the sub-images and patch sizes obtained from segmenting the original image in the current frame are consistent.
[0032] In one specific embodiment, I×J can be 24×16, 16×16, 32×32, etc., depending on the algorithm design adopted by the specific hardware used.
[0033] Furthermore, in this embodiment, step S3 involves adding an overlapping region to the periphery of the sub-graph.
[0034] Specifically, in this embodiment, different methods for increasing overlapping regions are set for sub-images in different regions of the original image of the current frame, wherein: If at least one edge of the subgraph is the boundary of the original image of the current frame, then an overlapping region is added to the non-boundary edges of the subgraph. If the non-boundary edge of the subgraph is a vertical edge, then the width of the overlapping region added around the vertical edge is 2×W / (M×(I-2)); if the non-boundary edge of the subgraph is a horizontal edge, then the height of the overlapping region added around the horizontal edge is 2×H / (N×(J-2)).
[0035] If none of the four sides of the sub-image are the boundaries of the original image of the current frame, then an overlapping region is added to the four sides of the sub-image. The width of the overlapping region added to the periphery of the vertical side of the sub-image is W / (M×(I-2)), and the height of the overlapping region added to the periphery of the horizontal side of the sub-image is H / (N×(J-2)).
[0036] It should be noted that when adding overlapping areas, the height of the overlapping area added around the vertical edge should be consistent with the height of the vertical edge after adding the overlapping area around the horizontal edge, and the width of the overlapping area added around the horizontal edge should be consistent with the width of the horizontal edge after adding the overlapping area around the vertical edge, so as to ensure that the sub-image after adding overlapping areas is rectangular, which facilitates subsequent image processing.
[0037] In practical applications, such as Figure 2 As shown, the original image of the current frame is divided into 5×4 sub-images. The sub-images at the four corners (dark gray filled sub-images) have two edges located on the boundaries of the original image of the current frame, and the sub-images at the four boundaries of the original image of the current frame (light gray filled sub-images) have one edge located on the boundary of the original image of the current frame. The sub-images at the remaining positions (white filled sub-images) have no edges located on the boundaries of the original image of the current frame. In this embodiment, overlapping regions are added to the non-boundary edges of these sub-images at the four corners and four boundaries, while no overlapping regions are added to the edges located on the boundaries; and overlapping regions are added to all four edges of the sub-images at the remaining positions.
[0038] As can be seen from the width and height dimensions of the overlapping regions mentioned above, the size of the overlapping region at the boundary is twice the size of the overlapping region at other locations. This ensures that the sub-image at the boundary can have a sufficient amount of overlapping region, thereby ensuring the global enhancement effect of the target enhancement parameters obtained based on statistics on the original image.
[0039] It should be noted that in this embodiment, because the subgraphs at the four corners have one horizontal and one vertical edge that require overlapping areas, the subgraphs at the boundaries have three edges that require overlapping areas, and the subgraphs at other locations have four edges that require overlapping areas, and the total area of the overlapping area added to the subgraphs at the boundaries is different from the total area of the overlapping area added to the subgraphs at other locations, the sizes of the subgraphs after adding overlapping areas are inconsistent. However, since the subgraphs carry size information when they are sent to the hardware for processing, when processing each subgraph in a time-division multiplexing manner, the hardware can treat each subgraph as an independent input based on the carried size information, and this will not affect the processing result.
[0040] Of course, in other embodiments, the area of the overlapping region can be increased according to the position of the subgraph to ensure that the size of the subgraph is consistent after the overlapping region is increased. For example, for the subgraphs at the four corners, an overlapping region with a height of 2×H / (N×(J-2)) is added to the horizontal side of the non-boundary, and an overlapping region with a width of 2×W / (M×(I-2)) is added to the vertical side; for the subgraphs at the four boundaries, an overlapping region with a height of 2×H / (N×(J-2)) or a width of 2×W / (M×(I-2)) is added to the side corresponding to the boundary, and an overlapping region with a height of H / (N×(J-2)) or a width of W / (M×(I-2)) is added to the two sides adjacent to the boundary; the overlapping region of the subgraphs at other positions is increased in the same way.
[0041] Furthermore, in this embodiment, step S4, which involves performing statistical analysis on the patches of each sub-image to obtain contrast feature values and pixel arrays, includes: S41, perform histogram statistics and minimum value statistics on all patches to obtain M×N×I×J contrast feature values DC.
[0042] Specifically, in this embodiment, the original image of the current frame contains M×N×I×J patches. Histogram statistics and minimum value statistics are performed on all patches to obtain the histogram and minimum value corresponding to each patch, which has several bins. For each patch, the bin with the highest count in its corresponding histogram is selected, and the left and right boundary values of that bin are obtained. If the minimum value corresponding to the patch is between the left and right boundary values, the minimum value is used as the contrast feature value; otherwise, the left boundary value is used as the contrast feature value.
[0043] In a histogram, a bin refers to a series of continuous, discrete intervals into which a data range (such as pixel intensity or color value) is divided. Each bin represents a subset, and its height indicates the frequency (e.g., the number of pixels) of the data points within that interval. For example, in a grayscale image, grayscale values from 0 to 255 are divided into multiple bins, each bin corresponding to a grayscale interval (such as 0-15, 16-31, etc.), and the value in a bin is the total number of pixels within that interval.
[0044] S42, based on the pixel value of each pixel, obtain M×N×I×J pixel values for the image blocks.
[0045] Specifically, in this embodiment, firstly, the three-channel values of each pixel, namely the R value, B value, and G value, are obtained. The sum of the three-channel values is taken as the pixel value, i.e., pixel value RGB = R + B + G. Then, the maximum value of all RGB values in each patch is selected as the patch pixel value, resulting in M × N × I × J patch pixel values. The R value, B value, and G value corresponding to each patch pixel value are stored as a pixel array LC of size 3, thus obtaining the pixel array LC corresponding to the M × N × I × J patches of the original image of the current frame.
[0046] S43, group the contrast feature values into groups of M×N, and select the minimum value in each group to obtain I×J contrast feature values DC.
[0047] S44. Group the pixel values of the image patch into groups of M×N, and select the pixel array corresponding to the maximum value in each group to obtain an I×J pixel array LC.
[0048] In this embodiment, when grouping according to M×N, it is still necessary to group according to width M and height N. That is, the grouping is directly related to the position of the patch corresponding to the contrast feature value DC and the pixel array LC.
[0049] In this way, by performing a stitching and fusion operation on the M×N×I×J contrast feature values DC and the pixel array LC, it can be ensured that there is no obvious bright-dark boundary in the final contrast-enhanced image, thereby improving the image display quality.
[0050] Furthermore, in this embodiment, step S5, the step of calculating the initial enhancement parameters based on the contrast feature values and the pixel array, includes: S51, according to a preset method, extract several contrast feature values from I×J contrast feature values, and calculate the three-channel pixel average value based on the pixel array of all the blocks corresponding to the extracted contrast feature values.
[0051] Specifically, in this embodiment, the first x contrast feature values DC can be extracted from I×J contrast feature values, and the pixel array LC of the patch corresponding to the x contrast feature values DC can be obtained. Then, based on the x pixel array LC, the corresponding three-channel values (R value, B value, and G value) are obtained. Afterwards, the average values of the x R values, B values, and G values are calculated to obtain the three-channel pixel average values, denoted as AR, AB, and AG.
[0052] S52 performs low-frequency spatial filtering on the I×J contrast feature values to obtain I×J contrast parameters DCS.
[0053] This embodiment effectively reduces the block effect of the entire image by performing low-frequency spatial filtering on I×J contrast feature values, thereby ensuring that there are no obvious bright and dark boundaries in the area where the sub-images are stitched together after subsequent contrast enhancement processing, thus improving image quality.
[0054] The implementation methods of low-frequency spatial filtering are well known to those skilled in the art, and will not be described in detail here.
[0055] S53 calculates I×J initial enhancement parameters using the three-channel pixel mean and I×J contrast parameters.
[0056] Specifically, in this embodiment, the initial enhancement parameter DCSAo is calculated using the following formula: DCSAo=DCS / Max(AR,AG,AB) Where DCS represents the contrast parameter, Max() means taking the maximum value, and AR, AB and AG represent the three-channel pixel average values calculated in step S51.
[0057] Furthermore, in this embodiment, in step S6, initial enhancement parameters are assigned to each sub-graph, and low-frequency spatial filtering processing is performed on the initial enhancement parameters and boundary fusion processing is performed on the sub-graph to obtain target enhancement parameters.
[0058] Specifically, in this embodiment, I×J initial enhancement parameters DCSAo are evenly distributed among all the map tiles (M×N×I×J tiles), so that every I×J tiles in the M×N sub-images use the same initial enhancement parameter DCSAo. Then, considering that the contrast feature value DC may be locally equal, low-frequency spatial filtering is applied to the initial enhancement parameters DCSAo used for the I×J tiles in the M×N sub-images to improve the effectiveness of the target enhancement parameter. Finally, boundary fusion processing is performed on the adjacent boundaries (overlapping areas of the stitched images) of the M×N sub-images, where the minimum value of the initial enhancement parameters DCSAo corresponding to the adjacent boundaries is selected as the target enhancement parameter DCSA.
[0059] Furthermore, in this embodiment, step S7, the step of performing contrast enhancement processing on the next frame of the original image using the target enhancement parameters, includes: S71 uses bilinear interpolation to interpolate the target enhancement parameters to the sub-target enhancement parameters corresponding to the sub-image of the original image in the next frame.
[0060] Specifically, in this embodiment, bilinear interpolation is used to interpolate the target enhancement parameter DCSA to the sub-target enhancement parameter DCSA_F corresponding to the sub-image of the next frame of the original image. The specific implementation of bilinear interpolation is well known to those skilled in the art, and will not be described in detail here.
[0061] S72 uses the enhancement intensity to correct the enhancement parameters of the sub-target in order to obtain the final enhancement parameters.
[0062] Specifically, in this embodiment, the formula for calculating the final enhancement parameter T_F(x,y) is as follows: T_F(x,y)=1-strength×DCSA_F(x,y) Wherein, strength represents the enhancement intensity, with a value range of 0 to 1, which can be set according to actual needs; (x,y) represents the pixel coordinates; DCSA_F(x,y) represents the sub-target enhancement parameter corresponding to the pixel, which is determined according to the sub-image where the pixel is located.
[0063] S73 uses the final enhancement parameters and the average pixel value of the three channels to perform contrast enhancement processing on the three-channel pixel values of the original image in the next frame.
[0064] Specifically, in this embodiment, the formula for contrast enhancement processing is: outputR(x,y)=(inputR(x,y)-AR) / T_F(x,y)+AR outputG(x,y)=(inputG(x,y)-AG) / T_F(x,y)+AG outputB(x,y)=(inputB(x,y)-AB) / T_F(x,y)+AB Wherein, inputR, inputG, and inputB represent the three-channel pixel values of the original image of the next frame, respectively; AR, AG, and AB represent the three-channel pixel mean values calculated in step S51, respectively; outputR, outputG, and outputB represent the three-channel pixel values of the original image of the next frame after contrast enhancement processing, respectively; (x,y) represents the pixel coordinates; and T_F(x,y) represents the final enhancement parameters.
[0065] Since the three-channel pixel values obtained after contrast enhancement are obtained by hardware processing of each sub-image, it is necessary to crop out the overlapping areas added before each sub-image and stitch them together to obtain the final large-size image after contrast enhancement.
[0066] The statistical image contrast enhancement method provided in this embodiment performs contrast enhancement processing on the next frame using the target enhancement parameters calculated in the current frame. It can effectively utilize block statistical data (contrast feature value DC and maximum pixel value LC) to ensure the contrast enhancement effect while avoiding windowing filtering operations, thus effectively reducing hardware overhead.
[0067] This embodiment also provides a statistical image contrast enhancement system for implementing the statistical image contrast enhancement method described above, such as... Figure 3 As shown, the statistical image contrast enhancement system includes: The acquisition module is used to acquire the original image of the current frame; The segmentation module is used to segment the original image of the current frame into several sub-images, and each sub-image into multiple patches; The calculation module is used to add overlapping regions to the periphery of the sub-image; it is also used to perform statistics on the patches of each sub-image to obtain contrast feature values and pixel arrays; it is also used to calculate the initial enhancement parameters based on the contrast feature values and pixel arrays; and it is used to assign the initial enhancement parameters to each sub-image, and to perform low-frequency spatial domain filtering on the initial enhancement parameters and boundary fusion processing on the sub-images to obtain the target enhancement parameters. The enhancement module is used to perform contrast enhancement processing on the original image of the next frame using the target enhancement parameters.
[0068] The statistical image contrast enhancement system provided in this embodiment segments the original image through a segmentation module, enabling hardware to process the image collaboratively using a time-division multiplexing approach, thus improving image processing efficiency. Simultaneously, a calculation module adds overlapping regions around the sub-images and performs statistical analysis, low-frequency spatial filtering, and boundary fusion to obtain target enhancement parameters. These parameters achieve a good contrast enhancement effect, eliminating bright-dark boundaries in the image. Furthermore, the enhancement module uses the target enhancement parameters calculated in the current frame to perform contrast enhancement processing on the next frame, effectively reducing hardware overhead while ensuring contrast enhancement performance. This solves the problem of bright-dark boundaries in existing statistical image contrast enhancement methods.
[0069] Furthermore, this embodiment also provides an electronic device, including a memory, a processor, and an executable program stored in the memory and capable of being run by the processor; when the processor runs the executable program, it performs the statistical image contrast enhancement method described above.
[0070] Furthermore, this embodiment also provides a computer storage medium storing an executable program; when the executable program is executed, it implements the statistical image contrast enhancement method as described in any of the preceding claims.
[0071] Furthermore, this embodiment also provides a computer program product, which includes a computer program that, when executed by a processor, implements the statistical image contrast enhancement method as described in any of the preceding claims.
[0072] It should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Similar or identical parts between embodiments can be referred to mutually. In addition, different parts between embodiments can also be combined with each other, and this invention does not limit this.
[0073] This embodiment provides a statistical image contrast enhancement method and system, electronic device, computer storage medium, and program product. The method includes: acquiring the original image of the current frame, wherein the original image of the current frame has a size of W×H; dividing the original image of the current frame into M×N sub-images, and dividing each sub-image into I×J patches; adding overlapping regions to the periphery of the sub-images; performing statistical analysis on the patches of each sub-image to obtain contrast feature values and pixel arrays; calculating initial enhancement parameters based on the contrast feature values and pixel arrays; assigning initial enhancement parameters to each sub-image, and performing low-frequency spatial domain filtering and boundary fusion processing on the initial enhancement parameters to obtain target enhancement parameters; and using the target enhancement parameters to perform contrast enhancement processing on the original image of the next frame. By segmenting the original image, the hardware can collaboratively process the image using a time-division multiplexing approach, improving image processing efficiency. Simultaneously, by adding overlapping regions around the sub-images and performing statistical analysis, low-frequency spatial filtering, and boundary fusion to obtain target enhancement parameters, a good contrast enhancement effect can be achieved using these parameters, eliminating bright-dark boundaries in the image. Furthermore, using the target enhancement parameters calculated in the current frame to perform contrast enhancement processing on the next frame effectively reduces hardware overhead while ensuring contrast enhancement, solving the problem of bright-dark boundaries in existing statistical image contrast enhancement methods.
[0074] The above description is merely a description of preferred embodiments of the present invention and is not intended to limit the scope of the present invention in any way. Any changes or modifications made by those skilled in the art based on the above disclosure shall fall within the protection scope of the claims.
Claims
1. A statistical image contrast enhancement method, characterized in that, include: Obtain the original image of the current frame, wherein the size of the original image of the current frame is W×H; The original image of the current frame is divided into M×N sub-images, and each sub-image is divided into I×J patches; Add overlapping regions around the perimeter of the subgraph; Statistical analysis is performed on the tiles of each sub-image to obtain contrast feature values and pixel arrays; The initial enhancement parameters are calculated based on the contrast feature values and the pixel array. Each sub-image is assigned initial enhancement parameters, and the initial enhancement parameters are subjected to low-frequency spatial filtering and the sub-images are subjected to boundary fusion processing to obtain the target enhancement parameters. The target enhancement parameters are used to perform contrast enhancement processing on the original image in the next frame.
2. The statistical image contrast enhancement method according to claim 1, characterized in that, The step of adding an overlapping region around the perimeter of the paired subgraphs includes: If at least one edge of the subgraph is the boundary of the original image of the current frame, then an overlapping region is added to the non-boundary edges of the subgraph. If the non-boundary edge of the subgraph is a vertical edge, then the width of the overlapping region added around the vertical edge is 2×W / (M×(I-2)); if the non-boundary edge of the subgraph is a horizontal edge, then the height of the overlapping region added around the horizontal edge is 2×H / (N×(J-2)). If none of the four sides of the sub-image are the boundaries of the original image of the current frame, then an overlapping region is added to the four sides of the sub-image. The width of the overlapping region added to the periphery of the vertical side of the sub-image is W / (M×(I-2)), and the height of the overlapping region added to the periphery of the horizontal side of the sub-image is H / (N×(J-2)).
3. The statistical image contrast enhancement method according to claim 1, characterized in that, The step of statistically analyzing the patches of each sub-image to obtain contrast feature values and pixel arrays includes: Histogram statistics and minimum value statistics are performed on all patches to obtain M×N×I×J contrast feature values; Based on the pixel value of each pixel, we obtain M×N×I×J pixel values for the image blocks; The contrast feature values are grouped into groups of M×N, and the minimum value in each group is selected to obtain I×J contrast feature values. The pixel values of the image are grouped into groups of M×N, and the pixel array corresponding to the maximum value in each group is selected to obtain I×J pixel arrays.
4. The statistical image contrast enhancement method according to claim 3, characterized in that, The step of performing histogram statistics and minimum value statistics on all patches to obtain M×N×I×J contrast feature values includes: Perform histogram statistics and minimum value statistics on all patches to obtain the histogram and minimum value corresponding to each patch with several bins; Select the bin with the highest count in the histogram and obtain its left and right boundary values; If the minimum value is between the left and right boundary values, then the minimum value is used as the contrast feature value; otherwise, the left boundary value is used as the contrast feature value.
5. The statistical image contrast enhancement method according to claim 3, characterized in that, The step of obtaining M×N×I×J pixel values for each pixel includes: Obtain the R, B, and G values of each pixel, and calculate the sum of the R, B, and G values to obtain the pixel value of each pixel; Select the maximum value of all pixel values in each tile as the tile pixel value for that tile, to obtain M×N×I×J tile pixel values; Save the R, B, and G values corresponding to the pixel values of each patch as a pixel array to obtain M×N×I×J pixel arrays.
6. The statistical image contrast enhancement method according to claim 3, characterized in that, The step of calculating the initial enhancement parameters based on the contrast feature values and the pixel array includes: According to a preset method, several contrast feature values are extracted from I×J contrast feature values, and the three-channel pixel mean is calculated based on the pixel array of all the patches corresponding to the extracted contrast feature values. Low-frequency spatial filtering is performed on the I×J contrast feature values to obtain I×J contrast parameters; I×J initial enhancement parameters are calculated using the three-channel pixel mean and I×J contrast parameters.
7. The statistical image contrast enhancement method according to claim 6, characterized in that, The steps of assigning initial enhancement parameters to each sub-image, performing low-frequency spatial filtering on the initial enhancement parameters, and performing boundary fusion on the sub-images to obtain the target enhancement parameters include: Distribute the I×J initial enhancement parameters equally among all the tiles; The initial enhancement parameters of the I×J patches of each sub-graph are subjected to low-frequency spatial filtering. Boundary fusion processing is performed on the adjacent boundaries of M×N sub-images. The minimum value of the initial enhancement parameters corresponding to the adjacent boundaries is selected as the target enhancement parameter, and the average value of the three-channel pixels is used as the global brightness index.
8. The statistical image contrast enhancement method according to claim 6, characterized in that, The step of performing contrast enhancement processing on the next frame of the original image using target enhancement parameters includes: Using bilinear interpolation, the target enhancement parameters are interpolated to the sub-target enhancement parameters corresponding to the sub-image of the original image in the next frame; The enhancement parameters of the sub-targets are corrected using the enhancement intensity to obtain the final enhancement parameters; Using the final enhancement parameters and the three-channel pixel mean, the three-channel pixel values of the next frame of the original image are contrast-enhanced.
9. The statistical image contrast enhancement method according to any one of claims 1 to 8, characterized in that, The dimensions of each sub-graph are W / M×H / N; the dimensions of each block are W / M / I×H / N / J; Where W and H are positive integers greater than or equal to 3, M and N are positive integers greater than 1, and I and J are positive integers greater than 2.
10. A statistical image contrast enhancement system, characterized in that, The statistical-based image contrast enhancement system includes: The acquisition module is used to acquire the original image of the current frame; The segmentation module is used to segment the original image of the current frame into several sub-images, and each sub-image into multiple patches; The calculation module is used to add overlapping regions to the periphery of the sub-image; it is also used to perform statistics on the patches of each sub-image to obtain contrast feature values and pixel arrays; it is also used to calculate the initial enhancement parameters based on the contrast feature values and pixel arrays; and it is used to assign the initial enhancement parameters to each sub-image, and to perform low-frequency spatial domain filtering on the initial enhancement parameters and boundary fusion processing on the sub-images to obtain the target enhancement parameters. The enhancement module is used to perform contrast enhancement processing on the original image of the next frame using the target enhancement parameters.
11. An electronic device, characterized in that, It includes a memory, a processor, and an executable program stored in the memory and capable of being run by the processor; when the processor runs the executable program, it performs the statistical image contrast enhancement method as described in any one of claims 1 to 9.
12. A computer storage medium, characterized in that, The computer storage medium stores an executable program; when the executable program is executed, it implements the statistical image contrast enhancement method as described in any one of claims 1 to 9.
13. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the statistical image contrast enhancement method as described in any one of claims 1 to 9.