• 沒有找到結果。

Color quantization by preserving color distribution features

N/A
N/A
Protected

Academic year: 2021

Share "Color quantization by preserving color distribution features"

Copied!
14
0
0

加載中.... (立即查看全文)

全文

(1)

Color quantization by preserving color distribution

features

Wu-Ja Lin*, Ja-Chen Lin

Department of Computer and Information Science, National Chiao-Tung University, Hsinchu 30050 Taiwan, People's Republic of China

Received 19 November 1997; received in revised form 12 April 1999

Abstract

A color quantization method is proposed. The method hierarchically uses a bisection tool that preserves certain color-distribution features. The preserved features are average color, variance in each color dimension, and average color radius. An algorithm is given that includes the histogram simpli"cation procedure, color palette generation, and pixel mapping. Experiments show that the proposed method usually obtains acceptable quantized images with competitive speed.  1999 Elsevier Science B.V. All rights reserved.

Zusammenfassung

Eine Methode zur Farbquantisierung wird vorgestellt. Die Methods verwendet ein Werkzeug zur Farbhalbierung hierarchisch, das gewisse Farbverteilungseigenschaften bewahrt. Diese Eigenschaften sind die durchschnittliche Farbe, die Varianz in jeder Farbdimension und der durchschnittliche Farbradius. Ein Algorithmus wird angegeben, der ein Vereinfachungsverfahren des Histogramms, eine Erzeugung der Farbpalette und eine Pixelkarte beinhaltet. Experimente zeigen, dass die vorgeschlagene Methode akzeptable Quantisierungsbilder mit konkurrenzfaKhiger Geschwindigkeit liefert.  1999 Elsevier Science B.V. All rights reserved.

Re2sume2

Nous proposons une meHthode de quanti"cation de la couleur. Elle utilise hieHrarchiquement un outil de bissection qui preHserve certaines caracteHristiques de distribution des couleurs. Celles-ci sont la couleur moyenne, la variance dans chaque dimension de couleur et le rayon de couleur moyen. Nous donnons un algorithme qui inclus une proceHdure de simpli"cation d'histogramme, de geHneHration de palettes de couleurs et de mise en correspondance de pixels. Des expeHriences montrent que la meHthode proposeHe obtient d'habitude des images quanti"eHes a` une vitesse compeHti-tive.  1999 Elsevier Science B.V. All rights reserved.

Keywords: Color quantization; Histogram simpli"cation; Color distribution features preserving; Hierarchical division

This study was supported by the National Science Council, Republic of China, under contract number: NSC.88-2213-E-009-067.

* Corresponding author. Tel.: #35-715-900; fax: #35-721-490. E-mail address: [email protected] (W.-J. Lin)

0165-1684/99/$ - see front matter  1999 Elsevier Science B.V. All rights reserved. PII: S 0 1 6 5 - 1 6 8 4 ( 9 9 ) 0 0 0 6 0 - 2

(2)

Nomenclature

P The input image

P The simpli"ed histogram of P

k The palette size

CK The mth color of the palette, 1)m)k

Q The quantized image

S A set of color points in the RGB color space

S, S A partition of S, i.e., S6S "S and S5S "

C The representative color C"(r,g,b) of S

C The representative color C "(r ,g ,b ) of S

p The percentage of points contained in

S

p The percentage of points contained in S

1. Introduction

Color quantization of an image is a process that uses a small number of colors to represent the image. The objective is to approximate as closely as possible the original full-color images. This tech-nique is necessary for systems that can display only a few colors. For example, systems with 8 bits/pixel frame bu!ers can display only 256 colors. Although many modern systems have 24 bits/pixel frame bu!ers and can display 2"16,777,216 colors, color quantization is still practical for systems run-ning animations and those used for advanced graphics applications. It reduces storage require-ments and saves image transmission time over net-works.

In general, color quantization can be divided into two parts: color-palette design, and mapping of pixels in the original image to colors in the designed palette. Several approaches can be used to perform color quantization. Linde et al. proposed the LBG method [15]. Given an initial palette, the LBG method minimizes image quantization errors by repeatedly assigning image pixels to the colors closest to them in the palette, and then updating palette colors using the average colors of pixels assigned to them. The LBG method usually obtains good color palettes when initial palettes (initial guesses) are carefully chosen. However, when a poor initial palette is used, the palette generated might also be poor. In other words, LBG perfor-mance is strongly dependent on the initial-palette choice. Scheunders proposed a genetic approach [17] to improve LBG's dependence on initial

palettes and to further reduce quantization errors. Tas,dizen et al. proposed a genetic method [19] for use in YUV color space. This method minimizes a distortion measure that uses di!erent weights for the >, ;, < components (> : ; : <"10 : 3 : 3) when measuring dissimilarities between colors. A common goal of the methods mentioned above is minimizing prede"ned distortion measures. Unfortunately, this kind of approach usually results in the problem of heavy computation loads, which makes them impractical for on-line quantization of colors.

Many methods use top-down (hierarchically di-visive) approaches to accomplish on-line quantiz-ation. Among these methods, the median-cut method [11,14] proposed by Heckbert constructs the color palette using the strategy that all colors in the palette should represent approximately equal numbers of image pixels. The method recursively subdivides reduced RGB color space (that is, the input image is "rst prequantized using 3}3}3 bit-cutting for the RGB components) into rectangular hyperboxes. During subdivision, the hyperbox con-taining the largest pixels count is picked and sub-divided. The division plane passes through the median point of the projected color distribution along the dimension with the largest color spread. The median-cut method has the advantage of being simple and easy to understand. However, the quantization error is not small enough.

Joy and Xiang proposed the center-cut method [12], a modi"cation of the median-cut method. It uses 3}2}4 bit-cutting to prequantize input images, which results in the same memory requirement as

(3)

that of the median-cut method, and partially compensates for the nonuniform nature of RGB color space. Center-cut divides the hyperbox along its so-called longest-dimension, and the division plane passes through the center point rather than the median point. The center-cut method is simple and easy to implement. However, as indicated by the authors in [12], uneven bit-cutting (3}2}4) may cause undesirable hue shifts and an auxiliary procedure is required to avoid this problem.

Wu and Witten proposed the mean-split method [22,25], which uses the mean rather than the median of the projected distribution (with the largest spread) as the partition point. Let ¸ be the number of clusters assigned to a splitting hyperbox. The number of clusters, ¸G, assigned to each of the two resulting subboxes is then, respectively,

¸G"¸;



qn#nnG #(1!q) <G <#<



,

i"1,2. (1)

Here, nG is the number of data points contained in subbox i, and <G is the volume of subbox i. The value of the heuristic parameter q is constrained to the range [0.5,0.7]. Hyperboxes will not be sub-divided further if their size are smaller than a pre-speci"ed value.

Wan et al. proposed the variance-based method [21,22] which di!ers from the median-cut, center-cut, and mean-split methods in that the sum of the square errors in the projected distribution in one of the three color-component axes is repeatedly mini-mized (see Eq. (11) of [21]). Therefore, (three-di-mensional) distortions of quantized images obtained using this method is usually low (though not minimal).

Braquelaire and Brun [4] used a similar strategy. Their method runs in HHH color space (H"R#G, H"R!G, H"B!(R#G)), and minimizes the quadratic errors associated with the two subboxes yielded by splitting along the axis with the largest variance. In general, the median-cut, center-median-cut, mean-split, variance-based and Braquelaire's methods all require that the division planes are perpendicular to one of the color

axes. This keeps the methods simple and their computation loads low. However, eliminating this restriction often leads to smaller quantization errors.

To address this, Orchard and Bouman proposed the binary splitting (BS) algorithm [16]. The BS algorithm uses a division plane that passes through the mean point of the color set being split and is perpendicular to the principal axis. They also pro-posed the erosion-based binary splitting (EBBS) method based on the BS technique [16] to improve image quality. The EBBS method takes the spatial relationship of colors into account and uses more quantization levels to represent colors which might yield false contours.

Balasubramanian et al. proposed the PQBS (binary splitting with prequantization) algorithm [2] to accelerate the BS algorithm execution speed. The PQBS algorithm uses a sophisticated data structure to store the average colors of the image pixels yielding the same "rst 7}8}6 bits of the R-G-B components, and uses these aver-age colors as inputs to the BS algorithm. This prequantization stage reduces input data size while retaining image quality. The PQBS method also uses a spatial-activity measure to avoid false contours while designing its color palette.

Wu proposed a color quantization method [23] based on principal analysis and dynamic program-ming. Wu's method yields much lower quantization errors at the expense of added execution time com-pared to the median-cut and variance-based methods.

In addition to using the top-down approach mentioned above, some methods [7,8,26] use a bot-tom-up approach. The botbot-tom-up approach forms the color palette by progressively merging input colors until the number of remaining colors is equal to (or less than) the predetermined palette size.

Balasubramanian et al. proposed a sophisti-cated quantization method called SSQ (sequen-tial scalar quantization) [3], which individually quantizes the scalar components of 3D color vec-tors, thereby generating color palettes more e$ciently. The quality of quantized images is also high.

(4)

In this paper, we propose a method that repeat-edly uses average color, variance, and radius preserving (ACVRP) bisection to quantize color images. The bisection method is applied in a hierarchically divisive manner. The idea about the ACVRP bisection method is that: whenever a set of color pixels is to be divided into two subsets, we always require that the representative colors of the two generated subsets, weighted by their corre-sponding population ratios, could preserve color distribution features of the set being split. Through-out this paper, the color distribution features preserved are: average color, variance in each color dimension, and average color radius. Average color is preserved (Eqs. (3)}(5) in Section 2) because this keeps the mean (the average brightness level) of each color component unchanged. The variance in each color dimension is preserved (Eqs. (6)}(8) in Section 2) so that the individual contrast of the red (R dimension), green (G dimension), and blue (B dimension) colors could be preserved in a certain sense, thus avoiding biasing the color hue. The average color radius is preserved (Eq. (9) in Section 2) to retain the so-called color activity ([1,13], re-spectively, evaluated in terms of l-norm and weighted l-norm where our evaluation is l-norm). (Note that an image with low color activity con-tains similar colors. A special case is an image with zero-value color activity, which means the image contains only one color.) By preserving these color distribution features, we hope our quantized im-ages will approximate the original imim-ages in the viewers' eyes. Preserving average color is also used in dithering techniques (e.g., error di!usion [9]). Our method and dithering techniques di!er in that our method tries to preserve average color in the color palette design procedure, whereas dithering tries to compensate (during color-mapping using a given palette) for the shift in the average color of newly mapped pixels. Such dithering is achieved at the cost of a substantial computational over-head, appearance of noise, etc., as indicated in [2,16]. (Note that dithering can be used as a post-processing after most color quantization methods [7,11,16,21,23].) Tsai [20], and Delp and Mitchell [6], proposed 1D (gray-valued) quantization to preserve moments (of the "rst, second, and third orders) of gray images. The novelty of our method

compared to their methods is the generalization from 1D-scalar to 3D-vector quantization (from gray to color) and the use of 3D analytical formulas (derived in Section 2). The di!erences in constraints on cluster splitting between the proposed method and the other methods are: our constraints are intended to make the representatives of the gener-ated clusters preserve the original data distribution, instead of balancing populations (e.g. median-cut) or minimizing (weighted) quantization errors (vari-ance-based, EBBS, SSQ, etc.). The constraints we use can also yield 3D formulas for bisecting data analytically, thus, our bisection method is para-meter-free and noniterative.

The proposed method uses the histogram-simpli-"cation procedure illustrated in Section 3 to reduce data size and decrease computation time. This pro-cedure is a little similar to that used in the PQBS method (but we use the "rst 5}5}5 rather than the 7}8}6 bits when prequantizing input images be-cause, as will be seen later in Tables 2 and 3, data size can be reduced 15 to 20 times smaller without degrading image quality much). Throughout this paper, we consider the proposed method to be run in RGB color space. It can also be run in other color spaces since its design is independent of color space. Some earlier studies showed that better re-sults can often be obtained by using uniform color spaces [10,18], however, the price is an increase in the execution time since the transformation into uniform color spaces is somewhat time-consuming. Other studies [3,16] examined the nonlinear rela-tionship between primary color input values and display intensities of typical monitors, and then compensated it. It should also be noted that using more quantization levels for the luminance term of the color signal can also increase image quality because human vision is more sensitive to changes in luminance than to changes in chromaticity [3,24].

The remainder of this paper is organized as fol-lows. In Section 2, the ACVRP bisection method is illustrated. The whole system for color quantiz-ation, including histogram-simpli"cation pre-processing, is introduced in Section 3. An algorithm is also given there to bene"t readers. Experimental results are shown in Section 4 and a summary is given in Section 5.

(5)

2. ACVRP: a bisection method using average color, variance, and radius preserving

Our method repeatedly bisects data in a hier-archically divisive manner. Below, we introduce the bisection tool, ACVRP, designed for the method we propose.

Suppose an N-point set in RGB color space

S"+(rG,gG,bG),,G is to be split into two subsets S and S . Let C"(r, g,b) and C "(r , g , b )

be the respective representative colors of S and S . We need to "nd explicit formulas for computing

C and C e$ciently. Let the population

percent-ages of S and S be p"n/N and p "n /N, respectively. (Here, n and n are the respective numbers of points [counting multiplicities] con-tained in S and S .) Since there are eight un-knowns: p, r, g, b, p , r , g , b , we need eight constraints. The "rst constraint we will consider is the natural requirement

p#p "1"100%. (2) In order to make C"(r, g, b) and C " (r , g , b ), weighted, respectively, by p and p , preserve the average color of S, we also require that

pr#p r "N1 , GrG"r"0, (3) pg#p g "N1 , GgG"g"0, (4) pb#p b "N1 , GbG"bM"0. (5)

(For simplicity, we temporarily assume that the average color (r , g, bM) of the set S being bisected is (0, 0, 0). This restriction will not be removed until the "nal paragraph of this section in which some formulas are useful in the case in which (r ,g,bM)O(0,0,0) are provided.) The remaining four constraints we use are

pr#p r "N1 , G rG"r, (6) pg#p g "N1 , G gG"g, (7) pb#p b "N1 , G bG"b, (8) and p(r#g#b#p (r #g #b "1 N , G(rG#gG#bG"RM. (9)

Note that r, g, b are the color variances of S (be-cause (r , g, bM)"(0, 0, 0) has been assumed), and RM is the average color radius of S. Using the eight equa-tions listed in (2)}(9), we may now solve for p, (r, g, b), p , and (r , g , b ). Eqs. (3)}(5) imply that

r "!pp r, (10)

g "!pp g, (11)

b "!pp b. (12) Substituting Eqs. (10)}(12) in Eqs. (6)}(8), we obtain

p p r"pp (p #p)r"r, (13) p p g"pp (p #p)g"g, (14) p p b"pp (p #p)b"b. (15)

The analytical formulas for computing C" (r,g,b) are therefore

r"$



pp r, (16)

g"$



pp g, (17)

b"$



pp b. (18) Once C is known, C "(r , g , b ) can also be evaluated using Eqs. (10)}(12). The remaining prob-lem is then determining the signs of r, g, and b, and the values of p and p . To determine the values of p and p , note that Eq. (2) implies

(6)

Substituting Eqs. (10)}(12) in (9), we obtain

2p(r#g#b"RM, i.e.,

4p(r#g#b)"RM.

Then, using Eqs. (16)}(18), we obtain

4pp (r#g#b)"RM. Using (19), we obtain 4p(1!p)"RM/(r#g#b). Hence, 4p!4p#[RM/(r#g#b)]"0. Therefore, p"12$ 1 2



1! RM  r#g#b. (20)

To prove p in Eq. (20) always yields real value, we must show that RM )r#g#b. This is guaran-teed by Schwartz's inequality and is proven in Appendix A.

Below, we show how to determine the signs of (r, g, b). Assume there are at least as many color points in S as there are in S , that is, p*p . Then

p"12# 1 2



1!

RM 

r#g#b. (21)

To determine the signs of (r, g,b) in (16)}(18), we proceed as follows:

Step 1. Choose the color dimension from among

+r, g, b, that yields the maximal variance. With-out loss of generality, r may be chosen, i.e.

r"max+r#g#b,. Check whether most of

the color points (rG,gG, bG) in S have positive rG. If they do, set the sign of r positive; otherwise, set the sign of r negative.

Step 2. Proceed as follows for the remaining color

dimensions (here, g and b):

a. Determine whether most of the color points (rG,gG, bG) in S yield positive product rGgG. If they do, assign g the same sign r has; otherwise, assign g the opposite sign.

b. Determine whether most of the color points (rG,gG, bG) in S yield positive product rGbG. If they do, assign b the same sign r has; otherwise, assign b the opposite sign.

Once values for C"(r, g, b) and C " (r , g , b ) have been obtained using the pro-cedure above, (16)}(18), and (10)}(12), then the par-tition separating subsets S and S can be con-sidered a plane perpendicular to the line segment

CC that cuts S into two subsets such that Np

points fall in the subset containing the point

C"(r, g, b). However, "nding this plane is

quite time-consuming and may make the whole method inapplicable to real-time color quantiz-ation. Therefore, if we note that p and p are just estimated values, and bear in mind that what we really want is a way to rapidly bisect data, we then realize the faster way to partition data is to apply the nearest neighbor rule: a data point is assigned to S if and only if the data point is closer to (r, g, b) than to (r , g ,b ).

So far, we have assumed that the centroid (r , g, bM) of the set S is (0, 0, 0). We now remove this restric-tion. Whenever the (r , g, bM) of S is not (0, 0, 0), we create a new N-point set SI , which is a translated version of the N-point set S, such that SI has the centroid (0, 0, 0). The formulas derived in this section can then be applied to SI to obtain the representative colors CI  and CI for SI. We may then translate CI  and CI back to the original coordinate system to obtain the two desired representative colors C and C for S. Note also that it is then easy to prove that the "nal values of p, p , C"(r, g, b) and

C "(r , g , b ) obtained in this way (translation

and back-translation) can also be expressed directly in terms of the input data S as follows: replace Eq. (21) with p"12# 1 2



1! *R *r#*g#*b, (22) where *r"1 N , G(rG!r), (23)

(7)

*g"1 N , G(gG!g), (24) *b"1 N , G(bG!bM), (25) and *R"1 N , G((rG!r)#(gG!g)#(bG!bM) (26)

The computation formula for p is still

p "1!p. (27)

Then replace Eqs. (10)}(12) with

r "r !prp , (28)

g "g !pgp , (29)

b "bM !pbp . (30) Finally, replace Eqs. (16)}(18) with

r"r$



p p*r, (31)

g"g$



pp *g, (32)

b"bM$



pp *b. (33) Of course, the signs in the three equations above can be determined by a rule analogous to (although not identical to) that in Steps 1 and 2 above. For example, the following sentences will replace Step 1, and an analogous statement will replace Step 2: Step 1. Choose the color dimension from among +r,g,b, that yields the maximal variance. Without loss of generality, we may let r be the chosen dimension, i.e., *r"max+*r, *g, *b,. Deter-mine whether most of the color points (rG, gG, bG) in

S have positive rG!r. If they do, use a plus sign in

Eq. (31) to evaluate r; otherwise, use a minus sign in Eq. (31).

3. The proposed method

Our quantization process has two parts: prepro-cessing, which we call histogram simplixcation, and the main procedure, which we call hierarchical

divisive quantization. Each pixel in input image P has a color value expressed as a 24-bit binary

number (8 bits for each of the three color compo-nents). Part 1 transforms P to P, and this P is for use as the input to Part 2. In Part 1, we group together those color points whose 5}5}5 most signi"cant bits of the r}g}b-component have identical values. (In other words, each group is formed of color points so similar to one another that their 15-bit expressions (5}5}5) are identical, their 24-bit expressions (8}8}8) might di!er.) Assume there are J such groups, e.g., P"

G6G626G(. We then compute the 24-bit

average color <H for each group GH, which will yield a simpli"ed histogram for P:

P"8(

H+<H,<H,<H,2(<H repeats "GH" times),,

where"GH" denotes the number of points contained in GH. Note that Part 1 reduces the number of distinct colors in a 512;512 image from, at most, 512;512"262,144 to at most 2>>"32,768. We found that using the output P of Part 1 (instead of the original image P) as the input to Part 2 only slightly degrades the reconstructed image quality; however, the computation load in Part 2 is reduced signi"cantly due to the simpli"cation job done in Part 1.

In Part 2 (the hierarchically divisive quantization part), we hierarchically apply the ACVRP bisec-tion method k!1 times to divide P, i.e. the sam-pled colors +<,<,2,<,; +<,<,2,<,; 2; +<(,<(,2,<(, (counting multiplicities) obtained in Part 1, into k subsets (usually k"256). The repre-sentative colors of the k subsets are also generated in Part 2 to form the desired k-color palette. The algorithm for this is given below.

Algorithm: The proposed color quantization method (ACVRP-cut).

Input: An integer k and a full-color (24-bit)

(8)

described in 24-bit, and there are at most "P" dis-tinct colors.)

Output: A quantized image Q containing k colors.

(Each color is described in 24-bit, and there are only k distinct colors. k"P".)

Step 1. Reduce P to P using the histogram

sim-pli"cation procedure, i.e., Part 1 described in the proceeding paragraphs. (Note that each point in P is still described in 24-bit.)

Step 2. Initially, let S"P and goto Step 4. Step 3. Choose from among the existing subsets

the subset S whose P E @Z1[(r!r)#(g!g)# (b!bM )] is the largest. Here, (r, g, bM) is the local centroid of the subset S. (Note that each subset has its own local centroid.)

Step 4. Use the*r, *g, *b, and *R (de"ned in Eqs. (23)}(26)) of S to evaluate C"(r,g,b) and C "(r ,g ,b ) according to Eqs. (22), (27), and (31)}(33), followed by (28)}(30).

Step 5. Use the two representative colors C and C to bisect S into the two subsets according to the

nearest-neighbor rule.

Step 6. Repeat Steps 3}5 until there are k subsets. Step 7. Output the k representatives colors

+C,2,CI, of these k existing subsets as the ex-pected k colors.

Step 8. Do the pixel mapping PP+C,2,CI,

according to the following rule: if Part 1 groups a pixel (rG, gG, bG)3P into, say, group GH, and if <H, which is the average color of the group GH, is "nally located in the mth subset (of the k "nal subsets mentioned in Step 7), then the input pixel (rG, gG,bG) should be painted using the mth representative color CK.

4. Experimental results

In this section we show the good cluster-splitting capacity of the proposed ACVRP cut, and compare it with the cluster-splitting capacities of the other methods. To make illustration easier, the 2D pro-jection of the Cherno! Fossil data and Fisher Iris data were used in the experiment. These two data sets have often been used in the "eld of data analy-sis [5], and we scaled the 2D projections of these two data such that their distributions could be clearly illustrated.

Fig. 1 shows the result of splitting the Cherno! Fossil data into three clusters, and Fig. 2 shows the result of splitting the Fisher Iris data into two clusters. (Note that, as mentioned in the Introduc-tion, BS algorithm was used in both EBBS and PQBS.) The solid lines denote the cut planes, and the numbers 1 and 2 in Fig. 1 indicate the "rst and second cuts, respectively. The corresponding root-mean-square error (RMSE), a commonly used measure in data-clustering, and the number of mis-classi"ed points, are both listed in Table 1. Here, RMSE is the root-mean-square l-norm distance of each point to the center of the class that the point belongs to. Figs. 1 and 2 both show that the pro-posed method made more reasonable splittings than the other methods. Table 1 also shows the same holds true for quantity values.

Four experimental applications of the proposed ACVRP cut to color quantization were performed using Lena, Boats, Peppers, and Zelda as the input images (see Fig. 3). The results yielded by the me-dian-cut [11,14], mean-split [22,25], variance-based [21,22], center-cut [12], EBBS [16], and PQBS [2] methods are included for purposes of comparison. When using the median-cut, mean-split, variance-based, and center-cut methods, we followed the original suggestions made by the authors of these methods for prequantizing images, i.e., 3}3}3 bit-cutting for the "rst three methods and 3}2}4 bit-cutting for the center-cut method. When using the EBBS algorithm, we prequantized the images using the proposed histogram simpli"cation procedure (5}5}5 grouping) so that the EBBS method could be compared on equal terms with our method. When using the PQBS algorithm, we followed the prequantization method the authors of PQBS suggested, that is, 7}8}6 grouping. Table 2 shows the number of colors obtained by each prequantization method for the four images in Fig. 3. We note the following with respect to implemen-ting these methods: (1) we used q"0.6 in Eq. (1), and set the minimum hyperbox size equal to 0 for the mean-split method; (2) we used the nearest-neighbor rule (choosing the closest of the k repre-sentative colors) to do pixel mapping for the me-dian-cut, mean-split, variance-based and center-cut methods; (3) erosion-based weighting was applied in the last one-third of the runs, as the authors

(9)

Fig. 1. Three-class clustering results for the Chernoff Fossil data using (a) median-cut, (b) mean-split, (c) variance-based, (d) center-cut, (e) binary splitting (BS) algorithm, and (f) our method.

suggested, for the EBBS method; (4) we directly allocated a huge amount of memory (2;2;2) to the PQBS method in order to simplify the prequantization procedure, and reduced the time needed to store and access the prequantized colors; (5) all the methods were implemented in C on an SGI Indygo2 workstation. Fig. 4 shows the results of quantizing Lena into 256 colors. Like EBBS and PQBS, the proposed method generated acceptable color smoothness on both the arm and the right cheek of Lena. Center-cut gave the worst image quality among the seven methods. The results from the median-cut and variance-based methods were

better than that of the mean-split method, although the color smoothness on Lena's arm (from the median-cut method) and Lena's right cheek (from the variance-based method) were not very good.

Table 3 lists the results quantizing the images in Fig. 3 into 256 colors from all methods. The results were measured using RMS*E (root-mean-square *E). In the"eld of image processing, this measure-ment is considered closer to the human perception [18] (than RMSE). Note that

RMS*E"



1 M;N +", G *E(¸H.G ,aH. G,bH.GH/G,aH/G,bH/G)

(10)

Fig. 2. Two-class clustering results for the Fisher Iris data using (a) median-cut, (b) mean-split, (c) variance-based, (d) center-cut, (e) binary splitting (BS) algorithm, and (f) our method.

Table 1

RMSEs and numbers of mis-classi"ed data points for the various methods

BS Our

Median-cut Mean-split Variance-based Center-cut algorithm method

Fossil 36.22/13 29.32/6 29.32/6 29.32/6 28.18/4 26.24/0 Iris 79.37/25 76.75/17 50.46/0 76.75/17 51.33/2 50.46/0 and *E(¸H.G,aH.G,bH.GH/G,aH/G,bH/G) "((¸H. GH/G)#(aH.G!aH/G)#(bH.G!bH/G).

Here, M;N denotes the image size; (¸H.

G,aH.G,bH.G) and

H/

G,aH/G,bH/G) denote the ¸HaHbH color values of the i-th pixel in the input image and quantized image.

The computation times listed in Table 3 were mea-sured in CPU seconds. Apparently, "ner prequant-ization did help the PQBS method obtain lower RMS*Es than the other methods yielded. (After prequantization, the number of prequantized colors the PQBS used was about 15}20 times larger than that of the other methods [see Table 2].) The EBBS method also yielded low RMS*Es. How-ever, the execution time for the EBBS and PQBS

(11)

Fig. 3. The four full-color images (left to right, top to bottom): Lena, Boats, Peppers, and Zelda. Table 2

Numbers of distinct colors using various prequantization methods

5}5}5 grouping and 3}2}4 bit-cutting 7}8}6 grouping 3}3}3 bit-cutting

Lena 2650 54063 2596

Boats 2451 39561 2353

Peppers 5113 86816 4972

Zelda 2987 50925 2781

Table 3

RMS*Es and execution time (in s) for the various methods. Images were quantized to 256 colors. The H line shows the average RMS*Es and time for the four lines above it

Median-cut Mean-split Variance-based Center-cut EBBS PQBS Our method Lena 3.34/1.02 3.42/1.04 3.22/1.18 4.25/1.05 2.98/5.09 2.78/5.77 2.92/0.91 Boats 7.32/0.97 6.77/0.95 6.35/1.08 13.34/1.02 3.50/4.45 3.34/4.40 3.38/0.88 Peppers 6.90/1.70 5.79/1.69 5.91/1.84 7.82/1.75 5.83/7.17 5.66/8.07 5.69/1.10 Zelda 6.98/1.07 7.04/1.08 4.03/1.20 10.67/1.15 3.59/5.81 3.56/5.62 3.57/0.95 (H 6.14/1.19 5.76/1.19 4.88/1.33 9.02/1.24 3.98/5.63 3.84/5.97 3.89/0.96)

(12)

Fig. 4. 256-color quantized images of Lena obtained from the various methods (left to right, top to bottom): median-cut, mean-split, variance-based, center-cut, EBBS, PQBS, and our method.

methods were higher than those of the other methods. On the other hand, although the pro-posed method used coarser prequantization than the PQBS method, the RMS*Es of the proposed method was close to that of the PQBS method. (In fact, in RMS*E terms, the proposed method was a little worse than PQBS, but a little better than

EBBS, and much better than the other four methods.) The execution speed of the proposed method was the best (similar to the remaining four methods, but faster than EBBS and PQBS). There-fore, the proposed method represents a good compromise between image quality and execution time.

(13)

5. Summary

The color quantization method proposed here repeatedly uses a bisection method called ACVRP, which preserves average color, variance in each color dimension, and average color radius of the data set being bisected. To get a k-color palette, a histogram-simpli"cation procedure is "rst used to transform the input image P into a simpler form P. The ACVRP bisection method is then applied

k!1 times in a hierarchically divisive manner such

that P is split to k subsets. The k colors of the palette, which are the k representative colors of these k subsets, are automatically generated by analytical formulas. In the "nal step (pixel-map-ping), it is not necessary to use the common near-est-neighbor rule to reduce quantization errors because our partition result (the k obtained subsets) are good enough so no re-allocation of pixels from one subset to another is needed to make our errors competitive. As shown by the experimental results, images quantized using the proposed method were visually acceptable. In commercial application, i.e., quantizing images into 256 colors, the proposed method usually gave low RMS*Es and attractive execution speed.

Appendix A

RM )r#g#b.

Proof. According to Eq. (9),

RM "



1 N , G(rG#gG#bG



 "



1 N , GRG



 , (A.1)

where RG"(rG#gG#bG. On the other hand,

r#g#b "



1 N , G rG



#



1 N , G gG



#



1 N , G bG



"1 N , G (rG#gG#bG) "1 N , G RG. (A.2)

Let X"(1/N,2,1/N), and Y"(R,R,2,R,) be two N-dimensional vectors. Then

RM "



1 N , GRG



 "



1 N, 1 N,2, 1 N



)(R, R,2, R,)



 "(X ) Y) )(""X """"Y "") """X """"Y "" "



N



1 N



(R#R#2#R,) "1 N , G RG "r#g#b,

where the inequality is due to Schwartz's in-equality.

References

[1] R. Balasubramanian, J.P. Allebach, A new approach to palette selection for color images, Proc. SPIE: Human Vision Visual Process. Digital Display III 1453 (1991) 58}69.

(14)

[2] R. Balasubramanian, J.P. Allebach, C.A. Bouman, Color-image quantization with use of a fast binary splitting technique, J. Opt. Soc. Amer. A 11 (11) (1994) 2777}2786.

[3] R. Balasubramanian, C.A. Bouman, J.P. Allebach, Sequen-tial scalar quantization of color images, J. Electron. Imag-ing 3 (1) (1994) 45}59.

[4] J.P. Braquelaire, L. Brun, Comparison and optimization of methods of color image quantization, IEEE Trans. Image Process. 6 (7) (1997) 1048}1052.

[5] Y.T. Chien, Interactive Pattern Recognition, Marcel Dekker, New York, 1978, pp. 226}230.

[6] E.J. Delp, O.R. Mitchell, Moment preserving quantization, IEEE Trans. Commun. 39 (11) (1991) 1549}1558. [7] S.S. Dixit, Quantization of color images for display

print-ing on limited color output devices, Comp. Graph. 15 (4) (1991) 561}567.

[8] W.H. Equitz, A new vector quantization clustering algo-rithm, IEEE Trans. Acoust. Speech Signal Process. 37 (10) (1989) 1568}1575.

[9] R.W. Floyd, L. Steinberg, An adaptive algorithm for spa-tial gray scale, Proc. SID 17 (2) (1976) 75}77.

[10] R.S. Gentile, J.P. Allebach, E. Walowit, Quantization of color images based on uniform color spaces, J. Imaging Technol. 16 (1) (1990) 12}21.

[11] P. Heckbert, Color image quantization for frame bu!er display, Comp. Graph. 16 (1982) 297}307.

[12] G. Joy, Z. Xiang, Center-cut for color-image quantization, The Visual Comput. 10 (1993) 62}66.

[13] K.M. Kim, C.S. Lee, E.J. Lee, Y.H. Ha, Color image quantization and dithering method based on human visual system characteristics, J. Imaging Sci. Technol. 40 (6) (1996) 502}509.

[14] A. Kruger, Median-cut color quantization, Dr. Dobb's Journal, September 1994, 46}92.

[15] Y. Linde, A. Buzo, R.M. Gray, An algorithm for vector quanti"er design, IEEE Trans. Commun. 28 (1980) 84}95. [16] M.T. Orchard, C.A. Bouman, Color quantization of im-ages, IEEE Trans. Signal Process. 39 (12) (1991) 2677}2690.

[17] P. Scheunders, A genetic c-means clustering algorithm applied to color image quantization, Pattern Recognition 30 (6) (1997) 859}866.

[18] K.E. Spaulding, L.A. Ray, J.R. Sullivan, Secondary quant-ization of color images for minimum visual distortion, Proc. SPIE: Human Vision Visual Proc. Digital Display IV 1913 (1993) 261}269.

[19] T. Tas,dizen, L. Akarun, C. Ersoy, Color quantization with genetic algorithms, Signal Processing: Image Communica-tion 12 (1998) 49}57.

[20] W.H. Tsai, Moment-preserving thresholding: a new ap-proach, Comp. Vision Graphics Image Process. 29 (1985) 377}393.

[21] S.J. Wan, P. Prusinkiewicz, S.K.M. Wong, Variance-based color image quantization for frame bu!er display, Color Res. Appl. 15 (1990) 52}58.

[22] S.J. Wan, S.K.M. Wong, P. Prusinkiewicz, An algorithm for multidimensional data clustering, ACM Trans. Math. Software 14 (1988) 153}162.

[23] X. Wu, Color quantization by dynamic programming and principal analysis, ACM Trans. Graph. 11 (4) (1992) 348}372. [24] X. Wu, YIQ vector quantization in a new color palette architecture, IEEE Trans. Image Process. 5 (2) (1996) 321}329.

[25] X. Wu, I.H. Witten, A fast k-means type clustering algo-rithm, Technique Report, Department of Computer Science, University of Calgary, Canada, 1985.

[26] Z. Xiang, G. Joy, Color image quantization by agglom-erative clustering, IEEE Comput. Graph. Appl. 1 (1994) 44}48.

數據

Fig. 1. Three-class clustering results for the Chernoff Fossil data using (a) median-cut, (b) mean-split, (c) variance-based, (d) center-cut, (e) binary splitting (BS) algorithm, and (f) our method.
Fig. 2. Two-class clustering results for the Fisher Iris data using (a) median-cut, (b) mean-split, (c) variance-based, (d) center-cut, (e) binary splitting (BS) algorithm, and (f) our method.
Fig. 3. The four full-color images (left to right, top to bottom): Lena, Boats, Peppers, and Zelda
Fig. 4. 256-color quantized images of Lena obtained from the various methods (left to right, top to bottom): median-cut, mean-split, variance-based, center-cut, EBBS, PQBS, and our method.

參考文獻

相關文件

• Emergent Z_k 1-form &amp; 2-form symmetry. BF theory

Rugged, high resolution, full-color, video-rate displays enable a multitude.

• Table 25.4 shows the usual symbols used in circuit diagrams... Resistors are color-coded for easy

只能用Windows的DIB或BMP檔 24bit full

Secondly, the key frame and several visual features (soil and grass color percentage, object number, motion vector, skin detection, player’s location) for each shot are extracted and

To improve the quality of reconstructed full-color images from color filter array (CFA) images, the ECDB algorithm first analyzes the neighboring samples around a green missing

The purpose of this paper is to achieve the recognition of guide routes by the neural network, which integrates the approaches of color space conversion, image binary,

A digital color image which contains guide-tile and non-guide-tile areas is used as the input of the proposed system.. In RGB model, color images are very sensitive