Patent Publication Number: US-7589866-B2

Title: Editing of digital images, including (but not limited to) color-to-monochromatic conversion and changing the color of a monochromatic image

Description:
CROSS REFERENCE TO RELATED APPLICATIONS 
   The present application is a continuation-in-part of U.S. patent application Ser. No. 11/321,443, filed Dec. 28, 2005 now U.S. Pat. No. 7,489,420 by Sergey N. Bezryadin, entitled “COLOR EDITING (INCLUDING BRIGHTNESS EDITING) USING COLOR COORDINATE SYSTEMS INCLUDING SYSTEMS WITH A COORDINATE DEFINED BY A SQUARE ROOT OF A QUADRATIC POLYNOMIAL IN TRISTIMULUS VALUES AND, POSSIBLY, BY A SIGN OF A FUNCTION OF ONE OR MORE OF TRISTIMULUS VALUES”, incorporated herein by reference. The present present application is also a continuation-in-part of U.S. patent application Ser. No. 11/322,111, filed Dec. 28, 2005 now U.S. Pat. No. 7,495,800 by Sergey N. Bezryadin, entitled “COLOR COORDINATE SYSTEMS INCLUDING SYSTEMS WITH A COORDINATE DEFINED BY A SQUARE ROOT OF A QUADRATIC POLYNOMIAL IN TRISTIMULUS VALUES AND, POSSIBLY, BY A SIGN OF A FUNCTION OF ONE OR MORE OF TRISTIMULUS VALUES”, incorporated herein by reference. 

   BACKGROUND OF THE INVENTION 
   The present invention relates to editing of color and monochromatic images. A digital representation of an image can be stored in a storage device (e.g. a computer memory, a digital video recorder, or some other device). Such representation can be transmitted over a network, and can be used to display the color image on a computer monitor, a television screen, a printer, or some other device. The image can be edited using a suitable computer program. 
   Color is a sensation caused by electromagnetic radiation (light) entering a human eye. The light causing the color sensation is called “color stimulus”. Color depends on the radiant power and spectral composition of the color stimulus, but different stimuli can cause the same color sensation. Therefore, a large number of colors can be reproduced (“matched”) by mixing just three “primary” color stimuli, e.g. a Red, a Blue and a Green. The primary stimuli can be produced by three “primary” light beams which, when mixed and reflected from an ideal diffuse surface, produce a desired color. The color can be represented by its coordinates, which specify the intensities of the primary light beams. For example, in linear RGB color coordinate systems, a color S is represented by coordinates R, G, B which define the intensities of the respective Red, Green and Blue primary light beams needed to match the color S. If P(λ) is the radiance (i.e. the energy per unit of time per unit wavelength) of a light source generating the color S, then the RGB coordinates can be computed as: 
                       R   =       ∫   0   ∞     ⁢       P   ⁡     (   λ   )       ⁢       r   _     ⁡     (   λ   )       ⁢           ⁢     ⅆ   λ                     G   =       ∫   0   ∞     ⁢       P   ⁡     (   λ   )       ⁢       g   _     ⁡     (   λ   )       ⁢           ⁢     ⅆ   λ                     B   =       ∫   0   ∞     ⁢       P   ⁡     (   λ   )       ⁢       b   _     ⁡     (   λ   )       ⁢           ⁢     ⅆ   λ                       (   1   )               
where  r (λ),  g (λ),  b (λ) are “color matching functions” (CMF&#39;s). For each fixed wavelength λ, the values  r (λ),  g (λ),  b (λ) are respectively the R, G and B values needed to match color produced by a monochromatic light of the wavelength λ of a unit radiance. The color matching functions are zero outside of the visible range of the λ values, so the integration limits in (1) can be replaced with the limits of the visible range. The integrals in (1) can be replaced with sums if the radiance P(λ) is specified as power at discrete wavelengths.  FIG. 1  illustrates the color matching functions for the 1931 CIE RGB color coordinate system for a 2° field. (CIE stands for “Commission Internationale de l&#39;Eclairage”.) See D. Malacara, “Color Vision and Colorimetry: theory and applications” (2002), and Wyszecki &amp; Stiles, “Color Science: concepts and Methods, Quantitative Data and Formulae” (2 nd  Ed. 2000), both incorporated herein by reference.
 
   The RGB system of  FIG. 1  is called linear because, as shown by equations (1), the R, G, and B values are linear in P(λ). In a linear system, the intensities such as R, G, B are called “tristimulus values”. 
   As seen from  FIG. 1 , the function  r (λ) can be negative, so the R coordinate can be negative. If R is negative, this means that when the color S is mixed with |R| units of the Red primary, the resulting color matches the mixture of G units of the Green primary with B units of the Blue primary. 
   New linear color coordinate systems can be obtained as non-degenerate linear transformations of other systems. For example, the 1931 CIE XYZ color coordinate system for a 2° field is obtained from the CIE RGB system of  FIG. 1  using the following transformation: 
                     [               X           Y                 Z         ]     =       A     RGB   -   XYZ       ⁡     [               R           G                 B         ]         ⁢     
     ⁢     where   ⁢     :               (   2   )                 A     RGB   -   XYZ       =       1     0.17697   ⁢               ⁡     [         0.49       0.31       0.20           0.17697       0.81240       0.01063           0.00       0.01       0.99         ]               (   3   )               
This XYZ system does not correspond to real, physical primaries. The color matching functions  x (λ),  y (λ),  z (λ) for this XYZ system are shown in  FIG. 2 . These color matching functions are defined by the same matrix A RGB-XYZ :
 
             [                   x   _     ⁡     (   λ   )                   y   _     ⁡     (   λ   )                         z   _     ⁡     (   λ   )             ]     =       A     RGB   -   XYZ       ⁡     [                   r   _     ⁡     (   λ   )                   g   _     ⁡     (   λ   )                         b   _     ⁡     (   λ   )             ]             
The tristimulus values X, Y, Z can be computed from the color matching functions in the usual way:
 
   
     
       
         
           
             
               
                 
                   
                     
                       X 
                       = 
                       
                         
                           ∫ 
                           0 
                           ∞ 
                         
                         ⁢ 
                         
                           
                             P 
                             ⁡ 
                             
                               ( 
                               λ 
                               ) 
                             
                           
                           ⁢ 
                           
                             
                               x 
                               _ 
                             
                             ⁡ 
                             
                               ( 
                               λ 
                               ) 
                             
                           
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           
                             ⅆ 
                             λ 
                           
                         
                       
                     
                   
                 
                 
                   
                     
                       Y 
                       = 
                       
                         
                           ∫ 
                           0 
                           ∞ 
                         
                         ⁢ 
                         
                           
                             P 
                             ⁡ 
                             
                               ( 
                               λ 
                               ) 
                             
                           
                           ⁢ 
                           
                             
                               y 
                               _ 
                             
                             ⁡ 
                             
                               ( 
                               λ 
                               ) 
                             
                           
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           
                             ⅆ 
                             λ 
                           
                         
                       
                     
                   
                 
                 
                   
                     
                       Z 
                       = 
                       
                         
                           ∫ 
                           0 
                           ∞ 
                         
                         ⁢ 
                         
                           
                             P 
                             ⁡ 
                             
                               ( 
                               λ 
                               ) 
                             
                           
                           ⁢ 
                           
                             
                               z 
                               _ 
                             
                             ⁡ 
                             
                               ( 
                               λ 
                               ) 
                             
                           
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           
                             ⅆ 
                             λ 
                           
                         
                       
                     
                   
                 
               
             
             
               
                 ( 
                 4 
                 ) 
               
             
           
         
       
     
   
   There are also non-linear color coordinate systems. One example is a non-linear sRGB system standardized by International Electrotechnical Commission (IEC) as IEC 61966-2-1. The sRGB coordinates can be converted to the XYZ coordinates (4) or the CIE RGB coordinates (1). Another example is HSB (Hue, Saturation, Brightness). The HSB system is based on sRGB. In the HSB system, the colors can be visualized as points of a vertical cylinder. The Hue coordinate is an angle on the cylinder&#39;s horizontal circular cross section. The pure Red color corresponds to Hue=0°; the pure Green to Hue=120°; the pure Blue to Hue=240°. The angles between 0° and 120° correspond to mixtures of the Red and the Green; the angles between 120° and 240° correspond to mixtures of the Green and the Blue; the angles between 240° and 360° correspond to mixtures of the Red and the Blue. The radial distance from the center indicates the color&#39;s Saturation, i.e. the amount of White (White means here that R=G=B). At the circumference, the Saturation is maximal, which means that the White amount is 0 (this means that at least one of the R, G, and B coordinates is 0). At the center, the Saturation is 0 because the center represents the White color (R=G=B). The Brightness is measured along the vertical axis of the cylinder, and is defined as max(R,G,B). 
   Different color coordinate systems are suitable for different purposes. For example, the sRGB system is convenient for rendering color on certain types of monitors which recognize the sRGB coordinates and automatically convert these coordinates into color. The HSB system is convenient for some color editing operations including brightness adjustments. 
   Brightness can be thought of as a degree of intensity of a color stimulus. Brightness corresponds to our sensation of an object being “bright” or “dim”. Brightness has been represented as the Y value of the XYZ system of  FIG. 2 , or as the maximum of the R, G and B coordinates of the sRGB coordinate system. Other representations also exist. Hue is the attribute of a color perception denoted by blue, green yellow, red, purple, and so on. See the Wyszecki &amp; Styles book cited above, page 487. Saturation can be thought of as a measure of the white amount in the color. 
   It is desirable to obtain color coordinate systems which facilitate transforming a color image into a monochromatic image (for example, in order to display a color image using a monochromatic printer or monitor, or to achieve a desired visual effect). It is also desirable to change the color of a monochromatic image. 
   SUMMARY 
   Some embodiments of the present invention provide color editing techniques using novel color coordinate systems and color editing apparatus and methods. In some embodiments, one of the coordinates is defined by a square root of a quadratic polynomial in tristimulus values, e.g. by a value B=√{square root over (T 1   2 +T 2   2 +T 3   2 )} where T 1 , T 2 , T 3  are tristimulus values, or by the value B and the sign of one or more of T 1 , T 2 , T 3 . In some embodiments, color-to-monochromatic conversion is facilitated. Also facilitated is changing the color of a monochromatic image. 
   In some embodiments, the color coordinate system has the following coordinates:
 
 B =√{square root over ( T   1   2   +T   2   2   +T   3   2 )}
 
 S   2   =T   2   /B  
 
 S   3   =T   3   /B  
 
In this coordinate system, if the B coordinate is changed, e.g. multiplied by some number k, and S 2  and S 3  are unchanged, the color modification corresponds to multiplying the tristimulus values by k. Such color modification does not change the chromaticity coordinates
 
T 1 /(T 1 +T 2 +T 3 ), T 2 /(T 1 +T 2 +T 3 ), T 3 /(T 1 +T 2 +T 3 ).
 
Therefore, B is a good representation of brightness, and S 2  and S 3  together provide a good representation of chromaticity. To convert a color image to a monochromatic image or to change the color of a monochromatic image, the coordinates S 2  and S 3  can be set to a predefined value representing the desired color (e.g. white for a black-and-white monochromatic image), and the value B can be left unchanged for each pixel. As a result, the brightness will be unchanged. Alternatively, the B coordinate can be processed to change the image brightness or contrast or achieve some other brightness-related effect.
 
   Another embodiment uses a color coordinate system BCH in which the B coordinate is defined as above (e.g. by the value B=√{square root over (T 1   2 +T 2   2 +T 3   2 )}, or the value B and the sign of one or more of T 1 , T 2 , T 3 ). The other coordinates C and H are such that:
 
cos  C=T   1   /B  
 
tan  H=T   3   /T   2  
 
In some embodiments, B represents the brightness, C represents the chroma (saturation), and H represents the hue. A color-to-monochromatic image conversion, or changing the color of a monochromatic image, can be achieved by setting C and H to predefined values representing the desired color. The B coordinate can be unchanged, or can be changed as needed for brightness-related processing.
 
   Linear transformations of such color coordinate systems can be used to obtain other color coordinate systems suitable for the color-to-monochromatic image conversion and changing the color of a monochromatic image. 
   The invention is not limited to the features and advantages described above. Other features are described below. The invention is defined by the appended claims. 

   
     BRIEF DESCRIPTION OF THE DRAWINGS 
       FIGS. 1 and 2  are graphs of color matching functions for prior art color coordinate systems. 
       FIG. 3  illustrates some color coordinate systems according to some embodiments of the present invention. 
       FIGS. 4 and 5  are block diagrams illustrating color editing according to some embodiments of the present invention. 
       FIG. 6  illustrates an image edited according to some embodiments of the present invention. 
       FIGS. 7 and 8  are block diagrams illustrating color editing according to some embodiments of the present invention. 
   

   DESCRIPTION OF SOME EMBODIMENTS 
   The embodiments described in this section illustrate but do not limit the invention. The invention is defined by the appended claims. 
   Some embodiments of the present invention use color coordinate systems Bef and BCH which can be defined, for example, as follows. First, a linear color coordinate system DEF is defined as a linear transformation of the 1931 CIE XYZ color coordinate system of  FIG. 2 : 
                     [               D           E                 F         ]     =       A     XYZ   -   DEF       ⁡     [               X           Y                 Z         ]         ⁢     
     ⁢     where   ⁢     :               (   5   )                 A     XYZ   -   DEF       =     [         0.205306       0.712507       0.467031           1.853667         -   1.279659           -   0.442859               -   0.365451         1.011998         -   0.610425           ]             (   6   )               
It has been found that for many computations, adequate results are achieved if the elements of matrix A XYZ-DEF  are rounded to four digits or fewer after the decimal point, i.e. the matrix elements can be computed with an error Err≦0.00005. Larger errors can also be tolerated in some embodiments. The DEF coordinate system corresponds to color matching functions  d (λ), ē(λ),  f (λ) which can be obtained from  x (λ),  y (λ),  z (λ) using the same matrix A XYZ-DEF :
 
                   [                   d   _     ⁡     (   λ   )                   e   _     ⁡     (   λ   )                         f   _     ⁡     (   λ   )             ]     =       A     XYZ   -   DEF       ⁡     [                   x   _     ⁡     (   λ   )                   y   _     ⁡     (   λ   )                         z   _     ⁡     (   λ   )             ]               (   7   )               
By definition of the color matching functions and the tristimulus values,
 
                       D   =       ∫   0   ∞     ⁢       P   ⁡     (   λ   )       ⁢       d   _     ⁡     (   λ   )       ⁢           ⁢     ⅆ   λ                     E   =       ∫   0   ∞     ⁢       P   ⁡     (   λ   )       ⁢       e   _     ⁡     (   λ   )       ⁢           ⁢     ⅆ   λ                     F   =       ∫   0   ∞     ⁢       P   ⁡     (   λ   )       ⁢       f   _     ⁡     (   λ   )       ⁢           ⁢     ⅆ   λ                       (   8   )               
As explained above, the integration can be performed over the visible range only.
 
   As seen in  FIG. 2 , the color matching functions  x (λ),  y (λ),  z (λ) are never negative. It follows from equations (4) that the X, Y, Z values are never negative. Since the first row of matrix A XYZ-DEF  has only positive coefficients, the function  d (λ) is never negative, and the D value is also never negative. 
   When D&gt;0 and E=F=0, the color is white or a shade of gray. Such colors coincide, up to a constant multiple, with the CIE D 65  white color standard. 
   If a color is produced by a monochromatic radiation with λ=700 nm (this is a red color), then F=0 and E&gt;0. 
   The color matching functions  d (λ), ē(λ),  f (λ) form an orthonormal system in the function space L 2  on [0,∞) (or on any interval containing the visible range of the λ values if the color matching functions are zero outside of this range), that is: 
                             ∫   0   ∞     ⁢         d   _     ⁡     (   λ   )       ⁢       e   _     ⁡     (   λ   )       ⁢           ⁢     ⅆ   λ         =       ∫   0   ∞     ⁢         d   _     ⁡     (   λ   )       ⁢       f   _     ⁡     (   λ   )       ⁢           ⁢     ⅆ   λ                     =       ∫   0   ∞     ⁢         e   _     ⁡     (   λ   )       ⁢       f   _     ⁡     (   λ   )       ⁢           ⁢     ⅆ   λ                       =   0     ⁢                   ⁢     
     ⁢               ∫   0   ∞     ⁢         [       d   _     ⁡     (   λ   )       ]     2     ⁢           ⁢     ⅆ   λ         =       ∫   0   ∞     ⁢         [       e   _     ⁡     (   λ   )       ]     2     ⁢           ⁢     ⅆ   λ                     =       ∫   0   ∞     ⁢         [       f   _     ⁡     (   λ   )       ]     2     ⁢           ⁢     ⅆ   λ                     =   K                   (   9   )               
where K is a positive constant defined by the measurement units for the wavelength λ and the radiance P(λ). The units can be chosen so that K=1.
 
   The integrals in (9) can be replaced with sums if the CMF&#39;s are defined at discrete λ values, i.e.: 
                             ∑   λ             ⁢         d   _     ⁡     (   λ   )       ⁢       e   _     ⁡     (   λ   )           =       ∑   λ             ⁢         d   _     ⁡     (   λ   )       ⁢       f   _     ⁡     (   λ   )                       =       ∑   λ             ⁢         e   _     ⁡     (   λ   )       ⁢       f   _     ⁡     (   λ   )                         =   0     ⁢                   ⁢     
     ⁢               ∑   λ             ⁢       [       d   _     ⁡     (   λ   )       ]     2       =       ∑   λ             ⁢       [       e   _     ⁡     (   λ   )       ]     2                   =       ∑   λ             ⁢       [       f   _     ⁡     (   λ   )       ]     2                   =   K                   (   10   )               
where the sums are taken over a discrete set of the λ values. The constant K can be different than in (9). Color matching functions will be called orthonormal herein if the satisfy the equations (9) or (10).
 
   If S 1  and S 2  are two colors with DEF coordinates (D 1 ,E 1 ,F 1 ) and (D 2 ,E 2 ,F 2 ), a dot product of these colors can be defined as follows:
 
&lt; S 1 ,S 2 &gt;=D 1* D 2 +E 1* E 2 +F 1* F 2  (11)
 
Thus, the DEF coordinate system can be thought of as a Cartesian coordinate system having mutually orthogonal axes D, E, F ( FIG. 3 ), with the same measurement unit for each of these axes.
 
   The dot product (11) does not depend on the color coordinate system as long as the color coordinate system is orthonormal in the sense of equations (9) or (10) and its CMF&#39;s are linear combinations of  x (λ),  y (λ),  z (λ) (and hence of  d (λ), ē(λ),  f (λ)). More particularly, let T 1 , T 2 , T 3  be tristimulus values in a color coordinate system whose CMF&#39;s  t 1   ,  t 2   ,  t 3    belong to a linear span Span(  d (λ), ē(λ),  f (λ)) and satisfy the conditions (9) or (10). For the case of equations (9), this means that: 
                             ∫   0   ∞     ⁢           t   1     _     ⁡     (   λ   )       ⁢           ⁢         t   2     _     ⁡     (   λ   )       ⁢           ⁢     ⅆ   λ         =       ∫   0   ∞     ⁢           t   1     _     ⁡     (   λ   )       ⁢           ⁢         t   3     _     ⁡     (   λ   )       ⁢           ⁢     ⅆ   λ                     =       ∫   0   ∞     ⁢           t   2     _     ⁡     (   λ   )       ⁢           ⁢         t   3     _     ⁡     (   λ   )       ⁢           ⁢     ⅆ   λ                     =   0           ⁢     
     ⁢               ∫   0   ∞     ⁢         [         t   1     _     ⁡     (   λ   )       ]     2     ⁢     ⅆ   λ         =       ∫   0   ∞     ⁢         [         t   2     _     ⁡     (   λ   )       ]     2     ⁢     ⅆ   λ                     =       ∫   0   ∞     ⁢         [         t   3     _     ⁡     (   λ   )       ]     2     ⁢     ⅆ   λ                     =   K                   (   12   )               
with the same constant K as in (9). The discrete case (10) is similar. Suppose the colors S 1 , S 2  have the T 1 T 2 T 3  coordinates (T 1.1 , T 2.1 , T 3.1 ) and (T 1.2 , T 2.2 , T 3.2 ) respectively. Then the dot product (11) is the same as
 &lt; S   1   ,S   2   &gt;=T   1.1   T   1.2   +T   2.1   T   2.2   +T   3.1   T   3.2 . 
   The brightness B of a color S can be represented as the length (the norm) of the vector S:
 
 B=∥S∥=√ {square root over (&lt; S,S &gt;)}=√{square root over ( D   2   +E   2   +F   2 )}  (13)
 
The Bef color coordinate system is defined as follows:
 
 B =√{square root over ( D   2   +E   2   +F   2 )}
 
 e=E/B  
 
 f=F/B   (14)
 
If B=0 (absolute black color), then e and f can be left undefined or can be defined in any way, e.g. as zeroes.
 
   Since D is never negative, the D, E, F values can be determined from the B, e, f values as follows:
 
 E=e×B  
 
 F=f×B  
 
 D =√{square root over ( B   2 −( e*B ) 2 −( f*B ) 2 )}{square root over ( B   2 −( e*B ) 2 −( f*B ) 2 )}= B √{square root over (1− e   2   −f   2 )}  (15)
 
   The Bef system is convenient for brightness editing because the brightness can be changed by changing the B coordinate and leaving e and f unchanged. Thus, if it is desired to change from some value B to a value k×B for some factor k, the new Bef color coordinates B*,e*,f* can be computed as:
 
 B*=k×B  
 
 e*=e  
 
 f*=f   (16)
 
Here k&gt;1 if the brightness is to be increased, and k&lt;1 if the brightness is to be decreased. The transformation (16) corresponds to multiplying the D, E and F values by k:
 
 D*=k×D  
 
 E*=k×E  
 
 F*=k×F   (17)
 
This transformation in turn corresponds to multiplying the color&#39;s radiance P(λ) by k (see equations (4)). The radiance multiplication by k is a good model for the intuitive understanding of brightness as a measure of the intensity of the color stimulus. Also, there is no color shift in the transformation (16), i.e. the color&#39;s chromatic perception does not change.
 
   The brightness can be changed over the whole image or over a portion of the image as desired. The brightness transformation can be performed using computer equipment known in the art. For example, in  FIG. 4 , a computer processor  410  receives the color coordinates B, e, f (from a memory, a network, or some other source) and also receives the factor k (which can be defined by a user via some input device, e.g. a keyboard or a mouse). The processor outputs the k×B, e, f coordinates. In some embodiments, this color editing is controlled by a user who watches the color on a monitor  420  before and after editing. To display the color on monitor  420 , the processor  410  may have to convert the color from the Bef coordinate system to some other coordinate system suitable for the monitor  420 , e.g. sRGB or some other system as defined by the monitor specification. The color conversion can be performed by converting the color between Bef and DEF as specified by equations (14) and (15), and between DEF and the XYZ system of  FIG. 2  by equations (5) and (6). The color conversion between the XYZ coordinate system and the sRGB can be performed using known techniques. 
   Another color coordinate system that facilitates the brightness editing is the spherical coordinate system for the DEF space. This coordinate system BCH (Brightness, Chroma, Hue) is defined as follows (see also  FIG. 3 ):
 
 B =√{square root over ( D   2   +E   2   +F   2 )}  (18)
 
   C (“chroma”) is the angle between the color S and the D axis; 
   H (“hue”) is the angle between (i) the orthogonal projection S EF  of the vector S on the EF plane and (ii) the E axis. 
   The term “chroma” has been used to represent a degree of saturation (see Malacara&#39;s book cited above). Recall that in the HSB system, the Saturation coordinate of a color represents the white amount in the color. In the BCH system, the C coordinate of a color is a good representation of saturation (and hence of chroma) because the C coordinate represents how much the color deviates from the white color D 65  represented by the D axis (E=F=0). 
   The H coordinate of the BCH system represents the angle between the projection S EF  and the red color represented by the E axis, and thus the H coordinate is a good representation of hue. 
   Transformation from BCH to DEF can be performed as follows:
 
 D=B ×cos  C  
 
 E=B ×sin  C ×cos  H  
 
 F=B ×sin  C ×sin  H   (19)
 
   Transformation from DEF to BCH can be performed as follows. The B coordinate can be computed as in (18). The C and H computations depend on the range of these angles. Any suitable ranges can be chosen. In some embodiments, the angle C is in the range [0,π/2], and hence
 
 C =cos −1 ( D/B )  (20)
 
In some embodiments, the angle H can be computed from the relationship:
 
tan  H=F/E   (21A)
 
or
 
tan  H=f/e   (21B)
 
where e and f are the Bef coordinates (14). For example, any of the following relations can be used:
 
 H =tan −1 ( F/E )+α
 
 H =tan −1 ( f/e )+α  (22)
 
where α depends on the range of H. In some embodiments, the angle H is measured from the positive direction of the E axis, and is in the range from 0 to 2π or −π to π. In some embodiments, one of the following computations is used:
 
 H=arctg ( E,F )
 
 H=arctg ( e,f )  (23)
 
where arctg is computed as shown in pseudocode in Appendix 1 at the end of this section before the claims.
 
   Transformation from BCH to Bef can be performed as follows:
 
B=B
 
 e =sin  C ×cos  H  
 
 f =sin  C ×sin  H   (24)
 
Transformation from Bef to BCH can be performed as follows:
 
B=B
 
 C =cos −1 √{square root over ( 1   −e   2   −f   2 )}, or  C =sin −1 √{square root over (e 2   +f   2 )}
 
 H =tan −1 ( f/e )+α (see (22)), or  H=arctg ( e,f ) (see Appendix 1).  (25)
 
   As with Bef, the BCH system has the property that a change in the B coordinate without changing C and H corresponds to multiplying the tristimulus values D, E, F by some constant k (see equations (17)). The brightness editing is therefore simple to perform. In  FIG. 5 , the brightness editing is performed like in  FIG. 4 , with the C and H coordinates used instead of e and f. 
   The Bef and BCH systems are also suitable for contrast editing. In some embodiments, the contrast is enhanced by increasing the brightness level at the image portions that are brighter than some average value B avg , and decreasing the brightness at the image portions that are dimmer than the average value. For the sake of illustration, suppose the image consists of a two-dimensional set of pixels with coordinates (x,y), as shown in  FIG. 6 . In some embodiments, the average value is the mean of the brightness values over the image: 
                   B   avg     =       1   N     ⁢       ∑     x   ,   y               ⁢     B       x   ,   y     ⁢                           (   26   )               
where N is the number of the pixels in a region containing the pixel (x,y). In some embodiments, the region is a square, a rectangle, a circle, or an ellipse, and the pixel (x,y) is at the region&#39;s center. In some embodiments, the regions have the same size for different pixels, except possibly at the image boundary. In some embodiments, the radius of a circular region, or one half of each axis of an elliptical region, or one half of each side of a rectangular region, are each greater than five pixels except perhaps at the image boundary. In the Bef system, for each pixel (x,y), the new coordinates B x,y *, e x,y *, f x,y * for the contrast adjustment are computed from the original coordinates B x,y,  e x,y,  f x,y  as follows:
   B   x,y   *=B   avg   1−ε   ×B   x,y   ε     e   x,y   *=e   x,y      f   x,y   *=f   x,y   (27) 
Here, ε is some positive constant. Of note, the equations (27) imply that:
 
                     B     x   ,   y     *       B   avg       =       (       B     x   ,   y         B   avg       )     ɛ             (   28   )               
Thus, if ε&gt;1, then the contrast is increased because the brightness range is increased over the image. If ε&lt;1, the contrast is decreased.
 
   The contrast adjustment can be performed over pixels (x,y) of a portion of the image rather than the entire image. 
   Similarly, in the BCH system, the B coordinate is computed as in (27), and the C and H coordinates are unchanged:
 
 B   x,y   *=B   avg   1−ε   ×B   x,y   ε 
 
 C   x,y   *=C   x,y  
 
 H   x,y   *=H   x,y   (29)
 
   In some embodiments, the transformations (27), (29) are also used to sharpen or blur the image or an image portion. The average value B avg  is computed over a small region containing the pixel (x,y). In some embodiments, the radius of a circular region, or one half of each axis of an elliptical region, or one half of each side of a rectangular region, are each five pixels or less except perhaps at the image boundary. 
   In some embodiments, the Bef and BCH systems are used to adjust a shadow portion or a highlight portion of the image (e.g. to deepen the shadow and/or brighten (highlight) a brighter image portion). As in equations (27), (29), the e and f coordinates or the C and H coordinates are unchanged. The brightness is modified as follows:
 
 B   x,y   *=B   x,y ×( B   0   /B   avg ) ε   (30)
 
where:
 
   B 0  is some pre-defined brightness level, e.g. the maximum brightness over the image; 
   B avg  is the mean brightness over a region containing the pixel (x,y); 
   ε is a pre-defined constant; ε is in the interval (0,1 ) if it is desired to increase the brightness range near the pixel (x,y), and thus to sharpen the image near the pixel (good results can be achieved with ε≦½); ε is negative (e.g. in the interval (−1,0)) if it is desired to reduce the sharpness range to blur the image. 
   The Bef and BCH systems are also convenient for converting a color image to a monochromatic image, or for changing the color of a monochromatic image. In these transformations, the brightness B can be unchanged. The transformation is performed in the Bef system by setting the e and f coordinates to some constant values e 0  and f 0 , as shown in  FIG. 7 . More particularly, computer processor  410  receives the color coordinates B, e, f and also receives the values e 0 ,f 0 . The processor outputs the coordinates B, e 0 ,f 0  for each pixel:
 
 B*=B  
 
 e*=e   0  
 
 f*=f   0   (31)
 
   In the BCH system, the monochromatic transformation is given by the following equations:
 
 B*=B  
 
 C*=C   0  
 
 H*=H   0   (32)
 
where C 0 , H 0  are some input values corresponding to the desired color. Computer processor  410  ( FIG. 8 ) receives the color coordinates B, C, H and also receives the values C 0 , H 0 . The processor outputs the coordinates B, C 0 , H 0  for each pixel according to (32).
 
   In some embodiments, the transformation (31) or (32) can be combined with some brightness editing. For example, in at least a portion of the image, the output brightness B* can be computed as in (16) for some input value k, or as in (26) or (28). Other brightness editing types are also possible. See e.g. U.S. patent application Ser. No. 11/377,161, entitled “EDITING (INCLUDING CONTRAST AND SHARPNESS EDITING) OF DIGITAL IMAGES”, filed on Mar. 16, 2006 by Sergey N. Bezryadin and incorporated herein by reference. 
   The invention includes systems and methods for color image editing and display. The Bef and BCH color coordinates can be transmitted in a data carrier such as a wireless or wired network link, a computer readable disk, or other types of computer readable media. The invention includes computer instructions that program a computer system to perform the brightness editing and color coordinate system conversions. Some embodiments of the invention use hardwired circuitry instead of, or together with, software programmable circuitry. 
   In some embodiments, the Bef or BCH color coordinate system can be replaced with their linear transforms, e.g. the coordinates (B+e,e,f) or (2B,2e,2f) can be used instead of (B,e,f). The angle H can be measured from the E axis or some other position. The angle C can also be measured from some other position. The invention is not limited to the order of the coordinates. The invention is not limited to DEF, XYZ, or any other color coordinate system as the initial coordinate system. In some embodiments, the orthonormality conditions (9) or (10) are replaced with quasi-orthonormality conditions, i.e. the equations (9) or (10) hold only approximately. More particularly, CMF&#39;s  t 1   (λ),  t 2   (λ),  t 3   (λ) will be called herein quasi-orthonormal with an error at most ε if they satisfy the following conditions:
     1. each of   

               ∫   0   ∞     ⁢           t   1     _     ⁡     (   λ   )       ⁢         t   2     _     ⁡     (   λ   )       ⁢     ⅆ   λ         ,       ∫   0   ∞     ⁢           t   1     _     ⁡     (   λ   )       ⁢         t   3     _     ⁡     (   λ   )       ⁢     ⅆ   λ         ,       ∫   0   ∞     ⁢           t   2     _     ⁡     (   λ   )       ⁢         t   3     _     ⁡     (   λ   )       ⁢     ⅆ   λ               
is in the interval [−ε,ε], and
     2. each of   
               ∫   0   ∞     ⁢         [         t   1     _     ⁡     (   λ   )       ]     2     ⁢     ⅆ   λ         ,       ∫   0   ∞     ⁢         [         t   2     _     ⁡     (   λ   )       ]     2     ⁢     ⅆ   λ         ,       ∫   0   ∞     ⁢         [         t   3     _     ⁡     (   λ   )       ]     2     ⁢     ⅆ   λ               
is in the interval [K−ε,K+ε] for positive constants K and ε. In some embodiments, ε is 0.3K, or 0.1K, or some other value at most 0.3K, or some other value. Alternatively, the CMF&#39;s will be called quasi-orthonormal with an error at most ε if they satisfy the following conditions:
     1. each of   
               ∑   λ             ⁢           t   1     _     ⁡     (   λ   )       ⁢         t   2     _     ⁡     (   λ   )           ,       ∑   λ             ⁢           t   1     _     ⁡     (   λ   )       ⁢         t   3     _     ⁡     (   λ   )           ,       ∑   λ             ⁢           t   2     _     ⁡     (   λ   )       ⁢         t   3     _     ⁡     (   λ   )                 
is in the interval [−ε,ε], and
     2. each of   
               ∑   λ             ⁢       [         t   1     _     ⁡     (   λ   )       ]     2       ,       ∑   λ             ⁢       [         t   2     _     ⁡     (   λ   )       ]     2       ,       ∑   λ             ⁢       [         t   3     _     ⁡     (   λ   )       ]     2             
is in the interval [K−ε,K+ε] for positive constants K and ε. In some embodiments, ε is 0.3K, or 0.1K, or some other value at most 0.3K, or some other value. Orthonormal functions are quasi-orthonormal, but the reverse is not always true. If ε=0.1K, the functions will be called 90%-orthonormal. More generally, the functions will be called n %-orthonormal if ε is (100-n)% of K. For example, for 70%-orthonormality, ε=0.3K.
 
   The invention is not limited to the orthonormal or quasi-orthonormal CMF&#39;s or to any particular white color representation. For example, in some embodiments, the following color coordinate system (S 1 ,S 2 ,S 3 ) is used for color editing:
 
 S   1 =√{square root over ( X   2   +Y   2   +Z   2 )}
 
 S   2   =X/S   1  
 
 S   3   =Z/S   1   (33)
 
The XYZ tristimulus values in (33) can be replaced with linear RGB tristimulus values or with some other tristimulus values T 1 , T 2 , T 3 , e.g.:
 
 S   1 =√{square root over ( T   1   2   +T   2   2   +T   3   2 )}
 
 S   2   =T   2   /S   1  
 
 S   3   =T   3   /S   1 .  (34)
 
If T 1  can be negative, than the sign of T 1  can be provided in addition to the coordinates. Alternatively the sign of T 1  can be incorporated into one of the S 1 , S 2 , and/or S 3  values,for example:
 
 S   1 =Sign( T   1 )×√{square root over ( T   1   2   +T   2   2   +T   3   2 )}  (35)
 
The brightness editing can still be performed by multiplying the S 1  coordinate by k, with the S 2  and S 3  values being unchanged.
 
   The BCH coordinate system can be constructed from linear systems other than DEF, including orthonormal and non-orthonormal, normalized and non-normalized systems. In some embodiments, a coordinate system is used with coordinates (S 1 ,S 2 ,S 3 ), where S 1  is defined as in (34) or (35), and the coordinates S 2  and S 3  are defined in a way similar to (20)-(23), e.g.:
 
 S   2 =cos −1 ( T   1   /B )
 
 S   3 =tan −1 ( T   3   /T   2 )+α  (36)
 
where α is as in (22), or
 
 S   3   =arctg ( T   2   ,T   3 )  (37)
 
   In some embodiments, the value B is the square root of some other quadratic polynomial of in T 1 , T 2 , T 3 :
 
 B =√{square root over ( g   11   T   1   2   +g   22   T   2   2   +g   33   T   3   2   +g   12   T   1   T   2   +g   13   T   1   T   3   +g   23   T   2   T   3 )}
 
wherein g 11 , g 22 , g 33 , g 12 , g 13 , g 23  are predefined constants, and g 11 , g 22 , g 33  are not equal to zero (e.g. g 11 , g 22 , g 33  are positive). Linear transforms result in different mathematical expressions of the coordinates without necessarily changing the values of the coordinates. For example, the coordinate system may use coordinates S 1 , S 2 , S 3  or their linear transform, wherein S 1  is defined by the value B, or S 1  is defined by B and the sign of a predefined function of one or more of T 1 , T 2 , T 3 . In some embodiments
 
 B =√{square root over (α 1   2 ( T   1   ,T   2   ,T   3 )+α 2   2 ( T   1   ,T   2   ,T   3 )+α 3   2 ( T   1   ,T   2   ,T   3 ))}{square root over (α 1   2 ( T   1   ,T   2   ,T   3 )+α 2   2 ( T   1   ,T   2   ,T   3 )+α 3   2 ( T   1   ,T   2   ,T   3 ))}{square root over (α 1   2 ( T   1   ,T   2   ,T   3 )+α 2   2 ( T   1   ,T   2   ,T   3 )+α 3   2 ( T   1   ,T   2   ,T   3 ))}
 
wherein
 
α 1 ( T   1   ,T   2   ,T   3 )=α 11   ×T   1 +α 12   ×T   2 +α 13   ×T   3  
 
α 2 ( T   1   ,T   2   ,T   3 )=α 21   ×T   1 +α 22   ×T   2 +α 23   ×T   3  
 
α 3 ( T   1   ,T   2   ,T   3 )=α 31   ×T   1 +α 32   ×T   2 +α 33   ×T   3  
 
wherein α 11 , α 12 , α 13 , α 21 , α 22 , α 23 , α 31 , α 32 , α 33  are predefined numbers such that the following matrix Λis non-degenerate:
 
           Λ   =     [           α   11           α   12           α   13               α   21           α   22           α   23               α   31           α   32           α   33           ]           
In some embodiments, the coordinate S 1  is defined by the value B and by a sign of a predefined function of one or more of T 1 , T 2 , T 3 . The function can be one of α 1 (T 1 ,T 2 ,T 3 ), α 2 (T 1 ,T 2 ,T 3 ), α 3 (T 1 ,T 2 ,T 3 ). Clearly, the values T 1 ′=α 1 (T 1 ,T 2 ,T 3 ), T 2 ′=α 2 (T 1 ,T 2 ,T 3 ), T 3 ′=α 3 (T 1 ,T 2 ,T 3 ) are also tristimulus values. In some embodiments, the coordinate S 2  is defined by a value β(T 1 ,T 2 ,T 3 )/B, wherein
 β( T   1   ,T   2   ,T   3 )=β 1   ×T   1 +β 2   ×T   2 +β 3   ×T   3 , 
wherein β 1 , β 2 , β 3  are predefined numbers at least one of which is not equal to zero, or the coordinate S 2  is defined by the value β(T 1 ,T 2 ,T 3 )/B and the sign of a predefined function of one or more of T 1 , T 2 , T 3 . The coordinate S 3  is defined by a value γ(T 1 ,T 2 ,T 3 )/B, wherein
 γ( T   1   ,T   2   ,T   3 )=γ 1   ×T   1 +γ 2   ×T   2 +γ 3   ×T   3 , 
wherein γ 1 , γ 2 , γ 3  are predefined numbers at least one of which is not equal to zero, and γ(T 1 ,T 2 ,T 3 ) is not a multiple of β(T 1 ,T 2 ,T 3 ), or the coordinate S 3  is defined by the value γ(T 1 ,T 2 ,T 3 )/B and the sign of a predefined function of one or more of T 1 ,T 2 ,T 3 . In some embodiments, a value cos S 2  is defined by a value β(T 1 ,T 2 ,T 3 )/B, wherein
 β( T   1   ,T   2   ,T   3 )=β 1   ×T   1 +β 2   ×T   2 +β 3   ×T   3 , 
wherein β 1 , β 2 , β 3  are predefined numbers at least one of which is not equal to zero, or the value cos S 2  is defined by the value β(T 1 ,T 2 ,T 3 )/B and the sign of a predefined function of one or more of T 1 , T 2 , T 3 . In some embodiments, a value tan S 3  is defined by a value γ(T 1 ,T 2 ,T 3 )/δ(T 1 ,T 2 ,T 3 ), wherein
 γ( T   1   ,T   2   ,T   3 )=γ 1   ×T   1 +γ 2   ×T   2 +γ 3   ×T   3 , δ( T   1   ,T   2   ,T   3 )=δ 1   ×T   1 +δ 2   ×T   2 +δ 3   ×T   3 , 
wherein γ 1 , γ 2 , γ 3  are predefined numbers at least one of which is not equal to zero, and δ 1 , δ 2 , δ 3  are predefined numbers at least one of which is not equal to zero, or the value tan S 3  is defined by the value γ(T 1 ,T 2 ,T 3 )/δ(T 1 ,T 2 ,T 3 ) and the sign of a predefined function of one or more of T 1 , T 2 , T 3 . In some embodiments, β(T 1 ,T 2 ,T 3 ) is one of α 1 (T 1 ,T 2 ,T 3 ), α 2 (T 1 ,T 2 ,T 3 ), α 3 (T 1 ,T 2 ,T 3 ); γ(T 1 ,T 2 ,T 3 ) is another one of α 1 (T 1 ,T 2 ,T 3 ), α 2 (T 1 ,T 2 ,T 3 ); and δ(T 1 ,T 2 ,T 3 ) is the third one of α 1 (T 1 ,T 2 ,T 3 ), α 2 (T 1 ,T 2 ,T 3 ), α 3 (T 1 ,T 2 ,T 3 ). In some embodiments, any color whose tristimulus values T 1 ,T 2 ,T 3  are such that α 1 (T 1 ,T 2 ,T 3 ) is not zero and α 2 (T 1 ,T 2 ,T 3 )=α 3 (T 1 ,T 2 ,T 3 )=0, is a white or a shade of gray. This can be D 65  or some other white color. In some embodiments, a monochromatic red color of a predefined wavelength has tristimulus values T 1 , T 2 , T 3  such that α 2 (T 1 ,T 2 ,T 3 ) is positive and α 3 (T 1 ,T 2 ,T 3 )=0. In some embodiments, α 1 (T 1 ,T 2 ,T 3 ), α 2 (T 1 ,T 2 ,T 3 ), α 3 (T 1 ,T 2 ,T 3 ) are tristimulus values corresponding to 70%-orthonormal color matching functions. In some embodiments, up to a constant multiple, Λ is an orthonorrnal matrix, i.e. ΛΛ T =I, where Λ T  is a transpose of Λ, and I is the identity matrix, i.e.
 
           I   =     [         1       0       0           0       1       0           0       0       1         ]           
We will also call the matrix orthonormal if ΛΛ T =c×I where c is a non-zero number. If the elements of ΛΛ T  are each within c×n/100 of the respective elements of a matrix c×I for some c and n, then the matrix Λ will be called (100-n)%-orthonormal. For example, if the elements of ΛΛ T  are each within 0.3×c of the respective elements of a matrix c×I (i.e. for each element λ i,j  of matrix ΛΛ T , |λ i,j −e i,j |≦0.3×c where e i,j  is the corresponding element of the matrix c×I), the matrix Λ will be called 70%-orthonormal. In some embodiments, the matrix Λ is 70% or more percent orthonormal (e.g. 90%-orthonormal).
 
   The tristimulus values T 1 , T 2 , T 3 , or the corresponding color matching functions, do not have to be normalized in any way. In some prior art systems, the color matching functions are normalized to require that the integral of each color matching function be equal to 1. In the XYZ system of  FIG. 2 , there is a normalizing condition X=Y=Z for a pre-defined, standard white color with a constant spectral power distribution function P(λ). The invention is not limited by any such requirements. 
   The invention is not limited to the two-dimensional images (as in  FIG. 6 ). The invention is applicable to pixel (bitmap) images and to vector graphics. Colors can be specified separately for each pixel, or a color can be specified for an entire object or some other image portion. The invention is not limited to a particular way to specify the brightness transformation or any other transformations. For example, the brightness transformation can be specified by a value to be added to the brightness (B*=B+k) or in some other way. Other embodiments and variations are within the scope of the invention, as defined by the appended claims. 
   Appendix 1—Function arctg(a,b) 
   Here is a pseudocode written in a C-like language (C is a programming language). inline float arctg(const float a, const float b) 
   
     
       
         
             
             
           
             
                 
                 
             
           
          
             
                 
               { 
             
          
         
         
             
             
          
             
                 
               float res; 
             
             
                 
               if( FLT_EPSILON * abs(b) &lt; abs(a) ) 
             
          
         
         
             
             
          
             
                 
               //FLT_EPSILON is the minimum positive number ε 
             
             
                 
               // such that 1-ε is different from 1 on the computer. 
             
             
                 
               //abs( ) is the absolute value 
             
          
         
         
             
             
          
             
                 
               { 
             
          
         
         
             
             
          
             
                 
               res = tan −1  (b / a) ; 
             
             
                 
               if (a &lt; 0) 
             
             
                 
               { 
             
          
         
         
             
             
          
             
                 
               res += π ; 
             
          
         
         
             
             
          
             
                 
               } 
             
             
                 
               else if (b &lt; 0) 
             
             
                 
               { 
             
          
         
         
             
             
          
             
                 
               res += 2 π ; 
             
          
         
         
             
             
          
             
                 
               }; 
             
          
         
         
             
             
          
             
                 
               } 
             
             
                 
               else 
             
             
                 
               { 
             
          
         
         
             
             
          
             
                 
               if(b &lt; 0) 
             
             
                 
               { 
             
          
         
         
             
             
          
             
                 
               res = 3/2 π ; 
             
          
         
         
             
             
          
             
                 
               } 
             
             
                 
               else 
             
             
                 
               { 
             
          
         
         
             
             
          
             
                 
               if (b &gt; 0) 
             
             
                 
               { 
             
          
         
         
             
             
          
             
                 
               res = ½ π ; 
             
          
         
         
             
             
          
             
                 
               } 
             
             
                 
               else 
             
             
                 
               { 
             
          
         
         
             
             
          
             
                 
               res = 0 ; 
             
          
         
         
             
             
          
             
                 
               }; 
             
          
         
         
             
             
          
             
                 
               }; 
             
          
         
         
             
             
          
             
                 
               }; 
             
             
                 
               return res ; 
             
          
         
         
             
             
          
             
                 
               };