Color image desaturation method based on detail contrast preservation and color consistency

By constructing an objective function and a local adaptive decolorization method, the process of converting color images into grayscale images is optimized, which solves the problems of insufficient detail contrast and color consistency in color image decolorization and achieves a more efficient decolorization effect.

CN119313755BActive Publication Date: 2025-10-10NORTHWEST UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411311933.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-20
Publication Date
2025-10-10
Estimated Expiration
2044-09-20

AI Technical Summary

Technical Problem

Existing color image decolorization methods are insufficient in preserving detail contrast and color consistency, resulting in information distortion and poor processing speed.

Method used

An objective function is constructed to optimize the process of converting color images into grayscale images. Pixel pairs are selected through clustering and weight optimization methods, and a local adaptive decolorization technique is used, combined with contrast and structural similarity evaluation indicators to optimize the decolorization effect.

Benefits of technology

It effectively preserves the detail contrast information of color images, improves processing speed, and maintains color consistency, meeting the human eye's perception requirements for detail contrast.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119313755B_ABST
    Figure CN119313755B_ABST
Patent Text Reader

Abstract

The application discloses a color image desaturation method based on detail contrast keeping and color consistency, comprising the following steps: constructing a target function, obtaining a data set, extracting pixel pairs of color images in the data set, and inputting the extracted pixel pairs into the target function to output conversion parameters between the color image and a gray image; and calculating the color image according to the conversion parameters output by the target function and outputting a gray image. A pixel pair selection method based on clustering and a method based on pixel pair weight optimization are designed to keep the detail contrast of the extracted image as much as possible. Meanwhile, for color-rich color synthesis pictures, a local adaptive desaturation method is proposed, which can retain more detail contrast while keeping color consistency. In order to improve the pixel pair selection efficiency and retain more effective contrast reference values, the size of the input image can be compressed to 64*64 before selection, so as to reduce pixel pair redundancy and improve processing speed.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of image processing, in particular to a color image desaturation method based on detail contrast preservation and color consistency. BACKGROUND

[0002] Color image desaturation is the process of converting color images into grayscale images, which is applied to devices that only support monochrome information output, such as monochrome printers, night mode on some smartphones, etc., and can also be used as a preprocessing step to eliminate color interference and reduce the number of channels in subsequent image processing tasks, making it more convenient and efficient. However, since desaturation involves converting multi-channel information into single-channel grayscale information, some information distortion is inevitable during dimension reduction. Therefore, preserving as much original image information and detail contrast as possible during grayscale conversion has been an important goal of color image desaturation technology research for many years. However, both early desaturation work and methods based on global and local desaturation will have some degree of contrast loss, especially in the preservation of detail contrast. And since the desaturation task is now applied to the preprocessing process of image processing, its role in information filtering and compression directly affects the results of subsequent processing, which requires not only to preserve more detail contrast information, but also to optimize processing speed. SUMMARY

[0003] Therefore, the purpose of the present application is to provide a color image desaturation method based on detail contrast preservation and color consistency to preserve more detail contrast information and optimize processing speed in the desaturation process.

[0004] The color image desaturation method based on detail contrast preservation and color consistency comprises the following steps:

[0005] Constructing a target function;

[0006] Obtaining a data set;

[0007] Extracting pixel pairs of color images in the data set and inputting the extracted pixel pairs into the target function to output conversion parameters between color images and grayscale images;

[0008] Calculating color images according to the conversion parameters output by the target function and outputting grayscale images.

[0009] Optionally, the construction method of the target function is:

[0010] Integrating the R channel, G channel and B channel of the color image into a single channel g of the grayscale image respectively;

[0011] g=w r I r +wg I g +w b I b ;

[0012] where I r is the input R channel, I g is the input G channel, I b is the input B channel, w r is the R channel optimization parameter, w g is the G channel optimization parameter, and w b is the B channel optimization parameter;

[0013] a contrast preservation value between pairs of pixels of the color image and the grayscale image, the contrast preservation value being a minimization of a distance between a pixel difference of the color image and a pixel difference of the grayscale image;

[0014]

[0015]

[0016] where g x is a global pair of pixels of the pool P of pairs of pixels of the grayscale image, g y is a local pair of pixels of the pool P of pairs of pixels of the grayscale image, δ x,y is a color contrast of the color image, |δ x,y | is a color contrast in the corresponding region based on the Euclidean distance, R x is a pixel value at position x in the R channel of the color image, R y is a pixel value at position y in the R channel of the color image, G x is a pixel value at position x in the G channel of the color image, G y is a pixel value at position y in the G channel of the color image, B x is a pixel value at position x in the B channel of the color image, B y is a pixel value at position y in the B channel of the color image;

[0017] is a grayscale difference g x -g y follows a normal distribution with mean δ x,y to achieve a maximization of the contrast preservation value:

[0018]

[0019] Δg x,y = g x -g y ;

[0020] wherein, π σ (δ x,y , σ 2 ) is a Gaussian function, and △g x,y is a gray difference of a global pixel pair and a local pixel pair of a pixel pair pool P of a gray image;

[0021] When the Gaussian function reaches a peak at δ x,y , the contrast δ x,y of the color image is constrained, and the sign of the gray difference △g x,y of the gray image is determined so that the contrast of the color image is +δ x,y or -δ x,y , and there is:

[0022]

[0023] An initialization objective function is established:

[0024] E(g) = π σ (δ x,y , σ 2 ) + π σ (-δ x,y , σ 2 ).

[0025] The initialization objective function is maximized to obtain a final objective function:

[0026] E(g) = -∑ (x,y)∈P ln{π σ (δ x,y , σ 2 ) + π σ (-δ x,y , σ 2 )}.

[0027] Optionally, the data set includes a Cadik2008 data set and a CSDD data set.

[0028] The Cadik2008 data set includes a plurality of natural images and synthetic images.

[0029] The CSDD data set is a color image with different patterns and rich colors.

[0030] Optionally, a pixel pair of the color image in the data set is extracted by a clustering-based pixel pair selection method or a weight optimization-based pixel pair selection method.

[0031] Optionally, the clustering-based pixel pair selection method is:

[0032] extracting a local pixel pair set and a global pixel pair set of the color image in the data set by a clustering method, and calculating pixel pair difference values of the local pixel pair set and the global pixel pair set respectively, taking the calculated pixel pair difference values as contrast preserving reference values of the local pixel pair set and the global pixel pair set respectively;

[0033] selecting n pixel pairs from the extracted local pixel pair set and global pixel pair set as initial clustering centers by a K-Means algorithm, then calculating Euclidean distances between the n initial clustering centers and the remaining pixel pairs respectively, and determining one of the initial clustering centers closest to the remaining pixel pairs as a clustering center C i , and calculating Euclidean distances d(x, C i ) between each pixel pair in the spatial domain and the clustering center C i ;

[0034]

[0035] wherein x is a pixel pair of the color image, C i is the i-th clustering center, m is the dimension of the pixel pair of the color image, x j is the j-th attribute value of x, C ij is the j-th attribute value of C i ;

[0036] taking the number of cluster classes included in the clustering center C i as a weight factor k of the pixel pair, and multiplying the weight factor k by the pixel pair difference value to perform weighted calculation on the pixel pair of the color image, so as to realize optimization of the pixel pair of the color image;

[0037]

[0038] wherein k1 and k2 respectively represent the number of pixel pairs contained in two clustering centers C i added to the pixel pair set for pixel pair calculation, and k represents the maximum weight of the pixel pair.

[0039] Optionally, the pixel pair selection method based on weight optimization is as follows:

[0040] reducing the size of the color image to 64*64 by a nearest neighbor interpolation method;

[0041] selecting pixel pairs vertically adjacent and horizontally adjacent from the reduced color image as local pixel pairs;

[0042] selecting pixel pairs at globally random positions from the reduced color image as global pixel pairs;

[0043] combining the local pixel pairs and the global pixel pairs into a whole pixel pair set;

[0044] performing difference calculation on each pixel pair in the whole pixel pair set, and sorting the pixel pairs in ascending order of the calculated pixel pair differences to obtain a statistical distribution of the pixel pair differences;

[0045] taking the pixel pairs in the statistical distribution of the pixel pair differences that conform to a Gaussian function as a data set and fitting a Gaussian function to obtain a nonlinear function, and using the nonlinear function as a mapping function of weights to optimize the pixel pairs in the whole pixel pair set;

[0046]

[0047] wherein f(x) is the nonlinear function, x is the pixel pair difference, exp is a natural exponential function, i.e., an exponential function with a base of the natural logarithm e (approximately equal to 2.71828), A is an amplitude, μ is a mean value, and σ is a standard deviation, and A, μ and σ are respectively used to find the best parameters of the Gaussian function using a nonlinear least squares method, so that the nonlinear function f(x) is as close as possible to the data points (x, y), x representing the pixel pair differences in ascending order, and y representing the frequency of the pixel pair differences;

[0048]

[0049] wherein S is a residual sum of squares to be minimized, x i represents the i-th pixel pair difference after the pixel pair differences are sorted in ascending order, and y i represents the frequency of the i-th pixel pair difference after the pixel pair differences are sorted in ascending order.

[0050] Optionally, when the data set is the CSDD data set, the color image is desaturated by a locally adaptive desaturation method, specifically:

[0051] dividing the length of the color image into two equal parts and the width into three equal parts to obtain six image blocks of the same size, and obtaining the region features of each image block;

[0052] calculating the adaptive parameters of each region feature by the target function to generate a parameter set, wherein the parameter set includes six groups of optimization parameters, and each group of optimization parameters includes w r , w g and w b ;

[0053] smoothing the parameter set by an exponential smoothing method to obtain six groups of smoothed parameters;

[0054] S t= a * y t + (1 - a) * S t-1 ;

[0055] wherein S t is a current smoothed value at a current time, y t is a current observation value, S t-1 is a previous smoothed value, and a is a smoothing coefficient, a being in the range [0, 1];

[0056] The corresponding image blocks in the color image are converted into gray image blocks by the six groups of smoothed parameters, and six gray image blocks are spliced to obtain a complete gray image.

[0057] Optionally, an evaluation index is designed, the evaluation index being based on a contrast similarity and a structural similarity between a color image and a desaturated gray image to evaluate a desaturation effect of the target function, and the evaluation index comprises the following steps:

[0058] A quantitative evaluation value SSIM(x, y) is calculated by the contrast similarity and the structural similarity, and the higher the quantitative evaluation value SSIM(x, y) is, the better the desaturation effect of the target function is;

[0059] SSIM(x, y) = C(x l , y l ) α S(x l , y l ) β ;

[0060] wherein C(x l , y l ) is a contrast similarity, S(x l , y l ) is a structural similarity, a is a similarity parameter, a > 0, β is a saliency parameter, β > 0, and a and β are in the range [0, 1].

[0061] Optionally, a method for obtaining a contrast similarity between a color image and a desaturated gray image is as follows:

[0062] A zero-mean image is used to highlight details of a color image and a desaturated gray image, and a contrast similarity of pixels of the color image and the desaturated gray image with respect to a local pixel block at the same position is evaluated, wherein

[0063] The contrast similarity C(x l , y l ) is defined as d c (x l , y l ) and d g (xl , y l ) is a function of the color image;

[0064]

[0065]

[0066]

[0067]

[0068] wherein φ(x ci , y ci ) is an output result of the Gaussian radial function to the color image, φ(x gi , y gi ) is an output result of the Gaussian radial function to the desaturated gray image, x ci and y ci represent pixel values of the color image position (x, y), x gi and y gi represent pixel values of the desaturated gray image position (x, y), d c (x i , y i ) represents contrast information of the color image, d g (x i , y i ) represents contrast information of the gray image, C(x i , y i ) represents a contrast similarity between the color image and the desaturated gray image, and C1 and C2 tend to 0.

[0069] Optionally, the method for obtaining the structural similarity between the color image and the desaturated gray image is:

[0070] a Laplacian filter is used to extract the color image and the desaturated gray image in terms of pattern boundary, internal contour and texture details, respectively, and then the structural similarity between the color image and the desaturated gray image is calculated based on the extracted color image and the desaturated gray image in terms of pattern boundary, internal contour and texture details, wherein:

[0071]

[0072]

[0073]

[0074]

[0075] wherein △ 2f(x i , y i ) represents the second derivative function of Laplace, which is used to extract the details of the image while reflecting the gradient change; σ c (x i , y i ) represents the structural information of the color image, σ g (x i , y i ) represents the structural information of the gray image after desaturation, x ci and y ci represent the pixel value of the color image position (x, y), x gi and y gi represent the pixel value of the gray image position (x, y), s(x i , y i ) represents the structural similarity between the color image and the gray image after desaturation, represents the partial derivative, and C1 and C2 tend to 0.

[0076] The beneficial effects that can be produced by the present application include:

[0077] The color image desaturation method based on detail contrast preservation and color consistency provided by the present application can maintain the extracted image detail contrast as much as possible by constructing a target function, and designing a pixel pair selection method based on clustering and a method based on pixel pair weight optimization; in order to improve the pixel pair selection efficiency and retain more effective contrast reference values, the size of the input image can be compressed to 64x64 before selection to reduce pixel pair redundancy and improve processing speed; for color-rich color synthesis pictures, a local adaptive desaturation method is proposed, which can retain more detail contrast while maintaining color consistency; and the desaturation effect of the target function is evaluated based on the contrast similarity and structural similarity between the color image and the gray image after desaturation, which is more consistent with the human eye's perception of detail contrast in the desaturation task. BRIEF DESCRIPTION OF DRAWINGS

[0078] Figure 1 The method flowchart for introducing the clustering method to participate in the pixel pair selection of the present application;

[0079] Figure 2 The example diagram of the mapping function from pixels to weights for the weight optimization pixel pair selection method in the present application;

[0080] Figure 3 The method flowchart based on local adaptive parameter selection of the present application;

[0081] Figure 4A comparison chart of the color removal evaluation index proposed in the present application and the existing color removal evaluation index C2G-SSIM; wherein (a) is the color removal result of the RTCP algorithm, (b) is the color removal result based on the clustering algorithm, (c) is the color removal result of the local adaptive algorithm, and (d) is the color removal result of the weighted optimization algorithm, Figure 4 In the single picture, the red and blue thumbs in the lower left corner are the best and worst decolorization effects based on the C2G-SSIM index, Figure 4 In the single picture, the red and blue thumbs in the upper right corner are the best and worst decolorization effects based on the evaluation index of the present application.

[0082] Figure 5 A complete result schematic diagram of converting color images into gray scale images by different methods in the simulation experiment of the present application; wherein (a) represents the result diagram of selecting the Y channel as a gray scale image; (b) represents the color removal result diagram of the RTCP algorithm; (c) represents the color removal result diagram of the GcsDecolor algorithm; (d) represents the color removal result diagram of the LeDecolor algorithm; (e) represents the color removal result diagram of the SPDecolor algorithm; and (f) represents the color removal result diagram of the best color removal method in the pixel pair extraction color removal method of the present application. DETAILED DESCRIPTION

[0083] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.

[0084] Please refer to Figures 1-5 As shown in the figure, the present application provides a color image decolorization method based on detail contrast preservation and color consistency, which comprises the following steps:

[0085] Constructing a target function;

[0086] Obtaining a data set;

[0087] Extracting pixel pairs of color images in the data set, and inputting the extracted pixel pairs into the target function to output conversion parameters between the color images and the gray scale images;

[0088] Calculating the color images according to the conversion parameters output by the target function and outputting the gray scale images.

[0089] Further, the construction method of the target function is:

[0090] Integrating the R channel, the G channel and the B channel of the color image into a single channel g of the gray scale image, respectively;

[0091] g = w r I r +w g I g +w b I b ;

[0092] where I r is the input R channel, I g is the input G channel, I b is the input B channel, w r is the R channel optimization parameter, w g is the G channel optimization parameter, and w b is the B channel optimization parameter;

[0093] calculating a contrast preservation value between pairs of pixels of the color image and the grayscale image, wherein the contrast preservation value is a minimization of a distance between pixel difference values of the color image and the grayscale image;

[0094]

[0095]

[0096] where g x is a global pair of pixels of the pool P of pairs of pixels of the grayscale image, g y is a local pair of pixels of the pool P of pairs of pixels of the grayscale image, δ x,y is a color contrast of the color image, |δ x,y | is a color contrast in the corresponding region based on the Euclidean distance, R x is a pixel value at position x in the R channel of the color image, R y is a pixel value at position y in the R channel of the color image, G x is a pixel value at position x in the G channel of the color image, G y is a pixel value at position y in the G channel of the color image, B x is a pixel value at position x in the B channel of the color image, B y is a pixel value at position y in the B channel of the color image;

[0097] is a grayscale difference g x -g y follows a normal distribution with mean δ x,y to achieve a maximization of the contrast preservation value:

[0098]

[0099] Δg x,y = g x-g y ;

[0100] wherein, π σ (δ x,y , σ 2 ) is a Gaussian function, and △g x,y is a gray difference of the global pixel pair and the local pixel pair of the pixel pair pool P of the gray image;

[0101] When the Gaussian function reaches the peak at δ x,y , the contrast δ x,y of the color image is constrained, and the sign of the gray difference △g x,y of the gray image is determined, so that the contrast of the color image is +δ x,y or-δ x,y , and there is:

[0102]

[0103] An initialization objective function is established:

[0104] E(g) = π σ (δ x,y , σ 2 ) + π σ (-δ x,y , σ 2 );

[0105] The initialization objective function is maximized to obtain a final objective function:

[0106] E(g) = -∑ (x,y)∈P ln{π σ (δ x,y , σ 2 ) + π σ (-δ x,y , σ 2 )}.

[0107] Further, the data set includes a Cadik 2008 data set and a CSDD data set;

[0108] The Cadik 2008 data set includes a plurality of natural images and synthetic images;

[0109] The CSDD data set is a color image with different patterns and rich colors.

[0110] Further, the pixel pairs of the color images in the data set are extracted by a clustering-based pixel pair selection method or a weight optimization-based pixel pair selection method.

[0111] Further, the clustering-based pixel pair selection method is:

[0112] The local pixel pair set and the global pixel pair set of the color image in the data set are extracted by clustering method, and the pixel pair difference of the local pixel pair set and the global pixel pair set is calculated respectively, and the calculated pixel pair difference is taken as the contrast reservation reference value of the corresponding local pixel pair set and global pixel pair set; in order to improve the pixel pair selection efficiency and reserve more effective contrast reference value, the size of the input image can be compressed to 64x64 before selection, at the same time, the local pixel pair selects any one pixel and its four adjacent pixels, and the global pixel pair uses the method of random selection;

[0113] n pixel pairs are randomly selected from the extracted local pixel pair set and global pixel pair set as initial cluster centers by K-Means algorithm, then the Euclidean distance between the n initial cluster centers and the remaining pixel pairs is calculated respectively, and the initial cluster center closest to the remaining pixel pairs is determined as the cluster center C i The Euclidean distance d(x, C i ) between each pixel pair in the spatial domain and the cluster center C i is calculated again.

[0114]

[0115] Wherein, x is the pixel pair of the color image, C i is the i-th cluster center, m is the dimension of the pixel pair of the color image, x j is the j-th attribute value of x, C ij is the j-th attribute value of C i .

[0116] The number of cluster classes included in the cluster center C i is taken as the weight factor k of the pixel pair, and the weight factor k is multiplied by the pixel pair difference to calculate the pixel pair of the color image, so as to realize the optimization of the pixel pair of the color image; the more the number of cluster centers, the more the colors close to the cluster center in the picture, and by expanding the weight proportion by using the number of cluster classes, the selected pixel pair can be more consistent with the overall contrast of the picture.

[0117]

[0118] Wherein, k1 and k2 respectively represent the number of pixel pairs contained in the two cluster centers C i added to the pixel pair set for calculation, and k represents the maximum weight of the pixel pair.

[0119] Further, the pixel pair selection method based on weight optimization is:

[0120] The selected pixel pairs are reduced in size to 64*64 by a nearest neighbor interpolation method to reduce the amount of calculation, and the pixel pairs are selected from the reduced color image as local pixel pairs and global pixel pairs; then the local pixel pairs and the global pixel pairs are combined into a whole pixel pair set; the pixel pair difference of each pixel pair in the whole pixel pair set is calculated, and the pixel pairs are sorted in ascending order of the calculated pixel pair difference to obtain a statistical distribution graph of the pixel pair difference; finally, the pixel pairs in the statistical distribution graph of the pixel pair difference that meet the Gaussian function are taken as a data set and a Gaussian function is fitted to obtain a nonlinear function, and the pixel pairs in the whole pixel pair set are optimized by taking the nonlinear function as a weight mapping function; wherein the pixel pair difference reflects the contrast size, and by observing the statistical distribution graph of the pixel pair difference, the number of small contrast is more, and the number of large contrast is less, so the number of contrast can be used as a weight to improve the attention to small contrast, and the distribution of the pixel pair difference is taken as a data set to fit the Gaussian function.

[0121]

[0122] wherein f(x) is a nonlinear function, x is a pixel pair difference, exp is a natural exponential function, A is an amplitude, μ is a mean, σ is a standard deviation, and A, μ and σ are used to find the best parameters of the Gaussian function by a nonlinear least squares method, so that the nonlinear function f(x) is as close as possible to the data points (x, y), x represents the pixel pair difference in ascending order, and y represents the frequency of the pixel pair difference;

[0123]

[0124] wherein S is a minimized residual sum of squares, x i represents the i-th pixel pair difference after the pixel pair difference is sorted in ascending order, and y i represents the frequency of the i-th pixel pair difference after the pixel pair difference is sorted in ascending order.

[0125] Further, when the data set is a CSDD data set, the color image is desaturated by a local adaptive desaturation method, specifically:

[0126] The length of the color image is equally divided into two equal parts, and the width is equally divided into three equal parts to obtain six image blocks of the same size, and the regional features of each image block are obtained;

[0127] The adaptive parameters of each regional feature are calculated by an objective function to generate a parameter set, wherein the parameter set includes six groups of optimization parameters, and each group of optimization parameters includes wr , w g and w b ;

[0128] Due to the large difference between the optimized parameters obtained by different regions, the final result after color separation and splicing for different regions has obvious color jump, which does not meet the color consistency requirement, therefore, the parameter set needs to be smoothed by the exponential smoothing method to obtain six groups of smoothed parameters;

[0129] S t = a y t + (1-a) S t-1 ;

[0130] Wherein, S t is the current smoothing value at the current time, y t is the current observation value, S t-1 is the previous smoothing value, and a is the smoothing coefficient, the value range of a is [0, 1]; if a tends to 1, the current smoothing value is more affected by the current observation value; when a tends to 0, the current smoothing value is more affected by the past smoothing value;

[0131] The corresponding image blocks in the color image are converted into gray image blocks by the six groups of smoothed parameters, and then the six gray image blocks are spliced to obtain a complete gray image.

[0132] Further, an evaluation index is designed, the evaluation index is based on the contrast similarity and structural similarity between the color image and the gray image after color separation to evaluate the color separation effect of the objective function, including the following steps:

[0133] The quantitative evaluation value SSIM(x, y) is calculated by the contrast similarity and the structural similarity, the higher the quantitative evaluation value SSIM(x, y) is, the better the color separation effect of the objective function is;

[0134] SSIM(x, y) = C(x l , y l ) α S(x l , y l ) β ;

[0135] Wherein, C(x l , y l ) is the contrast similarity, S(x l , y l ) is the structural similarity, a is the similarity parameter, a>0, β is the significance parameter, β>0, and the value range of a and β is both [0, 1].

[0136] Further, the method for obtaining the contrast similarity between the color image and the desaturated gray image is:

[0137] The details of the color image and the desaturated gray image are highlighted by zero-mean image, so that the spatial features are more highlighted, thereby being used to evaluate the contrast similarity of the pixel pair of the color image and the desaturated gray image relative to the local pixel block at the same position, so that the evaluation index is more consistent with the perception of the human eye to the detail contrast in the desaturation task, wherein

[0138] The contrast similarity C(x l , y l ) is defined as a function of d c (x l , y l ) and d g (x l , y l );

[0139]

[0140]

[0141]

[0142]

[0143] wherein φ(x ci , y ci ) is the output result of the Gaussian radial function to the color image, φ(x gi , y gi ) is the output result of the Gaussian radial function to the desaturated gray image, x ci and y ci represent the pixel value of the color image position (x, y), x gi and y gi represent the pixel value of the desaturated gray image position (x, y), d c (x i , y i ) represents the contrast information of the color image, d g (x i , y i ) represents the contrast information of the gray image, C(x i , y i ) represents the contrast similarity between the color image and the desaturated gray image, C1 and C2 tend to 0.

[0144] Further, the method for obtaining the structure similarity between the color image and the desaturated gray image is:

[0145] The Laplace filter is used to extract the detail differences of the color image and the desaturated gray image in pattern boundary, internal contour and texture, respectively, and then the structural similarity between the color image and the desaturated gray image is calculated through the extracted detail differences of the color image and the desaturated gray image in pattern boundary, internal contour and texture.

[0146]

[0147]

[0148]

[0149]

[0150] Wherein, △ 2 f(x i , y i ) represents a second derivative function of Laplace, which is used to extract the details of the image while reflecting the gradient change; σ c (x i , y i ) represents the structural information of the color image, σ g (x i , y i ) represents the structural information of the desaturated gray image, x ci and y ci represent the pixel values of the color image position (x, y), x gi and y gi represent the pixel values of the gray image position (x, y), and s(x i , y i ) represents the structural similarity between the color image and the desaturated gray image. represents a partial derivative, and C1 and C2 tend to 0.

[0151] In the present application, in order to verify the color image desaturation result of the present application, the effectiveness of the color image desaturation method based on detail contrast preservation and color consistency proposed in the present application is verified through simulation experiments:

[0152] In an embodiment of the present application, the color images in the Cadik2008 dataset and the CSDD dataset are desaturated by the color image desaturation method based on detail contrast preservation and color consistency proposed in the present application. As shown in FIG. 2, the color images in the Cadik2008 dataset and the CSDD dataset are desaturated by the color image desaturation method based on detail contrast preservation and color consistency proposed in the present application. Figure 4The pixel pair selection method based on clustering, the pixel pair selection method based on weight optimization and the local adaptive color removal method involved in the present application are compared with the PTCP algorithm as shown. It can be seen that the three methods improve the RTCP algorithm in different aspects. The black text on the green paper in the image in the last row is only clearly visible when the local adaptive method is used, because the local adaptation is based on small-scale parameter learning. Due to the large global contrast in the image, the method based on global learning may ignore some important information. In the images in the third and fourth rows, the method based on weight optimization retains more color blocks recognizable by the human eye and the color edges are clearer. This is because the weights of smaller pixel pairs are mapped out to expand the original contrast and prevent information loss during dimension reduction. The pixel pair selection method based on clustering is generally suitable for images with large color changes and performs better than the other two methods in edge retention, but is not good at retaining fine detail contrast.

[0153] As shown in Table 1, the present application shows the experimental results of the above three methods on different data sets, proving the improvement of these methods relative to the original algorithm. It can be seen that the average index of the weight optimization method is higher than that of the other methods, because it retains more fine-grained contrast. However, in images with rich global contrast and significant color changes, the other two methods are more practical. Relatively speaking, the three methods are superior to the PTCP color removal algorithm in performance indicators.

[0154] Table 1 Evaluation results of D-C2G-SSIM evaluation indicators on different methods

[0155]

[0156] As Figure 4 shown, the blue and red thumbs respectively correspond to the worst and best evaluations in the evaluation of the color removal result of a certain color removal evaluation indicator. The lower left corner shows the evaluation result of C2G-SSIM, and the upper right corner shows the evaluation result of the color removal evaluation indicator proposed in the present application. Through the above analysis, it is found that the evaluation result in the present application is more consistent with human perception than the evaluation result of C2G-SSIM, and has better distinguishability.

[0157] As Figure 5 shown, the method in the present application is compared with other excellent color removal methods, and the method obtains the highest score in the new evaluation indicator proposed. Whether it is to retain the red leaves of the tree in the image in the fourth row or the gradient color in the image in the last row, a solution suitable for the color removal scene can be found, and the method has higher robustness compared with other methods.

[0158] It is worth noting that: visual evaluation contrast can have a more intuitive understanding of the color image desaturation result, but it is difficult to give the most accurate judgment of the desaturation result by relying on subjective evaluation alone, therefore, the desaturation result needs to be evaluated in combination with objective indexes; the application evaluates and quantifies the effectiveness of the model by designing multiple key performance indexes: in quantitative evaluation, the color contrast preservation rate (CCPR) and the color content fidelity ratio (CCFR) proposed by Lu et al. and the E-score and C2G-SSIM indexes proposed by Ma et al. are used. Since E-score is a combination of CCPR and CCFR, E-score is directly used to represent the quantitative evaluation. In addition, in order to prove the effectiveness of the evaluation index designed in the application, the evaluation index is used for evaluation and compared with other indexes. The evaluation index proposed in the application is named D-C2G-SSIM. The desaturation effect is evaluated from multiple angles to prove the effectiveness of the desaturation algorithm of the application. The index evaluation results of different methods are shown in Table 2.

[0159] Table 2 Index evaluation results of different methods

[0160]

[0161] As shown in Table 2, by listing the comparison data of the desaturation method of the application and other several algorithms in each evaluation index, the performance and advantages of the desaturation method of the application are fully displayed. In two evaluation indexes, the desaturation method of the application is the best, and in C2G-SSIM, the index of SPDecolor is higher, because C2G-SSIM is more inclined to global contrast comparison, rather than detail contrast comparison. This shows that the desaturation method of the application can perform gray-scale processing on color images in different scenes, and in the case of ensuring the preservation of global contrast, it pays more attention to the preservation of detail contrast and color consistency, and the D-C2G-SSIM index proposed is the same as other indexes in the trend of evaluating the desaturation result and is more suitable for the desaturation scene of detail contrast preservation. In summary, the color image desaturation method based on detail contrast preservation and color consistency given by the combination of visual evaluation and objective index evaluation in the application can adapt to more desaturation scenes and has high robustness.

Claims

1. A color image decolorization method based on detail contrast preservation and color consistency, characterized in that: The following steps are involved: Construct the objective function; Get the dataset; Extracting pixel pairs of the color image in the data set, and inputting the extracted pixel pairs into the objective function to output conversion parameters between the color image and the grayscale image; Calculate the color image according to the conversion parameters output by the objective function and output a grayscale image; The objective function is constructed as follows: Integrate the R channel, G channel, and B channel of the color image into the single channel g of the grayscale image respectively; g=w r I r +w g I g +w b I b ; Among them, I r For input R channel, I g For input G channel, I b is the input B channel, w r Optimize the parameters for the R channel, w g Optimize the parameters for the G channel, w b Optimize parameters for the B channel; Calculating a contrast preservation value between pixel pairs of the color image and the grayscale image, wherein the contrast preservation value is to minimize the distance between the pixel difference value of the color image and the pixel difference value of the grayscale image; Among them, g x is the global pixel pair of the pixel pair pool P of the grayscale image, g y is the local pixel pair of the pixel pair pool P of the grayscale image, δ x,y is the color contrast of the color image, |δ x,y | is the color contrast in the corresponding area based on the Euclidean distance, R x is the pixel value at position x in the R channel of the color image, R y is the pixel value at position y in the R channel of the color image, G x is the pixel value at position x in the G channel of the color image, G y is the pixel value at position y in the G channel of the color image, B x is the pixel value at position x in the B channel of the color image, B y is the pixel value at position y in the B channel of the color image; is the grayscale difference g between pixel x and pixel y of the grayscale image x -g y Follow the δ x,y is a normal distribution with a mean value to maximize the contrast preservation value: △g x,y =g x -g y ; Among them, π σ (δ x,y ,σ 2 ) is a Gaussian function, △g x,y is the grayscale difference between the global pixel pair and the local pixel pair of the pixel pair pool P of the grayscale image; When the Gaussian function is distributed in δ x,y When the contrast of the color image reaches its peak at x,y Subject to constraints, the grayscale difference △g of the grayscale image is determined at the same time x,y The sign of the color image is +δ x,y or -δ x,y , then: Establish the initialization target function: E(g)=π σ (d x,y ,s 2 )+π σ (-d x,y ,s 2 ); The initialized objective function is maximized to obtain the final objective function: E(g)=-∑ (x,y)∈P ln{π σ (d x,y ,s 2 )+π σ (-d x,y ,s 2 )}; The datasets include the Cadik 2008 dataset and the CSDD dataset; The Cadik 2008 dataset includes several natural images and synthetic images; The CSDD dataset is a color image with different patterns and rich colors; Extracting pixel pairs of the color image in the data set by a clustering-based pixel pair selection method or a weight optimization-based pixel pair selection method; The pixel pair selection method based on clustering is: Extracting local pixel pair sets and global pixel pair sets of the color image in the data set by a clustering method, and calculating pixel pair differences of the local pixel pair sets and the global pixel pair sets respectively, and using the calculated pixel pair differences as contrast-preserving reference values ​​of the corresponding local pixel pair sets and the global pixel pair sets; The K-Means algorithm is used to randomly select n pixel pairs from the extracted local pixel pair set and the global pixel pair set as the initial cluster centers, and then the Euclidean distances between the n initial cluster centers and the remaining pixel pairs are calculated, and the initial cluster center closest to the remaining pixel pairs is determined as the cluster center C. i , and then calculate the relationship between each pixel pair and the cluster center C in the spatial domain i The Euclidean distance d(x,C i ); Among them, x is the pixel pair of the color image, C i is the i-th cluster center, m is the dimension of the pixel pair of the color image, x j is the jth attribute value of x, C ij C i The j-th attribute value of ; The cluster center C i The number of clusters included is used as a weight factor k of the pixel pair, and the weight factor k is multiplied by the pixel pair difference to perform weighted calculation on the pixel pair of the color image, thereby achieving pixel pair optimization of the color image; Among them, k1 and k2 represent the two cluster centers C in the pixel pair set added to the pixel pair calculation. i The number of pixel pairs included, k represents the final weight of the pixel pair; The pixel pair selection method based on weight optimization is: Reduce the size of the color image to 64*64 by the nearest neighbor interpolation method; Selecting vertically adjacent and horizontally adjacent pixel pairs from the reduced color image as local pixel pairs; Selecting pixel pairs at globally random positions from the reduced color image as global pixel pairs; Combining local pixel pairs and global pixel pairs into a global pixel pair set; performing difference calculation on each pixel pair in the overall pixel pair set, and sorting the pixel pairs in ascending order based on the calculated pixel pair differences to obtain a statistical distribution graph of the pixel pair differences; Pixel pairs that conform to the Gaussian function in the statistical distribution diagram of the pixel pair differences are used as a data set, and the Gaussian function is fitted to obtain a nonlinear function, and the nonlinear function is then used as a weight mapping function to optimize the pixel pairs in the overall pixel pair set; Where f(x) is a nonlinear function, x is the pixel pair difference, exp is the natural exponential function, A is the amplitude, μ is the mean, σ is the standard deviation, and A, μ, and σ use nonlinear least squares to find the optimal parameters of the Gaussian function, so that the nonlinear function f(x) is as close as possible to the data point (x, y), x represents the pixel pair difference arranged in order from small to large, and y represents the frequency of the pixel pair difference; Among them, S is the minimum residual sum of squares, x i Indicates the difference between the i-th pixel pair after sorting the pixel pair differences from small to large, y i Represents the frequency of occurrence of the ith pixel pair difference after the pixel pair differences are sorted from small to large; When the data set is the CSDD data set, the color image is decolorized using a local adaptive decolorization method, specifically: Divide the length of the color image into two equal parts and the width into three equal parts to obtain six image blocks of equal size, and obtain the regional features of each image block; The adaptive parameters of each of the regional features are calculated by the objective function to generate a parameter set, wherein the parameter set includes six groups of optimization parameters, each group of optimization parameters includes w r , w g and w b ; Smoothing the parameter set by an exponential smoothing method to obtain six sets of smoothed parameters; S t =α·y t +(1-α)·S t-1 ; Among them, S t is the current smoothed value at the current moment, y t is the current observation value, S t-1 is the previous smoothing value, α is the smoothing coefficient, and the value range of α is [0,1]; The corresponding image blocks in the color image are converted into grayscale image blocks using the six sets of smoothed parameters, and then the six grayscale image blocks are spliced ​​together to obtain a complete grayscale image.

2. The color image decolorization method based on detail contrast preservation and color consistency according to claim 1, characterized in that: Designing an evaluation index, wherein the evaluation index is based on the contrast similarity and structural similarity between the color image and the decolorized grayscale image to evaluate the decolorization effect of the objective function, comprising the following steps: A quantitative evaluation value SSIM(x,y) is obtained by calculating the contrast similarity and the structural similarity. The higher the quantitative evaluation value SSIM(x,y), the better the decolorization effect of the objective function. SSIM(x,y)=C(x l ,y l ) α S(x l ,y l ) β ; Among them, C(x l ,y l ) is the contrast similarity, S(x l ,y l ) is the structural similarity, α is the similarity parameter, α>0, β is the significance parameter, β>0, and the value range of α and β is [0,1].

3. The color image decolorization method based on detail contrast preservation and color consistency according to claim 2, characterized in that: The method for obtaining the contrast similarity between the color image and the decolorized grayscale image is: The zero-mean image is used to highlight the details of the color image and the decolorized grayscale image to evaluate the contrast similarity of the pixel pairs of the color image and the decolorized grayscale image relative to the local pixel blocks at the same position, where; The contrast similarity C(x l ,y l ) is defined as d c (x l ,y l ) and d g (x l ,y l ) function; Among them, φ(x ci ,y ci ) is the output result of Gaussian radial function for color image, φ(x gi ,y gi ) is the output of the Gaussian radial function on the grayscale image after decolorization, x ci and y ci Represents the pixel value at position (x, y) of the color image, x gi and y gi Represents the pixel value of the grayscale image position (x, y) after decolorization, d c (x i ,y i ) represents the contrast information of the color image, d g (x i ,y i ) represents the contrast information of the grayscale image, C(x i ,y i ) represents the contrast similarity between the color image and the desaturated grayscale image, and C1 and C2 are close to 0.

4. The color image decolorization method based on detail contrast preservation and color consistency according to claim 2, characterized in that: The method for obtaining the structural similarity between the color image and the decolorized grayscale image is: A Laplacian filter is used to extract the detail differences between the color image and the decolorized grayscale image in terms of pattern boundaries, internal contours, and textures. Then, the structural similarity between the color image and the decolorized grayscale image is calculated based on the extracted detail differences between the color image and the decolorized grayscale image in terms of pattern boundaries, internal contours, and textures. Among them, △ 2 f(x i ,y i ) represents the second-order derivative function of Laplace, which is used to extract image details while reflecting gradient changes; σ c (x i ,y i ) represents the structural information of the color image, σ g (x i ,y i ) represents the structural information of the grayscale image after decolorization, x ci and y ci Represents the pixel value at position (x, y) of the color image, x gi and y gi Represents the pixel value at the grayscale image position (x, y), s(x i ,y i ) represents the structural similarity between the color image and the decolorized grayscale image, Represents partial derivatives, C1 and C2 approach 0.

Citation Information

Patent Citations

  • Color image high-precision graying method based on structural similarity

    CN109993690A

  • Image conversion apparatus and image conversion method

    KR1020120025204A