An image enhancement method based on texture prior and color clustering
By using an image enhancement method based on texture prior and color clustering, the problem of poor enhancement effect of the MSRCR algorithm in different lighting regions is solved, and the image contrast and texture information are improved, resulting in a richer and more natural image.
Patent Information
- Application Number
- CN202310946937.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-31
- Publication Date
- 2026-02-24
- Estimated Expiration
- 2043-07-31
AI Technical Summary
The existing MSRCR algorithm performs the same enhancement on images in different lighting areas during image enhancement, resulting in poor results and problems such as easy loss of information and unclear texture information.
An image enhancement method based on texture prior and color clustering is adopted. By extracting the texture structure of the image, the image segmentation algorithm is used for block enhancement. Based on the block processing, a mapping scheme based on mean square value and mean square error is proposed. The effectiveness is evaluated by combining the information entropy and natural statistical properties of the image.
It effectively avoids the loss of image information, enhances the contrast and texture information of the image, and improves the richness and naturalness of the image.
Smart Images

Figure CN116862811B_ABST
Abstract
Description
Technical Field
[0001] This invention mainly relates to the technical field of image enhancement, specifically to an image enhancement method based on texture prior and color clustering. Background Technology
[0002] With the continuous development of society and the constant innovation of humankind, people's ways of obtaining information have become increasingly diverse and simplified, but images remain a primary means of information acquisition. However, due to various factors, such as human error, improper storage, age, and outdated conditions, the images we obtain often differ from our expectations. Thus, image processing technology has emerged. Image enhancement is a processing technique that improves image quality and visual effects. It is widely used in computer vision, photography, medical image processing, and autonomous driving. The goal of image enhancement is to make images easier to understand and analyze while preserving as much image detail as possible. The technological background of image enhancement can be traced back to the early photography and film industries. In photography, image quality is improved by adjusting exposure time, aperture size, and lens filters. In the film industry, color correction and post-production techniques are used to enhance the visual effects of film footage. With the development of digital image technology, image enhancement methods have also been greatly improved. Here are some common image enhancement techniques:
[0003] Traditional image enhancement methods are often based on the MSRCR algorithm. However, when the MSRCR algorithm weakens image contrast, it often performs the same enhancement on images in different lighting areas, resulting in poor results. It also has the disadvantages of losing some information and not significantly enhancing texture information. Summary of the Invention
[0004] This invention provides an image enhancement method based on texture prior and color clustering to solve the technical problems mentioned in the background.
[0005] The technical solution adopted by the present invention to solve the above-mentioned technical problems is as follows:
[0006] An image enhancement method based on texture prior and color clustering includes the following steps:
[0007] Step one: Extract the texture structure and then perform image enhancement.
[0008] Step two: Use the information entropy and natural statistical properties of the image to evaluate the effectiveness of the augmented image;
[0009] Step 3: Blend the enhanced image with the image texture;
[0010] Step four: Perform block enhancement processing using an image segmentation algorithm;
[0011] Step 5: Based on the block processing, a mapping scheme based on mean square value and mean square error is proposed to improve image contrast.
[0012] Furthermore, in step four, the image obtained under uneven lighting conditions is enhanced by dividing it into blocks according to the different levels of brightness. The image is divided into several blocks for enhancement processing. When the colors in each small block are close to the same, the lighting is considered to be uniform and then enhancement processing is performed.
[0013] Furthermore, in step five, the image is divided into blocks based on color, transforming it into a clustering problem. Parts with the same or similar colors are grouped together to achieve image segmentation. Color clustering is used for image segmentation, and the specific steps include:
[0014] Step 1: Convert the input RGB image to Lab color space;
[0015] Step 2: Calculate the color histogram of the input image, analyze the histogram to obtain the colors that make up the image, count the proportion of each color, sort them by size, select the top N colors that make up the image according to the number of clusters N input by the user, and set them as the initial cluster centers.
[0016] Step 3: Cluster the image pixels according to the colors that make up the image to obtain the category of each pixel. For each pixel, calculate the color difference between it and the color of each cluster center, and assign the pixel to the nearest cluster center.
[0017] Step 4: For all pixel categories, recalculate the cluster centers and determine if they are close to the initial cluster centers. If they are close, end the iteration; otherwise, continue iterating and updating.
[0018] Step 5: Optimize the clustering results by eliminating isolated pixels and scattered small areas to obtain smooth partitioned regions.
[0019] Furthermore, in step one, the texture structure is extracted, and according to the structure-texture decomposition model, the image is represented as the sum of the texture image and the structure image.
[0020] Furthermore, the sum of the texture image and the structure image is expressed as: I(x,y)=I S (x,y)+I T (x,y);
[0021] In the formula, I S (x,y) is the structural image, I T (x,y) is the texture image.
[0022] Furthermore, step five proposes a mapping scheme based on mean square value and mean square error. Before mapping, pixel values that may be negative need to be corrected. The correction formula is as follows: Log e [R MSRCRi [x,y)′]=G×Log e [R MSRCRi [x,y)]+b
[0023] In the formula, G and b are parameters, typically taken as 192 and -30, respectively, and Value is Log. e [R MSRCRi The values of (x,y) are defined as follows: min is the minimum value among all pixel values, and max is the maximum value among all pixel values.
[0024] Furthermore, step five proposes a mapping scheme based on mean square value and mean square error, with the specific steps as follows:
[0025] Step 1, calculate Log e Mean and standard deviation Var of the R / G / B channels in [R(x,y)];
[0026] Step 2: Calculate the Min and Max values for each channel using the mean and standard deviation:
[0027] Min = Mean - ρ × Var;
[0028] Max = Mean + ρ × Var;
[0029] In the formula, ρ is an adjustable parameter;
[0030] Step 3, for Log e For each value of [R(x,y)], perform a linear mapping, but overflow checks are required:
[0031] f(R(x,y)>255)R i (x,y)=255;
[0032] else if (R(x,y)<0)R i (x,y)=0.
[0033] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0034] This invention employs texture prior on the basis of the MSRCR algorithm, which avoids the problem of image information loss to a certain extent and makes the image more vivid. Block processing is conducive to combining image features for enhancement, avoiding the interference of irrelevant information and the problem of poor tonal differentiation. In addition, the improved mapping approach by combining the overall image information also makes the enhancement effect more natural.
[0035] The present invention will be explained in detail below with reference to the accompanying drawings and specific embodiments. Attached Figure Description
[0036] Figure 1 This is a framework diagram of the present invention. Detailed Implementation
[0037] To facilitate understanding of the present invention, a more comprehensive description of the present invention will be given below with reference to the accompanying drawings, which illustrate several embodiments of the present invention. However, the present invention can be implemented in different forms and is not limited to the embodiments described in the text. Rather, these embodiments are provided to make the disclosure of the present invention more thorough and complete.
[0038] It should be noted that when an element is referred to as being "fixed to" another element, it can be directly on the other element or there may be an intervening element. When an element is referred to as being "connected to" another element, it can be directly connected to the other element or there may be an intervening element. The terms "vertical," "horizontal," "left," "right," and similar expressions used in this document are for illustrative purposes only.
[0039] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used herein in the specification of this invention is for the purpose of describing particular embodiments only and is not intended to limit the invention. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.
[0040] For an example, please refer to the appendix. Figure 1 An image enhancement method based on texture prior and color clustering is proposed. The method proposes the following improvements to the MSRCR method: First, the texture structure is extracted before image enhancement, and then fused with the image texture after image enhancement is completed to solve the image texture blurring problem in the MSRCR algorithm.
[0041] Secondly, regarding the issue of the MSRCR algorithm weakening image contrast, mainly because performing the same enhancement on images in different lighting areas leads to poor results, this invention proposes to use an image segmentation algorithm for block-based enhancement processing to achieve better results. Furthermore, in terms of image pixel mapping, a mapping scheme based on mean square value and mean square error is proposed on the basis of block processing, which is beneficial for improving image contrast and effectively avoids the influence of parameters under different lighting conditions. Finally, in the evaluation part of the enhancement algorithm, the information entropy and natural statistical properties of the image are used to further evaluate the effectiveness of the enhanced image.
[0042] Furthermore, the method proposes to extract texture prior information before image enhancement to avoid the filtering out of detail information.
[0043] Furthermore, the method is designed to enhance images obtained under uneven lighting conditions by dividing them into blocks based on the intensity of the light. The intensity of the light is reflected in the difference in the brightness of the colors in the image. Based on the difference in brightness, the image can be divided into several blocks for enhancement. Since the colors in each small block are approximately the same, the lighting can be considered uniform, and thus enhancement processing can be performed.
[0044] Furthermore, the method proposes a pixel mapping scheme based on mean and mean square error to address the issue that different parameters can have a significant impact on the information entropy of different images, especially those with uneven illumination distribution, thus determining the enhancement strength and the amount of information carried.
[0045] Furthermore, in Retinex theory, the MSRCR algorithm filters out low-frequency components such as the incident image and enhances high-frequency components such as the reflected image. However, images contain rich information, including structural and texture information, among which low-frequency information is abundant. Thus, MSRCR processing also filters out detailed information from the reflected image. Based on this, this invention proposes extracting texture prior information before image enhancement. According to the structure-texture decomposition model, any image can be represented as the sum of the texture image and the structure image, expressed as: I(x,y)=I S (x,y)+I T (x,y), where I S (x,y) is the structural image, I T (x,y) represents the texture image. This invention employs the LBP operator, which possesses grayscale invariance and rotation invariance properties, to extract image texture features.
[0046] Furthermore, according to Retinex theory, all images can be assumed to be spatially smooth images, which is obviously unreasonable for images with uneven lighting. Therefore, based on Retinex theory and practice, it is proposed to enhance images by dividing them into blocks according to the intensity of lighting. The intensity of lighting is reflected in the difference in brightness of colors in the image. Based on the difference in brightness, the image can be divided into several blocks for enhancement processing. The colors in each small block are approximately the same, which can be considered as uniform lighting. The following is an introduction to image block processing.
[0047] Dividing an image into blocks based on color can be transformed into a clustering problem, grouping parts with the same or similar colors into one category to achieve image segmentation. This invention uses color clustering for image segmentation, with the specific steps as follows:
[0048] ① Convert the input RGB image to Lab color space;
[0049] ② Calculate the color histogram of the input image, analyze the histogram to obtain the colors that make up the image, count the proportion of each color, sort them by size, select the top N colors that make up the image according to the number of clusters N input by the user, and set these as the initial cluster centers.
[0050] ③ Cluster the image pixels according to the colors that make up the image to obtain the category of each pixel. For each pixel, calculate the color difference between it and the color of each cluster center, and assign the pixel to the nearest cluster center.
[0051] ④ For all pixel categories, recalculate the cluster centers and determine whether they are close to the initial cluster centers. If they are close, end the iteration; otherwise, continue iterating and updating.
[0052] ⑤ Optimize the clustering results to eliminate isolated pixels and scattered small areas, resulting in smooth segmentation regions.
[0053] Color clustering algorithms perform clustering by calculating the color difference between each pixel and the cluster center color. In the CIELab color space, the specific formula for color difference is:
[0054]
[0055] Furthermore, in the original MSRCR algorithm, the final Log is... e [R MSRCRi The image (x, y) needs to be mapped to obtain the final RGB image output. Before mapping, pixel values that may be negative need to be corrected. The correction formula is as follows: Log e [R MSRCRi [x,y)′]=G×Log e [R MSRCRi [x,y)]+b
[0056] In the formula, G and b are parameters, typically taken as 192 and -30, respectively, and Value is Log. e [R MSRCRi The values of (x,y) are defined as follows: min is the minimum value among all pixel values, and max is the maximum value among all pixel values.
[0057] Experimental studies have found that for different images, especially those with uneven illumination, different b values have a significant impact on the image's information entropy, determining the enhancement strength and the amount of information carried. This invention proposes a pixel mapping scheme based on mean and mean square error, with the following steps:
[0058] ① Calculate Log e Mean and standard deviation Var of the R / G / B channels in [R(x,y)];
[0059] ② Calculate the Min and Max values of each channel using the mean and standard deviation (ρ is an adjustable parameter):
[0060] Min = Mean - ρ × Var;
[0061] Max = Mean + ρ × Var;
[0062] ③Regarding Log e For each value of [R(x,y)], perform a linear mapping, but overflow checks are required:
[0063] f(R(x,y)>255)R i (x,y)=255;
[0064] else if (R(x,y)<0)R i (x,y)=0;
[0065] The image is segmented and then enhanced using the MSRCR algorithm for each sub-block. The sub-blocks are then combined to obtain the complete image enhancement result after segmentation. The details are enhanced based on prior texture information. Finally, the image is smoothed to complete the overall processing.
[0066] To verify the effectiveness of the algorithm, several sets of images were selected for experiments under various lighting conditions, including sunrise, sunset, evening, night, and low light. The results were compared with histogram enhancement algorithms, SSR, MSR, MSRCR, JIEP, and STAR algorithms. The information entropy and NIEQ test values for each enhancement algorithm are given below:
[0067] Table 1 Information Entropy of Different Enhancement Methods
[0068]
[0069] Table 2 NIQE for different enhancement methods
[0070]
[0071] The table above shows the information entropy and NIEQ values of different algorithms for enhancing different images. The results show that histogram equalization, which transforms an image with arbitrary pixel distribution into a uniformly distributed image through stretching transformation, improves the overall contrast of the image, resulting in relatively high information entropy and NIEQ values. The SSR algorithm enhances the image by filtering out information from the incident image, but it loses low-frequency components, leading to a decrease in information entropy. Furthermore, issues such as halo and blurred image edges increase the NIEQ value. The MSR algorithm enhances the image using a three-channel SSR algorithm, enhancing more image details, but the effect is not significant according to the table data. The MSRCR algorithm introduces a color restoration factor, effectively enhancing the image; compared to the MSR algorithm, both information entropy and NIEQ values are significantly improved. The high reflectivity of the JIEP and STAR algorithms causes loss of visual content in the scene, resulting in less than ideal information entropy and NIEQ results. The image enhancement algorithm proposed in this invention, based on texture prior and color clustering, effectively enhances the structure and texture of images to a certain extent. Compared with the original MSRCR algorithm, it yields better results in information entropy and natural statistical properties, and retains more natural characteristics while minimizing image information loss.
[0072] The present invention has been described above by way of example in conjunction with the accompanying drawings. Obviously, the specific implementation of the present invention is not limited to the above-described manner. Any non-substantial improvement made by adopting the inventive concept and technical solution of the present invention, or the direct application of the inventive concept and technical solution of the present invention to other occasions without modification, shall be within the protection scope of the present invention.
Claims
1. An image enhancement method based on texture prior and color clustering, characterized in that, Includes the following steps: Step one: Extract the texture structure and then perform image enhancement. Step two: Use the information entropy and natural statistical properties of the image to evaluate the effectiveness of the augmented image; Step 3: Blend the enhanced image with the image texture; Step four: Perform block enhancement processing using an image segmentation algorithm; Step 5: Based on the block processing, a mapping scheme based on mean square value and mean square error is proposed to improve image contrast. In step five, the image is divided into blocks based on color, transforming it into a clustering problem. Parts with the same or similar colors are grouped together to achieve image segmentation. Color clustering is used for image segmentation, and the specific steps include: Step 1: Convert the input RGB image to Lab color space; Step 2: Calculate the color histogram of the input image, analyze the histogram to obtain the colors that make up the image, count the proportion of each color, sort them by size, select the top N colors that make up the image according to the number of clusters N input by the user, and set them as the initial cluster centers. Step 3: Cluster the image pixels according to the colors that make up the image to obtain the category of each pixel. For each pixel, calculate the color difference between it and the color of each cluster center, and assign the pixel to the nearest cluster center. Step 4: For all pixel categories, recalculate the cluster centers and determine if they are close to the initial cluster centers. If they are close, end the iteration; otherwise, continue iterating and updating. Step 5: Optimize the clustering results by eliminating isolated pixels and scattered small areas to obtain smooth partitioned regions. Step five proposes a mapping scheme based on mean square value and mean square error. Before mapping, pixel values that may be negative need to be corrected. The correction formula is as follows: In the formula, G and b are parameters, taken as 192 and -30, respectively, and Value is Log. e [R MSRCRi The values of (x,y) are defined as follows: min is the minimum value among all pixel values, and max is the maximum value among all pixel values. Step five proposes a mapping scheme based on mean square value and mean square error, and the specific steps are as follows: Step a, calculate Log e Mean and standard deviation Var of the R / G / B channels in [R(x,y)]; Step b: Calculate the Min and Max values for each channel using the mean and standard deviation: Min = Mean - ρ × Var; Max = Mean + ρ × Var; In the formula, ρ is an adjustable parameter; Step c, for Log e For each value of [R(x,y)], perform a linear mapping, but overflow checks are required: f(R(x,y)>255)R i (x,y)=255; else if(R(x,y)<0)R i (x,y)=0。 2. The image enhancement method based on texture prior and color clustering according to claim 1, characterized in that, In step four, the image obtained under uneven lighting conditions is enhanced by dividing it into blocks according to the different levels of brightness. The image is divided into several blocks for enhancement processing. When the colors in each small block are close to the same, the lighting is considered to be uniform and then enhancement processing is performed.
3. The image enhancement method based on texture prior and color clustering according to claim 1, characterized in that, In step one, the texture structure is extracted, and the image is represented as the sum of the texture image and the structure image according to the structure-texture decomposition model.
4. The image enhancement method based on texture prior and color clustering according to claim 3, characterized in that, The sum of the texture image and the structure image is represented as: I(x,y)=I S (x,y)+I T (x,y); In the formula, I S (x,y) is the structural image, I T (x,y) is the texture image.
Citation Information
Patent Citations
Image defogging enhancement algorithm based on gradient domain guided filtering and multi-scale Retinex theory
CN111476725A