Abstract:
A method for transforming a first image defined by a first multi-dimensional color space (RGB) into second image defined by a second multi-dimensional color space (CMYK). The method computes the transformation using information derived from a previous transformation of said second image into said first image. The method then minimizes the error produced while transforming the second image back into the first image. As such, an image editing system can display on a video monitor an image that is defined in one multi-dimensional color space (RGB), print using a printer that prints images using a second multi-dimensional color space (CMYK) and edit an image using any multi-dimensional color space (either RGB or CMYK) that facilitates rapid and accurate image editing.

Description:
RELATED APPLICATIONS 
     This application is a continuation of U.S. patent application Ser. No. 08/267,140, filed Jun. 24, 1994, now U.S. Pat. No. 6,301,025. 
    
    
     BACKGROUND OF THE DISCLOSURE 
     1. Field of the Invention 
     The invention relates to image processing systems. More particularly, the invention relates to a method for accurately transforming color information between two color spaces having differing dimensions, e.g., between a red-green-blue (RGB) color space and a cyan-magenta-yellow-black (CMYK) color space and vice versa. 
     2. Description of the Background Art 
     In printing, image retouching and image processing, it is often necessary to convert colors from one representation (color space) into another. Many computer video monitors and scanners, for example, use red-green-blue (RGB) representations for colors, while printers typically represent colors in terms of the amounts of a variety of differently colors inks (for example, cyan-magenta-yellow-black (CMYK)). As such, in a typical computer system, the RGB color space used to produce an image upon a computer screen must be converted into a CMYK color space to facilitate printing of the image depicted on the screen. However, for any particular two color spaces, it is in many instances much easier to convert in one direction than the other, e.g., convert from CMYK to RGB. For example, converting from CMYK to RGB is relatively easy because the CMYK space has more dimensions than the RGB space. 
     Specifically, an important task in photocompositing is to take a set of images in CMYK format, modify them, and output the result in CMYK. Many of the intermediate operations (image modifications) are more easily or effectively accomplished in RGB space, so it is often necessary to convert from CMYK to RGB and then back to CMYK. One problem with such a transformation is that a CMYK color space is a four-dimensional space and an RGB color space is a three-dimensional space, so the transformation from CMYK to RGB, though relatively simple, inherently loses color information. In particular, the color information produced by “black generation” during creation of the CMYK image is lost. Black generation describes an amount of black ink substituted for equal parts of Cyan, Magenta and Yellow for printing processes. Consequently, it is very important that an image processing system be able to convert from CMYK to RGB and back to CMYK and produce a black component of the CMYK image that closely approximates the black component in the original CMYK image. 
     Thus, a difficult and widely needed color transformation is the transformation from an RGB color space to a CMYK color space that retains, as closely as possible, the black generation of the original CMYK image. U.S. Pat. No. 4,500,919 discloses a particular method for converting from RGB to CMYK which is called the Ink Correction Model (ICM). The patent mentions that the ICM “. . . could be implemented in one huge lookup table, but this would be uneconomic and would also give no clue as to how to find the data to be stored in the LUT short of an impossibly large printing test.” [11:21] Since the timing of filing of &#39;919 patent, the cost of memory has been reduced sufficiently that it is no longer uneconomic to use “one huge lookup table”. Furthermore, the &#39;919 patent states that, in using a table based transformation, a large printing test must be conducted to facilitate color space transformation calibration. However, such printing tests are time consuming and complicate the transformation process. 
     Therefore, a need exists in the art for a method that rapidly and accurately transforms images from a first multi-dimensional color space, e.g., RGB, into a second multi-dimensional color space, e.g., CKYK, without using a printing test and which preserves as closely as possible the black generation of an original CMYK image. 
     SUMMARY OF THE INVENTION 
     The present invention overcomes the disadvantages heretofore associated with the prior art. Specifically, the present invention converts pixel values from one color space to another, e.g., RGB to CMYK, using a table of interpolated values. The values in the table are filled using data derived from sample images which have been previously converted in the other direction, e.g., CMYK to RGB. The invention infers from those sample images enough about the forward transformation to build an inverse transformation in the table. 
     In order to convert from RGB to CMYK while retaining as closely as possible the black generation of the original CMYK files, the present invention examines the CMYK file and implicitly infers a black generation model. It does this by creating a table in RGB space of the CMYK values found in the files. At the beginning, each sample of the RGB table is initialized with a value determined from a default transformation of RGB into CMYK using any default black generation strategy. The choice of this transformation is not very important because it is highly modified in the following steps performed by the invention. Next, each pixel of each CMYK image used for creation of the table is converted into RGB, and then the appropriate entries in the RGB-space table are modified so that the interpolation of the table entries at the RGB values yields a value as close as possible to the CMYK pixel color. Once the table has been constructed, it may be low-pass filtered (smoothed), so that the values are highly continuous and no visible artifacts can be identified in the conversion. If the CMYK values of the input images are converted to RGB and the resulting RGB values are converted back to CMYK using the table described above, the original CMYK values with their original black generation are reconstructed with high accuracy as long as all the input images used the same black-generation strategy. If several input images are used that were created with different black-generation strategies (different UCR, GCR, and the like), the table is constructed using an average of the different strategies. 
     A key advantage of the current invention is that the user need not know anything about the black-generation strategy used in the CMYK file. It is inferred automatically by the inventive method. In situations where people are collaborating over long distances and it is impractical to do a large series of printing tests to facilitate optimization of the color space transformation process, the invention has great advantages over the prior art. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
       The teachings of the present invention can be readily understood by considering the following detailed description in conjunction with the accompanying drawings, in which: 
         FIG. 1  depicts a computer system capable of executing an image processing program as well as a color space transformation program in accordance this the present invention; 
         FIG. 2  depicts a flow chart of a color space transformation table generation routine as executed upon the computer system shown in  FIG. 1 ; and 
         FIG. 3  depicts a flow chart of a color space transformation routine that uses the table generated using the routine depicted in FIG.  2 . 
       To facilitate understanding, identical reference numerals have been used, where possible, to designate identical elements that are common to the figures. 
     
    
    
     DETAILED DESCRIPTION 
       FIG. 1  is a block diagram of a conventional computer system  100  capable of executing a color space transformation computer program  118 . This program contains a routine that implements the method of the present invention to transform an image based in a first color space into an image based in a second color space. As such, the images can then be respectively printed and displayed on a printer  110  and a display monitor  108  even though the printer and display monitor utilize differing types of color spaces to produce an image. 
     Specifically, the computer system  100  contains an image input device  102 , a computer  104 , a user input device  106 , a display monitor  108  and a printer  110 . In operation, an original image is created by an image input device  102  such as a conventional image scanner. The scanned image (also referred to herein as a source image or original image) is formatted by the scanner into an image file  120  using a particular color space (e.g., RGB or CMYK). The image is then stored in the memory  116  within computer  104 . Alternatively, the original image could be generated by a drawing or drafting program (shown generally as image processing program  122 ) executed on the computer  104  or another computer and stored, as image file  120 , in memory  116 . The computer  104  contains at least one central processing unit (CPU)  112 , memory  116 , and various well-known CPU support circuits  114 . An illustrative computer is a Macintosh Quadra model 900 manufactured by Apple Computer, Inc. of Cupertino, Calif. The transformation program  118  and the image editing program  122  as well as one or more images are stored in the memory  116 . 
     In operation, a user typically manipulates the user command input device  106  such as a mouse, trackball, light pen, and/or keyboard, to control, via the computer  104 , the image input device  102 , e.g., an image scanner. The image scanner, in a conventional manner, scans a hardcopy of an image and stores a digitized representation of the hardcopy in the memory  116  as an image file  120 . Subsequently, the user can instruct the CPU  112  to execute the image processing program  122  and also to recall an image file (original image) from the memory. The image processing program  122  interacts, as necessary, with the transformation program  118  to facilitate color space transformation and display of the image on the monitor  108  and the printer  110 . 
     Broadly speaking, the transformation program  118  contains an executable routine that transforms a color space having n-dimensions to a color space having m-dimensions. In particular, consider a transformation T: R″→R′″ from an n-dimensional color space to a m-dimensional space and suppose that n&gt;m. For example, R″ may be a CMYK color space and R′″ may be an RGB color space. Since n has more dimensions than m, the mapping transformation T will generally be many-to-one. In other words, there are typically many different colors x in R″ such that T(x)=y where y is a given color. In the general case, there will be an (n−m)-dimensional set of colors x such that T(x)=y for any given y. 
     Inverting T is problematic. Since T is many-to-one, there is no full inverse T −1  such that T −1 (T(x))=x for all x. Nonetheless, to perform accurate inverse color transformations in practical situations, it is important to be able to recover x as closely as possible from T(x). 
     The present invention makes use of the observation that even though R″ is a higher-dimensional space than R′″, for many purposes, not all of R″ is used to produce colors in an image. In fact, usually no more than an m-dimensional subspace of R″ is used to produce a pixel color. Hence, for many purposes, it suffices to invert T(x) on an m-dimensional subspace. 
     The invention, which is embodied in a software routine  200  shown in  FIG. 2 , operates as follows: 
     The routine begins by creating an m-dimensional grid which samples R′″, an m-dimensional color space image. For example, if R′″ is in an RGB color space, then, at step  204 , the routine creates, in memory, a table G. The table contains a grid that illustratively consist of 32×32×32 elements P. This grid is referred to as an interpolation table G. In each element P of table G, the routine places an n-dimensional value H(i 1 , i 2 , . . . i m )=(h 1 , h 2 , . . . h n ). These values of H are initialized using a default mapping from color space R′″ to color space R″. For example, if R′″ is RGB and R″ is CMYK, the default transformation can be given by a standard transformation with a particular UCR or GCR black generation strategy. 
     At step  206 , the routine defines an interpolation function S(x 1 , x 2 , . . . x m )=(s 1 , s 2 , . . . s n ) based on the present elements H in the grid. For example, S can be the tri-linear interpolation of the entries H in G. With the interpolation defined, S is then a function from R′″ to R″ The goal is to set the elements H in G such that the function S accurately inverts the given transformation function T(x). 
     In order to establish the values H, the routine looks for colors in R″ that transform, according to the forward transformation T, to locations in R′″ near the samples in the interpolation table G. In order to achieve this goal, the routines stores with each element P, a distance D(P) to the nearest sample found thus far. If the method subsequently finds a closer sample, the routine updates G(P) and D(P). D(P) is initialized to the largest representable value at the beginning of the method. 
     Specifically, the source for the colors C is a source image containing a collection of pixels x in R″ that ideally spans the range of colors of interest. For each x in C, the routine, at step  208 , computes y=T(x). The routine, at step  210 , then finds the point P in G which is closest to y. If, at step  212 , D(P) is less than a distance Q between y and P, the method, at step  214 , sets G(P) to y and D(p) to Q. Through step  216 , the routine repeats this operation for all the pixels in the source image. 
     If, at step  212 , the distance D(P) of a point P in the grid G is not zero, then T(G(P)) is not exactly equal to P. In order to reduce or eliminate this error, the routine, at step  218 , uses a second phase in which, for each point P in the grid G, the routine minimizes the squared error (T(G(P))−P) 2  by modifying value H. This produces a continuous minimization of the H values over m-variables and can be done using simple gradient descent, or a coarse-to-fine search technique. These techniques and other more sophisticated continuous minimization methods are well described in the literature (c.f. Practical Optimization, Gill et. al., Academic Press 1984). 
     It is possible that the table resulting from the second phase, i.e., an updated table G containing modified H values, can be insufficiently smooth if the colors in the source image do not cover the entire color space. Consequently, there will be a transition region between the portion of G(P) which still contains the original default mapping and the portion that contains the updated mapping based on the source image. To ensure that there are no objectionable artifacts produced by this boundary, the routine, at step  220 , smoothes the values H in G in a third phase. Any low-pass filter may be used for this smoothing operation. For mappings from RGB to CMYK using a 32×32×32 table, averaging each CMYK sample H with its 9 neighbors produces acceptable results. The routine ends at step  222 . 
     Using the grid G and the interpolation function S, any input pixel value from an m-dimensional color space is accurately transformed into a pixel value in an n-dimensional color space.  FIG. 3  depicts a flow chart of a transformation routine  300  that performs such a dimensional transformation upon input pixel values. 
     The routine is entered at step  302  and proceeds to step  304 . At step  304 , an pixel value from an m-dimensional color space, e.g., RGB color space, is input. At step  306 , the routine determines the H values in the table G that are nearest the input pixel value. The nearest H values are, at step  308 , interpolated using the interpolation function S. At step  310 , the routine outputs a pixel value in n-dimensional color space, e.g., CMYK color space. Lastly, the routine ends at step  312 . 
     In operation, the two routines ( FIGS. 2 and 3 ) have obtained quite satisfactory results transforming colors from RGB to CMYK using the conventional tri-linear interpolant. The resulting transformation has the property for RGB to CMYK transformation that it reproduces very accurately the black generation in the original CMYK file. In experiments, the observed errors typically on the order of one or two percent of the original CMYK values. 
     Using the present invention within an image editing system, an operator can convert a series of images from CMYK to RGB, re-touch or edit the images in RGB, and then transform the result back into CM, knowing that the black-generation of the resulting CMYK image will very closely match the original black-generation. 
     Although one embodiment incorporating the teachings of the present invention has been shown and described in detail herein, those skilled in the art can readily devise many other varied embodiments that still incorporate these teachings.