Abstract:
An object of the invention is to provide an image coding device and an image decoding device enabling a transmitting color function through irreversible coding by performing the processing to reduce the occurrence of noises at the encoder&#39;s end without using a mask image. A grayscale shift unit shifts the grayscale of a transmitting color of an original image, after which a coding unit performs irreversible coding on the image. A transmitting color judging unit judges the transmitting color of a decoded image based on luminance information alone, and an up-sampling unit restores an outline of an object faithfully without being accompanied by deterioration in resolution resulted from the sub-sampling. It is thus possible to obtain a high-quality image with fewer noises.

Description:
BACKGROUND OF THE INVENTION  
         [0001]    1. Field of the Invention  
           [0002]    The invention relates to an image coding device and an image decoding device for compositing an object image with a background image through irreversible coding having a high compression rate, using a specific color of an image as a transmitting color.  
           [0003]    2. Description of the Related Art  
           [0004]    To meet the advancement of digital image processing techniques, image composition processing for compositing an input image from an image reading apparatus, such as a digital camera and a scanner, with another image to be used as a background image has been used increasingly in recent years. In a case of TV broadcasting and movies, a picture of an individual standing in front of a blue or green background is taken with a camera, then the color portion of the background in the pictured video is composited with a scene of a foreign country or the like through the use of a method called a chroma key, and a video as if the individual were in that country is thereby produced.  
           [0005]    In the WWW browser of the Internet, an image of an outlined subject is also composited with a background image. In this case, the image composition is performed on the personal computer of the user. However, because an image to be placed on the foreground is sent from a remote server over the Internet, the image is compressed to save the transmission time. The outlined subject to be placed on the foreground is called an object and the surroundings of the object are filled with a specified transmitting color, so that the background will be visible only through the portion of the transmitting color that becomes transparent when the object and the background image are superimposed. GIF (Graphics Interchange Format) and PNG (Portable Network Graphics) are known as a standard image format that realizes the transmitting color in the above manner and comes with the WWW browser. Both of these compression methods adopt reversible compression by which an image will not change due to compression.  
           [0006]    For a color facsimile machine, there is an optional coding method called MRC (Mixed Raster Content) that enables the image composition in the same manner as above. According to MRC, an image is divided into three layers: a fore layer, a mask layer, and a back layer, and each layer is encoded through different methods. The fore layer and the back layer are color images and the mask layer is a binary image, and which of the fore layer and the back layer is to be displayed is selected at the decoder&#39;s end.  
           [0007]    Also, MPEG (Moving Picture Coding Experts Group)-4 used for encoding a moving image is furnished with an object-based coding function that enables the image composition in the same manner as above. According to the object-based coding, an image called an alpha plane is used separately besides an image containing an object to specify a transparent portion surrounding the object. The alpha plane includes a binary alpha plane of a binary image and a grayscale alpha plane. The grayscale alpha plane is used to specify translucence as an option, and irreversible coding is applied. The binary alpha plane is essential and reversible coding is applied.  
           [0008]    [0008]FIG. 7 shows the original image  1  with a specified transmitting color  5 , and FIG. 8 shows the decoded image  2  obtained through irreversibly coding. The reason why the related arts use the reversible coding for the image composition using a transmitting color as with GIF and PNG is as follows. That is, even when the transmitting color is specified, the pixel density is changed between a non-encoded original image  1  and a decoded image  2  in the case of irreversible coding, which causes noises particularly near the edge, and a portion other than the transmitting color portion is thereby produced in the surroundings of an object  4 . Both in FIG. 7 and in FIG. 8, the gray portion represents the transmitting color. The reversible coding, however, has a problem that a compression rate is lower than that of the irreversible coding.  
           [0009]    In order to use the irreversible coding while avoiding the occurrence of noises  6  in the surroundings of the object  4 , a mask image is used separately besides the images to be composited as with the arbitrary shape coding in MRC and MPEG-4. Of a mask image  3  of FIG. 9, a white portion specifies the display of an object and a black portion specifies the display of a background. However, although a mask image is a binary image, it has to be reversibly encoded, which increases an overall coding quantity. Moreover, the need to composite images at the decoder&#39;s end using two or more coding methods not only complicates the device, but also demands a larger memory capacity, thereby posing a problem that the manufacturing costs are increased.  
           [0010]    Further, in many cases of irreversible coding, an image is separated into a luminance component and two color-difference components before being encoded, and sub-sampling is performed on the color-difference components. This is because the human eyes are less sensitive to a change in color difference in comparison with a spatial change in luminance. Thus, in the case of a natural image, when an individual sees an image restored to the original resolution through up-sampling at the time of decoding, he hardly notices deterioration in image quality; moreover, it is almost impossible to identify a difference between an image restored from the data on which the sub-sampling was performed and an image restored from the data on which the sub-sampling was not performed. The occurrence of noises can be suppressed by lowering the compression rate even in the irreversible coding method. However, because the resolution is deteriorated when the sub-sampling is performed, lowering the compression rate is not suitable when displaying characters, the shape of an object, etc.  
         SUMMARY OF THE INVENTION  
         [0011]    Accordingly, an object of the invention is to provide an image coding device and an image decoding device enabling a transmitting color function through irreversible coding by performing the processing to reduce the occurrence of noises at the encoder&#39;s end without using a mask image.  
           [0012]    The invention provides an image coding device, comprising: grayscale shifting means for shifting a grayscale of luminance of a transmitting color of an original image; and image coding means for irreversibly encoding the image whose grayscale has been shifted by the grayscale shifting means.  
           [0013]    According to the invention, the grayscale of the transmitting color of an original image is shifted by the grayscale shifting means, after which irreversible coding with a high compression rate is performed. It is thus possible to encode an object with a smaller coding quantity without using a mask image. Also, because the need to use the mask image can be eliminated, the structure can be simpler, and hence the cost can be saved.  
           [0014]    In the invention it is preferable that the grayscale shifting means uses a value representing a darkest color of black as the grayscale of luminance of the transmitting color.  
           [0015]    In the invention it is preferable that the grayscale shifting means uses a value representing a brightest color of white as the grayscale of luminance of the transmitting color.  
           [0016]    In the invention it is preferable that the grayscale shifting means shifts the grayscale of luminance of the transmitting color of the original image which exists within a predetermined range, to an outside thereof.  
           [0017]    Furthermore, the invention provides an image decoding device comprising: image decoding means for decoding an encoded image; and transmitting color judging means for judging a transmitting color from luminance information of the image decoded in the image decoding means.  
           [0018]    According to the invention, an encoded image is decoded in the image decoding means, and the transmitting color judging means judges the transmitting color of the decoded image using the luminance information alone. It is thus possible to restore and reproduce the outline of an object faithfully without being accompanied by deterioration in resolution resulted from the sub-sampling.  
           [0019]    Further, in the invention it is preferable that the transmitting color judging means uses a value representing a darkest color of black as a grayscale of luminance judged as being the transmitting color.  
           [0020]    Further, in the invention it is preferable that the transmitting color judging means uses a value representing a brightest color of white as a grayscale of luminance judged as being the transmitting color.  
           [0021]    In the invention it is preferable that the image decoding means replaces, out of grayscales of luminance of the image decoded, grayscales outside a predetermined range, within the predetermined range.  
           [0022]    Furthermore, the invention provides an image processing apparatus comprising: grayscale shifting means for shifting a grayscale of a transmitting color of an original image; image coding means for irreversibly encoding the image whose grayscale has been shifted by the grayscale shifting means; image decoding means for decoding the image encoded by the image coding means; and transmitting color judging means for judging the transmitting color from luminance of the image decoded by the image decoding means.  
           [0023]    According to the invention, the grayscale of the transmitting color of an original image is shifted by the grayscale shifting means, after which the irreversible coding with a high compression rate is performed, and the object is thereby encoded with a smaller coding quantity without using a mask image. The image encoded in this manner is decoded, and the transmitting color judging means judges the transmitting color of the decoded image based on the luminance information alone. The outline of the object is thus restored faithfully without being accompanied by deterioration in resolution resulted from the sub-sampling, thereby making it possible to obtain a high-quality image with fewer noises. Also, because the need to use the mask image can be eliminated, the arrangement can be simpler, and hence the cost can be saved.  
           [0024]    Further, in the invention it is preferable that the grayscale shifting means uses a value representing a darkest color of black as the grayscale of luminance of the transmitting color, and the transmitting color judging means uses the value representing the darkest color of black as the grayscale of luminance judged as being the transmitting color.  
           [0025]    Further, in the invention it is preferable that the grayscale shifting means uses a value representing a brightest color of white as the grayscale of luminance of the transmitting color, and the transmitting color judging means uses the value representing the brightest color of white as the grayscale of luminance judged as being the transmitting color.  
           [0026]    Further, in the invention it is preferable that the transmitting color judging means uses only luminance in judging the transmitting color, and uses a value representing a darkest color of black as the grayscale of luminance judged as being the transmitting color.  
           [0027]    Further, in the invention it is preferable that the transmitting color judging means uses only luminance in judging the transmitting color, and uses a value representing a brightest color of white as the grayscale of luminance judged as being the transmitting color.  
           [0028]    In the invention it is preferable that the grayscale shifting means shifts the grayscale of luminance of the transmitting color of the original image which exists within a predetermined range, to an outside thereof, and that the image decoding means replaces, out of grayscales of luminance of the image decoded, grayscales outside a predetermined range, within the predetermined range.  
           [0029]    According to the invention, an object image can be encoded at a low cost by suppressing the occurrence of the noises in a transmitting color portion without using a mask image needed in the related arts. Because the transmitting color is judged based on the luminance alone, the outline of the object can be reproduced faithfully without being accompanied by deterioration in resolution resulted from the sub-sampling, thereby making it possible to obtain a high-quality image. Further, by using the value representing the darkest color of black or the value representing the brightest color of white as the grayscale of luminance judged as being the transmitting color, it is possible to use the value with reference to which noises were eliminated through clipping as the transmitting color. Hence, should noises occur in a color-difference image, the transmitting color can be still judged correctly. 
       
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS  
       [0030]    Other and further objects, features, and advantages of the invention will be more explicit from the following detailed description taken with reference to the drawings wherein:  
         [0031]    [0031]FIG. 1 is a block diagram showing an image processing apparatus according to one embodiment of the invention;  
         [0032]    [0032]FIG. 2 is a view showing, in a case where an original image on a white (pixel value R) background has a step-like edge and noises are occurring near the edge in a decoded image, how the noises having the pixel values equal to or greater than R are shifted to R−1 through clipping;  
         [0033]    [0033]FIG. 3 is a view used to explain a first conversion equation set in a shift processing unit;  
         [0034]    [0034]FIG. 4 is a view used to explain a second conversion equation set in the shift processing unit;  
         [0035]    [0035]FIG. 5 is a view used to explain a third conversion equation set in the shift processing unit;  
         [0036]    [0036]FIGS. 6A through 6D are views used to explain the principle based on which the image processing apparatus reduces noises in a transmitting color portion surrounding an object when 0 is given to a transmitting color;  
         [0037]    [0037]FIG. 7 is a view showing an original image with a specified transmitting color in the related art;  
         [0038]    [0038]FIG. 8 is a view showing a decoded image obtained through irreversible coding in the related art; and  
         [0039]    [0039]FIG. 9 is a view showing a mask image used in the related art.  
     
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS  
       [0040]    Now referring to the drawings, preferred embodiments of the invention are described below.  
         [0041]    [0041]FIG. 1 is a block diagram showing an image processing apparatus  30  according one embodiment of the invention. The image processing apparatus  30  of this embodiment includes an image coding device  31  and an image decoding device  32 . The image coding device  31  includes a color converting unit  33 , a sub-sampling unit  34 , a shift processing unit  35  as grayscale shifting means, and an irreversible coding unit  36  as image encoding means. Also, the image decoding device  32  includes a decoding unit  37  as image decoding means, an up-sampling unit  38 , a transmitting color judging unit  39  as transmitting color judging means, and a color converting unit  40 .  
         [0042]    In the image coding device  31 , the color converting unit  33  converts a color space of an original image  20  using, for example, the RGB representation, into luminance and two color differences. As a color space represented by the luminance and the color differences, a YCbCr color space is used for a digital camera and a TV camera, and a CIELAB color space is used for a color facsimile machine. The color representation system of a color space differs depending on an application program installed in each machine. However, the invention is not addressed to an essential difference, and it is therefore sufficient to use a color converting method of the International Standards.  
         [0043]    The sub-sampling unit  34  leaves the resolution of luminance intact and lowers the resolution of the color differences. As a method of sampling, a method of sampling pixels both vertically and horizontally to assign a color difference to four luminance pixels, or a method of sampling pixels only horizontally to assign one color-difference pixel to two luminance pixels is adopted. The sampling method may adopt an averaging method instead of using the skipping method alone.  
         [0044]    To be more specific, assume that the grayscale is represented by 0 to R−1, then the grayscale of luminance of a transmitting color in a transmitting color portion  21  surrounding an object  23  is either 0 or R−1. Herein, R is an integer, and R=256 for 8-bit data. In regard to an image  20  inputted into the image coding device  31 , assume that a range of the transmitting color is determined in advance, and the transmitting color portion  21  is also determined in advance to be either white or black. Given R=256 and white is the transmitting color, then 255 is given to each of RGB, and a value of the luminance after the color conversion is also 255. When black is the transmitting color, 0 is given to each of RGB, and the value of the luminance is also 0. The shift processing unit  35  shifts the grayscale to a negative value for the transmitting color having the luminance 0, and to a value equal to or greater than R for the transmitting color having the luminance R−1.  
         [0045]    The principle based on which the noises in the transmitting color are reduced by the shift will now be explained. Given R as the grayscale, then a pixel value is an integer value from 0 to R−1. Generally, 256 is often given to R, which is a value for 8-bit data, and this value is also adopted in this embodiment. The pixel value (R=256) is inputted when the coding is performed. However, in the case of irreversible conversion coding, such as JPEG and JPEG2000, an error occurs due to frequency conversion and quantization, and for this reason, the pixel value may go outside the grayscale range when the image is decoded. In this case, the decoding unit  37  performs clipping processing to return the pixel value outside the range to a boundary value, that is, 0 or R−1.  
         [0046]    [0046]FIG. 2 is a view showing, in a case where an original image on a white (pixel value R) background has a step-like edge and noises are occurring near the edge in a decoded image, how the noises having the pixel values equal to or greater than R are shifted to R−1 through clipping. Such clipping processing eventually makes only the noises having the pixel values equal to or lower than R−1 visible. Most of the noises on the background having the pixel values outside the grayscale range before the coding are eliminated through clipping as shown in FIG. 2 when the grayscale width used to shift the background is larger than the grayscale width of the noise occurring due to the coding.  
         [0047]    The reason why a transmitting color is set to the boundary value of the grayscale is as follows. That is, the file formats enabling the transmitting color function are limited to those of the reversible coding methods having a low compression rate, such as GIF and PNG. Meanwhile, because the value is changed through irreversible conversion coding having a high compression rate, such as JPEG, a portion of a color other than the transmitting color turns to the transmitting color, or conversely, a portion of the transmitting color turns to a color other than the transmitting color, which results in a dot-like missing display spot called a “void” on the object  23 , or a dot-like extra display portion called a “dirt” in the surroundings of the object  23 , and the image quality of the composite image is thus deteriorated.  
         [0048]    Hence, advantage is taken of the characteristic that all the values outside the grayscale range are returned to the boundary value through clipping, in other words, by specifying the boundary value of the grayscale as the transmitting color and shifting this value to outside the grayscale range before the coding, it becomes possible to achieve the transmitting color function through irreversible conversion coding without deteriorating the image quality of the composite image. A color specified as the transmitting color is either 0 (black) or R−1 (white) or both.  
         [0049]    [0049]FIG. 3 is a view used to explain a first conversion equation set in the shift processing unit  35 , FIG. 4 is a view used to explain a second conversion equation set in the shift processing unit  35 , and FIG. 5 is a view used to explain a third conversion equation set in the shift processing unit  35 . The shift processing unit  35  is set with the conversion equations needed for the aforementioned shift processing. The conversion equations may take several forms, and conversion equations expressed by linear functions are set forth below as one example, where Yi is the luminance of an input image to the shift processing unit  35 , Yo is the luminance of an output image from the shift processing unit  35 , R is the number of grayscale (herein, R=256, which is a value for 8-bit data), and each of α, β, D1, and D2 is 0 or a positive integer.  
         [0050]    (a) First Conversion Equation 
           Yo=−D 1( Yi =0)  (1) 
           Yo=αYi+β (0 &lt;Yi&lt;R− 1)  (2) 
           Yo=R− 1 +D 2( Yi=R− 1)  (3) 
         [0051]    (b) Second Conversion Equation 
           Yo=−D 1( Yi= 0)  (4) 
           Yo=αYi+β (0 &lt;Yi≦R− 1)  (5) 
         [0052]    (c) Third Conversion Equation 
           Yo=αYi (0 ≦Yi&lt;R− 1)  (6) 
           Yo=R− 1 +D 2( Yi=R− 1)  (7) 
         [0053]    The first conversion equation having Equations (1) through (3) uses both 0 and R−1 as the transmitting color. The second conversion equation having Equations (4) and (5) uses 0 as the transmitting color, and the third conversion equation having Equations (6) and (7) uses R−1 as the transmitting color. Each conversion equation is set in such a manner that the transmitting color is shifted to outside the grayscale range. The conditions for α and β in the first through third conversion equations are: α≦1 and β≧0.  
         [0054]    There is a possibility that a pixel within the object  23  turns into the transmitting color through the coding and the aforementioned dot-like missing display spot is produced within the object  23 . In order to reduce the possibility of the occurrence of such a dot-like missing display spot, the grayscale values of pixels within the object  23  are set to values far from that of the transmitting color. These values far from that of the transmitting color take values farther from that of the transmitting color after the conversion through any of the first through third conversion equations by giving a smaller value to α and a larger value to β. In a case where pixels having the grayscale 0 or R−1, which is the grayscale of the transmitting color, are originally contained within the object  23 , the occurrence of the dot-like missing display spot cannot be avoided by merely using the first through third conversion equations. Hence, in order to forestall such an inconvenience, the pre-processing is performed on the pixels within the object  23 , so that the pixel value is changed from 0 to 1, for example.  
         [0055]    The irreversible coding unit  36  collectively encodes all the components separated into the luminance and the color differences. Color conversion coding is used as the irreversible coding, and JPEG (Joint Photographic Coding Experts Group) and MPEG (Moving Picture Coding Experts Group) of the International Standards can be used. The conversion coding reduces information by separating an image into spatial components, followed by fine quantization for low-frequency components and rough quantization for high-frequency components. This is because the human eyes are not so sensitive to the high-frequency components that the image quality hardly deteriorates when the high-frequency components are made less accurate. It should be noted, however, that the less accurate high-frequency components generate high frequency noises.  
         [0056]    The image data encoded in the image coding device  31  is stored first in an accumulation medium through a communication line or the like, then read out therefrom, and inputted into the image decoding device  32 .  
         [0057]    In the image decoding device  32 , the decoding unit  37  decodes data encoded in the image coding device  31 , and converts the encoded data into image data represented by luminance and color differences. In this instance, of the grayscales outside the range from 0 to R−1, those having negative values are returned to 0 and those having values equal to or greater than R are returned to R−1 by the decoding unit  37  through clipping.  
         [0058]    The up-sampling unit  38  returns the resolution of the color differences to the original resolution, that is, to the resolution as high as that of luminance. As a method of the up-sampling, a method of copying a single pixel to four color-difference pixels, a method of effecting interpolation, etc. can be adopted when two color-difference pixels are assigned to four luminance pixels.  
         [0059]    The transmitting color judging unit  39  judges a portion having the luminance 0 or R−1 as the transmitting color. In general, white or black specified as the transmitting color is colorless, and for this reason, the color-difference value is R/2 (128 when R=256), that is, an intermediate value of the grayscale. However, the color-difference value may take a value other than R/2 due to influences of noises caused by the sub-sampling and the irreversible coding, which may give a color to the transmitting color. In order to avoid such an inconvenience, the transmitting color judging unit  39  changes the color-difference value forcedly to R/2 when the luminance has the value specified as that of the transmitting color.  
         [0060]    The color converting unit  40  converts a color space represented by the luminance and the color differences to a color space specific to the display device, which allows an image to be displayed. For example, an RGB color space is used when the display device is a display, and a CMYK color space is used when the display device is a printer.  
         [0061]    [0061]FIGS. 6A through 6D are views used to explain the principle based on which the image processing apparatus  30  reduces noises in a transmitting color portion surrounding the object when 0 is given to the transmitting color. In the drawings, the ordinate is used for the grayscale value and the abscissa is used for the pixel position on one line of an image. FIG. 6A shows an original image containing the transmitting color, and the grayscale of the transmitting color portion is shifted to a negative value by the shift processing unit  35  as shown in FIG. 6B.  
         [0062]    The image data encoded in the image coding device  31  is inputted into the image decoding device  32  through transmitting means  25  achieved by a communication line or an accumulation device, and decoded in the decoding unit  37 . FIG. 6C shows the decoded luminance prior to the clipping, and noises in the transmitting color portion  21  are eliminated as shown in FIG. 6D through the clipping processing by which the grayscale is rounded off to the range from 0 to R−1. Although noises are left in the color-difference portions, noises caused from the color-difference components will not affect the transmitting color portion  21  because the transmitting color is judged based on the luminance components alone. An image of the background is composited with the transmitting color portion obtained in this manner.  
         [0063]    As has been described, according to this embodiment, because noises in the transmitting color portion  21  can be suppressed, the object-based coding can be achieved through irreversible coding having a high compression rate without using a mask image separately. Also, because the mask composition processing is not needed, the arrangement of the device can be simpler, and hence the manufacturing costs can be saved. Further, because a standard image coding method used extensively in encoding a natural image can be adopted as the coding method regardless of whether a moving image or a still image is to be encoded. Hence, this embodiment can be implemented easily, and can be readily incorporated into various application programs.  
         [0064]    The invention can be suitably applied to application programs handling a moving image and a still image, installed into the WWW browser, a color facsimile machine, a television telephone, and a cellular phone equipped with a display, etc.  
         [0065]    The invention may be embodied in other specific forms without departing from the spirit or essential characteristics thereof. The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description and all changes which come within the meaning and the range of equivalency of the claims are therefore intended to be embraced therein.