Color image decoloring method based on detail contrast maintenance and color consistency

By constructing the objective function and optimizing the pixel pair selection method, the problem of details contrast and processing speed in color image color removal is solved, and the details retention and speed optimization of color removal are achieved, improving the reliability and color consistency of color removal effect sex.

CN119313755AActive Publication Date: 2025-01-14NORTHWEST UNIV
View PDF 3 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

The existing color image decolorization methods will cause information distortion during the dimensionality reduction process, especially in the retention of details contrast, and the processing speed is not optimized enough, which will affect the subsequent image processing results.

Method used

By constructing the objective function, the pixel pairs of color images are extracted, and the conversion parameters are calculated to generate grayscale images using clustering and weight optimization methods. Combining Gaussian functions and exponential smoothing methods, the color image decolorization process is optimized, the details are preserved and the contrast is improved. Processing speed.

Benefits of technology

The detailed contrast information of the color image is effectively maintained, the color removal processing speed is optimized, and the reliability and color consistency of the color removal effect are improved through the contrast and structural similarity evaluation index.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119313755A_ABST
    Figure CN119313755A_ABST
Patent Text Reader

Abstract

The invention discloses a color image decoloring method based on detail contrast maintenance and color consistency, and the method comprises the following steps: constructing an objective function, obtaining a data set, extracting pixel pairs of a color image in the data set, inputting the extracted pixel pairs into the objective function, and outputting a conversion parameter between the color image and a grayscale image; and calculating the color image according to the conversion parameter output by the target function and outputting a gray level image. A clustering-based pixel pair selection method and a pixel pair weight optimization-based method are designed, so that the detail contrast of the extracted image is kept as much as possible; meanwhile, a local self-adaptive decoloring method is provided for a color synthesis picture with rich colors, color consistency can be kept while more detail contrast can be kept, meanwhile, in order to improve the pixel pair selection efficiency and keep a more effective contrast reference value, the size of an input image can be compressed to be 64 * 64 before selection, and the input image can be compressed to be 64 * 64. Pixel pair redundancy is reduced, and the processing speed is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of image processing, and in particular to a color image decolorization method based on detail contrast preservation and color consistency. Background Art

[0002] Color image decolorization is the process of converting color images into grayscale images. It is applied to devices that only support monochrome information output, such as monochrome printers, night mode on some smartphones, etc. It can also be used as a preprocessing step to eliminate color interference and reduce the number of channels of subsequent image processing tasks, making it more convenient and efficient. However, since decolorization involves converting multi-channel information into single-channel grayscale information, some information distortion will inevitably occur during the dimensionality reduction process. For this reason, maximizing the retention of original image information and more detail contrast during the grayscale conversion process has always been an important goal of color image decolorization technology research for many years. However, whether it is the early decolorization work or the methods based on global and local decolorization, there will be a certain degree of contrast loss, especially in the retention of detail contrast. At present, the decolorization task is applied to the preprocessing process of image processing. Its role in information filtering and compression directly affects the results of subsequent processing, which requires that the decolorization work should not only retain more detail contrast information, but also optimize the processing speed. Summary of the invention

[0003] In view of this, an object of the present invention is to provide a color image decolorization method based on detail contrast preservation and color consistency, so as to retain more detail contrast information and optimize the processing speed during the decolorization work.

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

[0005] Construct the objective function;

[0006] Get the dataset;

[0007] 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;

[0008] The color image is calculated according to the conversion parameters output by the objective function and a grayscale image is output.

[0009] Optionally, the objective function is constructed as follows:

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

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

[0012] 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;

[0013] 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;

[0014]

[0015]

[0016] 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;

[0017] is the grayscale difference g between pixel x and pixel y of the grayscale image x -g y Follow δ x,y is a normal distribution with a mean value to maximize the contrast preservation value:

[0018]

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

[0020] 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;

[0021] 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:

[0022]

[0023] Establish the initialization target function:

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

[0025] The initialized objective function is maximized to obtain the 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 dataset includes several natural images and synthetic images;

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

[0030] Optionally, 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.

[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 respectively calculating pixel pair differences of the local pixel pair set and the global pixel pair set, and using the calculated pixel pair differences as contrast preservation reference values ​​of the corresponding local pixel pair set and the global pixel pair set;

[0033] 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 in the spatial domain and the cluster center C i The Euclidean distance d(x,C i );

[0034]

[0035] 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 ;

[0036] 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, so as to achieve pixel pair optimization of the color image;

[0037]

[0038] Among them, k 1 and k 2 Respectively 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.

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

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

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

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

[0043] Combining local pixel pairs and global pixel pairs into an overall pixel pair set;

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

[0045] The pixel pairs in the statistical distribution diagram of the pixel pair difference values ​​that conform to the Gaussian function are taken 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;

[0046]

[0047] Wherein, f(x) is a nonlinear function, x is the pixel pair difference, exp is a natural exponential function, that is, an exponential function with the natural logarithm e (approximately equal to 2.71828) as the base; A is the amplitude, μ is the mean, σ is the standard deviation, and A, μ and σ use nonlinear least squares method to find the optimal parameters of Gaussian function respectively, 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 occurrence of the pixel pair difference;

[0048]

[0049] Among them, S is the minimum residual sum of squares, x i Represents the difference of the ith pixel pair after the pixel pair differences are sorted from small to large, y i Indicates the frequency of occurrence of the i-th pixel pair difference after the pixel pair differences are sorted from small to large.

[0050] Optionally, when the data set is the CSDD data set, the color image is decolorized by a local adaptive decolorization method, specifically:

[0051] Divide 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 obtain the regional features of each image block;

[0052] 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 ;

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

[0054] S t =α·y t +(1-α)·S t-1 ;

[0055] Among them, S t is the current smoothing 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];

[0056] The corresponding image blocks in the color image are converted into grayscale image blocks by using the six sets of smoothed parameters, and then the six grayscale image blocks are spliced ​​to obtain a complete grayscale image.

[0057] Optionally, an evaluation index is designed, 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, and the steps include:

[0058] A quantitative evaluation value SSIM(x, y) is calculated by contrast similarity and structural similarity. The higher the quantitative evaluation value SSIM(x, y), the better the decolorization effect of the objective function.

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

[0060] 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].

[0061] Optionally, the method for obtaining the contrast similarity between the color image and the decolorized grayscale image is:

[0062] The details of the color image and the decolorized grayscale image are highlighted by the zero-mean 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;

[0063] 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;

[0064]

[0065]

[0066]

[0067]

[0068] Among them, φ(x ci ,y ci ) is the output result of Gaussian radial function for color image, φ(x gi ,y gi ) is the output result of the Gaussian radial function on the desaturated grayscale image, x ci and ci Represents the pixel value at position (x, y) of the color image, x gi and 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 decolorized grayscale image, C 1 and C 2 Approaching 0.

[0069] Optionally, a method for obtaining the structural similarity between the color image and the decolorized grayscale image is:

[0070] 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, and 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, where;

[0071]

[0072]

[0073]

[0074]

[0075] 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 ci Represents the pixel value at position (x, y) of the color image, x gi and gi Represents the pixel value at position (x, y) of the grayscale image, s(x i ,y i ) represents the structural similarity between the color image and the decolorized grayscale image, represents the partial derivative, C 1 and C 2 Approaching 0.

[0076] The beneficial effects that the present invention can produce include:

[0077] The color image decolorization method based on detail contrast preservation and color consistency provided by the present invention constructs an objective function, and designs a clustering-based pixel pair selection method and a pixel pair weight optimization method to preserve the detail contrast of the extracted image as much as possible; at the same time, in order to improve the efficiency of pixel pair selection and retain a more effective contrast reference value, the size of the input image can be compressed to 64×64 before selection to reduce pixel pair redundancy and improve processing speed; and for color composite pictures with rich colors, a local adaptive decolorization method is proposed, which can preserve more detail contrast while maintaining color consistency; and the decolorization effect of the objective function is evaluated based on the contrast similarity and structural similarity between the color image and the decolorized grayscale image, which is more in line with the human eye's perception of detail contrast in the decolorization task. BRIEF DESCRIPTION OF THE DRAWINGS

[0078] Figure 1 A flow chart of the method for introducing a clustering method to participate in pixel pair selection in the present invention;

[0079] Figure 2 An example diagram of a mapping function from pixels to weights in the weight-optimized pixel pair selection method of the present invention;

[0080] Figure 3 It is a flow chart of the method based on local adaptive parameter selection of the present invention;

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

[0082] Figure 5 The present invention is a complete schematic diagram of the results of converting color images into grayscale images using different methods in the simulation experiment of the present invention; wherein, (a) represents the result of selecting the Y channel as the grayscale image; (b) represents the decolorization result of the RTCP algorithm; (c) represents the decolorization result of the GcsDecolor algorithm; (d) represents the decolorization result of the LeDecolor algorithm; (e) represents the decolorization result of the SPDecolor algorithm; (f) represents the best decolorization result of the pixel pair extraction decolorization method of the present invention. DETAILED DESCRIPTION

[0083] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0084] See also Figure 1-Figure 5 As shown, the present invention provides a color image decolorization method based on detail contrast preservation and color consistency, comprising the following steps:

[0085] Construct the objective function;

[0086] Get the dataset;

[0087] Extract pixel pairs of color images in the data set, and input the extracted pixel pairs into the objective function to output the conversion parameters between color images and grayscale images;

[0088] The color image is calculated according to the conversion parameters output by the objective function and the grayscale image is output.

[0089] Furthermore, the objective function is constructed as follows:

[0090] Integrate the R channel, G channel and B channel of the color image into the single channel g of the grayscale image respectively;

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

[0092] 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;

[0093] 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;

[0094]

[0095]

[0096] 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;

[0097] is the grayscale difference g between pixel x and pixel y of the grayscale image x -g y Follow δ x,y is a normal distribution with the mean maximizing the contrast preservation value:

[0098]

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

[0100] 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;

[0101] 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:

[0102]

[0103] Establish the initialization target function:

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

[0105] Maximize the initialized objective function to obtain the final objective function:

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

[0107] Furthermore, the datasets include the Cadik 2008 dataset and the CSDD dataset;

[0108] The Cadik 2008 dataset includes several natural and synthetic images;

[0109] The CSDD dataset consists of color images with different patterns and rich colors.

[0110] Furthermore, pixel pairs of 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] Furthermore, 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 values ​​of the local pixel pair set and the global pixel pair set are calculated respectively, and the calculated pixel pair difference values ​​are used as the contrast retention reference values ​​of the corresponding local pixel pair set and the global pixel pair set; wherein, in order to improve the efficiency of pixel pair selection and retain more effective contrast reference values, the size of the input image can be compressed to 64x64 before selection, and at the same time, the local pixel pair selects any pixel and its four adjacent pixels, and the global pixel pair selection uses a random selection method;

[0113] 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 each pixel pair in the spatial domain and the cluster center C i The Euclidean distance d(x,C i );

[0114]

[0115] 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 ;

[0116] The cluster center C i The number of clusters included is used as the 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 pairs of the color image, thereby optimizing the pixel pairs of the color image; wherein, the more cluster centers there are, the more colors in the image that are close to the cluster centers. By using the number of clusters to expand the weight ratio, the selected pixel pairs can be more consistent with the overall contrast of the image;

[0117]

[0118] Among them, k 1 and k 2 Respectively 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.

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

[0120] The random pixel pair selection method is adopted. Since the reduction of the image will not change the distribution of the overall contrast, in order to reduce the amount of calculation, the size of the color image is reduced to 64*64 by the nearest neighbor interpolation method; vertically adjacent and horizontally adjacent pixel pairs are selected from the reduced color image as local pixel pairs; pixel pairs at global random positions are selected from the reduced color image as global pixel pairs; then the local pixel pairs and the global pixel pairs are combined into a whole pixel pair set; then the difference is calculated for each pixel pair in the whole pixel pair set, and the pixel pairs are sorted in the order of small to large by the calculated pixel pair difference, and the statistical distribution map of the pixel pair difference is obtained; finally, the pixel pairs that meet the Gaussian function in the statistical distribution map of the pixel pair difference are taken as the data set and the Gaussian function is fitted to obtain a nonlinear function, and then the nonlinear function is used as the mapping function of the weight to optimize the pixel pairs in the whole pixel pair set; wherein, the pixel pair difference reflects the contrast size, and by observing the statistical distribution map of the pixel pair difference, the number of smaller contrasts is large, while the number of larger contrasts is small, therefore, the number of contrasts can be used as a weight to increase the attention to the smaller contrast, so that the distribution of the pixel pair difference is used as a data set to fit the Gaussian function;

[0121]

[0122] 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 method to find the optimal parameters of 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 occurrence of pixel pair difference;

[0123]

[0124] Among them, S is the minimum residual sum of squares, x i Represents the difference of the ith pixel pair after the pixel pair differences are sorted from small to large, y i Indicates the frequency of occurrence of the i-th pixel pair difference after the pixel pair differences are sorted from small to large.

[0125] Furthermore, when the data set is a CSDD data set, the color image is decolorized by a local adaptive decolorization method, specifically:

[0126] The length of the color image is divided into two equal parts, and the width is 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 through the objective function to generate a parameter set, where the parameter set includes six groups of optimization parameters, each of which includes wr , w g and w b ;

[0128] Since the optimization parameters obtained in different regions are quite different, the final result after decolorization of different regions and then splicing has obvious color jumps, which does not meet the color consistency requirements. Therefore, it is necessary to smooth the parameter set using the exponential smoothing method to obtain six sets of smoothed parameters.

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

[0130] Among them, S t is the current smoothing 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]. If α is close to 1, the current smoothing value is more affected by the current observation value; when α is close 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 grayscale image blocks through the six sets of smoothed parameters, and then the six grayscale image blocks are spliced ​​to obtain a complete grayscale image.

[0132] Furthermore, an evaluation index is designed, which 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 target function, including the following steps:

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

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

[0135] 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].

[0136] Furthermore, the method for obtaining the contrast similarity between the color image and the decolorized grayscale image is:

[0137] The zero-mean image is used to highlight the details of the color image and the decolorized grayscale image to make the spatial features more prominent, so as 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, so that the evaluation index is more consistent with the human eye's perception of detail contrast in the decolorization task, where;

[0138] 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;

[0139]

[0140]

[0141]

[0142]

[0143] Among them, φ(x ci ,y ci ) is the output result of Gaussian radial function for color image, φ(x gi ,y gi ) is the output result of the Gaussian radial function on the desaturated grayscale image, x ci and ci Represents the pixel value at position (x, y) of the color image, x gi and 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 decolorized grayscale image, C 1 and C 2 Approaching 0.

[0144] Furthermore, the method for obtaining the structural similarity between the color image and the decolorized grayscale image is:

[0145] 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, and 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, where;

[0146]

[0147]

[0148]

[0149]

[0150] 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 ci Represents the pixel value at position (x, y) of the color image, x gi and gi Represents the pixel value at position (x, y) of the grayscale image, s(x i ,y i ) represents the structural similarity between the color image and the decolorized grayscale image, represents the partial derivative, C 1 and C 2 Approaching 0.

[0151] In the present invention, in order to verify the color image decolorization result of the present application, a simulation experiment is performed to verify the effectiveness of the color image decolorization method based on detail contrast preservation and color consistency proposed in the present application:

[0152] In one embodiment of the present application, the color images in the Cadik2008 dataset and the CSDD dataset are decolored by the color image decolorization method based on detail contrast preservation and color consistency proposed by the present invention. Figure 4As shown, the pixel pair selection method based on clustering, the pixel pair selection method based on weight optimization and the local adaptive decolorization method involved in the present invention are compared with the PTCP algorithm. It can be seen that these three methods have improved the RTCP algorithm in different aspects. The black text on the green paper in the last row of images is only clearly visible when the local adaptive method is used, because the local adaptive method 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 that can be recognized 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 from being lost during the dimensionality reduction process. 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 preservation, but is not outstanding in retaining fine detail contrast.

[0153] As shown in Table 1, this application presents the experimental results of the above three methods on different datasets, demonstrating the improvements of these methods over the original algorithms. 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, these three methods are better than the PTCP decolorization algorithm in terms of performance indicators.

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

[0155]

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

[0157] like Figure 5 As shown in the figure, the method of the present invention is compared with other excellent decolorization methods, and the method obtains the highest score in the proposed new evaluation index. Whether it is retaining the red leaves of the tree in the fourth row of images or the gradient color in the last row of images, a solution suitable for the decolorization scene can be found, which has higher robustness than other methods.

[0158] It is worth noting that: visual evaluation comparison can give a more intuitive understanding of the decolorization results of color images, but it is difficult to give the most accurate judgment of the decolorization results by relying solely on subjective evaluation. Therefore, it is necessary to combine objective indicators to evaluate the decolorization results; this application designs multiple key performance indicators to evaluate and quantify the effectiveness of the model: in the quantitative evaluation, the color contrast retention rate (CCPR) and color content fidelity ratio (CCFR) proposed by Lu et al., as well as the E-score and C2G-SSIM indicators proposed by Ma et al. are used. Since E-score is a combination of CCPR and CCFR, E-score is directly used to unify the measurement representation. In addition, in order to prove the effectiveness of the evaluation index designed in the present invention, the evaluation index is involved in the evaluation and compared with other indicators. The evaluation index proposed in the present invention is named D-C2G-SSIM. The decolorization effect is evaluated from multiple angles to prove the effectiveness of the decolorization algorithm of this application. Table 2 shows the index evaluation results of different methods.

[0159] Table 2 Index evaluation results of different methods

[0160]

[0161] As shown in Table 2, by listing the comparative data of the decolorization method of the present application and several other algorithms in various evaluation indicators, the performance and advantages of the decolorization method of the present application are fully demonstrated. It is the best in both evaluation indicators, and in C2G-SSIM, the index of SPDecolor is higher. This is because C2G-SSIM is more inclined to global contrast comparison rather than detail contrast comparison. This shows that the decolorization method of the present application can grayscale color images in different scenes, and pay more attention to the retention of detail contrast and color consistency while ensuring the retention of global contrast. At the same time, the proposed D-C2G-SSIM index has the same trend in evaluating the decolorization results as other indicators and is more suitable for decolorization scenes with detail contrast retention. In summary, the color image decolorization method based on detail contrast retention and color consistency given by the present application in combination with visual evaluation and objective indicator evaluation can adapt to the decolorization of more scenes and has high robust performance.

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; The color image is calculated according to the conversion parameters output by the objective function and a grayscale image is output.

2. The color image decolorization method based on detail contrast preservation and color consistency according to claim 1, characterized in that: 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, Ry 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 δ 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 )}。 3. The color image decolorization method based on detail contrast preservation and color consistency according to claim 1, characterized in that: The data sets include the Cadik 2008 data set and the CSDD data set; The Cadik 2008 dataset includes several natural images and synthetic images; The CSDD dataset is a color image with different patterns and rich colors.

4. The color image decolorization method based on detail contrast preservation and color consistency according to claim 1, characterized in that: Pixel pairs of the color images in the data set are extracted by a pixel pair selection method based on clustering or a pixel pair selection method based on weight optimization.

5. The color image decolorization method based on detail contrast preservation and color consistency according to claim 4, characterized in that: The clustering-based pixel pair selection method is: 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 respectively calculating pixel pair differences of the local pixel pair set and the global pixel pair set, and using the calculated pixel pair differences as contrast preservation reference values ​​of the corresponding local pixel pair set and the global pixel pair set; 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 in the spatial domain and the cluster center C 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, so as to achieve pixel pair optimization of the color image; Among them, k1 and k2 represent the two cluster centers C of 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.

6. The color image decolorization method based on detail contrast preservation and color consistency according to claim 4, characterized in that: 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 global random positions from the reduced color image as global pixel pairs; Combining local pixel pairs and global pixel pairs into an overall pixel pair set; Performing difference calculation on each pixel pair in the overall pixel pair set, and sorting the pixel pairs in ascending order according to the calculated pixel pair differences, to obtain a statistical distribution diagram of the pixel pair differences; The pixel pairs in the statistical distribution diagram of the pixel pair difference values ​​that conform to the Gaussian function are taken 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 method to find the optimal parameters of 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 occurrence of pixel pair difference; Among them, S is the minimum residual sum of squares, x i Represents the difference of the ith pixel pair after the pixel pair differences are sorted from small to large, y i Indicates the frequency of occurrence of the i-th pixel pair difference after the pixel pair differences are sorted from small to large.

7. The color image decolorization method based on detail contrast preservation and color consistency according to claim 3, characterized in that: When the data set is the CSDD data set, the color image is decolorized by 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 the same 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 smoothing 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 by using the six sets of smoothed parameters, and then the six grayscale image blocks are spliced ​​to obtain a complete grayscale image.

8. 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 to evaluate the decolorization effect of the objective function based on the contrast similarity and structural similarity between the color image and the decolorized grayscale image, 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].

9. The color image decolorization method based on detail contrast preservation and color consistency according to claim 8, characterized in that: The method for obtaining the contrast similarity between the color image and the decolorized grayscale image is: The details of the color image and the decolorized grayscale image are highlighted by the zero-mean 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 result of the Gaussian radial function on the desaturated grayscale image, x ci and ci Represents the pixel value at position (x, y) of the color image, x gi and 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 decolorized grayscale image, and C1 and C2 are close to 0.

10. The color image decolorization method based on detail contrast preservation and color consistency according to claim 8, 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, and 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, where; 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 ci Represents the pixel value at position (x, y) of the color image, x gi and gi Represents the pixel value at position (x, y) of the grayscale image, 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

  • Region growing with adaptive thresholds and distance function parameters

    US20040130546A1