Next Article in Journal
Hybrid Techniques to Predict Solar Radiation Using Support Vector Machine and Search Optimization Algorithms: A Review
Previous Article in Journal
Optimal Segment Control of Active Twist Rotor for Power Reduction in Forward Flight
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

An Efficient Palette Generation Method for Color Image Quantization

Department of Computer Science, National Pingtung University, Pingtung City, Pingtung County 90003, Taiwan
Appl. Sci. 2021, 11(3), 1043; https://doi.org/10.3390/app11031043
Submission received: 17 December 2020 / Revised: 19 January 2021 / Accepted: 20 January 2021 / Published: 24 January 2021
(This article belongs to the Section Computing and Artificial Intelligence)

Abstract

:
This article describes an efficient method to generate a color palette for color image quantization. The method consists of two stages. In the first stage, the initial palette is generated. Initially, the color palette is an empty set. First, the N colors are generated according to the data distribution of the input image in the RGB (Red, Green, Blue) color space. Then, one color is selected from the N colors and this color is added to the initial palette, and the step is repeated until the color number of the initial palette is equal to K. In the second stage, the quantized image is generated using the fast K-means algorithm. There are many sampling rates used in this study. For each sampled pixel, a fast searching method is employed to efficiently determine the closest color in the palette. Experimental results show that the high-quality quantized images can be generated by the proposed method. When the sampling rate equals 0.125, the computation time of the proposed method is less than 0.3 s for all cases.

1. Introduction

Nowadays, RGB color images are widely used for storage, transmission and display. In order to reduce the storage space required and the transfer time of the color images, several color image quantization techniques have been proposed [1]. Color image quantization consists of two procedures. The first is to design a color palette which is a set of representative colors, while the second is to map each image pixel to one color in the color palette.
The key to color image quantization is a good color palette. If a good color palette is used, good reconstructed image quality of the compressed color image can be achieved. Several palette design methods have been proposed for color image quantization. Orchard and Bouman [2] proposed the binary splitting approach for color image quantization. Wu [3] employed an iterative process to divide the color space into boxes based on variance minimization. Then, the average value of each resulting box is represented as a color of the palette. Pei and Lo [4] proposed a color quantization technique which is based on the Kohonen neural network to train the color images. Hsieh and Fan [5] calculated the sorted histogram list, and an adaptive clustering algorithm used this list to extract the palette colors for color image quantization. Omran et al. [6] developed a color image quantization algorithm that combines particle swarm optimization with the K-means clustering algorithm. Ghanbarian et al. [7] proposed the ant colony algorithm for color reduction. Hu and Su [8] employed two test conditions to accelerate the K-means algorithm for color image quantization. Hu et al. [9] proposed two schemes to design the color palette. The first scheme employed the splitting-based technique for initial palette generation, and the second employed the k-means algorithm to generate the final color palette. Celebi [10] introduced fast variants of k-means with several initialization schemes for color image quantization. Celebi et al. [11] introduced an effective color quantization method which is based on divisive hierarchical clustering and the binary splitting strategy. El-Said [12] proposed an optimized Fuzzy C-means algorithm for color image quantization. Ponti [13] proposed a method which makes a contribution regarding the use of image quantization to dimensionality reduction of visual data. Ueda et al. [14] described a color quantization method using statistical features obtained by linear discriminant analysis and principal component analysis. Frackiewicz et al. [15] proposed a fast color image quantization method based on K-means clustering combined with image sampling. Pérez-Delgado [16] employed the shuffled-frog leaping algorithm for color image quantization. Pérez-Delgado [17] solved the color quantization problem by combining the particle swarm optimization algorithm with the Ant-tree.
Although these methods can generate quantized images, some methods generate poorer images and some consume a great deal of time. The aim of this study is to generate high-quality quantized images with low computational cost. Experimental results show that high-quality quantized images can be generated by the proposed method. When the sampling rate equals 0.125, the computation time of the proposed method is less than 0.3 s for all cases.
The rest of this paper is organized as follows. Section 2 presents the related work. Section 3 gives a description of the color image quantization method. In Section 4, the experimental results and discussion are presented. Section 5 gives the conclusions.

2. Related Work

Vector quantization has been successfully used in image compression. There are many techniques which have been proposed to speed up the codebook search in vector quantization [18,19,20,21,22,23,24,25]. Wu and Lin [22] proposed a kick-out condition for the fast codeword searching algorithm. In this article, this fast searching method is called by Wu–Lin method. For a color pixel in the color image, the Wu–Lin method can efficiently determine the closest color in the palette.
For the color pixel x = (x1, x2, x3) in an image and a color y = (y1, y2, y3) in the palette, the square Euclidean distance is defined as follows:
SED ( x , y ) = j = 1 3 ( x j y j ) 2 = | | x | | 2 + | | y | | 2 2 j = 1 3 x j y j
The goal is to find a palette color y such that it minimizes Equation (1). Given the color pixel x, | | x | | 2 is a common term for all palette colors. Therefore, the goal is also to find a palette color y such that it minimizes
SED 1 ( x , y ) = | | y | | 2 2 j = 1 3 x j y j
According to the Cauchy–Schwarz inequality, we have
| | x | | × | | y | | j = 1 3 x j y j
Therefore, the following inequality is always true:
SED 1 ( x , y ) | | y | | 2 2 | | x | | × | | y | | = | | y | | ( | | y | |   2 | | x | | )
If a palette color y satisfies the test condition
| | y | | ( | | y | |   2 | | x | | ) S E D 1 _ m i n
where SED1_min denotes the minimal SED1 between the color pixel x and the closest palette color ymin found so far, then S E D 1 ( x , y )   S E D 1 _ m i n can be derived from Equations (4) and (5). Therefore, the palette color y is not the closest color.
The color palette is sorted in ascending order of length. Assume that c1 and c2 are two colors in the palette. The following two properties are important. The first property is that if ||c1|| < ||x|| when the palette color c1 is not the closest color; the palette color c2 is also not the closest color if ||c2|| < ||c1||. The second property is that if ||c1|| > ||x|| when the palette color c1 is not the closest color; the palette color c2 is also not the closest color if ||c2|| > ||c1||.
If the color pixel x = (125, 65, 130), the value of ||x|| is about 191.70. Figure 1a shows the sorted palette of K colors. Assume that the color c is the initial searched palette color for the color pixel x. In this study, the color c is the palette color with the closest length value to x, and the binary search technique is employed to find the color c. In this case, the palette color c = (73, 58, 167). It can be computed that the value of ||c|| is about 191.26. Therefore, Figure 1b shows the searching order of colors in the palette.

3. The Proposed Method

The method consists of two stages: initial palette generation and fast K-means algorithm.

3.1. Initial Palette Generation

For the color pixel x = (x1, x2, x3) in an image, x1, x2, and x3 are integers between 0 and 255. Figure 2 shows the data distribution of the Airplane image in the RGB color space. The color pixel x = (x1, x2, x3) in the Airplane image corresponds to a point (x1, x2, x3) in Figure 2. The 3D RGB space can be divided into non-overlapping cubes. In this study, each cube size is 16 × 16 × 16 such that there are 4096 cubes in total. These cubes are identified as Cube(i), i = 0, 1, …, 4095. For the initial palette generation, the proposed method only considers the cubes in which the point number contained in them is greater than or equal to Thr. These considered cubes are identified as mCube(i), i = 0, 1, …, N—1. The point number contained in mCube(i) and the center of all the points in mCube(i) are denoted by initn(i) and initc(i), respectively. For example, the point number contained in mCube(0) is equal to 3. Assume that the locations of these points are (81, 115, 35), (85, 118, 40) and (90, 116, 36). Hence, initc(0) = ( 81 ,   115 ,   35 )   +   ( 85 ,   118 ,   40 )   +   ( 90 ,   116 ,   36 ) 3 = (85, 116, 37).
Figure 3 shows 8 cubes. The 8 cubes contain 0, 1, 15, 1, 0, 16, 1, and 0 points, respectively. Assume that the value of Thr is set to 6. The point numbers contained within Cubes 2 and 5 are greater than or equal to 6. Hence, mCube(0) = Cube(2), mCube(1) = Cube(5), N = 2, initn(0) = 15, and initn(1) = 16. Consequently, initc(0) and initc(1) denote the centers of these points contained in mCube(0) and mCube(1), respectively.
After the N colors initc(i), i = 0, 1, …, N—1, are determined, the proposed method selects K colors from the N colors to generate the initial palette. The steps of initial palette generation are as follows.
  • Step 1: The initial palette is an empty set.
      Selected(i) = 0, i = 0, 1, …, N—1. The value of Selected(i) is equal to 1 which indicates that the color initc(i) has been selected and added to the initial palette.
      Cno = 0.
  • Step 2: If initn(j) == max {initn(i) | i = 0, 1, …, N—1}, then the color initc(j) is selected and added to the initial palette.
      Selected(j) = 1 and Cno = Cno +1.
  • Step 3: For the colors initc(i) with Selected(i) = 0, compute the square Euclidean distance between the color initc(i) and each color in the initial palette. The minimum value among these square Euclidean distances is identified as Dist(i). For the color initc(i), the value DistN(i) is computed as follows
    DistN ( i ) =   Dist ( i ) × ( initn ( i ) ) 0.5 .  
      If DistN(j) == max {DistN(i) | if Selected(i) == 0, i = 0, 1, …, N—1}, then the color initc(j) is selected and added to the initial palette.
      Selected(j) = 1 and Cno = Cno + 1.
  • Step 4: If K > Cno, then go to Step 3. Otherwise go to Step 5.
  • Step 5: The initial palette is generated.

3.2. Fast K-Means Algorithm

The K-means algorithm is the common data clustering method. However, the K-means algorithm is time consuming. In order to reduce the computational cost, the fast K-means algorithm is developed.
The data sampling process is employed, and many sampling rates are used in this study. The sampling rate = 1 indicates that every pixel of the color image is sampled. For the 2 × 2 block shown in Figure 4a, only one pixel is sampled from the 2 × 2 block if the sampling rate = 0.25. In this study, a random number, denoted by rnum1, is generated. If the value of (rnum1% 4) is equal to 3, then the location of the sampled pixel is (3/2, 3% 2) = (1, 1). For the 4×4 block shown in Figure 4b, two pixels are sampled from the 4 × 4 block if the sampling rate = 0.125. In this study, a random number, denoted by rnum2, is generated. If the value of (rnum2% 8) is equal to 5, then the location of the first sampled pixel is (x1, y1) = (5/4, 5% 4) = (1, 1) and the location of the second sampled pixel is (x2, y2) = (x1 + 2, (y1 + 2)% 4) = (3, 3).
According to the data sampling process described above, the sampling rates 0.5, 0.0625 and 0.03125 can also be used. Two pixels are sampled from the 2 × 2 block if the sampling rate = 0.5, only one pixel is sampled from the 4 × 4 block if the sampling rate = 0.0625, and two pixels are sampled from the 8 × 8 block if the sampling rate = 0.03125.
The steps of the fast K-means algorithm can be described as follows.
  •   Input: The initial palette described in Section 3.1.
  • Step 1: The data sampling process is employed. The sampled color pixels are denoted by SCPi, i = 0, 1, …, SPN—1.
  • Iter = 0
  • StopF = 0
  • Step 2: For the sampled pixel SCPi, the closest color in the palette is denoted by CCPi. The color CCPi is efficiently determined by the Wu–Lin method described in Section 2. If the index value of its closest palette color is r, then the sampled pixel is classified into the r-th group.
  • Step 3: Compute the mean values of these K groups. The new color palette is generated by sorting these K values in ascending order of length.
  • Step 4: The mean square error at iteration Iter is defined as follows
    M S E 1 ( I t e r ) = 1 S P N i = 0 S P N 1 S E D ( S C P i ,   C C P i ) .  
  •   If ((Iter >0) and ( M S E 1 ( I t e r )   M S E 1 ( I t e r 1 ) )), then set StopF to 1.
  • Step 5: Iter = Iter + 1.
  • If ((Iter == Max_cycle) or (StopF == 1)), then go to Step 6. Otherwise, go to Step 2.
  • Step 6: The color palette is generated. The required iteration number, denoted by Iter, is output.

4. Experimental Results and Discussion

The proposed algorithm is implemented in C language. All of the experiments were performed on a PC running under the operating system of Windows 7, with an I7 processor (3.6 GHz) and 32 GBytes of RAM. The set of test images includes Lena, Baboon, Lake, Peppers and Airplane, which have the same size of 512 × 512 pixels. They were downloaded from [26] and were used for conducting the experiments. The parameters Thr = 10 and Max_cycle = 20 were used in the experiments.
The experimental results are shown in Table 1. The results presented are the solutions with the mean square error, the required iteration number, and computation time. The mean square error (MSE) is defined as follows:
M S E = 1 512 × 512 i = 0 511 j = 0 511 S E D ( f ( i , j ) ,   f ( i , j ) ) ,
where f is the original color image, and f′ is the quantized image. For the same image and same color palette size, we can observe the following:
(1)
The mean square errors obtained when the sampling rate = 1, 0.5, 0.25 and 0.125 are near, and the mean square error obtained when the sampling rate = 0.03125 is higher than that obtained when the sampling rate = 1, 0.5, 0.25, 0.125 and 0.0625 in most cases.
(2)
When the sampling rate decreases, the computation time decreases in most cases.
Table 2 shows the computation time (milliseconds) of the proposed method with a sampling rate of 0.125. The total computation time is the summation of T1 and T2. T1 is the computation time for initial palette generation and T2 is the computation time for clustering by the fast K-means algorithm. It is observed that the value of T1 is between 10 and 30 milliseconds, the value of T2 is between 20 and 200 milliseconds, and the total computation is between 30 and 230 milliseconds. For the Lena image, the required iteration numbers are 18 and 13 for K = 128 and 256, respectively. Therefore, the results show that the total computation time when K = 256 is less than the total computation time when K = 128.
Figure 5, Figure 6, Figure 7, Figure 8 and Figure 9 illustrate the quantized images of Lena, Baboon, Lake, Peppers, and Airplane, respectively. The color numbers of the palette range from 32 to 256. These quantized images are produced by the proposed method with a sampling rate of 0.125. It shows that as the color number of the palette increases, the quality of the quantized image produced by the proposed method always improves. It is noted that the visual quality of the 256 colors quantized image is approximately the same as that of the original image.
In addition, two color images, Splash and Tree, were used for testing. The Splash image consists of 512 × 512 pixels, and the Tree image consists of 256 × 256 pixels. Figure 10 and Figure 11 illustrate the quantized images of Splash and Tree, respectively. These quantized images are produced by the proposed method with a sampling rate of 0.125. The results show that the proposed method can generate high-quality quantized images. It is observed that the visual quality of the 256 colors quantized image is approximately the same as that of the original image.
The effect of the parameter Thr on the solution is discussed in this section. The comparison is applied to the Baboon and Peppers images. The MSE obtained will be shown in a figure for comparison.
The proposed method only considers the cubes for which the point number contained in them is greater than or equal to Thr in order to generate the initial palette. Figure 12 compares the results of Thr = {3, 10, 30, 60} for the Baboon image. This figure shows that the mean square errors obtained when Thr = 3, 10 and 30 are near, and the average mean square error obtained when Thr = 60 is slightly higher than that obtained when Thr = 3, 10 and 30. Figure 13 compares the results of Thr = {3, 10, 30, 60} for the Peppers image. This figure shows that the average mean square error obtained when Thr = 10 is slightly lower than that obtained when Thr = 3 and 30, and the average mean square error obtained when Thr = 60 is higher than that obtained when Thr = 3, 10 and 30. Therefore, the value selected for the parameter Thr of the proposed algorithm was 10.
In 2020, a color image quantization algorithm, identified as PSO+ATCQ-3, that combines particle swarm optimization and artificial ants was proposed by Pérez-Delgado [17]. The quality of the quantized images produced by PSO+ATCQ-3 is better than that produced by some well-known color image quantization methods. The PSO+ATCQ-3 algorithm was implemented in C language and executed on a PC running under the Linux operating system with an I7 processor (2 GHz) and 16 GBytes of RAM [17]. The experimental results obtained by PSO+ATCQ-3 are shown in Table 3.
First, the performance of the proposed method with sampling rate = 0.125 is compared to the iteration 1 of PSO+ATCQ-3. The MSE obtained by PSO+ATCQ-3 is higher than that obtained by the proposed method for all cases. The computation time of PSO+ATCQ-3 is between 468 and 2074 milliseconds. The computation time of the proposed method is between 30 and 230 milliseconds. It reveals that PSO+ATCQ-3 consumes more computation time than the proposed method.
Second, the performance of the proposed method with sampling rate = 0.25 is compared to the iteration 5 of PSO+ATCQ-3. For the Lena, Baboon, Peppers and Lake images, the MSE obtained by PSO+ATCQ-3 is slightly lower than that obtained by the proposed method. For the Airplane image, the MSE obtained by PSO+ATCQ-3 is higher than that obtained by the proposed method. The computation time of PSO+ATCQ-3 is between 2358 and 10,412 milliseconds. The computation time of the proposed method is between 70 and 340 milliseconds. It also reveals that PSO+ATCQ-3 consumes more computation time than the proposed method.

5. Conclusions

In this article, an efficient method is presented to generate the color palette. The proposed method consists of two stages. The first stage is to generate the initial palette. First, the N colors are generated according to the data distribution of the input image in the RGB color space. Then, one color is selected from the N colors and this color is added to the initial palette, and the step is repeated until the color number of the initial palette is equal to K. The second stage is to generate the quantized images using the fast K-means algorithm. The data sampling process and the Wu–Lin method are employed to achieve reduction in computation time.
Many sampling rates are used in this study. Experimental results show that the visual quality of the 256 colors quantized image is approximately the same as that of the original image. When the sampling rate = 0.125, the computation time of the proposed method is less than 0.3 s. In other words, the proposed method can generate high-quality quantized images while consuming little computational cost. It is thus suitable for real-time multimedia applications.

Funding

This research received no external funding.

Informed Consent Statement

Not applicable.

Data Availability Statement

The data presented in this study are available on request from the corresponding author.

Acknowledgments

This work was partially supported by the Ministry of Science and Technology, Taiwan, under Grant MOST 104-2221-E-153-012.

Conflicts of Interest

The author declares that there is no conflict of interest.

References

  1. Ozturk, C.; Hancer, E.; Karaboga, D. Color image quantization: A short review and an application with artificial bee colony algorithm. Informatica 2014, 25, 485–503. [Google Scholar] [CrossRef] [Green Version]
  2. Orchard, M.T.; Bouman, C.A. Color quantization of images. IEEE Trans. Signal Process. 1991, 39, 2677–2690. [Google Scholar] [CrossRef]
  3. Wu, X. Efficient Statistical Computations for Optimal Color Quantization. In Graphics Gems II; Arvo, J., Ed.; Academic Press: New York, NY, USA, 1991; pp. 126–133. [Google Scholar]
  4. Pei, S.C.; Lo, Y.S. Color image compression and limited display using self-organization Kohonen map. IEEE Trans. Circuits Syst. Video Technol. 1998, 8, 191–205. [Google Scholar]
  5. Hsieh, I.S.; Fan, K.C. An adaptive clustering algorithm for color quantization. Pattern Recognit. Lett. 2000, 21, 337–346. [Google Scholar] [CrossRef]
  6. Omran, M.G.; Engelbrecht, A.P.; Salman, A. A color image quantization algorithm based on particle swarm optimization. Informatica 2005, 29, 261–269. [Google Scholar]
  7. Ghanbarian, A.T.; Kabir, E.; Charkari, N.M. Color reduction based on ant colony. Pattern Recognit. Lett. 2007, 28, 1383–1390. [Google Scholar] [CrossRef]
  8. Hu, Y.C.; Su, B.H. Accelerated pixel mapping scheme for colour image quantization. Imaging Sci. J. 2008, 56, 68–78. [Google Scholar] [CrossRef]
  9. Hu, Y.C.; Lee, M.G.; Tsai, P. Colour palette generation schemes for colour image quantization. Imaging Sci. J. 2009, 57, 46–57. [Google Scholar] [CrossRef]
  10. Celebi, M.E. Improving the performance of k-means for color quantization. Image Vis. Comput. 2011, 29, 260–271. [Google Scholar] [CrossRef] [Green Version]
  11. Celebi, M.E.; Wen, Q.; Hwang, S. An effective real-time color quantization method based on divisive hierarchical clustering. J. Real-Time Image Process. 2015, 10, 329–344. [Google Scholar] [CrossRef]
  12. El-Said, S.A. Image quantization using improved artificial fish swarm algorithm. Soft Comput. 2015, 19, 2667–2679. [Google Scholar] [CrossRef]
  13. Ponti, M.; Nazaré, T.S.; Thumé, G.S. Image quantization as a dimensionality reduction procedure in color and texture feature extraction. Neurocomputing 2016, 173, 385–396. [Google Scholar] [CrossRef]
  14. Ueda, Y.; Koga, T.; Suetake, N.; Uchino, E. Color quantization method based on principal component analysis and linear discriminant analysis for palette-based image generation. Opt. Rev. 2017, 24, 741–756. [Google Scholar] [CrossRef]
  15. Frackiewicz, M.; Mandrella, A.; Palus, H. Fast color quantization by K-means clustering combined with image sampling. Symmetry 2019, 11, 963. [Google Scholar] [CrossRef] [Green Version]
  16. Pérez-Delgado, M.L. Color image quantization using the shuffled-frog leaping algorithm. Eng. Appl. Artif. Intell. 2019, 79, 142–158. [Google Scholar] [CrossRef]
  17. Pérez-Delgado, M.L. Color quantization with particle swarm optimization and artificial ants. Soft Comput. 2020, 24, 4545–4573. [Google Scholar] [CrossRef]
  18. Huang, S.H.; Chen, S.H. Fast encoding algorithm for VQ-based image coding. Electron. Lett. 1990, 26, 1618–1619. [Google Scholar] [CrossRef]
  19. Ra, S.W.; Kim, J.K. A fast mean-distance-ordered partial codebook search algorithm for image vector quantization. IEEE Trans. Circuits Syst. II Analog Digit. Signal Process. 1993, 40, 576–579. [Google Scholar] [CrossRef]
  20. Torres, L.; Huguet, J. An improvement on codebook search for vector quantization. IEEE Trans. Commun. 1994, 42, 208–210. [Google Scholar] [CrossRef] [Green Version]
  21. Lin, Y.C.; Tai, S.C. A fast Linde-Buzo-Gray algorithm in image vector quantization. IEEE Trans. Circuits Syst. II Analog Digit. Signal Process. 1998, 45, 432–435. [Google Scholar]
  22. Wu, K.S.; Lin, J.C. Fast VQ encoding by an efficient kick-out condition. IEEE Trans. Circuits Syst. Video Technol. 2000, 10, 59–62. [Google Scholar]
  23. Hu, Y.C.; Chang, C.C. An effective codebook search algorithm for vector quantization. Imaging Sci. J. 2003, 51, 221–234. [Google Scholar] [CrossRef]
  24. Pan, J.S.; Lu, Z.M.; Sun, S.H. An efficient encoding algorithm for vector quantization based on subvector technique. IEEE Trans. Image Process. 2003, 12, 265–270. [Google Scholar] [PubMed]
  25. Chang, C.C.; Hsieh, Y.P. A fast VQ codebook search with initialization and search order. Inf. Sci. 2012, 183, 132–139. [Google Scholar] [CrossRef]
  26. The USC-SIPI Image Database. Available online: http://sipi.usc.edu/database/database.php/ (accessed on 15 June 2018).
Figure 1. (a) The color palette is sorted in ascending order of length, (b) the searching order of colors in the palette if the color pixel x = (125, 65, 130).
Figure 1. (a) The color palette is sorted in ascending order of length, (b) the searching order of colors in the palette if the color pixel x = (125, 65, 130).
Applsci 11 01043 g001
Figure 2. Data distribution of the Airplane image in the RGB (Red, Green, Blue) color space.
Figure 2. Data distribution of the Airplane image in the RGB (Red, Green, Blue) color space.
Applsci 11 01043 g002
Figure 3. The 8 cubes contain 0, 1, 15, 1, 0, 16, 1, and 0 points, respectively.
Figure 3. The 8 cubes contain 0, 1, 15, 1, 0, 16, 1, and 0 points, respectively.
Applsci 11 01043 g003
Figure 4. (a) Only one pixel is sampled, (b) two pixels are sampled
Figure 4. (a) Only one pixel is sampled, (b) two pixels are sampled
Applsci 11 01043 g004
Figure 5. (a) The Lena image, (b) 32 colors with MSE = 123.84, (c) 64 colors with MSE = 74.31, (d) 128 colors with MSE = 47.86, (e) 256 colors with MSE = 32.24.
Figure 5. (a) The Lena image, (b) 32 colors with MSE = 123.84, (c) 64 colors with MSE = 74.31, (d) 128 colors with MSE = 47.86, (e) 256 colors with MSE = 32.24.
Applsci 11 01043 g005aApplsci 11 01043 g005b
Figure 6. (a) The Baboon image, (b) 32 colors with MSE = 383.92, (c) 64 colors with MSE = 241.11, (d) 128 colors with MSE = 154.91, (e) 256 colors with MSE = 100.22.
Figure 6. (a) The Baboon image, (b) 32 colors with MSE = 383.92, (c) 64 colors with MSE = 241.11, (d) 128 colors with MSE = 154.91, (e) 256 colors with MSE = 100.22.
Applsci 11 01043 g006aApplsci 11 01043 g006b
Figure 7. (a) The Pepper image, (b) 32 colors with MSE = 230.00, (c) 64 colors with MSE = 137.14, (d) 128 colors with MSE = 85.87, (e) 256 colors with MSE = 55.70.
Figure 7. (a) The Pepper image, (b) 32 colors with MSE = 230.00, (c) 64 colors with MSE = 137.14, (d) 128 colors with MSE = 85.87, (e) 256 colors with MSE = 55.70.
Applsci 11 01043 g007aApplsci 11 01043 g007b
Figure 8. (a) The Lake image, (b) 32 colors with MSE = 211.57, (c) 64 colors with MSE = 135.67, (d) 128 colors with MSE = 87.99, (e) 256 colors with MSE = 58.44.
Figure 8. (a) The Lake image, (b) 32 colors with MSE = 211.57, (c) 64 colors with MSE = 135.67, (d) 128 colors with MSE = 87.99, (e) 256 colors with MSE = 58.44.
Applsci 11 01043 g008aApplsci 11 01043 g008b
Figure 9. (a) The Airplane image, (b) 32 colors with MSE = 70.21, (c) 64 colors with MSE = 41.62, (d) 128 colors with MSE = 27.27, (e) 256 colors with MSE = 19.22.
Figure 9. (a) The Airplane image, (b) 32 colors with MSE = 70.21, (c) 64 colors with MSE = 41.62, (d) 128 colors with MSE = 27.27, (e) 256 colors with MSE = 19.22.
Applsci 11 01043 g009aApplsci 11 01043 g009b
Figure 10. (a) The Splash image, (b) 32 colors with MSE = 96.72, (c) 64 colors with MSE = 52.64, (d) 128 colors with MSE = 30.65, (e) 256 colors with MSE = 19.31.
Figure 10. (a) The Splash image, (b) 32 colors with MSE = 96.72, (c) 64 colors with MSE = 52.64, (d) 128 colors with MSE = 30.65, (e) 256 colors with MSE = 19.31.
Applsci 11 01043 g010aApplsci 11 01043 g010b
Figure 11. (a) The Tree image, (b) 32 colors with MSE = 34.50, (c) 64 colors with MSE = 20.92, (d) 128 colors with MSE = 13.79, (e) 256 colors with MSE = 9.44.
Figure 11. (a) The Tree image, (b) 32 colors with MSE = 34.50, (c) 64 colors with MSE = 20.92, (d) 128 colors with MSE = 13.79, (e) 256 colors with MSE = 9.44.
Applsci 11 01043 g011
Figure 12. Compare the results of Thr = {3, 10, 30, 60} for the Baboon image, (a) MSE—32 colors, (b) MSE—64 colors, (c) MSE—128 colors, (d) MSE—256 colors.
Figure 12. Compare the results of Thr = {3, 10, 30, 60} for the Baboon image, (a) MSE—32 colors, (b) MSE—64 colors, (c) MSE—128 colors, (d) MSE—256 colors.
Applsci 11 01043 g012
Figure 13. Compare the results of Thr = {3, 10, 30, 60} for the Peppers image, (a) MSE—32 colors, (b) MSE—64 colors, (c) MSE—128 colors, (d) MSE—256 colors.
Figure 13. Compare the results of Thr = {3, 10, 30, 60} for the Peppers image, (a) MSE—32 colors, (b) MSE—64 colors, (c) MSE—128 colors, (d) MSE—256 colors.
Applsci 11 01043 g013
Table 1. Results of the proposed method with Thr = 10 and Max_cycle = 20. (Sr: sampling rate, Iter: the required iteration number, T: computation time (milliseconds)).
Table 1. Results of the proposed method with Thr = 10 and Max_cycle = 20. (Sr: sampling rate, Iter: the required iteration number, T: computation time (milliseconds)).
K = 32K = 64K = 128K = 256
ImageSrMSEIterTMSEIterTMSEIterTMSEIterT
Lena1123.101341074.001559047.281471031.30201260
0.5123.391220073.511939047.431744031.4520660
0.25123.311413074.121113047.601217031.7320340
0.125123.84116074.311610047.861813032.2413120
0.0625123.83195073.62207048.16188032.611470
0.03125123.96143074.55174048.42195033.551140
Baboon1381.8720780240.2511550153.4014880100.483280
0.5385.9820410240.5114380153.831446099.2916670
0.25385.8920210240.6612180153.991830099.6913290
0.125383.9220120241.1120150154.9116160100.2220230
0.0625389.162070241.941670156.2920110101.5820130
0.03125385.792050242.842050157.702070103.162080
Peppers1230.1920670136.731461084.991266054.9114970
0.5230.1818320136.851533084.941133055.1815550
0.25230.5818180136.521821085.061420055.4715290
0.125230.001470137.141812085.871412055.7014150
0.0625230.562060137.75166086.09116056.531480
0.03125232.122040138.20194087.12205058.121250
Lake1210.9820640135.051040086.951680056.78201220
0.5210.6220340134.881022087.021437057.3317550
0.25211.0120170134.891517087.451319057.5620320
0.125211.5720100135.67117087.991612058.4414130
0.0625210.111750136.19145088.54208059.0118100
0.03125211.401830138.43184090.86205061.142060
Airplane169.43922041.47617026.99829018.556280
0.569.211418041.49610026.97714018.808190
0.2569.59108041.5267026.9078018.7810120
0.12570.21145041.6263027.2774019.22850
0.062570.06164041.8362027.5963018.86840
0.0312571.51102040.6892027.6092019.12930
Table 2. The computation time (milliseconds) of the proposed method with a sampling rate of 0.125.
Table 2. The computation time (milliseconds) of the proposed method with a sampling rate of 0.125.
ImageKT1T2Total Computation Time
Lena32105060
641090100
12810120130
25610110120
Baboon3220100120
6430120150
12830130160
25630200230
Peppers32106070
6420100120
12820100120
25620130150
Lake321090100
64106070
12820100120
25620110130
Airplane32104050
64102030
128103040
256104050
Table 3. Results of the method proposed by Pérez-Delgado [17]. (Iter: iteration of the algorithm, MSEa: average MSE, dev: standard deviation of MSE, T: average computation time (milliseconds)).
Table 3. Results of the method proposed by Pérez-Delgado [17]. (Iter: iteration of the algorithm, MSEa: average MSE, dev: standard deviation of MSE, T: average computation time (milliseconds)).
K = 32K = 64K = 128K = 256
ImageIterMSEadevTMSEadevTMSEadevTMSEadevT
Lena1126.442.0946877.301.2772350.000.46117232.770.302074
5119.260.61237373.050.60361646.960.32582730.840.2110412
10118.560.41476472.530.38721946.660.271178730.610.2020783
Baboon1390.163.87478247.092.29716159.211.241177103.400.642042
5376.971.192401238.570.873593153.750.65586998.770.3910209
10375.430.584803237.790.707224153.240.531171298.410.3420452
Peppers1245.474.81478148.213.1973991.792.65116759.870.882049
5230.251.192382136.121.78367884.760.81589455.420.4210244
10229.311.374727134.591.51732584.310.471174654.660.3420484
Lake1216.974.06474143.663.4071295.531.77115663.321.272043
5204.890.762358132.670.88359587.010.52589056.940.3310223
10203.730.794718131.690.49718385.750.431173555.530.3620447
Airplane1130.0617.7546967.1210.4270138.703.40118224.981.062055
591.8814.08236653.003.74350133.062.22587421.680.8310242
1071.614.97470746.942.31700431.491.491176121.080.7220588
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Huang, S.-C. An Efficient Palette Generation Method for Color Image Quantization. Appl. Sci. 2021, 11, 1043. https://doi.org/10.3390/app11031043

AMA Style

Huang S-C. An Efficient Palette Generation Method for Color Image Quantization. Applied Sciences. 2021; 11(3):1043. https://doi.org/10.3390/app11031043

Chicago/Turabian Style

Huang, Shu-Chien. 2021. "An Efficient Palette Generation Method for Color Image Quantization" Applied Sciences 11, no. 3: 1043. https://doi.org/10.3390/app11031043

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop