Research Article  Open Access
Hyun Jun Park, Kwang Baek Kim, EuiYoung Cha, "An Effective Color Quantization Method Using OctreeBased SelfOrganizing Maps", Computational Intelligence and Neuroscience, vol. 2016, Article ID 5302957, 11 pages, 2016. https://doi.org/10.1155/2016/5302957
An Effective Color Quantization Method Using OctreeBased SelfOrganizing Maps
Abstract
Color quantization is an essential technique in color image processing, which has been continuously researched. It is often used, in particular, as preprocessing for many applications. SelfOrganizing Map (SOM) color quantization is one of the most effective methods. However, it is inefficient for obtaining accurate results when it performs quantization with too few colors. In this paper, we present a more effective color quantization algorithm that reduces the number of colors to a small number by using octree quantization. This generates more natural results with less difference from the original image. The proposed method is evaluated by comparing it with wellknown quantization methods. The experimental results show that the proposed method is more effective than other methods when using a small number of colors to quantize the colors. Also, it takes only 71.73% of the processing time of the conventional SOM method.
1. Introduction
24bit images can represent up to 16,777,216 colors. A variety of colors in an image provides the advantages of having greater abilities of expression and aesthetics. However, a variety of colors becomes a serious problem for most color image processing. Therefore, research to represent the various colors within a limited number of colors, which is called color quantization, has been conducted.
SelfOrganizing Map (SOM), which is one of the most effective color quantization methods, provides excellent results [1–5]. However, lowfrequency colors in the original image tend to be excluded during the learning process because of the characteristics of the SOM learning algorithm [6]. In addition, when SOM updates the winner node, it also updates neighbor nodes, which causes loss of the original color of the neighbor node. In particular, the loss of original color increases when SOM uses a small number of nodes to quantize the image with a small number of colors. Therefore, to complement these SOM disadvantages, we propose an effective color quantization algorithm that is effective even when it uses only a small number of colors by using an octree color quantization method.
Usually, mean absolute error (MAE), mean square error (MSE), and processing time are used to quantify the performance of the color quantization results. MAE and MSE are calculated by the following, respectively:where denotes the original image, denotes the quantized image, and and denote image height and width, respectively.
2. Octree Color Quantization
An octree is one of the imagedependent methods classified as a hierarchical clustering method. It is faster than partitional clustering methods, but its performance is relatively poor [7, 8].
An octree is a tree structure with up to eight nodes as children. The octree can represent all colors in an image within an eightlevel tree because the colors are represented with eight bits. At first, color distribution in the image is represented using an octree, which then prunes the nodes until nodes remain. The palette colors are chosen from the remaining nodes. This method is fast and gives good results [6, 9].
As mentioned above, octree color quantization generates the palette using the distribution of colors in the image, but it does not consider the frequency of color. This means that if an image is composed of similar colors overall but has many different lowfrequency colors or noise, octree’s results can be very poor.
Figure 1 shows the strengths and weaknesses of octree color quantization. The original image has two highfrequency colors overall and many lowfrequency colors around them. Yellowish and bluish colors occupy most of the image. Because SOM quantization considers the distribution of color, the generated palette has 21 yellowish colors and 5 bluish colors. By contrast, the generated palette from octree quantization has 5 yellowish colors and 9 bluish colors. Because of this, it is not influenced by the distribution of colors, and it creates a much greater difference from the original image. This is obviously octree’s weakness.
However, octree has various colors, like greenish and pinkish, which SOM does not have. This is a strength for octree for the same reason.
In this paper, we present a more effective color quantization algorithm that complements the weakness of SOM by using the strengths of octree, which are fast and offer various colors.
3. SOM Color Quantization
SOM color quantization shows excellent results with most images. The results are very natural and have a low MAE and MSE because the SOM learning algorithm spontaneously considers the distribution of colors.
However, when SOM color quantization has only a small number of colors (i.e., the number of colors, , becomes lower), its disadvantage is apparent. The SOM learning algorithm finds the winner node and updates its weight. At that time, neighbor nodes of the winner are also updated. This means SOM generates a more natural palette, but also it means SOM loses the original color of the neighbor nodes. Highfrequency colors are learned many times, so they update the weights many times. This means that highfrequency colors influence neighbor nodes much more, because when the winner is updated, the neighbor nodes are also updated. It becomes more serious when the number of colors, , becomes smaller. If becomes too small, then the SOM map also becomes so small that the influences on updating the winner become much greater. Therefore, the overall colors can become similar and the lowfrequency colors disappear through updating the weights.
Figure 2 shows quantized results with 16 colors from SOM [3, 6] and octree [9]. SOM (MAE 28.93, MSE 501.62) obviously has fewer differences from the original image than octree (MAE 56.30, MSE 1609.28). However, visually, the result of octree looks better because the results from SOM lost the skyblue color, even if octree has almost double the MAE.
SOM color quantization is excellent method, but the number of colors, , is small; then its performance is decreased. Therefore, it can be a problem when it is used to quantize an image with a small number of colors.
4. OctreeBased SOM Color Quantization
We present a more effective color quantization algorithm by using octreebased SOM color. It complements the disadvantages of SOM, so it not only gives visually natural results but also provides low MAE and MSE.
The beginning of the SOM learning algorithm initializes the weights with random values. It causes similar colors to be located anywhere on the palette. If they are highfrequency colors, then lowfrequency colors around them are lost. Therefore, we intentionally initialize the weights with colors in the image. This can induce the results to be more similar to the original image with reduced loss of the original colors. Thus, because the initial weights are fixed, we can always get the same results, unlike traditional SOM.
The weight initialization should satisfy the following conditions to complement the problem above.(1)The time to create the map must be short.(2)The map should be created using the colors in the image.(3)It should be configured with a variety of colors from the image as much as possible.
Octree color quantization satisfies these conditions. It constructs the octree using the colors in the image, and it prunes them until only nodes remain. It does not need much time to create the palette. In addition, it has various colors because it does not consider the distribution of color. Therefore, the proposed method initializes the weights using the palette generated by octree quantization.
Figure 3 shows the overall process of the proposed method. At first, it builds an octree on the input image and prunes the octree until nodes remain to get the number of colors for initializing the weights of SOM [9].
After initializing, SOM learning is performed. The proposed method uses a twodimensional SOM and two different learning rates for winner and neighbor nodes. The learning rate for neighbor node is a lot smaller than the learning rate for winner node in order to reduce the loss of lowfrequency colors.
The proposed method uses different training data in each iteration. If SOM learns sequential pixels in an image, it means SOM learns similar pixels repeatedly because adjacent pixels in an image have similar colors. The training data for th iteration, , is defined as follows for data sampling:
Determining the winner node and updating the weights are performed by traditional SOM learning method as shown in the following:
Algorithm 1 shows the learning algorithm of octreebased SOM color quantization.

In this paper, it assumes that the weights converge if the average variation in the weights is lower than 0.025, and it is used as an end condition. The end condition is experimental value. Figure 4 shows average MAE, MSE, and processing time of all test cases. When the end condition is set between 0.01 and 0.025, it gives best performances. It shows the end condition 0.025 is reasonable.
5. Experimental Results
The proposed method was tested on a set of ten truecolor images commonly used to evaluate performance. The images are shown in Figure 5, and information about the test images is in Table 1. Test images (i) and (j) are collected from Berkeley color image database (http://www.eecs.berkeley.edu/Research/Projects/CS/vision/bsds). All of the color quantization methods were tested on an Intel i54460 3.2 GHz, 8.0 GB RAM machine and were implemented in C++.

(a) Lenna
(b) Parrots
(c) Mona Lisa
(d) House
(e) Mandrill
(f) Venus
(g) Bedroom
(h) Scream
(i) Old man
(j) Dragonfly
The color differences shown in Table 1 were calculated with (5). As this value increases, the image has various colors, and the differences among the colors are greater:
We evaluated the proposed method by comparing it with wellknown color quantization algorithms, such as popularity (POP) [10], octree (OCT) [9], mediancut (MC) [10], means (KM) [11], Adaptive Resonance Theory 2 (ART2) [12], and SelfOrganizing Maps (SOM) [3]. Table 2 explains these color quantization methods.

Tables 3 and 4 show a comparison of MAE and MSE, respectively. means the number of colors used for quantizing an image. The best method is indicated in bold. As expected, the experimental results show that the proposed method gives better results than the conventional SOM method when is small. It is the consequence obtained by reducing the learning rate of the neighbors. It minimizes the influence on the neighbor by the winner, so the proposed method has the original colors of the palette. It means the proposed method is more effective than other algorithms when is small.


On the other hand, the disadvantage of SOM is reduced when SOM uses a big enough size of map for learning, because the influence of the winner is decreased. Therefore, the performance gap between conventional SOM and the proposed method also decreases when is large. In some cases, the proposed method gives a larger MAE and MSE, because the low learning rate of the neighbor disturbs similar color grouping on the map.
Table 5 shows the processing time of the color quantization methods. The proposed method is faster than the conventional SOM method because the weights are initialized with the palette generated by octree. On the other hand, the conventional SOM method initializes the weights with random values. It makes SOM need less time before the weights converge. Therefore, the proposed method requires only 71.73% of the processing time of the conventional SOM method.

In Figure 6, the peak signaltonoise ratio (PSNR) is additionally measured to evaluate quantization quality. PSNR is a popular measure to evaluate the reconstruction quality of image compression codecs and thus is used to evaluate color compression quality. A higher PSNR means the color quantization method has higher quality [13]. PSNR is defined as shown in the following:
Figure 7 shows that the proposed method gives more similar results to the original image, visually, even if it has similar MAE and MSE. Overall colors in the palette generated by SOM become similar if is small. However, the proposed method has colors more similar to the original image because of the low learning rate of neighbors and initialization by octree colors. The proposed method gives more similar sky color on scream image and gives more similar background color on Mona Lisa image.
6. Conclusions
In this paper, an effective color quantization method is proposed. Having many colors in the original image is a serious problem for image processing, so the number of colors must be reduced. Therefore, we propose an octreebased SOM color quantization method. It is particularly more effective than other algorithms when the number of colors, , is small.
It uses an octree color quantization method to complement the disadvantages of SOM color quantization, which is one of the more effective methods. The octree color quantization method does not consider the distribution of colors, so its palette includes various colors. Therefore, we use the palette generated by octree to initialize the SOM weights. This causes the palette generated by SOM to have more varied colors than conventional SOM. In addition, the learning rate of the neighbors is set to low to minimize the loss of color information from updating the winner, because the influence of the winner becomes greater when is small. The low learning rate of the neighbor means the proposed method can have colors similar to the original image.
The proposed method was evaluated by comparing it with six wellknown quantization methods. MAE, MSE, and processing time are measured for comparison. The experimental results show that the proposed method is more effective than other methods when it uses a smaller number of colors to quantize the colors in the image (). It gives lower MAE and MSE. Thus, the proposed method requires only 71.73% of the processing time of the conventional SOM method. On the other hand, when it uses a large number of colors, the performance of the proposed method gives similar MAE and MSE with conventional SOM, but it is still faster.
It is expected that the proposed method will be available to many applications that have a problem with varied colors in images.
Conflict of Interests
The authors declare that there is no conflict of interests regarding the publication of this paper.
Acknowledgment
This work was supported by BK21PLUS, Creative Human Resource Development Program for IT Convergence.
References
 C.H. Chang, P. Xu, R. Xiao, and T. Srikanthan, “New adaptive color quantization method based on selforganizing maps,” IEEE Transactions on Neural Networks, vol. 16, no. 1, pp. 237–249, 2005. View at: Publisher Site  Google Scholar
 K.L. Chung, Y.H. Huang, J.P. Wang, and M.S. Cheng, “Speedup of color palette indexing in selforganization of Kohonen feature map,” Expert Systems with Applications, vol. 39, no. 3, pp. 2427–2432, 2012. View at: Publisher Site  Google Scholar
 A. H. Dekker, “Kohonen neural networks for optimal colour quantization,” Network: Computation in Neural Systems, vol. 5, no. 3, pp. 351–367, 1994. View at: Publisher Site  Google Scholar  Zentralblatt MATH
 J. Rasti, A. Monadjemi, and A. Vafaei, “Color reduction using a multistage Kohonen selforganizing map with redundant features,” Expert Systems with Applications, vol. 38, no. 10, pp. 13188–13197, 2011. View at: Publisher Site  Google Scholar
 Y. Xiao, C.S. Leung, P.M. Lam, and T.Y. Ho, “Selforganizing mapbased color palette for highdynamic range texture compression,” Neural Computing and Applications, vol. 21, no. 4, pp. 639–647, 2012. View at: Publisher Site  Google Scholar
 H. J. Park, K. B. Kim, and E. Y. Cha, “An effective color quantization method using color importancebased selforganizing maps,” Neural Network World, vol. 25, no. 2, pp. 121–137, 2015. View at: Publisher Site  Google Scholar
 Y. Deng, B. S. Manjunath, C. Kenney, M. S. Moore, and H. Shin, “An efficient color representation for image retrieval,” IEEE Transactions on Image Processing, vol. 10, no. 1, pp. 140–147, 2001. View at: Publisher Site  Google Scholar  Zentralblatt MATH
 M. E. Celebi, Q. Wen, and S. Hwang, “An effective realtime color quantization method based on divisive hierarchical clustering,” Journal of RealTime Image Processing, vol. 10, no. 2, pp. 329–344, 2012. View at: Publisher Site  Google Scholar
 M. Gervautz and W. Purgathofer, “A simple method for color quantization: octree quantization,” in New Trends in Computer Graphics, pp. 219–231, Springer, Berlin, Germany, 1988. View at: Google Scholar
 P. Heckbert, “Color image quantization for frame buffer display,” ACM SIGGRAPH Computer Graphics, vol. 16, no. 3, pp. 297–307, 1982. View at: Publisher Site  Google Scholar
 Y.C. Hu and M.G. Lee, “Kmeansbased color palette design scheme with the use of stable flags,” Journal of Electronic Imaging, vol. 16, no. 3, Article ID 033003, 2007. View at: Publisher Site  Google Scholar
 K. B. Kim, M. Kim, and Y. W. Woo, “Recognition of shipping container identifiers using ART2based quantization and a refined RBF network,” in Adaptive and Natural Computing Algorithms, pp. 572–581, Springer, Berlin, Germany, 2007. View at: Google Scholar
 X. D. Yue, D. Q. Miao, L. B. Cao, Q. Wu, and Y. F. Chen, “An efficient color quantization based on generic roughness measure,” Pattern Recognition, vol. 47, no. 4, pp. 1777–1789, 2014. View at: Publisher Site  Google Scholar
 Y.C. Hu and B.H. Su, “Accelerated kmeans clustering algorithm for colour image quantization,” The Imaging Science Journal, vol. 56, no. 1, pp. 29–40, 2008. View at: Publisher Site  Google Scholar
 Y.L. Huang and R.F. Chang, “A fast finitestate algorithm for generating RGB palettes of color quantized images,” Journal of Information Science and Engineering, vol. 20, no. 4, pp. 771–782, 2004. View at: Google Scholar
Copyright
Copyright © 2016 Hyun Jun Park et al. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.