Image enhancement method, device, equipment and storage medium
By performing edge contrast enhancement, adaptive compression and histogram equalization on the image, combined with morphological Top-hat transformation and PCA fusion, the problem of noise increase in the image enhancement process in the prior art is solved, and better image clarity and contrast effect are achieved.
Patent Information
- Application Number
- CN202011510665.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-18
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2040-12-18
AI Technical Summary
The prior art may increase the contrast of background noise during image enhancement process and reduce the contrast of useful signals, resulting in problems such as noise, color spots or bright blocks in the enhanced image, and the enhancement effect is poor.
By performing edge contrast enhancement processing on the image to be processed, the calculation amount is reduced, the foreground edge is highlighted, and adaptively compressed image contrast is used to reduce noise in the same area. Then the compressed contrast is subjected to histogram equalization, and the image fusion is performed through the morphological Top-hat transformation algorithm, and the weight value of the PCA fusion is adaptively calculated to achieve better enhancement effect than a single processing.
Effectively suppress noise in the image, enhance image contrast, improve image clarity, make the visual effect at the foreground edge more obvious, and achieve better enhancement effect.
Smart Images

Figure CN114648448B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of image processing technology, and specifically relates to an image enhancement method, device, equipment and storage medium. Background Art
[0002] In our daily life, people often use mobile phones or tablets to take pictures. Sometimes the pictures taken have problems such as low contrast and overexposure, which makes the pictures unclear. For example, UV images taken by UV (Ultraviolet) cameras are often not clear enough. For unclear images, image enhancement technology can be used to make them clear.
[0003] At present, the related technology usually adopts an image enhancement method based on OpenCV, which uses histogram equalization to increase the global contrast of the image. Specifically, the brightness distribution histogram of the image to be processed is statistically obtained, and the arithmetic mean of the brightness of all pixels in the image to be processed is calculated according to the brightness distribution histogram. Based on the brightness arithmetic mean, the brightness of the pixels in the image to be processed whose brightness is lower than the brightness arithmetic mean is enhanced.
[0004] However, in the above-mentioned related technologies, global contrast enhancement is performed on all pixels of the image to be processed. This is indiscriminate processing of the processed data, which is likely to increase the contrast of the background noise and reduce the contrast of the useful signal, resulting in noise, color spots or bright blocks in the enhanced image, and poor image enhancement effect. Summary of the invention
[0005] The present application proposes an image enhancement method, device, equipment and storage medium. The present application enhances the foreground edge, reduces the amount of calculation and highlights the foreground edge. Adaptively compresses the image contrast to reduce the noise in the same area. By fusing the images after compressing the contrast and performing histogram equalization processing, the noise points that may exist in the image are suppressed and the enhancement effect is enhanced.
[0006] The first embodiment of the present application provides an image enhancement method, comprising:
[0007] Performing edge contrast enhancement processing on the image to be processed to obtain a local enhanced image corresponding to the image to be processed;
[0008] Performing compression processing on the local enhanced image to obtain a first histogram and a second histogram corresponding to the image to be processed;
[0009] Using the first histogram and the second histogram respectively to perform histogram equalization processing on the local enhanced image to obtain a first equalized image and a second equalized image;
[0010] The first equalized image and the second equalized image are fused to obtain a fused image corresponding to the image to be processed.
[0011] In some embodiments of the present application, performing edge contrast enhancement processing on the image to be processed to obtain a local enhanced image corresponding to the image to be processed includes:
[0012] Divide the image to be processed into multiple sub-images by using a grid of a preset size;
[0013] Contrast enhancement processing is performed on the foreground edge of the sub-image to obtain a local enhanced image corresponding to the image to be processed.
[0014] In some embodiments of the present application, contrast enhancement processing is performed on the foreground edge of the sub-image to obtain a local enhanced image corresponding to the image to be processed, including:
[0015] According to the brightness value of each pixel in each sub-image, the logarithmic mean of the brightness corresponding to each sub-image is calculated respectively;
[0016] According to the logarithmic mean of brightness corresponding to each sub-image, the foreground edge of each sub-image is subjected to contrast enhancement processing to obtain a local enhanced image corresponding to the image to be processed.
[0017] In some embodiments of the present application, the step of performing contrast enhancement processing on the foreground edge of each sub-image according to the logarithmic mean of brightness corresponding to each sub-image includes:
[0018] Determine a dark pixel point from a first sub-image, wherein the brightness value of the dark pixel point is less than the logarithmic mean of the brightness corresponding to the first sub-image, and the first sub-image is any sub-image in the image to be processed;
[0019] Calculate the product of the brightness value of the dark pixel and the logarithmic mean of the brightness corresponding to the first sub-image;
[0020] The brightness value of the dark pixel is modified to be the product.
[0021] In some embodiments of the present application, the compressing the local enhanced image to obtain a first histogram image and a second histogram image corresponding to the image to be processed includes:
[0022] Obtaining statistically the brightness histogram corresponding to each sub-image in the local enhanced image and determining the maximum brightness value in each sub-image;
[0023] Calculate the first scaling factor and the second scaling factor corresponding to each sub-image according to the size information of each sub-image and the corresponding maximum brightness value;
[0024] According to the first scaling factor corresponding to each sub-image, the number of pixels corresponding to each brightness value in the brightness histogram of each sub-image is updated respectively to obtain a first histogram corresponding to each sub-image;
[0025] According to the second scaling factor corresponding to each sub-image, the number of pixels corresponding to each brightness value in the brightness histogram of each sub-image is updated respectively to obtain a second histogram corresponding to each sub-image.
[0026] In some embodiments of the present application, using the first histogram to perform histogram equalization processing on the local enhanced image to obtain a first equalized image includes:
[0027] According to the first rectangular image corresponding to each sub-image in the local enhanced image, respectively calculating the cumulative distribution function corresponding to each sub-image;
[0028] According to the cumulative distribution function corresponding to each sub-image and the position of each pixel, the brightness value of each pixel is mapped and transformed to obtain a first balanced image.
[0029] In some embodiments of the present application, mapping and transforming the brightness value of each pixel point according to the cumulative distribution function corresponding to each sub-image and the position of each pixel point includes:
[0030] In a sub-image located at a corner of the local enhanced image, the sub-image is equally divided into four rectangular areas with the center point of the sub-image as a dividing intersection point, and the rectangular area located at the corner of the local enhanced image is used as a corner point area; the area surrounded by the center points of all sub-images located at the boundary of the local enhanced image is used as the image main area; and the area other than the image main area and the corner point area is determined as the boundary area;
[0031] According to the cumulative distribution function of the sub-image to which the first pixel belongs, mapping transformation is performed on the brightness value of the first pixel, where the first pixel is located at the center point of the sub-image to which the first pixel belongs or in the corner point area;
[0032] According to the cumulative distribution function of the sub-image to which the second pixel belongs and the cumulative distribution function of the sub-image closest to the second pixel and located at the boundary, mapping and transforming the brightness value of the second pixel by a linear difference algorithm, the second pixel being a pixel located at a non-central point in the boundary area;
[0033] According to the cumulative distribution function of the sub-image to which the third pixel belongs and the cumulative distribution functions of two sub-images that share a boundary with the sub-image to which the third pixel belongs and are closest to the third pixel, the brightness value of the third pixel is mapped and transformed by a bilinear interpolation algorithm. The third pixel is a pixel point located at a non-center point in the main area of the image.
[0034] In some embodiments of the present application, the fusing the first equalized image and the second equalized image to obtain a fused image corresponding to the image to be processed includes:
[0035] splicing the first equalized image and the second equalized image into an image matrix;
[0036] Calculating a covariance matrix of the image matrix;
[0037] Determine the maximum eigenvalue corresponding to the covariance matrix and the eigenvector corresponding to the maximum eigenvalue;
[0038] Calculating a first fusion weight and a second fusion weight according to the eigenvector corresponding to the maximum eigenvalue;
[0039] The first equalized image and the second equalized image are fused into a fused image corresponding to the image to be processed according to the first fusion weight and the second fusion weight.
[0040] In some embodiments of the present application, the method further includes:
[0041] Modifying the brightness value of each pixel in the local enhanced image to the inverse of the brightness value of each pixel, and then performing the compression process;
[0042] After obtaining the fused image corresponding to the image to be processed, the reciprocal of the brightness value of each pixel in the fused image is taken.
[0043] In some embodiments of the present application, the method further includes:
[0044] Acquire an original image to be processed, map the color space of the original image from the RGB space to the YUV space, and obtain an image to be processed corresponding to the original image;
[0045] After obtaining the fused image corresponding to the image to be processed, the color space of the fused image is mapped from the YUV space to the RGB space.
[0046] An embodiment of a second aspect of the present application provides an image enhancement device, comprising:
[0047] A local enhancement module, used for performing edge contrast enhancement processing on the image to be processed to obtain a local enhanced image corresponding to the image to be processed;
[0048] A compression module, used for compressing the local enhanced image to obtain a first histogram and a second histogram corresponding to the image to be processed;
[0049] a histogram equalization module, configured to perform histogram equalization processing on the local enhanced image using the first histogram and the second histogram respectively, to obtain a first equalized image and a second equalized image;
[0050] The image fusion module is used to fuse the first equalized image and the second equalized image to obtain a fused image corresponding to the image to be processed.
[0051] An embodiment of the third aspect of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method described in the first aspect above.
[0052] An embodiment of the fourth aspect of the present application provides a computer-readable storage medium on which a computer program is stored, and the program is executed by a processor to implement the method described in the first aspect above.
[0053] The technical solution provided in the embodiments of the present application has at least the following technical effects or advantages:
[0054] In the embodiment of the present application, the foreground edge is enhanced and the logarithmic mean is used for enhancement, which reduces the amount of calculation and makes the visual effect of the foreground edge more obvious. After the foreground edge is enhanced, adaptive compression image processing is performed, and the histogram gradient is directly reduced proportionally according to the threshold value, and the part exceeding the threshold value is not re-added to the histogram, thereby reducing the noise in the same area. Finally, the morphological Top-hat transformation algorithm is used for image fusion, and the weight value of PCA fusion is adaptively calculated. The calculated weight value is used for fusion to achieve a better enhancement effect than a single process. PCA fusion performs image fusion based on the correlation between the selected component images. Through weighted fusion, the noise points that may exist in the image obtained by local histogram equalization under high threshold limit will be suppressed, and the contrast enhancement effect will be enhanced.
[0055] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present application. Also, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0057] Figure 1 A flowchart of an image enhancement method provided by an embodiment of the present application is shown;
[0058] Figure 2 A schematic diagram showing the cumulative distribution functions of different sub-graphs used in histogram equalization of pixels in different regions of an image provided by an embodiment of the present application;
[0059] Figure 3 A schematic diagram showing that there is an obvious boundary contour at the boundary between sub-images before histogram equalization provided by an embodiment of the present application;
[0060] Figure 4 Another flow chart of an image enhancement method provided by an embodiment of the present application is shown;
[0061] Figure 5 A schematic diagram of the structure of an image enhancement device provided by an embodiment of the present application is shown;
[0062] Figure 6 A schematic diagram of the structure of an electronic device provided by an embodiment of the present application is shown;
[0063] Figure 7 A schematic diagram of a storage medium provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0064] The exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present application and to fully convey the scope of the present application to those skilled in the art.
[0065] It should be noted that, unless otherwise specified, the technical terms or scientific terms used in this application should have the common meanings understood by technicians in the field to which this application belongs.
[0066] An image enhancement method, apparatus, device and storage medium proposed according to an embodiment of the present application are described below in conjunction with the accompanying drawings.
[0067] At present, the related technologies usually adopt OpenCV-based image enhancement methods, such as histogram equalization, wide image dynamic range enhancement, gamma transform, truncation thresholding and other methods. Among them, histogram equalization does not select the data in the image to be processed during the processing process, which is likely to increase the contrast of the background noise and reduce the contrast of the useful signal. In the wide image dynamic range enhancement method, the halo effect is achieved for the particularly bright part of the image to be processed. Since the highlight part of the foreground diffuses over a large area to become an irregular halo, the noise increases after processing, and the contrast between the foreground and the background is not well improved. In addition, the wide image dynamic range enhancement uses the RGB three color channels to process the image to be processed, and the final image may be covered with bright color blocks. Gamma transform also does not select the data in the image to be processed, which inevitably causes large-area halo and noise, and blue or green color blocks are prone to appear under the RGB three color channels. However, truncation thresholding only performs threshold processing on pixels with high brightness values, and cannot improve the contrast of the dark part with low brightness values, and the overall contrast improvement effect is not obvious.
[0068] In order to reduce the problems of noise, color spots or bright blocks after image enhancement, the embodiment of the present application provides an image enhancement method, which performs edge contrast enhancement processing on the image to be processed, and uses the logarithmic mean for enhancement, which reduces the amount of calculation and can make the visual effect of the foreground edge more obvious. After the edge contrast enhancement is performed to obtain a local enhanced image, the local enhanced image is subjected to adaptive compression image contrast processing, and the histogram gradient is directly reduced proportionally according to the threshold, and the part exceeding the threshold is not re-added to the histogram, thereby reducing the noise in the same area. Finally, in the image fusion process, the morphological Top-hat transformation algorithm is used to adaptively calculate the weight value of PCA (Principal Component Analysis) fusion, and the calculated weight value is used to fuse the image obtained by local histogram equalization under high / low threshold limits, so as to achieve a better enhancement effect than single processing. PCA fusion performs image fusion based on the correlation between the selected component images. Through weighted fusion, the noise points that may exist in the image obtained by local histogram equalization under high threshold limits will be suppressed, and the contrast enhancement effect will be enhanced.
[0069] See also Figure 1 , the method specifically comprises the following steps:
[0070] Step 101: performing edge contrast enhancement processing on the image to be processed to obtain a local enhanced image corresponding to the image to be processed.
[0071] The execution subject of the embodiment of the present application is a terminal for image enhancement, which can be a mobile phone, a computer or a server device. The terminal first obtains the image to be processed, and the image to be processed can be any image that needs to be enhanced, such as the image to be processed can be a UV (Ultraviolet) image that is not clear enough. The terminal can shoot the original image to be processed through a shooting device such as a color camera, a UV camera, etc., or the terminal can receive the original image to be processed uploaded by the user or downloaded from the network. After the terminal obtains the original image to be processed, the color space of the original image is mapped from the RGB space to the YUV space to obtain the image to be processed corresponding to the original image.
[0072] After obtaining the image to be processed in the color coding format of YUV, the image to be processed is locally enhanced through the following operations of steps A1 and A2, including:
[0073] A1: Divide the image to be processed into multiple sub-images using a grid of preset size.
[0074] The preset size can be 8*8 or 4*4, etc. If the brightness variance of the image to be processed is large, the divided sub-image is too small, and when the histogram equalization is performed by the interpolation algorithm in the subsequent step 103, large defects may appear in the equalized image. In order to avoid large defects when executing the interpolation algorithm, when the brightness variance of the image to be processed is large, the preset size can be set to a smaller size to make the divided sub-image larger. In an embodiment of the present application, the size of each sub-image can be represented by m*n, where m and n are the number of horizontal pixels and the number of vertical pixels of the sub-image, respectively.
[0075] For example, an 8*8 grid is used to divide the image to be processed into 64 sub-images. When the brightness variance of the image to be processed is large, the preset size can be set to 4*4, and the image to be processed can be divided into 16 sub-images using a 4*4 grid.
[0076] A2: Perform contrast enhancement processing on the foreground edge of the sub-image to obtain a local enhanced image corresponding to the image to be processed.
[0077] First, according to the brightness value of each pixel in each sub-image, the logarithmic mean of the brightness corresponding to each sub-image is calculated. The embodiment of the present application calculates the logarithmic mean of the brightness corresponding to each sub-image by the following formula (1):
[0078]
[0079] In formula (1), is the logarithmic mean of the brightness corresponding to the sub-image, x, y are the coordinates of the pixels in the sub-image, L is the brightness value of the pixel with coordinates x, y in the sub-image, and N is the total number of pixels in the sub-image.
[0080] Then, according to the logarithmic mean of the brightness corresponding to each sub-image, the foreground edge of each sub-image is subjected to contrast enhancement processing. Specifically, dark pixels are determined from the first sub-image, and the brightness value of the dark pixels is less than the logarithmic mean of the brightness corresponding to the first sub-image, and the first sub-image is any sub-image in the image to be processed; the product between the brightness value of the dark pixel and the logarithmic mean of the brightness corresponding to the first sub-image is calculated; and the brightness value of the dark pixel is modified to the product. Specifically, the edge contrast enhancement processing is performed on each sub-image according to the following formula (2):
[0081]
[0082] In formula (2), L(x,y) is the brightness value of the pixel with coordinates x,y in the sub-image. is the logarithmic mean of the brightness corresponding to the sub-image.
[0083] Since the brightness value of the pixels in the foreground in the image to be processed is higher, and the brightness value of the pixels in the background is lower. The sub-image containing the foreground edge includes both the pixels in the foreground and the pixels in the background. Therefore, the logarithmic mean of the brightness corresponding to the sub-image containing the foreground edge will be smaller than the logarithmic mean of the brightness corresponding to the sub-image including only the pixels in the foreground, and greater than the logarithmic mean of the brightness corresponding to the sub-image including only the pixels in the background. In order to reduce the amount of calculation, the embodiment of the present application may not perform the above-mentioned edge contrast enhancement processing on each sub-image in the image to be processed, but only perform contrast enhancement processing on the sub-image containing the foreground edge. First, it can be judged whether the sub-image contains a foreground edge based on the size of the logarithmic mean of the brightness corresponding to the sub-image.
[0084] The embodiment of the present application pre-sets a preset threshold interval for determining whether a sub-image contains a foreground edge, and the upper limit and lower limit of the preset threshold interval are empirical values obtained by calculating the logarithmic mean of brightness for sub-images of a large number of images, wherein the upper limit may be the minimum value of the logarithmic mean of brightness of sub-images that only include foregrounds in a large number of images, and the lower limit may be the maximum value of the logarithmic mean of brightness of sub-images that only include backgrounds in a large number of images.
[0085] After calculating the logarithmic mean of brightness corresponding to each sub-image in the image to be processed by the above formula (1), the logarithmic mean of brightness of each sub-image is compared with the upper limit and lower limit of the preset threshold interval. If the logarithmic mean of brightness of the sub-image is greater than the lower limit of the preset threshold interval and less than the upper limit, the sub-image is determined to be a sub-image containing a foreground edge. Then, according to the logarithmic mean of brightness corresponding to the sub-image containing a foreground edge, the sub-image containing a foreground edge is subjected to contrast enhancement processing according to the above formula (2) to obtain a local enhanced image corresponding to the image to be processed.
[0086] In the embodiment of the present application, the variance is not considered in the process of local contrast enhancement of the processed image, which reduces the amount of calculation. According to the Weber-Fechner law, the human visual system perceives brightness as a logarithmic function, so the logarithmic mean of the brightness is used as the enhancement coefficient to enhance the dark pixels in the sub-image, and the enhancement effect is better.
[0087] In some embodiments of the present application, after obtaining the local enhanced image corresponding to the image to be processed in the above manner, the brightness value of each pixel in the local enhanced image can be modified to the inverse of the brightness value of each pixel. In this way, the brightness value of each pixel in the local enhanced image is normalized, which can reduce the increase of noise.
[0088] After the local enhanced image is obtained through the operations of steps A1 and A2, or after the brightness value of each pixel in the local enhanced image is normalized, the local enhanced image is subjected to adaptive compression contrast processing through the operation of the following step 102.
[0089] Step 102: compress the local enhanced image to obtain a first histogram and a second histogram corresponding to the image to be processed.
[0090] The embodiment of the present application specifically performs compression contrast processing on the local enhanced image through the following operations of steps B1-B3, including:
[0091] B1: Obtain the brightness histogram corresponding to each sub-image in the local enhanced image and determine the maximum brightness value in each sub-image.
[0092] For each sub-image in the local enhanced image, the compression contrast processing process used is the same. The compression contrast processing is described in detail by taking the second sub-image as an example. The second sub-image is any sub-image in the local enhanced image. The brightness value of each pixel in the second sub-image is traversed, the number of pixels corresponding to each brightness value is counted, the brightness histogram corresponding to the second sub-image is drawn, and the maximum brightness value in the second sub-image is determined. The maximum brightness value can be represented by M.
[0093] B2: Calculate the first scaling factor and the second scaling factor corresponding to each sub-image according to the size information of each sub-image and the corresponding maximum brightness value.
[0094] The size information of the sub-image includes the length and width of the sub-image, and the size of the sub-image is represented by m*n. First, according to the size information of the sub-image and the maximum brightness value, the first compression threshold and the second compression threshold corresponding to the sub-image are calculated by the following formula (3).
[0095]
[0096] In formula (3), L1 is the first compression threshold, L2 is the second compression threshold, m*n is the size information of the sub-image, M is the maximum brightness value corresponding to the sub-image, A and B are threshold coefficients, A + B = 1, A < B, and both A and B are values between 0 and 1. For example, A can be 1 / 4 and B can be 3 / 4.
[0097] Calculate the first compression threshold and the second compression threshold corresponding to the second sub-image using the above formula (3), where the second compression threshold is greater than the first compression threshold. Then, according to the maximum brightness value, the first compression threshold, and the second compression threshold of the second sub-image, calculate the first scaling coefficient and the second scaling coefficient corresponding to the second sub-image through the following formula (4).
[0098]
[0099] In formula (4), scl1 is the first scaling coefficient and scl2 is the second scaling coefficient.
[0100] B3: According to the first scaling coefficient corresponding to each sub-image, update the number of pixels corresponding to each brightness value in the brightness histogram of each sub-image respectively to obtain the first histogram image corresponding to each sub-image; according to the second scaling coefficient corresponding to each sub-image, update the number of pixels corresponding to each brightness value in the brightness histogram of each sub-image respectively to obtain the second histogram image corresponding to each sub-image.
[0101] After obtaining the first scaling coefficient and the second scaling coefficient corresponding to the second sub-image through the above formulas (3) and (4), calculate the number of pixels corresponding to each brightness value in the brightness histogram of the second sub-image respectively according to the first scaling coefficient and the second scaling coefficient corresponding to the second sub-image through the following formula (5).
[0102]
[0103] In formula (5), s is the number of pixels corresponding to the brightness value in the brightness histogram of the sub-image, s1 is the number of pixels corresponding to this brightness value after compression using the first scaling coefficient scl1, and s2 is the number of pixels corresponding to this brightness value after compression using the second scaling coefficient scl2.
[0104] For each brightness value in the brightness histogram of the second sub-image, scale it respectively using the first scaling coefficient and the second scaling coefficient according to the above formula (5) to obtain two histograms corresponding to the second sub-image. For each sub-image in the local enhanced image, scale the brightness histogram of each sub-image respectively in the above manner. Scale through the first scaling coefficient to obtain the first histogram image corresponding to each sub-image in the image to be processed, and scale through the second scaling coefficient to obtain the second histogram image corresponding to each sub-image in the image to be processed.
[0105] The embodiment of the present application determines the first scaling factor and the second scaling factor corresponding to each sub-image according to the maximum brightness value of each sub-image in the above manner, thereby adaptively compressing the brightness histogram of each sub-image.
[0106] Step 103: Performing histogram equalization processing on the local enhanced image using the first histogram image and the second histogram image respectively to obtain a first equalized image and a second equalized image.
[0107] According to the first rectangular image corresponding to each sub-image in the local enhanced image, the Cumulative Distribution Function (CDF) corresponding to each sub-image is calculated respectively. According to the Cumulative Distribution Function corresponding to each sub-image and the position of each pixel, the brightness value of each pixel is mapped and transformed respectively to obtain the first balanced image.
[0108] like Figure 2 As shown, the local enhanced image is divided into an image main area, a corner area and a boundary area. Specifically, the area surrounded by the center points of all sub-images located at the boundary of the local enhanced image is taken as the image main area. Figure 2 The small black square in the enlarged image on the left represents the center point of the sub-image. In the sub-image located at the corner of the local enhanced image, the sub-image is divided into four rectangular areas with the center point of the sub-image as the dividing intersection point, and the rectangular area located at the corner of the local enhanced image is taken as the corner area. The area other than the main image area and the corner area in the local enhanced image is determined as the boundary area.
[0109] For the pixel points located at the center point of each sub-image in the local enhanced image and the pixel points located in the corner point area, the embodiment of the present application refers to them as first pixel points. According to the cumulative distribution function of the sub-image to which the first pixel point belongs, the brightness value of the first pixel point is mapped and transformed, and the position of the first pixel point is located at the center point of the sub-image to which it belongs or in the corner point area. Specifically, the brightness value of the first pixel point is substituted into the cumulative distribution function of the sub-image to which the first pixel point belongs, the brightness value after the mapping transformation is calculated, and then the brightness value of the first pixel point is replaced by the calculated brightness value.
[0110] For the pixel points that are not the center points in the boundary area, the embodiment of the present application refers to them as second pixel points. According to the cumulative distribution function of the sub-image to which the second pixel point belongs and the cumulative distribution function of the sub-image that is closest to the second pixel point and located at the boundary, the brightness value of the second pixel point is mapped and transformed by a linear difference algorithm. Specifically, the brightness value of the second pixel point is respectively substituted into the cumulative distribution function of the sub-image to which it belongs and the cumulative distribution function of the sub-image that is closest to the second pixel point and located at the boundary, and two brightness values after mapping transformation are calculated. Then, linear interpolation is performed based on these two brightness values to obtain an interpolated brightness value. The brightness value of the second pixel point is replaced with the brightness value obtained by interpolation. For example, Figure 2 The second pixel point 1 in the image uses the cumulative distribution function of the sub-image to which it belongs and the cumulative distribution function of the sub-image adjacent to the upper side of the sub-image to which it belongs. The second pixel point 2 uses the cumulative distribution function of the sub-image to which it belongs and the cumulative distribution function of the sub-image adjacent to the right side of the sub-image to which it belongs.
[0111] For non-central pixel points located in the main area of the image, the brightness value of the third pixel is mapped and transformed by a bilinear difference algorithm according to the cumulative distribution function of the sub-image to which the third pixel belongs and the cumulative distribution functions of the two sub-images that share a boundary with the sub-image to which the third pixel belongs and are closest to the third pixel. Specifically, the brightness value of the third pixel is substituted into the cumulative distribution function of the sub-image to which it belongs to calculate the first brightness value, and the second brightness value and the third brightness value are substituted into the cumulative distribution function of the two sub-images that share a boundary with the sub-image to which the third pixel belongs and are closest to the third pixel to calculate the distribution. Then, linear interpolation is performed on the first brightness value and the second brightness value, and on the first brightness value and the third brightness value, respectively, to obtain two interpolated brightness values, and then linear interpolation is performed on the two interpolated brightness values again to obtain the final brightness value. The brightness value of the second pixel is replaced with the final brightness value. For example, Figure 2 The third pixel point 3 in utilizes the cumulative distribution function of the sub-image to which it belongs, the cumulative distribution function of the sub-image adjacent to the left of the sub-image to which it belongs, and the cumulative distribution function of the sub-image adjacent to the top.
[0112] After the brightness value of each pixel in the local enhanced image is mapped and transformed using the first histogram image in the above manner, a first balanced image is obtained. The histogram equalization processing using the second histogram image is the same as the histogram equalization processing using the first histogram image, and the brightness value of each pixel in the local enhanced image is mapped and transformed using the second histogram image to obtain a second balanced image.
[0113] Since the edge contrast enhancement of the local enhanced image is performed in step 101, the processing is performed in units of sub-images, so the boundaries between sub-images in the obtained local enhanced image will appear. Figure 3The obvious boundary contours shown make the brightness between sub-images discontinuous and there is a sense of separation. In this step, the first histogram image and the second histogram image are used to perform histogram equalization on the local enhanced image, so that the brightness values at the boundaries between sub-images in the obtained first and second equalized images are smoothly transitioned, which can eliminate the obvious boundary contours at the boundaries between sub-images.
[0114] Step 104: Fusing the first equalized image and the second equalized image to obtain a fused image corresponding to the image to be processed.
[0115] Since the first compression threshold L1 in step 102 is less than the second compression threshold L2, the image enhancement effect under the first compression threshold L1 is not as good as the enhancement effect under the second compression threshold L2. However, there will still be noise in the enhanced image under the second compression threshold L2. Simply taking any value between the first compression threshold L1 and the second compression threshold L2 cannot adapt to every image. In order to solve this problem, this step adopts the morphological Top-hat transformation algorithm to adaptively calculate the weight value of PCA fusion, and uses the calculated weight value to fuse the first balanced image and the second balanced image, which can effectively correct the image to be processed with uneven brightness values, and achieve a better enhancement effect than single processing. Specifically, the image fusion is performed through the following steps C1-C5, including:
[0116] C1: Concatenate the first equalized image and the second equalized image into an image matrix.
[0117] Assuming that the first balanced image is V1 and the second balanced image is V2, the spliced image matrix V = [V1, V2].
[0118] C2: Calculate the covariance matrix of the image matrix.
[0119] The covariance matrix C of the image matrix V = [V1, V2] is calculated according to formula (6):
[0120]
[0121] In formula (6), is the covariance of image i and image j, is the arithmetic mean of the brightness values of all pixels in image i. is the arithmetic mean of the brightness values of all pixels in image j. il is the brightness value of the lth pixel in image i. jl is the brightness value of the lth pixel in image j. and The calculation method is the same as The calculation method is similar.
[0122] The covariance matrix of the image matrix V = [V1, V2] calculated according to the above formula (6) is
[0123] C3: Determine the maximum eigenvalue corresponding to the covariance matrix and the eigenvector corresponding to the maximum eigenvalue.
[0124] Substitute the covariance matrix calculated in step C2 into the eigenvalue formula shown in formula (7):
[0125] |λI-C|=0…(7)
[0126] In formula (7), λ is the eigenvalue and I is the unit vector.
[0127] The eigenvalue formula is solved to calculate the first eigenvalue λ1 and the second eigenvalue λ2 corresponding to the covariance matrix C, and to obtain the eigenvector corresponding to the first eigenvalue and the eigenvector corresponding to the second eigenvalue.
[0128] Select the maximum eigenvalue from the first eigenvalue and the second eigenvalue, and select the eigenvector corresponding to the maximum eigenvalue. The eigenvector can be expressed as (ξ i1 ,ξ i2 ).
[0129] C4: Calculate the first fusion weight and the second fusion weight according to the eigenvector corresponding to the maximum eigenvalue.
[0130] Substitute the eigenvector corresponding to the maximum eigenvalue into formula (8) to calculate the fusion weight:
[0131]
[0132] In formula (8), ω1 is the first fusion weight, ω2 is the second fusion weight, (ξ i1 ,ξ i2 ) is the eigenvector corresponding to the maximum eigenvalue.
[0133] C5: According to the first fusion weight and the second fusion weight, the first equalized image and the second equalized image are fused into a fused image corresponding to the image to be processed.
[0134] Substitute the first fusion weight and the second fusion weight calculated above into formula (9) to perform image fusion:
[0135] VF=ω1V1+ω2V2…(9)
[0136] In formula (9), VF is the fused image obtained by fusion, ω1 is the first fusion weight, ω2 is the second fusion weight, V1 is the first balanced image, and V2 is the second balanced image.
[0137] That is, for the pixel points at the same coordinates in the first and second equalized images, the first product of the brightness value of the pixel points at the coordinates in the first equalized image and the first fusion weight is calculated, and the second product of the brightness value of the pixel points at the coordinates in the second equalized image and the second fusion weight is calculated, and the sum of the first product and the second product is used as the brightness value of the pixel points at the coordinates in the fused image obtained by fusion. For the brightness value of the pixel points at each coordinate, brightness fusion is performed in the above manner to obtain a fused image of the first and second equalized images.
[0138] If the brightness value of each pixel in the local enhanced image is normalized by taking the inverse before executing step 102, then after obtaining the fused image in this step, it is necessary to take the inverse of the brightness value of each pixel in the fused image to perform a reverse operation of normalization on the brightness value of each pixel in the fused image. After that, the color space of the fused image is mapped from the YUV space to the RGB space.
[0139] If the brightness value of each pixel in the local enhanced image is not normalized before executing step 102, after obtaining the fused image corresponding to the image to be processed, the color space of the fused image is directly mapped from the YUV space to the RGB space.
[0140] After remapping the fused image to the RGB space, the final result of the image enhancement processing of the embodiment of the present application is obtained. In order to facilitate understanding of the complete process of image enhancement of the embodiment of the present application, the following is a description with reference to the accompanying drawings. Figure 4 As shown, S1: obtain the original image. S2: map the original image from RGB space to YUV space to obtain the image to be processed. S3: divide the image to be processed into multiple sub-images through a grid of preset size. S4: perform edge contrast enhancement on the sub-image to obtain a local enhanced image. S5: take the inverse of the brightness value of each pixel in the local enhanced image. S6: calculate the first scaling factor and the second scaling factor corresponding to each sub-image according to the size information of each sub-image and the corresponding maximum brightness value. S7: update the number of pixels corresponding to each brightness value in the brightness histogram of each sub-image in the local enhanced image according to the first scaling factor and the second scaling factor, respectively, to obtain the first histogram image and the second histogram image. S8: perform histogram equalization on the local enhanced image using the first histogram and the second histogram, respectively, to obtain the first equalized image and the second equalized image. S9: perform OCA fusion on the first equalized image and the second equalized image to obtain the fused image corresponding to the image to be processed. S10: take the inverse of the brightness value of each pixel in the fused image, and then map the fused image from YUV space to RGB space.
[0141] In the embodiment of the present application, the foreground edge is enhanced and the logarithmic mean is used for enhancement, which reduces the amount of calculation and makes the visual effect of the foreground edge more obvious. After the foreground edge is enhanced, adaptive compression image contrast processing is performed, and the histogram gradient is directly reduced proportionally according to the threshold value, and the part exceeding the threshold value is not re-added to the histogram, thereby reducing the noise in the same area. Finally, the morphological Top-hat transformation algorithm is used for image fusion, and the weight value of PCA fusion is adaptively calculated. The calculated weight value is used for fusion to achieve a better enhancement effect than a single treatment. PCA fusion performs image fusion based on the correlation between the selected component images. Through weighted fusion, the noise points that may exist in the image obtained by local histogram equalization under high threshold limit will be suppressed, and the contrast enhancement effect will be enhanced.
[0142] The present application also provides an image enhancement device, which is used to execute the image enhancement method provided in any of the above embodiments. Figure 5 , the device comprises:
[0143] The local enhancement module 501 is used to perform edge contrast enhancement processing on the image to be processed to obtain a local enhanced image corresponding to the image to be processed;
[0144] A compression module 502 is used to compress the local enhanced image to obtain a first histogram and a second histogram corresponding to the image to be processed;
[0145] A histogram equalization module 503 is used to perform histogram equalization processing on the local enhanced image using the first histogram image and the second histogram image to obtain a first equalized image and a second equalized image;
[0146] The image fusion module 504 is used to fuse the first equalized image and the second equalized image to obtain a fused image corresponding to the image to be processed.
[0147] The local enhancement module 501 is used to divide the image to be processed into multiple sub-images through a grid of a preset size; perform contrast enhancement processing on the foreground edge of the sub-image to obtain a local enhanced image corresponding to the image to be processed.
[0148] The local enhancement module 501 is used to calculate the logarithmic mean of the brightness corresponding to each sub-image according to the brightness value of each pixel in each sub-image; and to perform contrast enhancement processing on the foreground edge of each sub-image according to the logarithmic mean of the brightness corresponding to each sub-image, so as to obtain a local enhanced image corresponding to the image to be processed.
[0149] The local enhancement module 501 is used to determine dark pixels from the first sub-image, where the brightness value of the dark pixels is less than the logarithmic mean of the brightness corresponding to the first sub-image, and the first sub-image is any sub-image in the image to be processed; calculate the product between the brightness value of the dark pixels and the logarithmic mean of the brightness corresponding to the first sub-image; and modify the brightness value of the dark pixels to the product.
[0150] The compression module 502 is used to statistically obtain the brightness histogram corresponding to each sub-image in the local enhanced image and determine the maximum brightness value in each sub-image; calculate the first scaling factor and the second scaling factor corresponding to each sub-image according to the size information of each sub-image and the corresponding maximum brightness value; update the number of pixels corresponding to each brightness value in the brightness histogram of each sub-image according to the first scaling factor corresponding to each sub-image, and obtain the first histogram corresponding to each sub-image; update the number of pixels corresponding to each brightness value in the brightness histogram of each sub-image according to the second scaling factor corresponding to each sub-image, and obtain the second histogram corresponding to each sub-image.
[0151] The histogram equalization module 503 is used to calculate the cumulative distribution function corresponding to each sub-image in the local enhanced image according to the first histogram corresponding to each sub-image; and map the brightness value of each pixel according to the cumulative distribution function corresponding to each sub-image and the position of each pixel to obtain a first equalized image.
[0152] The histogram equalization module 503 is used to divide the sub-image located at the corner of the local enhanced image into four rectangular areas with the center point of the sub-image as the dividing intersection point, and the rectangular area located at the corner of the local enhanced image is used as the corner area; the area surrounded by the center points of all sub-images located at the boundary of the local enhanced image is used as the main image area; the area other than the main image area and the corner area is determined as the boundary area; according to the cumulative distribution function of the sub-image to which the first pixel point belongs, the brightness value of the first pixel point is mapped and transformed, and the first pixel point is located at the center point of the sub-image to which it belongs or in the corner area of the image. pixel point; according to the cumulative distribution function of the sub-image to which the second pixel point belongs and the cumulative distribution function of the sub-image that is closest to the second pixel point and located at the boundary, the brightness value of the second pixel point is mapped and transformed by a linear interpolation algorithm, and the second pixel point is a pixel point located at a non-center point in the boundary area; according to the cumulative distribution function of the sub-image to which the third pixel point belongs and the cumulative distribution functions of two sub-images that share a boundary with the sub-image to which the third pixel point belongs and are closest to the third pixel point, the brightness value of the third pixel point is mapped and transformed by a bilinear interpolation algorithm, and the third pixel point is a pixel point located at a non-center point in the main area of the image.
[0153] The image fusion module 504 is used to splice the first equalized image and the second equalized image into an image matrix; calculate the covariance matrix of the image matrix; determine the maximum eigenvalue corresponding to the covariance matrix and the eigenvector corresponding to the maximum eigenvalue; calculate the first fusion weight and the second fusion weight according to the eigenvector corresponding to the maximum eigenvalue; and fuse the first equalized image and the second equalized image into a fused image corresponding to the image to be processed according to the first fusion weight and the second fusion weight.
[0154] The device also includes: a normalization module, which is used to modify the brightness value of each pixel in the local enhanced image to the reciprocal of the brightness value of each pixel, and then execute the processing process of the compression module 502; after obtaining the fused image corresponding to the image to be processed, the reciprocal of the brightness value of each pixel in the fused image is taken.
[0155] The device also includes: a color space mapping module, which is used to obtain an original image to be processed, map the color space of the original image from the RGB space to the YUV space, and obtain an image to be processed corresponding to the original image; after obtaining a fused image corresponding to the image to be processed, map the color space of the fused image from the YUV space to the RGB space.
[0156] The image enhancement device provided in the above-mentioned embodiment of the present application and the image enhancement method provided in the embodiment of the present application are based on the same inventive concept and have the same beneficial effects as the method adopted, run or implemented by the application program stored therein.
[0157] The present application also provides an electronic device to perform the above-mentioned image enhancement method. Figure 6 , which shows a schematic diagram of an electronic device provided by some embodiments of the present application. Figure 6 As shown, the electronic device 6 includes: a processor 600, a memory 601, a bus 602 and a communication interface 603, wherein the processor 600, the communication interface 603 and the memory 601 are connected via the bus 602; the memory 601 stores a computer program that can be run on the processor 600, and when the processor 600 runs the computer program, the image enhancement method provided in any of the aforementioned embodiments of the present application is executed.
[0158] The memory 601 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk memory. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 603 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used.
[0159] The bus 602 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The memory 601 is used to store programs, and the processor 600 executes the programs after receiving execution instructions. The image enhancement method disclosed in any implementation of the aforementioned embodiment of the present application may be applied to the processor 600, or implemented by the processor 600.
[0160] The processor 600 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 600. The above processor 600 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor to be executed, or the hardware and software modules in the decoding processor can be executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 601, and the processor 600 reads the information in the memory 601 and completes the steps of the above method in combination with its hardware.
[0161] The electronic device provided in the embodiment of the present application and the image enhancement method provided in the embodiment of the present application are based on the same inventive concept and have the same beneficial effects as the methods adopted, operated or implemented therein.
[0162] The present application also provides a computer-readable storage medium corresponding to the image enhancement method provided in the above embodiment. Figure 7 The computer-readable storage medium shown is a CD 30 on which a computer program (ie, a program product) is stored. When the computer program is run by a processor, the image enhancement method provided by any of the aforementioned embodiments is executed.
[0163] It should be noted that examples of the computer-readable storage medium may also include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other optical or magnetic storage media, which are not listed here one by one.
[0164] The computer-readable storage medium provided in the above-mentioned embodiments of the present application and the image enhancement method provided in the embodiments of the present application are based on the same inventive concept and have the same beneficial effects as the methods adopted, run or implemented by the application programs stored therein.
[0165] It should be noted that:
[0166] In the description provided herein, a large number of specific details are described. However, it is understood that the embodiments of the present application can be practiced without these specific details. In some instances, well-known structures and technologies are not shown in detail so as not to obscure the understanding of this description.
[0167] Similarly, it should be understood that in order to streamline the present application and help understand one or more of the various inventive aspects, in the above description of the exemplary embodiments of the present application, the various features of the present application are sometimes grouped together into a single embodiment, figure, or description thereof. However, the disclosed method should not be interpreted as reflecting the following schematic diagram: the claimed application requires more features than the features clearly stated in each claim. More specifically, as reflected in the claims below, the inventive aspects are less than all the features of the single embodiment disclosed above. Therefore, the claims following the specific embodiment are hereby expressly incorporated into the specific embodiment, wherein each claim itself serves as a separate embodiment of the present application.
[0168] In addition, those skilled in the art will appreciate that, although some embodiments described herein include certain features included in other embodiments but not other features, the combination of features of different embodiments is meant to be within the scope of the present application and form different embodiments. For example, in the claims below, any one of the claimed embodiments may be used in any combination.
[0169] The above is only a preferred specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. An image enhancement method, characterized in that: include: Performing edge contrast enhancement processing on the image to be processed to obtain a local enhanced image corresponding to the image to be processed; Performing compression processing on the local enhanced image to obtain a first histogram image and a second histogram image corresponding to the image to be processed; Using the first histogram and the second histogram respectively to perform histogram equalization processing on the local enhanced image to obtain a first equalized image and a second equalized image; fusing the first equalized image and the second equalized image to obtain a fused image corresponding to the image to be processed; The step of compressing the locally enhanced image to obtain a first histogram image and a second histogram image corresponding to the image to be processed includes: Obtaining statistically the brightness histogram corresponding to each sub-image in the local enhanced image and determining the maximum brightness value in each sub-image; Calculate the first scaling factor and the second scaling factor corresponding to each sub-image according to the size information of each sub-image and the corresponding maximum brightness value; According to the first scaling factor corresponding to each sub-image, the number of pixels corresponding to each brightness value in the brightness histogram of each sub-image is updated respectively to obtain a first histogram corresponding to each sub-image; According to the second scaling factor corresponding to each sub-image, the number of pixels corresponding to each brightness value in the brightness histogram of each sub-image is updated respectively to obtain a second histogram corresponding to each sub-image.
2. The method according to claim 1, characterized in that The performing edge contrast enhancement processing on the image to be processed to obtain a local enhanced image corresponding to the image to be processed includes: Divide the image to be processed into multiple sub-images by using a grid of a preset size; Contrast enhancement processing is performed on the foreground edge of the sub-image to obtain a local enhanced image corresponding to the image to be processed.
3. The method according to claim 2, characterized in that Performing contrast enhancement processing on the foreground edge of the sub-image to obtain a local enhanced image corresponding to the image to be processed includes: According to the brightness value of each pixel in each sub-image, the logarithmic mean of the brightness corresponding to each sub-image is calculated respectively; According to the logarithmic mean of brightness corresponding to each sub-image, the foreground edge of each sub-image is subjected to contrast enhancement processing to obtain a local enhanced image corresponding to the image to be processed.
4. The method according to claim 3, characterized in that: The step of performing contrast enhancement processing on the foreground edge of each sub-image according to the logarithmic mean of brightness corresponding to each sub-image comprises: Determine a dark pixel point from a first sub-image, wherein the brightness value of the dark pixel point is less than the logarithmic mean of the brightness corresponding to the first sub-image, and the first sub-image is any sub-image in the image to be processed; Calculate the product of the brightness value of the dark pixel and the logarithmic mean of the brightness corresponding to the first sub-image; The brightness value of the dark pixel is modified to be the product.
5. The method according to claim 1, characterized in that: Using the first histogram to perform histogram equalization processing on the local enhanced image to obtain a first equalized image includes: According to the first rectangular image corresponding to each sub-image in the local enhanced image, respectively calculating the cumulative distribution function corresponding to each sub-image; According to the cumulative distribution function corresponding to each sub-image and the position of each pixel, the brightness value of each pixel is mapped and transformed to obtain a first balanced image.
6. The method according to claim 5, characterized in that The mapping transformation of the brightness value of each pixel point according to the cumulative distribution function corresponding to each sub-image and the position of each pixel point includes: In a sub-image located at a corner of the local enhanced image, the sub-image is equally divided into four rectangular areas with the center point of the sub-image as a dividing intersection point, and the rectangular area located at the corner of the local enhanced image is used as a corner point area; the area surrounded by the center points of all sub-images located at the boundary of the local enhanced image is used as the image main area; and the area other than the image main area and the corner point area is determined as the boundary area; According to the cumulative distribution function of the sub-image to which the first pixel belongs, mapping transformation is performed on the brightness value of the first pixel, where the first pixel is located at the center point of the sub-image to which the first pixel belongs or in the corner point area; According to the cumulative distribution function of the sub-image to which the second pixel belongs and the cumulative distribution function of the sub-image closest to the second pixel and located at the boundary, mapping and transforming the brightness value of the second pixel by a linear difference algorithm, the second pixel being a pixel located at a non-central point in the boundary area; According to the cumulative distribution function of the sub-image to which the third pixel belongs and the cumulative distribution functions of two sub-images that share a boundary with the sub-image to which the third pixel belongs and are closest to the third pixel, the brightness value of the third pixel is mapped and transformed by a bilinear interpolation algorithm. The third pixel is a pixel point located at a non-center point in the main area of the image.
7. The method according to claim 1, characterized in that The fusing the first equalized image and the second equalized image to obtain a fused image corresponding to the image to be processed includes: splicing the first equalized image and the second equalized image into an image matrix; Calculating a covariance matrix of the image matrix; Determine the maximum eigenvalue corresponding to the covariance matrix and the eigenvector corresponding to the maximum eigenvalue; Calculating a first fusion weight and a second fusion weight according to the eigenvector corresponding to the maximum eigenvalue; The first equalized image and the second equalized image are fused into a fused image corresponding to the image to be processed according to the first fusion weight and the second fusion weight.
8. The method according to any one of claims 1 to 7, characterized in that: The method further comprises: Modifying the brightness value of each pixel in the local enhanced image to the inverse of the brightness value of each pixel, and then performing the compression process; After obtaining the fused image corresponding to the image to be processed, the reciprocal of the brightness value of each pixel in the fused image is taken.
9. The method according to claims 1-7, characterized in that: The method further comprises: Acquire an original image to be processed, map the color space of the original image from the RGB space to the YUV space, and obtain an image to be processed corresponding to the original image; After obtaining the fused image corresponding to the image to be processed, the color space of the fused image is mapped from the YUV space to the RGB space.
10. An image enhancement device, characterized in that: include: A local enhancement module, used for performing edge contrast enhancement processing on the image to be processed to obtain a local enhanced image corresponding to the image to be processed; A compression module, used for compressing the local enhanced image to obtain a first histogram and a second histogram corresponding to the image to be processed; a histogram equalization module, configured to perform histogram equalization processing on the local enhanced image using the first histogram and the second histogram respectively, to obtain a first equalized image and a second equalized image; An image fusion module, used for fusing the first equalized image and the second equalized image to obtain a fused image corresponding to the image to be processed; The compression module is specifically used to obtain the brightness histogram corresponding to each sub-image in the local enhanced image and determine the maximum brightness value in each sub-image; and calculate the first scaling factor and the second scaling factor corresponding to each sub-image according to the size information of each sub-image and the corresponding maximum brightness value; According to the first scaling factor corresponding to each sub-image, the number of pixels corresponding to each brightness value in the brightness histogram of each sub-image is updated respectively to obtain a first histogram corresponding to each sub-image; According to the second scaling factor corresponding to each sub-image, the number of pixels corresponding to each brightness value in the brightness histogram of each sub-image is updated respectively to obtain a second histogram corresponding to each sub-image.
11. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: The processor runs the computer program to implement the method according to any one of claims 1 to 9.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that: The program is executed by a processor to implement the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Improved image zooming method
CN103530845A
Image processing method, apparatus, electronic device and storage medium
WO2019148912A1