<<

Efficient clipping for image processing using LHS and YIQ

Christopher C. Yang Abstract. Out-of-gamut problems exist in processing and The Chinese University of Hong Kong color reproduction in different devices. Extensive research has been Department of Systems Engineering and done on transforming out-of-gamut to the inside of the output Engineering Management device’s color gamut for color reproduction. We focus on the out-of- Shatin, New Territories, Hong Kong gamut problem in color image processing. Luminance, , and satura- E-mail: [email protected] tion (LHS) and YIQ color coordinate systems are investigated. Efficient techniques for luminance and saturation processing and gamut clippings S. H. Kwok are presented. The efficient technique of luminance clipping for LHS is The Hong Kong University of Science and developed based on scaling, and the efficient technique of luminance Technology clipping for YIQ is developed based on shifting. However, the efficient Department of Information and Systems technique of saturation clipping for both LHS and YIQ is a combination of Management scaling and shifting. Such efficient techniques reduce the complexity of Clear Water Bay, Kowloon, Hong Kong forward and backward transformations between the color representing the color coordinate system (RGB) and the processing color coordinate system (LHS or YIQ) significantly. Illustrations show the result of RGB, luminance, and saturation clippings. Saturation clipping is the best in terms of maintaining the hue and contrast of the original image. Experi- ments are also conducted to measure the efficiency of the proposed efficient techniques. It shows that the processing time is reduced by 27% comparing with the conventional technique using forward and backward color transformations. © 2003 Society of Photo-Optical Instrumentation Engineers. [DOI: 10.1117/1.1544479]

Subject terms: color image processing; LHS; YIQ; color gamut; gamut clipping. Paper 020037 received Feb. 4, 2002; revised manuscript received Aug. 6, 2002; accepted for publication Sep. 10, 2002.

1 Introduction corresponding to human perception, such as CIELAB, Color clipping is a technique to transform out-of-gamut LHS, and YIQ, before the processing. After processing, colors to the color gamut being used. Out-of-gamut prob- some of the colors are no longer within the RGB color Ͼ Ͻ lems always exist in two typical situations. 1. Due to the gamut. R, G, B 1orR,G,B 0. Therefore, these out-of- physical limitation ͑e.g., phosphors, colorants, substrates, gamut colors need to be clipped before they can be repre- etc.͒ of the output devices, such as cathode ray tube ͑CRT͒ sented in an RGB color gamut again. CIELAB monitors and hardcopy color printers, color gamut differ- is used in gamut clipping for different color devices due to ences among these devices is noticeable in our daily appli- its uniformity, although there are recent reports of the sub- stantial discrepancies between observed uniform color cations. 2. Due to the limitation of the resolution for image 5 storage and display, such as RGB, color gamut difference spaces and calculated L*a*b*. In addition, the transfor- between the color coordinate systems for image storage/ mation between RGB and CIELAB is complicated and time display and the color coordinate systems for color image consuming, which is not preferred in color image process- processing is common. After color image processing using ing. LHS and YIQ color coordinate systems are utilized in a color coordinate system corresponding to the perceptual this work because efficient techniques can be developed to attributes of the human visual system, such as LHS and bypass the complicated forward and backward transforma- YIQ, the color may not be able to map to the color gamut tions. for image input/output (0рR,G,Bр1). 1.1 Color Gamut Clipping Much research work has been done to study the gamut of CRT monitors and hardcopy printers.1–6 The CIELAB Many color gamut clippings have been investigated in the color space, a uniform color space, has been explored for literature, especially the CRT gamut. Although we focus on to preserve the appearance of a color image color gamut clipping for image processing, existing tech- as much as possible when the image is reproduced by CRT niques for all purposes are first reviewed. Typical color monitors and hardcopy printers. gamut clipping techniques include: We focus on the out-of-gamut problem in color image processing. In color image processing, colors (0рR,G,B • chroma clipping р1) in an RGB color space ͑a color space used to repre- • centroid clipping sent color images͒ are first transformed to a color space • clipping

Opt. Eng. 42(3) 701–711 (March 2003) 0091-3286/2003/$15.00 © 2003 Society of Photo-Optical Instrumentation Engineers 701 Yang and Kwok: Efficient gamut clipping...

• orthogonal clipping ͑to the boundary of the gamut͒ • cusp clipping or chord clipping • mapping functions, e.g., sigmoid lightness mapping function and chroma mapping function • categorical mapping.

Next are some recently developed clipping techniques. Ito, Katoh, and Ohno7,8 proposed to clip the out-of- gamut color to the reproduction gamut boundary. The smallest E value calculated by a weighted formula CIELAB is employed. Other color difference for- ⌬ 9 ⌬ 9 ⌬ 10 ⌬ 11 ⌬ 4 mulas, Eab* , Euv* , E94 , ECMC , EBFD , and ⌬ 7 Ewt , were also studied. Braun and Fairchild investigated the hue nonuniformities in CIELAB1 and developed the sigmoidal lightness mapping functions to boost the image contrast selectively when the original gamut is mapped into 12 13 the reproduced gamut. Shimizu et al. proposed the Fig. 1 Maxwell triangle in the RGB cube. chroma proportional clipping ͑CPC͒ method with the Inter- national Color Consortium ͑ICC͒ frame- 14 work. MacDonald and Morovic compared several meth- The National Television Systems Committee ͑NTSC͒ ods of gamut mapping on fine art painting using La*b* develops the YIQ color space for commercial color televi- color space. These methods are the paper cast removal, sion broadcasting and other applications. YIQ is a record- lightness mapping, orthogonal clipping, chord clipping, and ing of RGB for transmission efficiency. LHS and YIQ are gamut compression. For different paintings with different utilized here due to their efficiency of transformation. percentages of out-of-gamut, different gamut mapping methods are reported to have the best performance. Laihanen15 presented two approaches of color mapping us- 2.1 LHS Color Coordinate System ing LABNU, a color space similar to CIELAB. These ap- The LHS color coordinate system has three components, proaches are gamut compressing with constant hue and luminance ͑L͒, hue ͑H͒, and saturation ͑S͒. Its development lightness and gamut compression toward the center of - is based on the Maxwell triangle in the RGB color cube as ness axis. shown in Fig. 1. The corners of the Maxwell triangle are We develop the efficient technique of color gamut clip- ͓1,0,0͔, ͓0,1,0͔, and ͓0,0,1͔ in the RGB cube. Given a vec- ping for color image processing using luminance, hue, and tor in the RGB cube, the length of the vector OP is propor- saturation ͑LHS͒ and YIQ. RGB, luminance, and saturation tional to the luminance, and the intersection of the vector clippings are compared. Efficiency of the clipping tech- OP and the Maxwell triangle represent the attributes of hue niques is also investigated. and saturation. Given the intersection point PЈ on the Max- well triangle in Fig. 2, the hue is the angle between the CPЈ 2 Color Coordinate Systems and CR, and the saturation is the ratio of the length CPЈ to Many three-dimensional color spaces have been proposed the length CQ, where C is the center of the Maxwell tri- and adopted in different applications in the last few de- angle. cades. All of them take different approaches to represent the trichromatic nature of light to satisfy their objectives. 2.1.1 Transformation from RGB to LHS For example, the CIELAB and CIELUV spaces11 promote uniformity of practice. In CIELUV, if two colored , The transformation from the RGB color coordinate system to the LHS color coordinate system17,20 is as follows: C1 and C2 , are mixed additively to produce a third color C3 , C3 lies on a straight line on a diagram joining C1 and C2 at a position that can be calculated from the relative amounts of C1 and C2 . The LHS color space16,17 is derived based on the Max- well triangle in the RGB color cube. The LHS color space is a cylindrical coordinate system where the vertical axis corresponds to the luminance and the horizontal plane cor- responds to the chromatic perceptions. The hue, saturation, and value ͑HSV͒ and hue, lightness, and saturation ͑HLS͒ color spaces,18 which are also known as the hexcone model and double hexcone model, respectively, are similar to the LHS color space except that the transformations are simpli- fied. The generalized lightness, hue, and saturation ͑GLHS͒ ,19 developed by Levkowitz and Herman, is a generalization of HSL, HSV, HLS, and other special mod- els. Fig. 2 The intersection point OPЈ in the Maxwell triangle.

702 Optical Engineering, Vol. 42 No. 3, March 2003 Yang and Kwok: Efficient gamut clipping...

Lϭ0.299Rϩ0.587Gϩ0.114B, ͑1͒ 2.1.2 Transformation from LHS to RGB The backward transformation from the LHS color coordi- N nate system to the RGB color coordinate system has not Hϭ␪ϩcosϪ1 , ͕6͓͑rϪ1/3͒2ϩ͑gϪ1/3͒2ϩ͑bϪ1/3͒2͔͖1/2 been reported in any literature so far, and it can be derived ͑2͒ geometrically in a straightforward manner as shown in the Appendix in Sec. 9. The transformation of LHS to RGB is different from the transformation from GLSH to RGB, where since the forward transformation is not based on the ap- proximation. The formulation is shown as follows: R G B ϭ ϭ ϭ r ϩ ϩ , g ϩ ϩ , b ϩ ϩ L R G B R G B R G B RϭR* , ͑4͒ L* ϭ ͑ ͒ 0 deg if r min r,g,b L GϭG* , ͑5͒ ␪ϭͭ 120 deg if gϭmin͑r,g,b͒ L* 240 deg if bϭmin͑r,g,b͒ L BϭB* , ͑6͒ 2rϪgϪb if rϭmin͑r,g,b͒ L* Nϭͭ 2gϪrϪb if gϭmin͑r,g,b͒ where Ϫ Ϫ ϭ ͑ ͒ 2b r g if b min r,g,b L*ϭ0.299R*ϩ0.587G*ϩ0.114B*

min͑R,G,B͒ If 0рHр2␲/3, ϭ Ϫ ͑ ͒ S 1 3 ϩ ϩ . 3 R G B 1 2␲/3ϪH 1 R*ϭ ϩͩ Ϫ ͪ S LHS versus GLHS. The GLHS color model is a gener- 3 2␲/3 3 alization of three special models, HSL, HSV, and HLS, 1 H 1 where the lightness is the weighted sum of the maximum, G*ϭ ϩͩ Ϫ ͪ S medium, and minimum values of R, G, and B with different 3 2␲/3 3 ϭ sets of weights. That means l(c) wmin min(c) ϩ ϩ ϭ ϭ 1 1 wmidmid(c) wmax max(c), where wmin wmid wmax B*ϭ Ϫ S. ϭ ϭ ϭ ϭ 1/3 for HSL; wmax 1 and wmin wmid 0 for HSV; wmin 3 3 ϭw ϭ1/2 and w ϭ0 for HLS. In LHS, L is the lumi- max mid If 2␲/3рHр4␲/3, nance of a color based on the brightness of R, G, and B perceived by humans but it is not a weighted sum of the 1 1 maximum, medium, and minimum of R, G, and B values. L R*ϭ Ϫ S is the same as the luminance in YIQ, Y, and it is the same 3 3 as the Y component in the computation of L* in CIELAB 1 4␲/3ϪH 1 and CIELUV. ϭ ϩ Ϫ G* ͩ ␲ ͪ S The hue used in GLHS, h(c), is a modified representa- 3 2 /3 3 tion of the hue function and approximates the projected 1 Ϫ2␲/3ϩH 1 color vector.19 Although the computation of hue is only a ϭ ϩ Ϫ B* ͩ ␲ ͪ S. summation and division of two subtractions, which is much 3 2 /3 3 ͑ ͒ simple than Eq. 2 in LHS, it does not obtain the exact If 4␲/3рHр2␲, value of hue. Similarly, the computation of saturation in GLHS, s(c), is also much simple than Eq. ͑3͒ in LHS. 1 Ϫ4␲/3ϩH 1 R*ϭ ϩͩ Ϫ ͪ S GLHS is a powerful model for computer graphics. It 3 2␲/3 3 generalizes several color models and it is efficient in trans- formation. However, it does not obtain the exact values of 1 1 G*ϭ Ϫ S luminance, hue and saturation based on the Maxwell tri- 3 3 angle as it does in LHS but approximation of these values. ␲Ϫ In color image processing, approximation may produce ar- 1 2 H 1 B*ϭ ϩͩ Ϫ ͪ S. tifacts in the processed images, which is not desired. In this 3 2␲/3 3 paper, we use the LHS color coordinate system to maintain the exact values for processing. Although the forward and 2.2 YIQ Color Coordinate System backward transformations between RGB and LHS is more The National Television Systems Committee ͑NTSC͒ for- computational expensive, the transformations are indeed mulated a color coordinate system, YIQ, for the develop- bypassed during color image processing and gamut clip- ment of the United States system.21 It has ping ͑as described in Secs. 3, 4, and 5͒. found widespread use in commercial color television

Optical Engineering, Vol. 42 No. 3, March 2003 703 Yang and Kwok: Efficient gamut clipping...

Fig. 3 Luminance processing for color images using LHS and YIQ Fig. 4 Efficient technique of luminance processing for color images color coordinate systems. bypassing forward and backward transformations between the RGB and LHS color coordinate systems. broadcasting and other applications in North America. The Y component is the same as the Y component of the Com- the Maxwell triangle. Changing the length of the vector OP mission Internationale de l’Eclairage’s ͑CIE͒ XYZ system changes the luminance; however, it does not affect the in- ͑ defined in 1931,22,23 which is also the same as the L com- tersection point i.e., it does not change the hue and satu- ͒ ponent in the LHS system. The I and Q components jointly ration . Consequently, scaling the vector OP adjusts the lu- represent the chromatic attributes. Transforming the rectan- minance component proportionally and the hue and gular coordinate system of IQ to a polar coordinate system, saturation remain unchanged. The processed RGB values the radius corresponds to the saturation and the angle cor- with processed luminance LЈ can be computed by scaling responds to the hue. the original RGB values with original luminance L. The The transformation from RGB to YIQ is as follows: formulation is as follows: RЈ R Y 0.299 0.587 0.114 R LЈ ͫ GЈͬ ϭ ͫ Gͬ . ͑9͒ ͫ I ͬ ϭ 0.596 Ϫ0.274 Ϫ0.322 ͫ Gͬ . ͑7͒ ͫ ͬ L BЈ B Q 0.211 Ϫ0.523 0.312 B 3.2 Luminance Processing in the YIQ Color The backward transformation from YIQ to RGB is as fol- Coordinate System lows: The forward and backward transformations between the R 1.000 0.956 0.621 Y RGB and YIQ color coordinate systems are both linear; therefore, an efficient technique bypassing both transforma- ͫ Gͬ ϭͫ 1.000 Ϫ0.273 Ϫ0.647ͬͫ I ͬ . ͑8͒ tions can be derived easily. The technique is shifting, for- B 1.000 Ϫ1.104 1.701 Q mulated as: Ϫ 3 Luminance Processing RЈ R YЈ Y ͫ GЈͬ ϭͫ Gͬ ϩͫ YЈϪY ͬ . ͑10͒ In most color image processing or enhancement, only the Ϫ luminance component is processed to avoid changes on the BЈ B YЈ Y image chromatic properties.20,24 The luminance processing used is similar to image processing, for ex- 4 Saturation Processing ample, histogram equalization, histogram scaling, etc. Although only luminance processing is involved in most In general, one can transform the RGB values of each color image processing or enhancement, the saturation pixel in the color image to LHS ͑or YIQ͒ values. The L component may also be involved in some situations. This is component ͑or Y component͒ is then taken for luminance because the saturation component often contains high fre- processing. The processed luminance component, LЈ ͑or quency components that are not present in the luminance YЈ), together with the original hue and saturation ͑or I and component, and the variations of saturation are less likely 5,27 Q͒, will then be transformed back to the RGB values for to depend on the local scene brightness. Strickland et al. each corresponding pixel. The whole process is shown in developed several techniques to enhance color images Fig. 3. However, the forward and backward transformations based on both the luminance and saturation components. In between the RGB and LHS color coordinate systems are this section, we discuss the processing of the saturation computationally expensive due to the nonlinearity of the component individually using the LHS and YIQ color co- transformations. A more efficient technique25,26 shown in ordinate systems. Fig. 4 is desired and the formulations for the luminance processing using LHS and YIQ color coordinate systems 4.1 Saturation Processing in the LHS Color are presented in Secs. 3.1 and 3.2. Coordinate System In saturation processing, ͓R, G, B͔ with saturation equal to 3.1 Luminance Processing in the LHS Color S is processed and changed to ͓RЈ,GЈ,BЈ͔ with saturation Coordinate System equal to SЈ, such that the original luminance and hue, L and The luminance component in the LHS color coordinate sys- H, are not changed. Given the formulations of forward and tem is independent of the hue and saturation components as backward transformations of RGB to LHS, one can take the defined in Sec. 2.1. The luminance is proportional to the forward transformation to obtain ͓L, H, S͔ from ͓R, G, B͔ length of the vector OP, while the hue and saturation are and then take the backward transformation to obtain determined based on the intersection of the vector OP and ͓RЈ,GЈ,BЈ͔ from ͓L,H,SЈ͔, as shown in Fig. 5. Using such

704 Optical Engineering, Vol. 42 No. 3, March 2003 Yang and Kwok: Efficient gamut clipping...

Fig. 5 Saturation processing using forward and backward transfor- mation between the RGB and LHS systems. transformations is again computationally expensive be- cause of the nonlinearity of the transformation. A formula- tion that by-passes such tedious transformations is desired. An efficient technique of saturation processing is derived using a graphical approach to by-pass the forward and backward transformations between RGB and LHS systems. Such a technique only requires ͓R, G, B͔ and the saturation values before and after the saturation processing to com- pute ͓RЈ,GЈ,BЈ͔, as shown in Fig. 6. The computations of L and H from ͓R, G, B͔ and ͓RЈ,GЈ,BЈ͔ from ͓L,H,SЈ͔ are by-passed. Projecting ͓R, G, B͔ onto the gray axis in the RGB cube as shown in Fig. 1, we obtain a vector ͓I, I, I͔, where I ϭ(RϩGϩB)/3. The gray axis is the line connecting ͓0, 0, 0͔ and ͓1, 1, 1͔ as shown in Fig. 7͑a͒, where the individual contributions of R, G, B are the same for any points on the gray axis (RϭGϭB). The saturation of all the points lying on the gray axis is 0. Connecting ͓I, I, I͔ to ͓R, G, B͔ and extending to the boundary of the RGB cube produces a Fig. 7 A plane in the RGB cube in which the vector [R,G,B] and the straight line parallel to the Maxwell triangle, as shown in gray axis lie. Fig. 7͑b͒. All the points on this line have the same hue as ͓R, G, B͔ with different saturation. Multiplying the vector ͓ ͔ ͓R,G,B͔Ϫ͓I,I,I͔ by a constant k* and adding it to ͓I, I, I͔ line are the same as those of R, G, B . However, this ͓ ͔ straight line is not parallel to the Maxwell triangle. There- produces a new vector R*,G*,B* with saturation equal ͓ ͔ ͓ ͔ ͑ ͒ ͓ ͔ ͓ ͔ fore, substituting L, L, L for I, I, I in Eq. 11 produces to k*S, where S is the saturation of R, G, B . R*,G*,B* a new vector, where its luminance and hue are the same as can be computed by the following equation. ͓R, G, B͔ but the saturation does not equal to k* times the R* R I saturation of ͓R, G, B͔, because the saturation is not pro- portional to the length of the vector ͓R-L, G-L, B-L͔.To ͫ G*ͬ ϭk*ͫ Gͬ ϩ͑1Ϫk*͒ͫ Iͬ . ͑11͒ obtain the vector ͓RЈ,GЈ,BЈ͔, where its luminance and hue B* B I are the same as ͓RЈ,GЈ,BЈ͔ and the saturation equals k ͓ Ј Ј Ј͔ However, ͓R*,G*,B*͔ does not have the same luminance times the saturation R ,G ,B , a transformation of k to as ͓R, G, B͔. To compute ͓RЈ,GЈ,BЈ͔, where the luminance k* is needed and is derived as follows: ͓ Ј Ј Ј͔ ͓ ͔ and hue of R ,G ,B and R, G, B are the same and the min͓k*Rϩ͑1Ϫk*͒L,k*Gϩ͑1Ϫk*͒L,k*Bϩ͑1Ϫk*͒L͔ ͓ Ј Ј Ј͔ SЈϭ1Ϫ3 . saturation of R ,G ,B equals to k times the saturation of k*͑RϩGϩB͒ϩ3͑1Ϫk*͒L ͓R, G, B͔, substitution of L to I and a transformation of k to k* in the previous equation is needed. If R is the minimum, Connecting ͓L, L, L͔ to ͓R, G, B͔ produces a straight R line, where the luminance and hue of all the points on the Sϭ1Ϫ3 , RϩGϩB

k*Rϩ͑1Ϫk*͒L SЈϭ1Ϫ3 , k*͑RϩGϩB͒ϩ3͑1Ϫk*͒L

kϭSЈ/S.

Therefore, k*͑RϩGϩB͒ Fig. 6 Efficient technique of saturation processing bypassing the kϭ , transformation from RGB to L and H and LHSЈ to RЈGЈBЈ. k*͑RϩGϩB͒ϩ3͑1Ϫk*͒L

Optical Engineering, Vol. 42 No. 3, March 2003 705 Yang and Kwok: Efficient gamut clipping...

scaling of a unit vector on a gray axis with different weight- ing, ␤ and ͑1-␤͒Y, as shown in the following formulation: RЈ R Y ͫ GЈͬ ϭ␤ͫ Gͬ ϩ͑1Ϫ␤͒ͫ Y ͬ , ͑14͒ BЈ B Y

where ␤ϭSЈ/S for the YIQ coordinate system, Fig. 8 Efficient technique of saturation processing bypassing the 3LSЈ/S forward and backward transformations between RGB and YIQ color ␤ϭ coordinate systems. ͑RϩGϩB͒͑1ϪSЈ/S͒ϩ3LSЈ/S

for LHS coordinate system. Ј ͓ Ј Ј Ј͔T 3Lk S is the saturation of R ,G ,B , S is the saturation k*ϭ . of ͓R,G,B͔T, and LϭYϭthe luminance of ͓R,G,B͔T. ͑1Ϫk͒͑RϩGϩB͒ϩ3Lk 5 Out-of-Gamut Problems using LHS or YIQ for It is the same when G or B is the minimum. Color Image Processing The efficient technique for saturation processing is: An RGB color coordinate system is commonly used in RЈ R L computer applications, such as storage and display. How- ͫ GЈͬ ϭk*ͫ Gͬ ϩ͑1Ϫk*͒ͫ Lͬ , ͑12͒ ever, RGB color coordinate systems do not correspond to BЈ B L the perceptual attributes of the human visual system. Color coordinate systems with components corresponding to lu- where minance, hue, and saturation, such as LHS and YIQ color coordinate systems, are more preferable in color image pro- 3Lk cessing. Therefore, the input and output images for color k*ϭ , kϭSЈ/S. ͑1Ϫk͒͑RϩGϩB͒ϩ3Lk image processing use the RGB color coordinate system ͑where 0рR, G, Bр1), while the processing itself uses other color coordinate systems ͑LHS and YIQ͒. In view of 4.2 Saturation Processing in YIQ Color Coordinate the different color coordinate systems being used in the Systems input, output, and processing, the gamut of the color coor- The saturation in YIQ systems is the length of ͓I,Q͔ on the dinate systems is important to ensure that the color repre- IQ plane. Scaling the vector by k will change the saturation sented by the processing color coordinate system can be from S to kS. As a result, the efficient technique of satura- transformed back to the RGB color gamut. Figure 9 illus- tion processing ͑Fig. 8͒ that by-passes both forward and trates the out-of-gamut problem.28,29 backward transformations can be derived as follows: Figure 10 illustrates the mapping of the RGB color gamut to the LHS system particularly on the , , and RЈ 1.000 0.956 0.621 Y hue plane. For the red hue plane, the range of satura- ͓ ͔ ͫ GЈͬ ϭͫ 1.000 Ϫ0.273 Ϫ0.647ͬͫ kI ͬ tion is 0,1 when the luminance is less than or equal to 0.299 ͑the weight on the red component in the luminance BЈ Ϫ kQ 1.000 1.104 1.701 equation͒. It is similar for the green and blue hue planes. As Ј ϩ ϩ the luminance increases, the allowable range of saturation R Y 0.956kI 0.621kQ decreases, and it is ͓0,0͔ when the luminance reaches the ͫ GЈͬ ϭͫ YϪ0.273kIϪ0.647kQͬ maximum value. BЈ YϪ1.104kIϩ1.701kQ 5.1 Gamut Clipping RЈ kYϩ0.956kIϩ0.621kQϩ͑1Ϫk͒Y In this section, three efficient gamut clipping techniques for ͫ GЈͬ ϭͫ kYϪ0.273kIϪ0.647kQϩ͑1ϪK͒Y ͬ . LHS and YIQ systems are presented, namely, RGB, lumi- BЈ kYϪ1.104kIϩ1.701kQϩ͑1Ϫk͒Y nance, and saturation clipping.

Therefore, 5.1.1 RGB clipping RЈ R Y Clipping RGB is the most straightforward clipping tech- nique. We simply replace any R, G, or B values that are ͫ GЈͬ ϭkͫ Gͬ ϩ͑1Ϫk͒ͫ Y ͬ . ͑13͒ greater than 1 by 1 or any R, G, or B values that are less BЈ B Y than0by0. Ͼ 4.3 Summary of Saturation Processing for LHS and 1ifR 1 RЈϭͭ , YIQ Color Coordinate Systems 0ifRϽ0 As derived in Secs. 4.1 and 4.2, the saturation processing 1ifGϾ1 using LHS and YIQ color coordinate systems are summa- GЈϭͭ , tions of the scaling of the original RGB values and the 0ifGϽ0

706 Optical Engineering, Vol. 42 No. 3, March 2003 Yang and Kwok: Efficient gamut clipping...

Fig. 9 Illustration of the out-of-gamut problem in color image processing when the color coordinate system used in the input and output is different than the color coordinate system used in processing.

1ifBϾ1 RЈ R BЈϭͭ . Ͻ ͫ GЈͬ ϭ␤ͫ Gͬ , 0ifB 0 BЈ B 5.1.2 Luminance clipping To clip luminance for a vector in the LHS and YIQ system, where the equations of luminance processing are utilized with the Ͼ ␤ min͑1/R,1/G,1/B͒ if R,G,B 1 maximum allowed value of . ␤ϭͭ ͮ . For LHS: 0ifR,G,BϽ0

Fig. 10 (a) The red, green, and blue hue planes in the LHS space, (b) the gamut of the LHS color coordinate system on the red hue plane, (c) the gamut of the LHS color coordinate system on the green hue plane, and (d) the gamut of the LHS color coordinate system on the blue hue plane.

Optical Engineering, Vol. 42 No. 3, March 2003 707 Yang and Kwok: Efficient gamut clipping...

Fig. 11 (a) Original image, (b) clipping R, G, or B values after luminance histogram equalization, (c) clipping luminance after luminance histogram equalization, and (d) clipping saturation after luminance histogram equalization.

708 Optical Engineering, Vol. 42 No. 3, March 2003 Yang and Kwok: Efficient gamut clipping...

Fig. 12 Illustration of luminance clipping on the red hue plane of the Fig. 13 Illustration of saturation clipping on the red hue plane of the LHS space. LHS space.

For YIQ: of the histogram equalization. The difference in contrast RЈ R ␤ can be obviously seen on the faces and the hairs of the man and woman, the carpet, the couch, and the flowers. ͫ GЈͬ ϭͫ Gͬ ϩͫ ␤ͬ , In clipping luminance, the hue and saturation is main- BЈ B ␤ tained but the luminance is changed to the clipped value. Using such an approach will not change the chromatic at- where tributes but may lose the contrast on the image. Figure 12 min͑1ϪR,1ϪG,1ϪB͒ if R,G,BϾ1 illustrates the clipping of luminance for two pixels, P1 ␤ϭͭ (͓L,H,S͔ϭ͓0.8,0 deg,0.6͔) and P (͓L,H,S͔ϭ͓0.6,0 deg, Ϫ ͑ ͒ Ͻ . 2 max R,G,B if R,G,B 0 0.6͔), on the red hue plane of the LHS space. Both of them ϭ are clipped to the same point, P3 (͓L,H,S͔ ͓0.427,0 deg, 5.1.3 Saturation clipping 0.6͔), of the LHS space, where they have the same value of To clip saturation for a vector in the LHS and YIQ system, luminance 0.427, although they are originally different. If the equation of saturation processing is utilized with the there are many pixels in a region of the image with differ- maximum allowed value of ␤. ent luminance values but very close values of saturation and hue, clipping their luminance values forces them to fall R* R L into a cluster with close values of luminance, hue, and satu- ͫ G*ͬ ϭ␤ͫ Gͬ ϩ͑1Ϫ␤͒ͫ Lͬ , ration. Therefore, the contrast of this region is completely B* B L lost. Clipping the values of R, G, or B will change the lumi- where nance, hue, and saturation of the processed pixel com- pletely in most cases. In particular, if the processed color is 1ϪL 1ϪL 1ϪL far away from the RGB color gamut, clipping the R, G, or minͩ , , ͪ if R,G,BϾ1 ␤ϭͭ RϪL GϪL BϪL . B values changes the color significantly. Observing the il- Ͻ lustration in Fig. 11, the result produced by clipping satu- 0ifR,G,B 0 ration has better contrast. Indeed, the allowable range of saturation decreases as the luminance increases. When the 6 Illustrations In this section, we illustrate the three gamut clipping tech- niques for luminance histogram equalization. In luminance Table 1 Processing time of color image processing with the con- ventional or efficient technique. histogram equalization, the luminance component of the original image is retrieved and the luminance accumulated Conventional technique histogram is plotted. Based on the accumulated histogram, (using forward and Efficient technique the histogram equalization is operated so that the resulted Type of color backward (using scaling image will have a uniform histogram. image processing transformations) and shifting) Figure 11͑a͒ shows the original image and Figs. 11͑b͒, ͑ ͒ ͑ ͒ Luminance histogram 2.2 sec 1.6 sec 11 c , and 11 d show the result of RGB, luminance, and equalization saturation clippings, respectively. It shows that clipping Luminance histogram 1.9 sec 1.4 sec saturation produces an image result with the best contrast stretching because each pixel is able to reach the expected luminance

Optical Engineering, Vol. 42 No. 3, March 2003 709 Yang and Kwok: Efficient gamut clipping... luminance is in its maximum value, the only allowable ␪ value of saturation is zero and the color is pure . ͉QR͉ϭ͉RG͉ 2␲/3 Clipping saturation does not affect the image visually. Figure 13 illustrates saturation clipping. P1 (͓L,H,S͔ ␪ ϭ͓0.8,0 deg,0.6͔) and P (͓L,H,S͔ϭ͓0.6,0 deg,0.6͔) with ͉QG͉ϭ͉RG͉ͩ 1Ϫ ͪ 2 2␲/3 the same saturation but different luminance are clipped ͓ ͔ϭ͓ ͔ ͓ ͔ to P3 ( L,H,S 0.8,0 deg,0.117 ) and P4 ( L,H,S ␪ ␪ ϭ͓0.6,0 deg,0.307͔), respectively. The luminance of P ІOQϭͫ1Ϫ , ,0ͬ 1 2␲/3 2␲/3 and P2 are kept but the saturation is clipped to the maxi- mum allowed value. OCϭ͓1/3,1/3,1/3͔ Јϭ ϩ ͑ Ϫ ͒ 7 Efficiency OP OC S OQ OC We conducted an experiment to compare the efficiency of 1 2 3␪ 1 3␪ 1 1 ͑ OPЈϭͫ ϩͩ Ϫ ͪ S, ϩͩ Ϫ ͪ S, ͑1ϪS͒ͬ the conventional technique using forward and backward 3 3 2␲ 3 2␲ 3 3 transformation͒ and the efficient techniques ͑bypassing for- ward and backward transformation by using scaling and ϭ͓R*,G*,B*͔. shifting͒. Twenty images were processed by luminance his- togram equalization and stretching. We measured the pro- Similarly, OPЈ can be derived for 120 degр␪Ͻ240 deg cessing time taken by both techniques. The average of the and 240 degр␪Ͻ360 deg, processing times are shown in Table 1. It shows that the efficient technique reduces the processing time by 27%. 1 1 5 3␪ 1 3␪ 4 OPЈϭͫ ͑1ϪS͒, ϩͩ Ϫ ͪ S, ϩͩ Ϫ ͪ Sͬ 3 3 3 2␲ 3 2␲ 3 8 Conclusion 1 3␪ 7 1 1 8 3␪ RGB color coordinate systems are employed for color im- OPЈϭͫ ϩͩ Ϫ ͪ S, ͑1ϪS͒, ϩͩ Ϫ ͪ Sͬ 3 2␲ 3 3 3 3 2␲ age representation in computer applications, such as stor- age, camera, scanner, etc. However, it does not correspond L*ϭ0.299R*ϩ0.587G*ϩ0.114B* to human perception; therefore, color coordinate systems such as LHS and YIQ are usually utilized in color image L processing. Unfortunately, many pixels cannot be mapped RϭR* to the RGB color gamut after processing in the LHS or YIQ L* space. Clipping techniques are necessary to solve such a L problem. Besides, the transformations between the RGB GϭG* color coordinate system and the LHS or YIQ color coordi- L* nate system are complicated and time consuming. Efficient techniques are desired. We present the efficient techniques L BϭB* of luminance and saturation processing using LHS and L* YIQ. In addition, we present the efficient techniques for three gamut clipping techniques, RGB, luminance, and where saturation clippings, using LHS and YIQ. Illustrations of the three clipping techniques are presented. Graphical L*ϭ0.299R*ϩ0.587G*ϩ0.114B*. analysis of luminance clipping and saturation clipping is also presented. Experiments to measure the efficiency of If 0рHр2␲/3, the conventional technique ͑using forward and backward transformations͒ and the efficient technique ͑using scaling 1 2␲/3ϪH 1 R*ϭ ϩͩ Ϫ ͪ S and shifting͒ were conducted. It shows that the efficient 3 2␲/3 3 technique reduces the processing time by 27%. 1 H 1 ϭ ϩ Ϫ G* ͩ ␲ ͪ S 9 Derivation of Backward Transformation 3 2 /3 3 between RGB and LHS LHS\RGB „ … 1 1 B*ϭ Ϫ S. The backward transformation can be derived geometrically 3 3 by two steps: 1. determining OPЈ based on the values of Ј hue and saturation, and 2. determining OP based on OP If 2␲/3рHр4␲/3, and the length of OP and OPЈ. The derivation is as follows: 1 1 р␪Ͻ R*ϭ Ϫ S assuming 0 deg 120 deg, 3 3 OQϭ͓1Ϫ͉QR͉cos 45 deg,1Ϫ͉QG͉cos 45 deg,0͔ 1 4␲/3ϪH 1 G*ϭ ϩͩ Ϫ ͪ S ͉RG͉ϭ& 3 2␲/3 3

710 Optical Engineering, Vol. 42 No. 3, March 2003 Yang and Kwok: Efficient gamut clipping...

1 Ϫ2␲/3ϩH 1 cation of color images,’’ Graphical Models and Image Process. 57͑5͒, B*ϭ ϩͩ Ϫ ͪ S. 432–440 ͑1995͒. 3 2␲/3 3 21. D. H. Pritchard, ‘‘U.S. color television fundamentals—A Review,’’ IEEE Trans. Consumer Electron. 23, 467–478 ͑1977͒. 22. A. R. Robertson, ‘‘Historical development of CIE recommended color If 4␲/3рHр2␲, difference equations,’’ Color Res. Appl. 15, 167–170 ͑1990͒. 23. A. R. Robertson, ‘‘The CIE 1976 color-difference formulae,’’ Color 1 Ϫ4␲/3ϩH 1 Res. Appl. 2, 7–11 ͑1977͒. R*ϭ ϩͩ Ϫ ͪ S 24. J. J. Rodriguez and C. C. Yang, ‘‘Effects of luminance quantization 3 2␲/3 3 error on color image processing,’’ IEEE Trans. Image Process. 3͑6͒, 850–854 ͑1994͒. 1 1 25. C. C. Yang and J. J. Rodriguez, ‘‘Efficient luminance and saturation G*ϭ Ϫ S processing techniques for bypassing color coordinate transforma- 3 3 tions,’’ Proc. IEEE Int. Conf. Systems, Man, and Cybernetics, IEEE, New York, Vol. 1, pp. 667–672 ͑1995͒. 26. C. C. Yang and J. J. Rodriguez, ‘‘Efficient luminance and saturation 1 2␲ϪH 1 ϭ ϩ Ϫ processing techniques for color images,’’ J. Visual Commun. Image B* ͩ ␲ ͪ S. Represent 8͑3͒, 263–277 ͑1997͒. 3 2 /3 3 27. B. A. Thomas, R. N. Strickland, and J. J. Rodriguez, ‘‘Color image enhancement using spatially adaptive saturation feedback,’’ Proc. Intl. Acknowledgment Conf. Image Process. 3, 30–33 ͑1997͒. 28. C. C. Yang and J. J. Rodriguez, ‘‘Saturation clipping in the LHS and This project is supported by the Earmarked Grant for Re- YIQ color spaces,’’ Proc. SPIE 2658, 297–307 ͑1996͒. 29. C. C. Yang and S. H. Kwok, ‘‘Gamut clipping in color image process- search of the Hong Kong Research Grants Council, CUHK ing,’’ Proc. IEEE Intl. Conf. Image Process., IEEE, Piscataway, NJ, 7034-98E. Vol. 2, pp. 824–827 ͑2000͒.

References Christopher C. Yang is currently an asso- 1. G. J. Braun and M. D. Fairchild, ‘‘Color gamut mapping in a hue- ciate professor in the Department of Sys- linearized CIELAB color space,’’ Proc. 6th IS&T/SID Color Imaging tems Engineering and Engineering Man- Conf., pp. 147–152 ͑1998͒. agement at the Chinese University of Hong 2. N. Katoh and T. Deguchi, ‘‘Reconsideration of CRT monitor charac- Kong. From 1997 to 1999, he was an as- teristics,’’ Proc. IS&T/SID Color Imaging Conf., 5,33–40͑1997͒. sistant professor in the Department of 3. H. Kotera and K. Kanamori, ‘‘The new color image processing tech- Computer Science and Information Sys- niques for hardcopy,’’ Proc. SPIE 1075, 252–259 ͑1989͒. ͑ ͒ tems and associate director of the Autho- 4. M. R. Luo and B. Rigg, ‘‘BFD l:c colour difference formula, Part 1 SM SM and Part 2,’’ J. Soc. Dyers Colour 103, 126–132 ͑1987͒. rized Academic Java Campus at the 5. J. J. McCann, ‘‘Color spaces for color-gamut mapping,’’ J. Electron. University of Hong Kong. He received his Imaging 8͑4͒, 354–364 ͑1999͒. BS, MS, and PhD in electrical and com- 6. G. Marcu and S. Abe, ‘‘Gamut mapping for color simulation on CRT puter engineering from the University of Arizona, Tucson, in 1990, devices,’’ Proc. SPIE 2658, 308–315 ͑1996͒. 1992, and 1997, respectively. From 1995 to 1997, he was a re- 7. M. Ito and N. Katoh, ‘‘Gamut compression for computer generated search scientist in the Artificial Intelligence Laboratory in the Depart- images,’’ Extended Abstracts of SPSTJ 70th Anniversary Symp. on ͑ ͒ ment of Management Information Systems, where he was an active Fine Imaging, pp. 85–88 1995 . researcher in the Illinois Digital Library project. The Illinois Digital 8. N. Katoh, M. Ito, and S. Ohno, ‘‘Three-dimensional gamut mapping using various color difference formulae and color spaces,’’ J. Elec- Library project was one of six multimillion projects in the US Digital tron. Imaging 8͑4͒, 365–379 ͑1999͒. Library Initiative 1 from 1994 to 1998. From 1992 to 1997, he was 9. , CIE Publication NO. 15.2, Bureau Central De la CIE, also a research associate in the Intelligent Systems Laboratory in Vienna ͑1986͒. the Department of Electrical and Computer Engineering. His current 10. R. Y. C. Wei, M. J. Shyu, and P. L. Sun, ‘‘A new gamut mapping research interests are digital library, Internet agents, information vi- approach involving lightness, chroma, and hue adjustment,’’ Proc. sualization, color image processing, constraint network, and com- ͑ ͒ TAGA, 685–701 1997 . puter integrated manufacturing and inspection. He has published 11. F. J. J. Clarke, R. McDonald, and B. Rigg, ‘‘Modification to the JPC79 more than 80 research papers in referred journals and conference colour difference formula,’’ J. Soc. Dyers Colour 100, 128–132 ͑1984͒. proceedings. He was the chairman of the Association for Computing 12. G. J. Braun and M. D. Fairchild, ‘‘Image lightness rescaling using Machinery Hong Kong Chapter in 2000. He was also the program sigmoidal contrast enhancement functions,’’ Proc. SPIE 3648,96– cochair of the First Asia Digital Library Workshop, and program com- 107 ͑1999͒. mittee and organizing committee member for several international 13. M. Shimizu, S. Semba, S. Suzuki, and K. Murashita, ‘‘Gamut map- conferences. He was an invited panelist of the NSF Digital Library ping algorithm suitable for implementation to device profiles,’’ Proc. Initiative II Review Panel, and Information Technology Research Re- ͑ ͒ 6th IS&T/SID Color Imaging Conf., 169–172 1998 . view Panel. 14. L. W. MacDonald and J. Morovic, ‘‘Assessing the effects of gamut compression in the reproduction of fine art paintings,’’ Proc. 3rd ͑ ͒ IS&T/SID Color Imaging Conf., pp. 194–200 1995 . S. H. Kwok received a BEng (Hons) in 15. P. Laihanen, ‘‘Color reproduction theory based on the principles of electronic and communications engineer- color science,’’ IARAIGAI Conf. Proc. Advances in Printing Science and Technology 19, 1–36 ͑1987͒. ing (1992) from the University of North Lon- 16. R. S. Ledley, M. Buas, and T. J. Golab, ‘‘Fundamentals of true-color don. He received his Diploma of Imperial image processing,’’ Proc. Int. Conf. Patt. Recog. 1, 791–795 ͑1990͒. College (DIC) (1997) from the Imperial Col- 17. R. N. Strickland, C. S. Kim, and McDonnel, ‘‘Digital color image lege of Science, Technology and Medicine, enhancement based on the saturation component,’’ Opt. Eng. 26͑7͒, and his PhD in digital image processing 609–616 ͑1987͒. (1997) from the University of London. He is 18. J. D. Foley, A. van Dam, S. K. Feiner, and J. F. Hughes, Computer currently assistant professor at the Depart- Graphics: Principles and Practice, Addision Wesley, Reading, MA ment of Information and Systems Manage- ͑1996͒. 19. H. Levkowitz and G. Herman, ‘‘GLHS: A generalized lightness, hue, ment, Hong Kong University of Science and saturation color model,’’ CVGIP: Graph. Models Image Process. and Technology (HKUST). He was a visiting scholar and a research 55͑4͒, 271–285 ͑1993͒. assistant in the Department of Electronic and Information Engineer- 20. J. J. Rodriguez and C. C. Yang, ‘‘High resolution histogram modifi- ing at the Hong Kong Polytechnic University (1994 to 1995).

Optical Engineering, Vol. 42 No. 3, March 2003 711