This application is based on Japanese Patent Application No. 2003-333856 filed on Sep. 25, 2003, the content of which is hereby incorporated by reference.
1. Field of the Invention
The present invention relates to an image processing apparatus, an image processing program, an image processing method and a data structure for data conversion, and more particularly to an image processing apparatus, an image processing program and an image processing method for forming a composite image by superimposing an overlay image on a base image, and a data structure for data conversion which is suited to be used for the device, the program and the method.
2. Description of Related Art
In recent years, with respect to image data which is stored to be printed or for other purposes, various kinds of image data compressing methods for reducing the volume of the stored data have been suggested. Also, various kinds of methods for combining two or more images have been suggested.
An example of forming and printing composite images is inset printing, in which changeable overlay images (for example, seat numbers) are superimposed on a fixed base image (for example, a theater ticket), and the formed composite images are successively printed.
Japanese Patent Laid-Open Publication Nos. 2003-46738 (Reference 1), 6-164950 (Reference 2), 2002-271791 (Reference 3) and 7-336675 (Reference 4) disclose data encoding methods of GBTC type. In these methods, image data is divided into a plurality of blocks, and for each block, a statistical parameter, such as a gray level representing the block, and quantization levels of the respective pixels in the block are encoded to form compressed data with a fixed length.
In forming a composite image by superimposing an overlay image on a base image, generally, a method in which the gray level of the overlay image is checked block by block is adopted. In the method, more specifically, when the gray level in a block of the overlay image is not less than 1, the image data of the overlay image is taken in for the corresponding block, and when the gray level in a block of the overlay image is 0, the image data of the base image is taken in for the corresponding block.
If this method is adopted to combine full-color image data, however, a problem is caused. Full-color image data is composed of data of the three primary colors and black, namely, CMYK. In checking the gray level of the overlay image in a block-by-block manner, if the gray level of one of the colors is 0, the color data of the overlay image is replaced with the corresponding color data of the base image. Consequently, color mixture is caused.
Reference 4 discloses a method for forming a composite image by superimposing an image B on an image A. In this method, if a block of the image B completely covers a block of the previously written image A, the encoded data of the block of the image A is updated (see paragraph 0007 of Reference 4).
In other words, in the method disclosed by Reference 4, since the image B has priority over the image A, in the region of the image B, the image A is completely deleted. Therefore, if the image A and the image B are of the same size, the base image A will be wholly deleted.
In the case of the above-mentioned inset printing, if the base image and the overlay image are of the same size, or if the overlay image is relatively large, according to the method disclosed by Reference 4, the entire or a large part of the base image A will be deleted.
An object of the present invention is to provide an image processing apparatus, an image processing program and an image processing method which forms a composite image by superimposing an overlay image on a base image without causing a problem of color mixture, and a data structure for data conversion which is suited for the image processing device, the image processing program and the image processing method.
In order to attain the object, a first aspect of the present invention relates to an image processing apparatus for forming a composite image by superimposing an overlay image which is composed of data of a plurality of colors on a base image, and the image processing apparatus comprises a data conversion section which, while checking a gray level of the overlay image in a block-by-block manner, if the data of all the colors in a block indicates a gray level of 0, sets the gray levels of all the colors to 0 for the corresponding block of the composite image, and if the data of at least one of the colors in a block indicates a gray level not less than 1, sets the gray levels of the other colors, which are 0, to an invisible gray level for the corresponding block of the composite image and keeps the gray level of the color, which is not less than 1, for the corresponding block of the composite image.
A second aspect of the present invention relates to an image processing program for commanding a computer to form a composite image by superimposing an overlay image which is composed of data of a plurality of colors on a base image, and the image processing program comprises a data converting step in which, while a gray level of the overlay image is being checked in a block-by-block manner, if the data of all the colors in a block indicates a gray level of 0, the gray levels of all the colors are set to 0 for the corresponding block of the composite image, and if the data of at least one of the colors in a block indicates a gray level not less than 1, the gray levels of the other colors, which are 0, are set to an invisible gray level for the corresponding block of the composite image, and the gray level of the color, which is not less than 1, is kept for the corresponding block of the composite image.
A third aspect of the present invention relates to an image processing method for forming a composite image by superimposing an overlay image which is composed of data of a plurality of colors on a base image, and the image processing method comprises a data converting step in which, while a gray level of the overlay image is being checked in a block-by-block manner, if the data of all the colors in a block indicates a gray level of 0, the gray levels of all the colors are set to 0 for the corresponding block of the composite image, and if the data of at least one of the colors in a block indicates a gray level not less than 1, the gray levels of the other colors, which are 0, are set to an invisible gray level for the corresponding block of the composite image, and the gray level of the color, which is not less than 1, is kept for the corresponding block of the composite image.
According to the first, the second and the third aspects of the present invention, while the gray level of the overlay image is being checked in a block-by-block manner, if the data of at least one of the colors in a block indicates a gray level not less than 1, the gray levels of the other colors, which are 0, are set to an invisible gray level for the corresponding block of the composite image, and thereby, color mixture of the overlay image with the base image can be avoided. This processing can be carried out very fast by use of a conventional image processing system.
In the apparatus, the program and the method according to the first, the second and the third aspects of the present invention, the invisible gray level is preferably 1 or 2. The base image and the overlay image to be combined with each other may be expressed by bmp data or by any type of compressed data.
A fourth aspect of the present invention relates to a data structure for data conversion, and in the data structure, while a gray level of input image data which is composed of data of a plurality of colors is being checked in a block-by-block manner, if the data of all the colors in a block indicates a gray level of 0, the gray levels of all the colors is set to 0 for the corresponding block, and if the data of at least one of the colors in a block indicates a gray level not less than 1, the gray levels of the other colors, which are 0, are set to an invisible gray level for the corresponding block, and the gray level of the color is kept for the corresponding block. The invisible gray level is preferably 1 or 2.
The data structure according to the fourth aspect of the present invention can be used like a conventional ICC profile. The data structure can be used as the data conversion section in the image processing apparatus according to the first aspect of the present invention and can be used as the data converting step in the image processing program according to the second aspect of the present invention and in the image processing method according to the third aspect of the present invention.
This and other objects and features of the present invention will be apparent from the following description with reference to the accompanying drawings, in which:
a and 8b are charts which show a way of pixel data at the time of expansion and a way of converting pixel data at the time of compression, respectively;
Image processing apparatuses, image processing programs and image composing methods according to preferred embodiments of the present invention are described with reference to the accompanying drawings.
First, GBTC (generalized block truncation coding) which is a basis of an image composing method according to the present invention is described.
In the present embodiment, image data compression by GBTC includes fixed length compression and variable length compression. In fixed length compression, multi-value bit map (bmp) image data (for example, eight bits per pixel) is divided into a plurality of blocks such that each block includes, for example, 4×4 pixels, and each block which thus includes 16 bytes is compressed to six bytes. In variable length compression, a parameter which indicates, for example, that all the pixels in the block are of the same gray level is quantized, and data is further compressed.
The GBTC compressed data is irreversible to the multi-value bmp data, and it is possible that part of gray level data may be lost. However, when data which was once compressed and expanded by GBTC is compressed and expanded by GBTC again, deterioration of picture quality is not caused. Fixed length compressed data and variable length compressed data are reversible to each other.
As the first process of data compression by GBTC, fixed length compression of bmp data is described. The fixed length compression is executed following the steps (A1) to (A5) described below.
At step (A1), 4×4 pixels are extracted as one block from the bmp data.
At step (A2), the average gray level and the gray level width of the block (16 pixels) are calculated. More specifically, the maximum and the minimum of the gray levels of the 16 pixels are calculated, and the middle between the maximum and the minimum is calculated as the average gray level of the block. Also, the difference between the maximum and the minimum is calculated as the gray level width of the block. Then, the gray level width is divided into quarters (see
The maximum gray level of the block is MAX, the minimum gray level of the block is MIN, the average gray level is LA, the gray level width is LD, the minimum value of the highest quarter of the LD is LMAX, and the maximum value of the lowest quarter of the LD is LMIN. Then, the following expressions are formed. “Di” means a pixel.
At step (A3), the gray level of each pixel in the block is converted into a two-bit code. More specifically, the gray levels of the pixels are classified into the ranges (a) through (d) and are converted into the corresponding two-bit codes (see
Therefore, if a pixel is denoted by Di and if a two-bit code is denoted by φi, there are the following relationships:
At step (A4), data of the respective blocks are shaped into pieces of data with a fixed length. More specifically, as data indicating one block, the average gray level, the gray level width and the two-bit codes of the respective pixels are arranged (see
At step (A5), the above-described steps (A1) through (A4) are executed on a block-by-block basis, and an array of pieces of block data with a fixed length is formed. Thus, the entire image data is turned into an array of six-byte block data which is converted from data of 4×4 pixels (see
Next, as the second process of GBTC compression, variable length compression of the fixed length compressed data is described. The variable length compression is executed following the steps (B1) through (B3) described blow.
At step (B1), the fixed length block data is classified into the following four patterns depending on the gray levels of the pixels:
At step (B2), the four patterns are expressed by variable length attribute bit codes (two-bit codes) as follows:
At step (B3), the data indicating one block is shaped by combining the variable length attribute code (two-bit code) and the two-bit codes of the pixels in the block (see
As is apparent from
A blank portion of an image is the pattern (A), and a thick portion (in which all the pixels are of the same gray level with respect to RGB) is the pattern (B) or (C). The pattern (D) indicates that the 4×4 pixels are of different gray levels, and the pattern (D) is less likely to appear than the patterns (A), (B) and (C) except that the image is intentionally formed. Therefore, by further performing the variable length compression as well as the fixed length compression, the data size is reduced more.
In order to expand the GBTC compressed data to multi-value bmp data, it is required to execute a process of expanding the variable length compressed data to fixed length compressed data and a process of expanding the fixed length compressed data to bmp data.
The first expansion process from the variable length compressed data to fixed length compressed data is executed following the steps (C1) through (C3) described below.
At step (C1), an expansion pattern of each block is selected from (A) through (D) according to the variable length attribute bit code as follows (see
When the patterns (A), (3) or (C) is selected, the two-bit codes for the respective pixels are produced based on the selected pattern. When the pattern (D) is selected, the variable length compressed data includes the two-bit codes of the respective 16 pixels.
At step (C2), fixed length compressed data is produced based on the variable length attribute bit code, the average gray level and the gray level width (see
In the case of pattern (C), because the gray levels of all the pixels are equal to each other, the value of one byte following the variable length attribute bit code is used as the gray level of all the pixels, and the gray level width is “0”. Further, the two-bit codes of the respective pixels are all “0”.
At step (C3), the variable length attribute bit code is deleted. In the case of pattern (D), because the variable length attribute bit code is followed by fixed length block data with six bytes, the first two bits of the data are deleted.
The second expansion process from the fixed length compressed data to eight-bit bmp data is executed in a pattern 1 or in a pattern 2 according to the variable length attribute bit code. The pattern 1 is selected when the average gray level is “0” or “0×FF” and when the gray level width is “0” (except that the average gray level is “0” or “0×FF”). The pattern 2 is selected when the gray level width is not “0”.
In the pattern 1, all the 4×4 pixels in the block are of the same gray level, and if the average gray level of the block is “0”, the value “0” is provided for all the 16 pixels. If the average gray level is “0×FF”, the value “0×FF” is provided for all the 16 pixels. If the gray level width is “0”, the value of the average gray level is provided for all the pixels.
In the pattern 2, the two-bit codes of the respective pixels are decoded. First, as
Next, the two-bit codes of the respective pixels are expanded to eight-bit codes. More specifically, if the two-bit code is 11, it is converted into the maximum level MAX, and if the two-bit code is 10, it is converted into the value DD2 which is ⅓ lower than the MAX. If the two-bit code is 01, it is converted into the value DD1 which is ⅓ higher than the MIN, and if the two-bit code is 00, it is converted into the minimum level MIN.
a and 8b show a way of converting pixel data at the time of expansion and a way of converting pixels data at the time of compression, respectively. The image data compressed by GTBC is irreversible to the original multi-value bmp data. However, even when the data which was once submitted to the GTBC data compression and expansion is compressed and expanded by GTBC again, the picture quality will not degrade.
Now, an example of image composition according to the present invention is described. In the present embodiment, for image composition, fixed length compressed data is used.
As
The fixed length compressed data of the base image 10 which is stored in the memory is updated or maintained in a block-by-block manner. Specifically, while the fixed length compressed data of the overlay image 20 is checked block by block, the following processes are carried out: when the average level LA of the overlay image 20 is “0”, that is, when the block of the overlay image 20 is a blank portion, the data stored in the memory is not updated, that is, the data of the base image 10 is maintained; and on the other hand, when the average gray level LA of the overlay image 20 is not “0”, that is, when the block of the overlay image 20 is an imaged portion, the data stored in the memory is updated to the block data of the overlay image 20.
In the case of
The volume of the fixed length compressed data is smaller than that of bmp data, and the necessity of data updating is judged not in a pixel-by-pixel manner but in a block-by-block manner in accordance with the average gray level LA indicating a characteristic of the block. Consequently, the processing speed is high.
As described above, compressed composite image data is made by replacing a part of fixed length block data of a base image with the same part of fixed length block data of an overlay image. Expansion of the compressed composite image data is carried out following the above-described steps for expansion of fixed length compressed data.
In the reproduced composite image 30, there are blank pixels between the base image and the overlay image. The data expansion to reproduce the composite image 30 is carried out block by block (4×4 pixels), and therefore, in bmp data after the expansion, unnecessary data updating may occur at the most in 3 rows×3 columns of pixels. When the area of the base image to be replaced by the overlay image is white, such unnecessary data updating to white does not influence the picture quality of the composite image.
Next, at step S3, the fixed length compressed data of the base image 10 is combined with the fixed length compressed data of the overlay image 20, and fixed length compressed data of a composite image 30 is produced. At step S4, the fixed length compressed data of the composite image 30 is compressed to variable length compressed data. Finally, the variable length compressed data is transmitted to an image control section as print data and expanded to fixed length compressed data and further to bmp data. Then, the composite image 30 is printed based on the bmp data.
As already described, in forming a composite image by superimposing a color overlay image on a base image, with respect to data of each of the planes (the CMYK colors), the gray level of the overlay image is checked. If the gray level of the overlay image with respect to one of the colors is 0, the color data of the overlay image is replaced with the data of the base image, and consequently, color mixture is caused.
In order to prevent this problem, in this embodiment, an ICC profile (data structure for data conversion) to check image data in a block-by-block manner is prepared. Specifically, in one block (in this embodiment, a block composed of 4×4 pixels) of input image data, when the gray levels of the respective CMYK planes are all 0, the gray levels of all the CMYK planes are set to 0 for the corresponding block. When at least one of the gray levels of the CMYK planes in a block is not less than 1, the gray levels of the other planes, which are 0, are set to an invisible gray level for the corresponding block, and the gray level of the plane, which is not less than 1, is kept for the corresponding block. An invisible gray level means a gray level which is not 0 but which is not seen as a gray level when it is printed. It is preferred that the invisible gray level is usually 1, but invisible gray level may be 2 or more as long as the level is invisible.
Now, a first exemplary printing system which uses the image composing method according to the present invention is described. As
It is possible to input data of base images and data of overlay images from the personal computer 101 to the server 102 (the data is stored in the data storage 103), and a base image and an overlay image to be printed can be designated from the personal computer 101. When a print command of a composite image of a base image and an overlay image is made, the base image data and the overlay image data are transmitted to the image processing device 110. The data of base images stored in the data storage 103 is bmp data, fixed length compressed data or variable length compressed data.
The control section 111 of the image processing device 110 produces fixed length compressed data of a composite image by combining fixed length compressed data of the base image with fixed length compressed data of the overlay image by the above-described image composing method. Then, the control section 111 converts the fixed length composite image data into variable length compressed data and transmits the variable length compressed data to the printer 112 as print data. In the printer 112, the variable length compressed data is expanded to fixed length compressed data and further expanded to bmp data. Then, the printer 112 prints out the composite image based on the bmp data.
Next, a second exemplary printing system which uses the image composing method according to the present invention is described. As
It is possible to input data of base images and data of overlay images from the personal computer 201 to the server 202 (the data is stored in the data storage 207), and a base image and an overlay image to be printed can be designated from the personal computer 201. When a print command of a composite image of a base image and an overlay image is made, the base image data and the overlay image data are transmitted to the image processing device 205. The data of base images stored in the data storage 207 is bmp data, fixed length compressed data or variable length compressed data.
The control section 206 of the image processing device 205 produces fixed length compressed data of a composite image by combining fixed length compressed data of the base image with fixed length compressed data of the overlay image by the above-described image composing method. Then, the control section 206 converts the fixed length composite image data into variable length compressed data and transmits the variable length compressed data to the printer 210 as print data. In the printer 210, the variable length compressed data is expanded to fixed length compressed data and further expanded to bmp data. Then, the printer 210 prints out the composite image based on the bmp data.
In the above, the servers 102 and 202 were described only about the concept.
The server 102 comprises a CPU 301, a ROM 302, a RAM 303, a hard disk 304, a display 305, an input device 306, a network interface 307 and a video interface 308 for the purpose only. These elements are connected to one another via buses 309.
The CPU 301 reads in a program, carries out the program and outputs the result. The ROM 302 is stored with control programs and data including BIOS. A program and a print image are temporarily stored in the RAM 303. The hard disk 304 is stored with various kinds of programs and data including an operating system. The display 305 displays various kinds of information.
The input device 306 is a pointing device, such as a mouse, and/or a keyboard. The network interface 307 is to communicate with other devices (especially with personal computers 101). The video interface 308 is connected to the printing apparatus 105 and sends a print image to the printing apparatus 105.
In each of the personal computers 101 of the users, an application soft which permits the user to make a print command to the server 102 is installed.
Now, referring to
Next at step S203, the user takes in the ICC profiles to the personal computer 101 or 102 from the server 102 or 202 by use of PPD up data. At step S204, the user displays a list of base images stored in the server 102 or 202 and a list of the ICC profiles on his/her personal computer 102 or 202.
At step S205, from the displayed lists, the user selects a base image and an ICC profile on the personal computer 101 or 102. Then, the user sends a print command with an overlay image to be printed from the personal computer 101 or 102 to the server 201 or 202. In response to the command, the server 102 or 202 sends a print job to the printing apparatus 105 or 210, and the printing apparatus prints out a composite image by use of the selected base image and the selected overlay ICC profile.
Next at step S313, the overlay image, which is in the form of bmp data, is subjected to fixed length compression. At step S314, the server 102 or 202 takes in the fixed length compressed data of the base image, and at step S315, the fixed length compressed data of the base image and the fixed length compressed data of the overlay image are combined. Next at step S316, the fixed length compressed data of the composite image is subjected to variable length compression. Thereafter, the steps from S312 to S316 are repeated, so that color conversion is carried out block by block.
When at least one of the CMYK planes in the block has a gray level not less than 1 (“NO” at step S401), it is checked at step S403 which plane(s) has/have a gray level not less than 1. With respect to the plane(s) of which gray level(s) is/are 0, at step S404, the gray level of the plane(s) is/are set to 1 (or may be set to 2 or more which is an invisible level) for the corresponding block. With respect to the plane(s) of which gray level(s) is/are not less than 1, at step S405, the gray level(s) of the plane(s) is/are kept for the corresponding block.
A first exemplary routine for image composition is described. This first routine is executed when both a base image and an overlay image are expressed by bmp data as shown in
First, at step S11, the base image bmp data is input in a module, and at step S12, the bmp data is compressed to the fixed length compressed data. The overlay bmp data is compressed to the fixed length compressed data at step S14. Then, at step S15, the fixed length compressed data of the base image and the fixed length compressed data of the overlay image are combined with each other. Next, the composite fixed length compressed data is compressed to the variable length compressed data at step S16. The variable length compressed data is transmitted to the printer 112 or 210. Then, the routine from step S13 is repeated, and new overlay images are superimposed on the base image successively.
A second exemplary routine for image composition is executed when a base image is stored as fixed length compressed data and when an overlay image is expressed by bmp data as shown in
First, at step S21, the fixed length compressed data of the base image is input in a module, and at step S23, the overlay image bmp data is compressed to the fixed length compressed data. Then, at step S24, the fixed length compressed data of the base image and the fixed length compressed data of the overlay image are combined with each other. Next, at step S25, the composite fixed length compressed data is compressed to the variable length compressed data. The variable length compressed data is transmitted to the printer 112 or 210. Then, the routine from step S22 is repeated, and new overlay images are superimposed on the base image successively.
A third exemplary routine for image composition is executed when a base image is stored as variable length compressed data and when an overlay image exists as bmp data as shown in
First, at step S31, the variable length compressed data of the base image is input in a module, and at step S32, the variable length compressed data is expanded to the fixed length compressed data. In the meantime, at step S34, the overlay image bmp data is compressed to the fixed length compressed data. Then, at step S35, the fixed length compressed data of the base image and the fixed length compressed data of the overlay image are combined with each other. Next, at step S36, the combined fixed length compressed data is compressed to the variable length compressed data. The variable length compressed data is transmitted to the printer 112 or 210. Then, the routine from step S33 is repeated, and new overlay images are combined with the base image successively.
Next, a first exemplary subroutine for combining fixed length compressed data which is executed at steps S15, S24 and S35 is described.
When the average gray level LA is not 0 (“NO” at step S43), it means that the block is an imaged portion of the overlay image, and at step S44, the fixed length block data of the overlay image is written in the domain. When the average level LA is 0 (“YES” at step S43), it means that the block of the overlay image is a non-imaged portion, and at step S45, the fixed length data of the corresponding block of the base image is written in the domain. Thus, at steps S44 and S45, six bytes of data are written at one time.
Next, at step S46, the start point of data reading from the overlay image is shifted to the next block, and at step S47, the start point of data writing into the memory is shifted to the next block. Then, the routine from step S42 is repeated to judge the average gray levels LA of all the blocks, and data of the base image or data of the overlay image is written block by block. Thus, composite image data of a base image and an overlay image is formed in the stage of fixed length compressed data, and the volume of data handled in this case is {fraction (1/16)} of that in the case of handling bmp data.
Next, a second exemplary subroutine for combining fixed length compressed data which is executed at steps S15, S24 and S35 is described.
Next, at step S54, the average gray level LA of a block of the overlay image is judged whether to be 0 or not. In other words, it is judged whether the gray level of the block composed of 4×4 pixels is 0. At step S54, only the average gray level LA which is the first byte of the six-byte fixed length block data is judged.
When the average gray level LA is not 0 (“NO” at step S54), it means that the block is an imaged portion of the overlay image, and at step S55, the corresponding block data of the base image is replaced with the block data of the overlay image. When the average gray level LA is 0 (“YES” at step S54), it means that the block of the overlay image is a non-imaged portion, and the corresponding block data of the base image is maintained. At steps S55, six bytes of data are updated at one time.
Next, at step S56, the start point of data reading from the overlay image is shifted to the next block, and at step S57, the start point of data writing onto the base image is shifted to the next block. Then, the routine from step S53 is repeated to judge the average gray levels LA of all the blocks, and it is judged what blocks of the base image are to be replaced with the corresponding blocks of the base image. Thus, composite image data of a base image and an overlay image is formed in the stage of fixed length compressed data, and the volume of data handled in this case is {fraction (1/16)} of that in the case of handling bmp data.
The image composing method according to the present invention, which is shown by flowcharts of
In the above-described embodiment, a base image and an overlay image which are of the same size are combined with each other, but it is possible to combine images of different sizes. Data of a composite image may be transmitted to the printer 112 or 210 in the stage of fixed length compressed data. The construction of the printing system 100 and 200 may be arbitrarily designed.
Although the present invention has been described in connection with the preferred embodiments above, it is to be noted that various changes and modifications are possible to those who are skilled in the art. Such changes and modifications are to be understood as being within the scope of the present invention.
Number | Date | Country | Kind |
---|---|---|---|
2003-333856 | Sep 2003 | JP | national |