Image enhancement method and device based on color distribution statistics
By performing semantic segmentation and LCH color space conversion on images to obtain regional color distribution statistics, combined with learnable color mapping and multi-dimensional loss function optimization, the problem of poor overall color adjustment coordination in existing image enhancement methods is solved, achieving accurate conversion and natural adjustment of image color style.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-24
- Publication Date
- 2026-03-17
AI Technical Summary
Existing image enhancement methods have poor overall coordination during color adjustment, resulting in over-adjustment or distortion in non-target areas, making it difficult to achieve fine-grained style control.
By performing semantic segmentation on the input image and standard sample, converting it to the LCH color space for regional color distribution statistics, using a learnable color mapping function for color mapping, and combining it with a multi-dimensional loss function for optimization, the accuracy and adaptability of color style transfer are ensured.
It achieves efficient and natural adjustment of image color style, ensuring image detail and visual realism, while maintaining the overall harmony and local features of the image.
Smart Images

Figure CN121685273A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image processing, and in particular to an image enhancement method and device based on color distribution statistics. BACKGROUND
[0002] Image color enhancement and style transfer are classic problems in the field of computer vision and image processing, aiming to improve the visual quality of an image or apply the style characteristics of one image to another image.
[0003] For example, global adjustment methods such as histogram equalization, automatic color scale and gamma correction, etc. adjust the color distribution by applying a uniform transformation to the entire image. Although such methods are computationally efficient, their main drawback is that they ignore the semantic information of the image content. Since different regions such as faces, backgrounds, and clothing are treated indiscriminately, it often leads to over-adjustment or distortion in non-target regions (such as the background), such as color overflow or unnatural skin color, making it difficult to achieve fine-grained style control.
[0004] Therefore, the image enhancement method in the related art has the technical problem of poor overall coordination of color adjustment. SUMMARY
[0005] The present application provides an image enhancement method and device based on color distribution statistics to solve the defect of poor overall coordination of color adjustment in the prior art image enhancement method, to improve the overall coordination of image color, and to approach the standard sample style.
[0006] The present application provides an image enhancement method based on color distribution statistics, comprising the following steps. An input image and a standard sample are obtained, wherein the input image is an image to be enhanced, and the standard sample is a reference image providing a target color style. The input image and the standard sample are respectively subjected to semantic segmentation to obtain regional mask information of the input image and regional mask information of the standard sample. The input image and the standard sample are converted from an RGB color space to an LCH color space to obtain an original LCH image and a standard LCH image. Based on the regional mask information of the input image and the regional mask information of the standard sample, the original LCH image and the standard LCH image are respectively subjected to regional color distribution statistics to obtain distribution statistics features of the original LCH image and distribution statistics features of the standard LCH image. Based on the distribution statistics features of the standard LCH image, the distribution statistics features of the original LCH image are color-mapped by a learnable color mapping function to obtain an adjusted LCH image. The adjusted LCH image is subjected to LCH color space conversion to RGB color space color space inversion to obtain an output image.
[0007] According to the image enhancement method based on color distribution statistics provided by the present invention, the step of performing semantic segmentation on the input image and the standard sample to obtain the region mask information of the input image and the region mask information of the standard sample includes: inputting the input image and the standard sample into a preset single-stage face detection model to obtain the face region of the input image and the face region of the standard sample output by the single-stage face detection model; inputting the face region of the input image and the face region of the standard sample into a preset face representation learning model to obtain the preliminary semantic label map of the input image and the preliminary semantic label map of the standard sample output by the face representation learning model; and performing category mapping on the preliminary semantic label map of the input image and the preliminary semantic label map of the standard sample based on a preset category mapping function to obtain the region mask information of the input image and the region mask information of the standard sample.
[0008] According to the present invention, an image enhancement method based on color distribution statistics is provided, wherein the method performs regional color distribution statistics on the original LCH image and the standard LCH image based on the regional mask information of the input image and the regional mask information of the standard sample, respectively, to obtain the distribution statistical characteristics of the original LCH image and the distribution statistical characteristics of the standard LCH image, including: determining the mean, standard deviation, and histogram distribution of brightness, chromaticity, and hue of each region in the original LCH image and the standard LCH image based on the regional mask information of the input image and the regional mask information of the standard sample, respectively, to obtain the distribution statistical characteristics of the original LCH image and the distribution statistical characteristics of the standard LCH image.
[0009] According to the image enhancement method based on color distribution statistics provided by the present invention, the step of determining the mean, standard deviation, and histogram distribution of luminance, chroma, and hue of each region in the original LCH image and the standard LCH image respectively includes: for each region of the original LCH image and the standard LCH image, determining the mean, standard deviation, and histogram distribution of luminance, chroma, and hue respectively according to the following formula: in, Indicates the first The average pixel value of each region Indicates the first The total number of pixels in each region Indicates the first The pixel value of a region of 1 pixel, a standard deviation representing a first a histogram distribution representing a first is a kernel function, is a bandwidth function, represents an input color value.
[0010] According to the image enhancement method based on color distribution statistics provided by the application, the distribution statistical characteristics of the standard LCH image are mapped through a learnable color mapping function, and an adjusted LCH image is obtained, which comprises the following steps: obtaining the brightness, chroma and hue of each pixel in the original LCH image; based on the brightness, chroma and hue of each pixel, a channel transformation is performed through a set of learnable lookup tables to obtain the preliminary mapping value of each pixel; based on the cross-influence term between different color channels, the preliminary mapping value of each pixel is adjusted to obtain the adjusted pixel value of each pixel, thereby forming an adjusted LCH image.
[0011] According to the image enhancement method based on color distribution statistics provided by the application, the method further comprises the following steps: obtaining the distribution statistical characteristics of the adjusted LCH image; based on the distribution statistical characteristics of the adjusted LCH image and the distribution statistical characteristics of the standard LCH image, a statistical matching loss is determined; based on the pixel value change between the original LCH image and the adjusted LCH image, an image smoothing loss is determined; based on the parameters of the color mapping function, a mapping function regularization loss is determined; based on the statistical matching loss, the image smoothing loss and the mapping function regularization loss, a comprehensive loss function is constructed; by minimizing the comprehensive loss function, the parameters of the color mapping function are iteratively optimized.
[0012] The application further provides an image enhancement device based on color distribution statistics, comprising the following modules: an input module, configured to acquire an input image and a standard sample, wherein the input image is an image to be enhanced, and the standard sample is a reference image providing a target color style; a mask module, configured to perform semantic segmentation on the input image and the standard sample respectively to obtain regional mask information of the input image and regional mask information of the standard sample; a conversion module, configured to convert the input image and the standard sample from an RGB color space to an LCH color space to obtain an original LCH image and a standard LCH image; a statistical module, configured to perform regional color distribution statistics on the original LCH image and the standard LCH image respectively based on the regional mask information of the input image and the regional mask information of the standard sample to obtain distribution statistical features of the original LCH image and distribution statistical features of the standard LCH image; a mapping module, configured to perform color mapping on the distribution statistical features of the original LCH image based on the distribution statistical features of the standard LCH image through a learnable color mapping function to obtain an adjusted LCH image; and an output module, configured to perform color space inversion from the LCH color space to the RGB color space based on the adjusted LCH image to obtain an output image.
[0013] The application further provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the image enhancement method based on color distribution statistics according to any one of the above when executing the program.
[0014] The application further provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program is executable on a processor to implement the image enhancement method based on color distribution statistics according to any one of the above.
[0015] The application further provides a computer program product comprising a computer program, wherein the computer program is executable on a processor to implement the image enhancement method based on color distribution statistics according to any one of the above.
[0016] The application provides an image enhancement method and device based on color distribution statistics. BRIEF DESCRIPTION OF DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the application or prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are some embodiments of the application, and other drawings can be obtained by those skilled in the art without any creative effort on the basis of these drawings.
[0018] Figure 1 FIG. 1 is a flowchart of the image enhancement method based on color distribution statistics provided by the application.
[0019] Figure 2 FIG. 2 is a whole flowchart of the image enhancement method based on color distribution statistics provided by the application.
[0020] Figure 3 FIG. 3 is a module schematic diagram of the image enhancement device based on color distribution statistics provided by the application.
[0021] Figure 4 FIG. 4 is a physical structure schematic diagram of the electronic device provided by the application. DETAILED DESCRIPTION
[0022] In order to make the purpose, technical solutions and advantages of the application more clear, the following will combine the drawings in the application to clearly and completely describe the technical solutions in the application. Obviously, the described embodiments are some embodiments of the application, not all the embodiments. Based on the embodiments in the application, all other embodiments obtained by those skilled in the art without any creative effort belong to the protection scope of the application.
[0023] The application provides an image enhancement method based on color distribution statistics, which comprises the following steps.
[0024] Optionally, the image enhancement method based on color distribution statistics can be executed by a server, a terminal device, or both the server and the terminal device.
[0025] Figure 1 The application provides an image enhancement method based on color distribution statistics, which comprises the following steps. Figure 1 The method comprises the following steps.
[0026] In step 101, an input image and a standard sample are obtained.
[0027] The input image is an image to be enhanced, and the standard sample is a reference image providing a target color style.
[0028] In the embodiment of the application, the input image is an original image to be color enhanced by a user, which is directly obtained by an image acquisition device (such as a digital camera, a scanner or a mobile terminal camera) or read from a storage device. The image is usually an RGB format digital image containing a portrait, such as a user's self-taken ID photo or portrait photo.
[0029] The standard sample represents a target color style to be output. The sample is usually a standard RGB image defined in advance and stored in a system database or a configuration file.
[0030] In step 102, semantic segmentation is performed on the input image and the standard sample to obtain regional mask information of the input image and regional mask information of the standard sample.
[0031] According to the image enhancement method based on color distribution statistics, semantic segmentation is performed on the input image and the standard sample to obtain regional mask information of the input image and regional mask information of the standard sample, which comprises the following steps. The input image and the standard sample are input into a preset single-stage face detection model to obtain a face region of the input image and a face region of the standard sample output by the single-stage face detection model. The face region of the input image and the face region of the standard sample are input into a preset face representation learning model to obtain a preliminary semantic label map of the input image and a preliminary semantic label map of the standard sample output by the face representation learning model; Based on a preset category mapping function, the preliminary semantic label map of the input image and the preliminary semantic label map of the standard sample are respectively subjected to category mapping to obtain region mask information of the input image and region mask information of the standard sample.
[0032] In the embodiment of the present application, the face in the input image and the standard sample is analyzed, which facilitates subsequent color mapping in the region.
[0033] In order to provide more accurate face region segmentation, the present application performs two-stage face analysis, and the analysis process uses two models of RetinaFace (i.e., a single-stage face detection model) and FaRL (i.e., a face representation learning model) for face region positioning and semantic label classification, respectively.
[0034] First, the RetinaFace model is used to position the face region, and then the FaRL model is used to analyze the detected face region. For each pixel position, the probability of belonging to each category is calculated through the Softmax operation, and finally each pixel is assigned to the category corresponding to the maximum probability to obtain a preliminary semantic label map .
[0035] The FaRL model uses a relatively fine-grained category definition, including 19 categories such as facial features and accessories. Since there are strict requirements for wearing and posture during the shooting of ID photos, and the regions used for color distribution statistics (such as the left and right eyes, upper and lower lips, etc.) have symmetry, in order to facilitate subsequent unified processing, the present application further designs a category mapping function to normalize it into twelve main labels. Specifically, we focus on the semantic regions of face, hair, skin, clothes, lips, and eyes.
[0036] Based on the category mapping function, the preliminary semantic label map of the input image and the preliminary semantic label map of the standard sample are respectively subjected to category mapping processing. The category mapping function defines the mapping relationship from the original fine-grained semantic label to the predefined main semantic category, and through the mapping, the detailed semantic classification is merged into several main semantic region categories. After the category mapping processing, the region mask information of the input image and the region mask information of the standard sample are finally obtained.
[0037] Through the embodiment of the present application, the face regions of the input image and the standard sample are accurately positioned by the single-stage face detection model, and then the preliminary semantic label image is generated by using the face representation learning model, and further the regional mask information is obtained by using the category mapping function, so that the detailed regional division of the image and the sample is realized, and the regional basis is provided for the subsequent image enhancement based on color distribution statistics.
[0038] In step 103, the input image and the standard sample are converted from the RGB color space to the LCH color space to obtain the original LCH image and the standard LCH image.
[0039] In some embodiments, the RGB values of each pixel in the input image and the standard sample are color space converted. The conversion process is realized by using a preset color space conversion algorithm, the RGB color space is converted to the CIELab color space, and then the LCH color space values are calculated. Among them, L represents the lightness component, representing the brightness information of the color; C represents the chroma component, representing the saturation of the color; H represents the hue component, representing the color attribute of the color.
[0040] Through the above conversion process, the input image is converted into an original LCH image with L, C, and H three channels, and the standard sample is converted into a standard LCH image with L, C, and H three channels. The original LCH image and the standard LCH image obtained after conversion will be used for subsequent color distribution statistics and processing.
[0041] In step 104, based on the regional mask information of the input image and the regional mask information of the standard sample, the original LCH image and the standard LCH image are respectively subjected to regional color distribution statistics to obtain the distribution statistics features of the original LCH image and the distribution statistics features of the standard LCH image.
[0042] In the embodiment of the present application, through the above conversion process, the input image is converted into an original LCH image with L, C, and H three channels, and the standard sample is converted into a standard LCH image with L, C, and H three channels. The original LCH image and the standard LCH image obtained after conversion will be used for subsequent color distribution statistics and processing.
[0043] According to the image enhancement method based on color distribution statistics provided by the present application, based on the regional mask information of the input image and the regional mask information of the standard sample, the original LCH image and the standard LCH image are respectively subjected to regional color distribution statistics to obtain the distribution statistics features of the original LCH image and the distribution statistics features of the standard LCH image, which comprises: Based on the region mask information of the input image and the region mask information of the standard sample, the mean, standard deviation and histogram distribution of brightness, chromaticity and hue of each region in the original LCH image and the standard LCH image are determined respectively, so as to obtain the distribution statistical characteristics of the original LCH image and the distribution statistical characteristics of the standard LCH image.
[0044] Specifically, for each pixel within a region, statistical metrics for its three channels in the LCH color space are calculated, including the mean, standard deviation, and a normalized probability density histogram based on the region division. These features describe the brightness distribution, color saturation, and hue distribution of that region, demonstrating strong representativeness and interpretability.
[0045] Through the embodiments of the present invention, regional color distribution statistics are performed on the original LCH image and the standard LCH image respectively, and statistical characteristics such as the mean, standard deviation and histogram distribution of brightness, chroma and hue of each region are accurately obtained. This provides comprehensive and detailed data support for subsequent targeted adjustment of image color distribution and the achievement of accurate and standard-compliant image enhancement.
[0046] According to the present invention, an image enhancement method based on color distribution statistics determines the mean, standard deviation, and histogram distribution of brightness, chromaticity, and hue of each region in the original LCH image and the standard LCH image, respectively, including: For each region of the original LCH image and the standard LCH image, determine the mean, standard deviation, and histogram distribution of luminance, chroma, and hue according to the following formulas: in, Indicates the first The average pixel value of each region Indicates the first The total number of pixels in each region Indicates the first The pixel value of a region of 1 pixel, Indicates the first Standard deviation of each region Indicates the first Histogram distribution of each region For kernel function, For bandwidth function, This indicates the input color value.
[0047] In this embodiment of the invention, in each region Within the range, calculate the mean, standard deviation, and histogram distribution of the L, C, and H components respectively: in, Indicates the first The total number of pixels in each region Indicates the first The histogram is calculated using kernel density estimation to smooth the region's pixel values. The histogram function is defined as: in, For kernel function, This is the bandwidth function. The target image is then calculated using the same method to determine its distribution statistics, which serve as the optimization objective. For the region... The target mean and target standard deviation are respectively and .
[0048] Through the embodiments of the present invention, the distribution statistical characteristics of the original LCH image and the distribution statistical characteristics of the standard LCH image will serve as important guiding signals for the next step of color mapping network optimization, driving the overall color style of the image to move closer to the target distribution from the source distribution.
[0049] Step 105: Based on the distribution statistical features of the standard LCH image, the distribution statistical features of the original LCH image are color-mapped using a learnable color mapping function to obtain the adjusted LCH image.
[0050] In this embodiment of the invention, a learnable color mapping function is constructed so that the color distribution of the original LCH image gradually approximates the color distribution of the standard LCH image within each semantic region. This invention employs an end-to-end color mapping function to achieve more flexible, continuous, and differentiable color style adjustment.
[0051] According to the present invention, an image enhancement method based on color distribution statistics is provided. Based on the distribution statistical characteristics of a standard LCH image, a learnable color mapping function is used to color map the distribution statistical characteristics of the original LCH image to obtain an adjusted LCH image. The method includes: Obtain the brightness, chromaticity, and hue of each pixel in the original LCH image; Based on the brightness, chromaticity, and hue of each pixel, channel transformation is performed through a set of learnable lookup tables to obtain the initial mapping value of each pixel; Based on the cross-influence terms between different color channels, the initial mapping value of each pixel is adjusted to obtain the adjusted pixel value of each pixel, thus forming the adjusted LCH image.
[0052] In this embodiment of the invention, the input to the color mapping function is the (L, C, H) value of each pixel in the original LCH image, and the output is the adjusted (L', C', H'). This invention establishes a set of lookup tables (LUTs) for the transformation of the three channels, and simultaneously introduces cross-influence terms from different channels for adjustment to enhance the coupling between multiple channels.
[0053] Through the embodiments of the present invention, a learnable lookup table is used to perform channel transformation to obtain a preliminary mapping value. The cross-influence terms between different color channels are considered to adjust the preliminary mapping value. The original image can be accurately and flexibly color mapped according to the distribution characteristics of the standard LCH image, effectively improving the color distribution of the original image and generating an adjusted LCH image with better color performance and higher quality.
[0054] According to the image enhancement method based on color distribution statistics provided by the present invention, the method further includes: Obtain the distribution statistics of the adjusted LCH image; Based on the distribution statistical characteristics of the adjusted LCH image and the distribution statistical characteristics of the standard LCH image, the statistical matching loss is determined. The image smoothing loss is determined based on the pixel value changes between the original LCH image and the adjusted LCH image. Based on the parameters of the color mapping function, determine the regularization loss of the mapping function; A comprehensive loss function is constructed based on statistical matching loss, image smoothing loss, and mapping function regularization loss. The parameters of the color mapping function are iteratively optimized by minimizing the comprehensive loss function.
[0055] To ensure that the color distribution of the optimized image conforms to the style of the target sample while preserving the local features of the original image, this invention designs a multi-loss function joint optimization strategy to guide the learning process of the color mapping function. For each region... The L, C, and H components are used to minimize the mean of the predicted values. Standard deviation The difference between the predicted and target values is calculated, and the KL divergence is used to measure the difference between the predicted and target distributions. in, This represents the histogram loss value (i.e., statistical matching loss). Denotes KL divergence, Indicates the first Predicted distribution of each region Indicates the first The target distribution of each region.
[0056] in, Represents distribution Relative to distribution The KL divergence, here, Used to represent , Used to represent , This represents the color value.
[0057] To ensure a smooth transition in the optimized image, a second-order derivative regularization term is designed to control gradient changes between pixels: in, This represents the smoothing loss value (i.e., image smoothing loss). and These are brightness The second derivative in the horizontal (x-axis) and vertical (y-axis) directions of the image.
[0058] To further maintain consistency in local details, additional loss terms are added for detailed areas such as the eyes and lips: in, This indicates the loss value in the eye area. This represents the brightness values of all pixels in the semantic region of the eye (usually including the left and right eye regions). This represents the chromaticity values of all pixels in the eye semantic region. Describes the minimum value function. Represents the median function. This represents the loss value for the lip region. This represents the average of the chroma values (C channel values) of all pixels in the lip semantic region. This represents the average chromaticity value of the corresponding lip semantic region in the standard sample.
[0059] To constrain the smoothness and mapping rationality of the LUT curve, a mapping curve regularization loss is introduced. The experiment combines multiple loss functions to form the final optimization objective function (i.e., the comprehensive loss function): in, Represents the comprehensive loss function. Indicates the first The weighting coefficients corresponding to the item loss. Indicates the first The numerical value corresponding to the item loss, This represents the statistical matching loss. This represents the mean-matching loss. This represents the standard deviation matching loss. Indicates smoothing loss. Indicates loss in the eye area. This indicates loss in the lip area. This represents the regularization loss of the mapping curve.
[0060] The Adam optimizer is used to iteratively optimize the LUT curve model parameters: in, This represents all the adjustable parameters in the color mapping function (learnable lookup table LUT). Indicates the iteration count index. Represents the gradient operator, The learning rate is set and dynamically adjusted during the iteration process.
[0061] Step 106: Based on the adjusted LCH image, perform a color space inverse conversion from LCH color space to RGB color space to obtain the output image.
[0062] refer to Figure 2 , Figure 2 This is an overall flowchart of the image enhancement method based on color distribution statistics provided by the present invention. It includes input image, standard sample, face detection, semantic segmentation, color space mapping, color distribution statistics, input image, standard sample, color mapping, color space inverse conversion, and output image.
[0063] This invention designs an automatic image color style adjustment method based on region semantic segmentation and LCH color mapping. This method aims to ensure that specific semantic regions of the image to be processed, such as face, hair, skin, and clothing, maintain color style consistency with standard sample specifications. The method first uses pre-trained models RetinaFace and FaRL to perform face detection and semantic label classification on the input image, respectively, to obtain the region-specific mask information of the portrait. Then, the image is converted from the RGB color space to the LCH color space to model and adjust the luminance (L), chroma (C), and hue (H) separately. After extracting the semantic regions, the distribution statistics of the L, C, and H channels of each region are calculated, including the mean, standard deviation, and normalized histogram density distribution. Simultaneously, the same processing is applied to the standard sample specifications to construct the target color distribution model. To achieve effective mapping from the source image to the target distribution, this invention designs a learnable color mapping function, which is jointly optimized through end-to-end training and multiple loss functions. After training, the adjusted LCH image is inversely transformed into an RGB image, and combined with the foreground transparency information of the original image, the background is replaced, ultimately obtaining a portrait image that maintains the geometric structure and adjusts the color style.
[0064] The method of this invention can be used for automatic enhancement and color correction of ID photos with standard sample specifications. It can automatically adjust the overall color style of the original image to be consistent with the standard sample specifications, and obtain a color-coordinated result.
[0065] Through the above embodiments of the present invention, by introducing semantic segmentation, key areas such as face, hair, skin, and clothing in the image are processed independently, avoiding background interference or distortion of non-target areas caused by traditional global adjustment, making the style transformation of the image more accurate and controllable.
[0066] Traditional color adjustment methods often rely on RGB or Lab color spaces, which suffer from coupling issues between channels. This invention uses the LCH color space for color modeling and mapping. This space features channel decoupling and is more consistent with human visual perception, resulting in smoother and more natural color adjustment results.
[0067] The optimization objective of this invention not only matches the mean, variance, and histogram of the color distribution, but also introduces smoothness loss, mapping function regularization term, etc., to ensure that the adjusted image is statistically close to the target style while maintaining the facial structure and local details.
[0068] The image enhancement device based on color distribution statistics provided by the present invention is described below. The image enhancement device based on color distribution statistics described below can be referred to in correspondence with the image enhancement method based on color distribution statistics described above.
[0069] refer toFigure 3 , Figure 3 This is a schematic diagram of the module of the image enhancement device based on color distribution statistics provided by the present invention.
[0070] The input module 301 is used to acquire an input image and a standard sample, wherein the input image is the image to be enhanced, and the standard sample is a reference image that provides the target color style; The mask module 302 is used to perform semantic segmentation on the input image and the standard sample respectively, and obtain the region mask information of the input image and the region mask information of the standard sample. The conversion module 303 is used to convert the input image and the standard sample from the RGB color space to the LCH color space to obtain the original LCH image and the standard LCH image. The statistics module 304 is used to perform regional color distribution statistics on the original LCH image and the standard LCH image based on the regional mask information of the input image and the regional mask information of the standard sample, respectively, to obtain the distribution statistics characteristics of the original LCH image and the distribution statistics characteristics of the standard LCH image. The mapping module 305 is used to perform color mapping on the distribution statistical features of the original LCH image based on the distribution statistical features of the standard LCH image through a learnable color mapping function to obtain the adjusted LCH image. The output module 306 is used to perform a color space inverse conversion from LCH color space to RGB color space based on the adjusted LCH image to obtain the output image.
[0071] Specifically, the image enhancement device based on color distribution statistics provided by the present invention can implement all the method steps implemented in the above-mentioned image enhancement method embodiment based on color distribution statistics, and can achieve the same technical effect. Here, the parts that are the same as those in the method embodiment and the beneficial effects will not be described in detail.
[0072] Figure 4 This is a schematic diagram of the physical structure of the electronic device provided by the present invention, such as... Figure 4As shown, the electronic device may include: a processor 410, a communications interface 420, a memory 430, and a communications bus 440, wherein the processor 410, the communications interface 420, and the memory 430 communicate with each other through the communications bus 440. The processor 410 can call logical instructions in the memory 430 to execute an image enhancement method based on color distribution statistics. This method includes: acquiring an input image and a standard sample, wherein the input image is the image to be enhanced, and the standard sample is a reference image providing the target color style; performing semantic segmentation on the input image and the standard sample respectively to obtain the region mask information of the input image and the region mask information of the standard sample; converting the input image and the standard sample from the RGB color space to the LCH color space to obtain an original LCH image and a standard LCH image; performing region color distribution statistics on the original LCH image and the standard LCH image respectively based on the region mask information of the input image and the region mask information of the standard sample to obtain the distribution statistical features of the original LCH image and the distribution statistical features of the standard LCH image; performing color mapping on the distribution statistical features of the original LCH image using a learnable color mapping function based on the distribution statistical features of the standard LCH image to obtain an adjusted LCH image; and performing a color space inverse conversion from the LCH color space to the RGB color space based on the adjusted LCH image to obtain an output image.
[0073] Furthermore, the logical instructions in the aforementioned memory 430 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0074] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer is able to execute the image enhancement method based on color distribution statistics provided by the above methods. The method includes: acquiring an input image and a standard sample, wherein the input image is the image to be enhanced, and the standard sample is a reference image providing a target color style; performing semantic segmentation on the input image and the standard sample respectively to obtain the region mask information of the input image and the region mask information of the standard sample; and converting the input image and the standard sample from the RGB color space. The image is converted to the LCH color space to obtain the original LCH image and the standard LCH image. Based on the region mask information of the input image and the region mask information of the standard sample, the color distribution statistics of the original LCH image and the standard LCH image are statistically analyzed by region to obtain the distribution statistics characteristics of the original LCH image and the standard LCH image respectively. Based on the distribution statistics characteristics of the standard LCH image, the distribution statistics characteristics of the original LCH image are color mapped using a learnable color mapping function to obtain the adjusted LCH image. Based on the adjusted LCH image, the LCH color space is converted to the RGB color space and then converted inversely to obtain the output image.
[0075] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the image enhancement method based on color distribution statistics provided by the methods described above. The method includes: acquiring an input image and a standard sample, wherein the input image is the image to be enhanced, and the standard sample is a reference image providing a target color style; performing semantic segmentation on the input image and the standard sample respectively to obtain region-specific mask information of the input image and region-specific mask information of the standard sample; and converting the input image and the standard sample from the RGB color space to the LCH color space to obtain the original... The original LCH image and the standard LCH image are compared. Based on the region-specific mask information of the input image and the region-specific mask information of the standard sample, the color distribution statistics of the original LCH image and the standard LCH image are statistically analyzed by region to obtain the distribution statistics characteristics of the original LCH image and the standard LCH image. Based on the distribution statistics characteristics of the standard LCH image, the distribution statistics characteristics of the original LCH image are color-mapped using a learnable color mapping function to obtain the adjusted LCH image. Based on the adjusted LCH image, the LCH color space is converted to the RGB color space and then converted inversely to obtain the output image.
[0076] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0077] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0078] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. An image enhancement method based on color distribution statistics, characterized in that, The method comprises the following steps: obtaining an input image and a standard sample, wherein the input image is an image to be enhanced, and the standard sample is a reference image providing a target color style; performing semantic segmentation on the input image and the standard sample respectively to obtain region mask information of the input image and region mask information of the standard sample; converting the input image and the standard sample from an RGB color space to an LCH color space to obtain an original LCH image and a standard LCH image; based on the region mask information of the input image and the region mask information of the standard sample, performing region color distribution statistics on the original LCH image and the standard LCH image respectively to obtain distribution statistics features of the original LCH image and distribution statistics features of the standard LCH image; based on the distribution statistics features of the standard LCH image, performing color mapping on the distribution statistics features of the original LCH image through a learnable color mapping function to obtain an adjusted LCH image; performing color space inversion from the LCH color space to the RGB color space based on the adjusted LCH image to obtain an output image.
2. The color distribution statistics based image enhancement method of claim 1, wherein, The step of performing semantic segmentation on the input image and the standard sample respectively to obtain region mask information of the input image and region mask information of the standard sample comprises the following steps: inputting the input image and the standard sample into a preset single-stage face detection model respectively to obtain a face region of the input image and a face region of the standard sample output by the single-stage face detection model; inputting the face region of the input image and the face region of the standard sample into a preset face representation learning model to obtain a preliminary semantic label map of the input image and a preliminary semantic label map of the standard sample output by the face representation learning model; based on a preset category mapping function, performing category mapping on the preliminary semantic label map of the input image and the preliminary semantic label map of the standard sample respectively to obtain the region mask information of the input image and the region mask information of the standard sample.
3. The color distribution statistics based image enhancement method of claim 1, wherein, The step of performing region color distribution statistics on the original LCH image and the standard LCH image respectively based on the region mask information of the input image and the region mask information of the standard sample to obtain distribution statistics features of the original LCH image and distribution statistics features of the standard LCH image comprises the following steps: based on the region mask information of the input image and the region mask information of the standard sample, determining the mean value, the standard deviation and the histogram distribution of the brightness, the chroma and the hue of each region in the original LCH image and the standard LCH image respectively to obtain the distribution statistics features of the original LCH image and the distribution statistics features of the standard LCH image.
4. The image enhancement method based on color distribution statistics according to claim 3, characterized in that, The step of determining the mean value, the standard deviation and the histogram distribution of the brightness, the chroma and the hue of each region in the original LCH image and the standard LCH image respectively comprises the following steps: For each region of the original LCH image and the standard LCH image, the mean, standard deviation and histogram distribution of luminance, chroma and hue are determined according to the following formula: wherein, represents the mean of the pixels of the represents the total number of pixels of the represents the region pixel value of the represents the standard deviation of the represents the histogram distribution of the is a kernel function, is a bandwidth function, represents the input color value. 5. The color distribution statistics based image enhancement method of claim 1, wherein, The distribution statistical features of the standard LCH image are used to color map the distribution statistical features of the original LCH image through a learnable color mapping function to obtain an adjusted LCH image, including: The luminance, chroma and hue of each pixel in the original LCH image are obtained; Based on the luminance, chroma and hue of each pixel, a channel transformation is performed through a set of learnable lookup tables to obtain the preliminary mapping value of each pixel; Based on the cross-influence term between different color channels, the preliminary mapping value of each pixel is adjusted to obtain the adjusted pixel value of each pixel, thereby forming an adjusted LCH image.
6. The color distribution statistics based image enhancement method of claim 1, wherein, The method further includes: The distribution statistical features of the adjusted LCH image are obtained; Based on the distribution statistical features of the adjusted LCH image and the distribution statistical features of the standard LCH image, a statistical matching loss is determined; Based on the pixel value change between the original LCH image and the adjusted LCH image, an image smoothing loss is determined; Based on the parameters of the color mapping function, a mapping function regularization loss is determined; Based on the statistical matching loss, the image smoothing loss and the mapping function regularization loss, a comprehensive loss function is constructed; The parameters of the color mapping function are iteratively optimized by minimizing the comprehensive loss function.
7. An image enhancement apparatus based on color distribution statistics, characterized by, It includes: An input module for obtaining an input image and a standard sample, wherein the input image is an image to be enhanced, and the standard sample is a reference image providing a target color style; A mask module for performing semantic segmentation on the input image and the standard sample respectively to obtain regional mask information of the input image and regional mask information of the standard sample; A conversion module for converting the input image and the standard sample from an RGB color space to an LCH color space to obtain an original LCH image and a standard LCH image; A statistical module for performing regional color distribution statistics on the original LCH image and the standard LCH image based on the regional mask information of the input image and the regional mask information of the standard sample to obtain distribution statistical features of the original LCH image and distribution statistical features of the standard LCH image; A mapping module for color mapping the distribution statistical features of the original LCH image through a learnable color mapping function based on the distribution statistical features of the standard LCH image to obtain an adjusted LCH image; An output module for performing LCH color space conversion to RGB color space color space inversion based on the adjusted LCH image to obtain an output image.
8. An electronic device comprising a memory, a processor, and a computer program stored on the memory and running on the processor, characterized in that, The processor executes the computer program to implement the image enhancement method based on color distribution statistics according to any one of claims 1-6. 9.A non-transitory computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the image enhancement method based on color distribution statistics according to any one of claims 1-6.
10. A computer program product comprising a computer program, characterized in that, The computer program, when executed by a processor, implements the image enhancement method based on color distribution statistics according to any one of claims 1 to 6.