1. Field of the Invention
The present invention relates to an image processing apparatus and image processing method and, more particularly, to an image processing apparatus and image processing method for performing error diffusion processing for an image.
2. Description of the Related Art
It is a common practice to process an image captured by a digital camera or the like and print the processed image. However, the printing apparatus can express a smaller number of tones per pixel than by the display apparatus. Pseudo-halftone processing is therefore required to reduce the number of tones of an image before printing and pseudo-expressing the original tonality. Pseudo-halftone processing is achieved by various methods. Among them, error diffusion processing is most popular because it can provide an image that satisfies both tonality and resolution. Error diffusion processing sequentially executes processing to diffuse the difference (quantization error) between the tone value of the pixel of interest and the quantization value of the pixel of interest to unprocessed pixels around the pixel of interest at predetermined ratios.
When processing image data, it needs to be developed in the memory. However, the cost rises if the device is equipped with a memory having a full-size storage capacity capable of developing all image data corresponding to one image. It is not practical to mount such a memory having a full-size storage capacity in a device which needs to be provided at low cost, like a home printer. Under the circumstances, an image is generally divided into a plurality of regions, and the regions are developed one by one in the memory and undergo image processing.
However, when error diffusion processing is done after region division, a dot pattern mismatch occurs at a joint where the error diffusion processing results of regions are connected. This is visually recognized as thread-like image degradation. This is because no error is diffused between regions, impairing the continuity of error diffusion processing at the joint.
Japanese Patent Publication No. 6-091606 (Japanese Patent Laid-Open No. 63-310269) discloses an invention which buffers a quantization error generated upon quantizing a pixel at the boundary of the region of interest in order to use it for error diffusion processing for a pixel at the boundary of a region to be processed next (to be referred to as the next region). Further, this literature discloses an invention which sets an overlapping region between the region of interest and the next region to approximate a quantization error to be diffused from a pixel at the boundary of the region of interest to one at the boundary of the next region.
In an invention disclosed in Japanese Patent No. 3004628, an image is divided into bands in the sub-scanning direction, and each band is further divided into slices in the main scanning direction. A quantization error generated in the final pixel of the slice is stored in the first memory, and a quantization error generated in each pixel is stored in the second memory. The first pixel of each slice is quantized by referring to quantization errors stored in the first and second memories. Another pixel is quantized by referring to only quantization errors stored in the second memory. Then, error diffusion processing is done. Error spread between bands using two memories which buffer quantization errors simultaneously achieves reduction of the storage capacity of the memory for developing an image and maintenance of the continuity of error diffusion processing at the band boundary.
The above-described conventional technique buffers a quantization error at the boundary of a region having undergone error diffusion processing (to be referred to as a previous region) before the region of interest. However, the continuity of error diffusion processing cannot always be maintained depending on the error diffusion processing method. For example, a quantization error itself may be buffered, or a diffusion error to be diffused to each pixel may be buffered. The diffusion error is a value obtained by multiplying the quantization error of the pixel of interest by a diffusion coefficient determined by the relationship between the pixel of interest and a pixel at the error diffusion destination (to be referred to as a diffusion destination pixel), and integrating the resultant values for each diffusion destination pixel. A method of storing an error in the buffer memory and a method of referring to an error stored in the buffer memory differ between these two cases. If the processing results of respective regions are connected without properly storing and referring to a buffered error (to be referred to as a spread error), a discontinuous dot pattern is generated at the joint.
In addition, a pixel whose quantization error is spread and a pixel to which a diffusion error is spread change depending on the region division manner such as whether to set an overlapping region or whether divided regions partially overlap each other. Note that divided regions partially overlap each other when an image is formed by superposing the dot patterns of adjacent divided regions. For example, even if an overlapping region is set and an error is spread from the boundary at the lower end of the region of interest to the next region, a discontinuous dot pattern may appear at the joint. This is because a portion where an error needs to be spread between regions does not coincide with the boundary at the lower end of the region of interest and the continuity of error diffusion processing is lost. When divided regions partially overlap each other, the lower end of the region of interest is not the boundary of the next region to which an error needs to be spread. Thus, no error can be appropriately spread, generating a discontinuous dot pattern at the joint.
The present invention in its first aspect, provides an image processing apparatus for performing error diffusion processing for each region of an image divided into a plurality of regions, comprising: a first error holding unit arranged to hold errors which occurred in the error diffusion processing for a region different from a region containing a pixel of interest in error diffusion processing; a second error holding unit arranged to hold an error which occurred in error diffusion processing for a pixel near the pixel of interest in the error diffusion processing for the region containing the pixel of interest; a first determining unit arranged to determine whether or not the pixel of interest exists at a first pixel position where it is necessary to reference the first error holding unit; a second determining unit arranged to determine whether or not the pixel of interest exists at a second pixel position where it is necessary to write in the first error holding unit; an obtaining unit arranged to obtain an error to be referred, wherein when the pixel of interest exists at the first pixel position, the error is obtained from at least the first error holding unit, and when the pixel of interest does not exist at the first pixel position, the error is obtained from the second error holding unit; a quantizing unit arranged to calculate an addition value from the error obtained by the obtaining unit and a value of the pixel of interest, and quantize the addition value to obtain a quantization value of the pixel of interest; a calculating unit arranged to calculate an error for the pixel of interest from the quantization value and the addition value; and a storing unit arranged to store the error for the pixel of interest, wherein when the pixel of interest does not exist at the second pixel position, the error for the pixel of interest is stored in the second error holding unit, and when the pixel of interest exists at the second pixel position, the error for the pixel of interest is stored in at least the first error holding unit.
The present invention in its second aspect, provides an image processing method of performing error diffusion processing for each region of an image divided into a plurality of regions, comprising the steps of: holding errors, which occurred in the error diffusion processing for a region different from a region containing a pixel of interest in error diffusion processing, in a first error holding unit; holding an error which occurred in error diffusion processing for a pixel near the pixel of interest in error diffusion processing for the region containing the pixel of interest in a second error holding unit; determining whether or not the pixel of interest exists at a first pixel position where it is necessary to reference the first error holding unit; determining whether or not the pixel interest exists at a second pixel position where it is necessary to write in the first error holding unit; obtaining an error to be referred, wherein when the pixel of interest exists at the first pixel position, the error is obtained from at least the first error holding unit, and when the pixel of interest does not exist at the first pixel position, the error is obtained from the second error holding unit; calculating an addition value from the error obtained in the obtaining step and a value of the pixel of interest, and quantizing the addition value to obtain a quantization value of the pixel of interest; calculating an error for the pixel of interest from the quantization value and the addition value; and storing the error for the pixel of interest, wherein when the pixel of interest does not exist at the second pixel position, the error for the pixel of interest is stored in the second error holding unit, and when the pixel of interest exists at the second pixel position, the error for the pixel of interest is stored in at least the first error holding unit.
According to these aspect, an error can be appropriately spread between regions when performing error diffusion processing for an image divided into a plurality of regions. This can prevent generation of a discontinuous dot pattern owing to poor continuity of error diffusion processing at the joint of a region.
Further features of the present invention will become apparent from the following description of exemplary embodiments with reference to the attached drawings.
An image processing apparatus and image processing method according to preferred embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
The first embodiment will describe an arrangement in which a quantization error or diffusion error can be selected as an error to be spread between bands when an image is divided into a plurality of bands and error diffusion processing is performed for each band.
The arrangement of an image processing apparatus according to the first embodiment will be exemplified with reference to the block diagram of
An example of an image division method, a pixel scanning method in error diffusion processing, and an error diffusion matrix will be explained with reference to
The error diffusion matrix shown in
The arrangement of the error diffusion processing unit 102 will be described with reference to the block diagram of
A register 303 selects a spread error from a quantization error and diffusion error. In the register 303, “0” is set to select a quantization error as the spread error, and “1” is set to select a diffusion error as the spread error. Selectors 304a, 304b, and 304c select a data path between blocks based on a value set in the register 303.
A buffer reference determination unit 310 receives the position (x,y) of the pixel of interest in a band, and determines whether this position is a pixel position where a spread error determined by an error diffusion matrix used in a multiplication unit 306 should be referred to. When this position is a pixel position where a spread error should be referred to, the buffer reference determination unit 310 outputs position information indicating the position of an error to be read out from an error buffer 309.
A buffer storage determination unit 311 receives the position (x,y) of the pixel of interest in a band, and determines, based on the region division method (for example, the number of lines of a band), whether this position is a pixel position where an error determined by an error diffusion matrix used in the multiplication unit 306 should be spread. When this position is a pixel position where an error should be spread, the buffer storage determination unit 311 outputs position information indicating a position where an error is to be written in the error buffer 309. If the number of lines differs between bands, the buffer storage determination unit 311 receives the position (x,y) of the pixel of interest in a band, and the number of lines of the band of interest from the region division unit 101.
An error buffer control unit 308 receives the determination results and pieces of position information output from the buffer reference determination unit 310 and buffer storage determination unit 311. The error buffer control unit 308 controls read/write from/in the error buffer 309 and the path of a selector 312. More specifically, when the determination result of the buffer reference determination unit 310 indicates reference to a spread error, the error buffer control unit 308 obtains a spread error from the error buffer 309 in accordance with position information which is output from the buffer reference determination unit 310 and indicates a read position in the error buffer 309. The error buffer control unit 308 controls the selector 312 to input the spread error to the multiplication unit 306. When the determination result of the buffer reference determination unit 310 indicates non-reference to a spread error, the error buffer control unit 308 controls the selector 312 to input an error from an error memory 305 to the multiplication unit 306. When the determination result of the buffer storage determination unit 311 indicates storage of a spread error, the error buffer control unit 308 stores, in the error buffer 309, an error input via the selector 304a in accordance with position information which is output from the buffer reference determination unit 310 and indicates a write position in the error buffer 309.
The error memory 305 stores a quantization error from the quantization error calculation unit 302 via the selector 304a. Alternatively, the error memory 305 stores a diffusion error from the multiplication unit 306 via the selector 304a. The multiplication unit 306 calculates an error by multiplying an error input via the selector 304b by a diffusion coefficient. The integration unit 307 integrates errors input via the selector 304c to output an integrated error to be added to the value of the pixel of interest.
By setting the register 303, the error diffusion processing unit 102 can cope with both spread of a quantization error between bands and spread of a diffusion error. Note that the error diffusion processing unit 102 is not limited to the arrangement of
An example in which error diffusion processing is sequentially done for a plurality of bands obtained by dividing an image, as shown in
Case in which Quantization Error is Spread
Processing by the error diffusion processing unit 102 when spreading a quantization error will be explained with reference to the flowchart of
The error diffusion processing unit 102 receives the value of the pixel of interest (step S501). The buffer reference determination unit 310 determines whether the pixel of interest exists at a pixel position where a spread error should be referred to (step S502). A pixel position where an error should be referred to and a pixel position where an error should be spread will be explained with reference to
Assume that each band is formed from four lines, as shown in
In the use of the error diffusion matrix shown in
Two adjacent pixels on line L4 refer to a quantization error stored at the same position in the error buffer 309. For example, in
If the pixel of interest exists at a pixel position where a spread error should be referred to, the error buffer control unit 308 reads out a quantization error from the error buffer 309 based on position information output from the buffer reference determination unit 310, and supplies the position information and quantization error to the multiplication unit 306 (step S503). Then, the error buffer control unit 308 reads out the quantization error of a diffusion source pixel for the pixel of interest that is held in the error memory 305, and supplies the position information and quantization error of the diffusion source pixel to the multiplication unit 306 (step S504). The multiplication unit 306 multiplies the quantization error by a diffusion coefficient of the diffusion matrix shown in
The error addition unit 300 adds the diffusion error integration value input from the integration unit 307 and the value of the pixel of interest, and outputs the addition result to the quantization unit 301 (step S507). The quantization unit 301 quantizes the addition value input from the error addition unit 300, and outputs the quantization result (step S508). The quantization error calculation unit 302 subtracts, from the quantization result, the addition value output from the error addition unit 300 and stores the resultant quantization error at a position corresponding to the pixel position of the pixel of interest in the error memory 305 (step S509).
The buffer storage determination unit 311 determines whether the pixel of interest exists at a pixel position where an error should be spread (step S510). When processing a pixel 601 of interest on line L3 in the band 201, pixels (to be referred to as diffusion destination pixels) to which the quantization error of the pixel 601 of interest should be spread are four neighboring pixels E, F, G, and H, as shown in
If the pixel of interest exists at a pixel position where an error should be spread, the error buffer control unit 308 stores a quantization error output from the quantization error calculation unit 302 in the error buffer 309 based on position information output from the buffer storage determination unit 311 (step S511). The error diffusion processing unit 102 determines whether error diffusion processing has ended for all the pixels of the image input by the image input unit 100 (step S512). The processes in steps S501 to S511 are repeated till the end of error diffusion processing for all the pixels.
Case in which Diffusion Error is Spread
Processing by the error diffusion processing unit 102 when spreading a diffusion error will be explained with reference to the flowchart of
The error diffusion processing unit 102 receives the value of the pixel of interest (step S601). The buffer reference determination unit 310 determines whether the pixel of interest exists at a pixel position where a spread error should be referred to (step S602). As described above, when processing the pixel 600 of interest on line L4 in the band 202, diffusion source pixels are four neighboring pixels A, B, C, and D shown in
If the pixel of interest exists at a pixel position where a spread error should be referred to, the error buffer control unit 308 reads out a diffusion error from the error buffer 309 based on position information (position information of the pixel of interest) output from the buffer reference determination unit 310, and supplies it to the integration unit 307 (step S603). Then, the error buffer control unit 308 reads out a diffusion error corresponding to the pixel of interest that is held in the error memory 305, and supplies it to the integration unit 307 (step S604).
The integration unit 307 integrates the diffusion errors input from the error buffer control unit 308, and outputs the integration result to the error addition unit 300 (step S605). The error addition unit 300 adds the diffusion error integration value input from the integration unit 307 and the value of the pixel of interest, and outputs the addition result to the quantization unit 301 (step S606). The quantization unit 301 quantizes the addition value input from the error addition unit 300, and outputs the quantization result (step S607). The quantization error calculation unit 302 calculates a quantization error by subtracting, from the quantization result, the addition value output from the error addition unit 300 (step S608). The multiplication unit 306 calculates a diffusion error by diffusing the quantization error of the pixel of interest in accordance with the error diffusion matrix shown in
The buffer storage determination unit 311 determines whether the pixel of interest exists at a pixel position where an error should be spread (step S610). As described above, when processing the pixel 601 of interest on line L3 in the band 201 shown in
The diffusion errors of two adjacent pixels on line L3 are diffused to the same pixel on line L4. For example, in
Depending on the shape of the error diffusion matrix, the band of interest may not have two or more pixels out of diffusion destination pixels to which an error should be diffused from the pixel of interest. In this case, the error buffer 309 requires a storage capacity corresponding to a plurality of lines. For example, the error buffer 309 needs to store diffusion errors to be diffused from pixels on line L2 to those on line L4, and diffusion errors to be diffused from pixels on line L3 to those on lines L4 and L5. In this case, a plurality of diffusion errors to pixels on line L4 are integrated using the memory for delay in the error buffer control unit 308, and stored in the error buffer 309. In general error diffusion processing, errors spread to pixels other than adjacent ones are small, and errors diffused from pixels on line L2 to those on line L4 are negligibly small. In addition, the influence of errors spread to adjacent pixels is significant. The influence of errors diffused from pixels on line L3 to those on line L4 is greater than that of errors diffused from pixels on line L2 to those on line L4. That is, the continuity of error diffusion processing is maintained even if errors diffused from pixels on line L2 to those on line L4 are ignored. Considering this error diffusion characteristic, even the storage capacity of the error buffer 309 can be reduced to that for one line.
If the pixel of interest exists at a pixel position where an error should be spread, the error buffer control unit 308 stores, at a position corresponding to the pixel position of the diffusion destination pixel in the error buffer 309, a diffusion error which is output from the multiplication unit 306 and is to be diffused to the next band (step S611). At this time, the error buffer control unit 308 adds a diffusion error which has already been stored at a storage position, and a diffusion error to be newly stored at the storage position, integrating the diffusion errors.
Based on the determination result and position information from the buffer reference determination unit 310, the error buffer control unit 308 determines whether error diffusion processing has ended for the band of interest (step S612). Further, based on the determination result and position information from the buffer storage determination unit 311, the error buffer control unit 308 determines whether error diffusion processing has ended for pixels (pixels on the first line in the band of interest in this example) which should refer to spread errors in the band of interest (step S614). After the end of error diffusion processing for the band of interest, the error buffer control unit 308 clears the error memory 305 not to integrate diffusion errors of a previous band (step S613). If error diffusion processing has ended for pixels which should refer to spread errors in the band of interest, the error buffer control unit 308 clears the error buffer 309 not to integrate diffusion errors of the previous band (step S615).
The error diffusion processing unit 102 determines whether error diffusion processing has ended for all the pixels of the image input by the image input unit 100 (step S616). The processes in steps S601 to S615 are repeated till the end of error diffusion processing for all the pixels.
As described above, based on the position of the pixel of interest, the shape of the error diffusion matrix, and the region division method, the buffer reference determination unit 310 and buffer storage determination unit 311 determine whether the error buffer 309 needs to be accessed. If the error buffer 309 needs to be accessed, an access position in the error buffer 309 is calculated, and a diffusion error is read out from the error buffer 309 or stored in it.
In the above manner, the error buffer control unit 308 controls storage and reference of an error in the error buffer 309 in accordance with the determination result of whether the error buffer 309 needs to be accessed, thereby implementing error spread at an arbitrary spread position.
When a quantization error is selected as a spread error, no diffusion coefficient is multiplied, and the value stored in the error buffer 309 is an integer. However, the error buffer 309 requires a storage capacity corresponding to a plurality of lines depending on the shape of the error diffusion matrix. To the contrary, when a diffusion error is selected as a spread error, the error buffer 309 needs to store even the decimal part upon multiplication of the diffusion coefficient. However, the error buffer 309 suffices to have a storage capacity corresponding to one line regardless of the shape of the error diffusion matrix. More specifically, when positions where errors should be referred to or positions where errors should be spread belong to one line in accordance with the shape of the error diffusion matrix, the storage capacity of the error buffer 309 can be reduced by selecting a quantization error as a spread error. When positions where errors should be referred to or positions where errors should be spread belong to a plurality of lines, the storage capacity of the error buffer 309 can be reduced by selecting a diffusion error as a spread error. In the above-described arrangement, the storage capacity of the error buffer 309 can always be minimized.
Also, the circuit design can be optimized for the feature of the storage device if the error memory 305 is formed from a static random access memory (SRAM) with high access speed though the cost per storage capacity is high, and the error buffer 309 is formed from a dynamic random access memory (DRAM) at low cost per storage capacity though the access speed is low. For error diffusion processing within a divided region, the errors of neighboring pixels are always read out from the error memory 305 in processing the pixel of interest, and errors generated by the processing are always stored. To the contrary, the error buffer 309 is accessed at only an error spread position for performing error spread between divided regions, but requires as large storage capacity to hold all spread errors. For this reason, an SRAM is used for the error memory 305 which needs to be accessed quickly, and a low-cost DRAM is used for the error buffer 309 requiring a large storage capacity. This can implement a high-speed, low-cost processing circuit.
In the above description, the error buffer 309 serving as the first error holding unit and the error memory 305 serving as the second error holding unit are individual storage devices. However, two physically different storage devices need not be used as long as storage areas for two functions are ensured. When storage areas for the two functions are ensured in a single storage device, it suffices to sequentially store and refer to errors. Also when storage areas for the two functions are ensured across a plurality of storage areas or storage devices, the present invention can be implemented as long as errors can be properly stored and referred to.
In this fashion, when performing error diffusion processing for an image divided into a plurality of regions, a quantization error or diffusion error is stored in the error buffer 309 to appropriately spread the error between the regions. This can prevent generation of a discontinuous dot pattern owing to poor continuity of error diffusion processing at the joint of a region.
An image processing apparatus and image processing method according to the second embodiment of the present invention will be described. In the second embodiment, the same reference numerals as those in the first embodiment denote the same parts, and a detailed description thereof will not be repeated.
An example of an image division method, a pixel scanning method in error diffusion processing, and an error diffusion matrix in the second embodiment will be explained with reference to
Image processing in the second embodiment is the same as that in the first embodiment except for the region division method and pixel scanning direction. The arrangement of an image processing apparatus shown in
A diffusion destination pixel which refers to the error of a tile having undergone error diffusion processing (to be referred to as a previous processing tile), and a diffusion source pixel which spreads an error to a tile to undergo error diffusion processing (to be referred to as an un-processing tile) will be explained. A pixel position where an error should be referred to and a pixel position where an error should be spread will be explained with reference to
Assume that each tile is formed from 4×4 pixels, as shown in
When processing a pixel 701 of interest on line L3 and row R3 in the tile 205, diffusion destination pixels for the pixel 701 of interest are four neighboring pixels E, F, G, and H, as shown in
Pixels whose quantization errors are actually stored in the error buffer 309 are those on the final line of a previous processing tile and those on the final row of the previous processing tile at the boundary between the previous processing tile and an un-processing tile. An example of pixels whose quantization errors are stored in the error buffer 309 will be explained with reference to
In this way, even if the region division method changes and the positions of diffusion source pixels or diffusion destination pixels change, it suffices to spread quantization errors or diffusion errors for pixels at the boundaries between regions having undergone error diffusion processing and regions to undergo error diffusion processing. This can be implemented by determining by a buffer reference determination unit 310 and buffer storage determination unit 311 whether to access the error buffer 309, and controlling access to the error buffer 309 and an error memory 305 by an error buffer control unit 308. Even if the region division method changes while the arrangement of the error diffusion processing unit 102 remains unchanged from that in the first embodiment, the continuity of error diffusion processing can be maintained by error spread between regions at proper positions.
An image processing apparatus and image processing method according to the third embodiment of the present invention will be described. In the third embodiment, the same reference numerals as those in the first and second embodiments denote the same parts, and a detailed description thereof will not be repeated.
It is known that a larger error reference range improves the image quality of a processing result in error diffusion processing. However, a larger error reference range increases the calculation load for processing one pixel, and decreases the processing speed. It is desirable to balance the permissible image quality and the permissible processing speed by adjusting or selecting the error reference range. The third embodiment will explain error diffusion processing capable of setting again the region division method and the shape of the error diffusion matrix (error reference range) in accordance with user settings.
An example of a region division method, an error diffusion matrix, a pixel position where an error should be referred to, and a pixel position where an error should be spread in accordance with an error diffusion processing mode settable by the user will be explained with reference to
In mode 1, error diffusion processing is done simultaneously for two final lines of a band to be processed first and two first lines (lines L3 and L4 when one band is formed from five lines) of a band to be processed next. In this case, the reference pixel position is line L3, and the spread pixel position is line L2.
In mode 2, error diffusion processing is performed using a larger error diffusion matrix than in mode 0 that is obtained by widening the error reference range by one line at each of the top and bottom and by one row on the left side. When one band is formed from five lines, the reference pixel position is line L5, and the spread pixel position is line L4.
In mode 3, an image is divided into tiles as in the second embodiment, and the error diffusion matrix shown in
In addition to the modes shown in
The arrangement of an error diffusion processing unit 102 in the third embodiment will be described with reference to the block diagram of
A setting unit 800 includes a table for storing setting information corresponding to each mode shown in
A buffer reference determination unit 310 compares the position (x,y) of the pixel of interest in a band or tile with a reference pixel position written in the register 801, and determines whether the pixel of interest exists at a pixel position where an error should be referred to. Similarly, a buffer storage determination unit 311 compares the position (x,y) of the pixel of interest in a band or tile with a spread pixel position written in the register 802, and determines whether the pixel of interest exists at a pixel position where an error should be spread.
When there is an overlapping processing region, like mode 1, it is also possible to control not to output all quantization results from the error diffusion processing unit 102. More specifically, the quantization result of the overlapping processing region is output in error diffusion processing for the vicinity of the final line of a band, and is not output in error diffusion processing for the vicinity of the first line of a band. It is also possible not to output the quantization result of the overlapping processing region in error diffusion processing for the vicinity of the final line of a band but to output it in error diffusion processing for the vicinity of the first line of a band. The error buffer control unit 308 controls an output unit 803 based on information about an overlapping processing region that is input from the setting unit 800, and position information of the pixel of interest that is input from the buffer reference determination unit 310 or buffer storage determination unit 311. Note that the information about an overlapping processing region is, for example, the number of lines of a band or that of lines of an overlapping processing region. Under the control of the error buffer control unit 308, the output unit 803 switches whether or not to output a quantization result.
Error diffusion processing when there is an overlapping processing region, like mode 1, will be explained.
An example of an image division method, a pixel scanning method in error diffusion processing, and an error diffusion matrix will be explained with reference to
Error diffusion processing when there is an overlapping processing region and a quantization error is to be spread will be explained with reference to the flowchart of
The error diffusion processing unit 102 receives the value of the pixel of interest (step S701). The buffer reference determination unit 310 determines whether the pixel of interest exists at a spread pixel position (step S702). A pixel position where an error should be spread will be explained with reference to
Assume that each band is formed from five lines including two lines of an overlapping processing region, as shown in
When processing a pixel 1102 of interest on line L4 in the band 216, diffusion source pixels for the pixel 1102 of interest are 12 neighboring pixels D to O shown in
In this fashion, error diffusion processing for pixels on line L3 needs to refer to the quantization errors of pixels on lines L1 and L2 in the previous band 215, similar to the pixel 1100 of interest. Also, error diffusion processing for pixels on line L4 needs to refer to the quantization errors of pixels on line L2 in the previous band 215, similar to the pixel 1102 of interest.
As the quantization errors of diffusion source pixels G, H, I, J, and M, quantization errors stored in the error memory 305 are referred to in error diffusion processing for the band 216. It is also possible to store the quantization errors of diffusion source pixels G, H, I, J, and M in the error buffer 309 in error diffusion processing for the band 215, and refer to the quantization errors of diffusion source pixels G, H, I, J, and M stored in the error buffer 309 in error diffusion processing for the band 216. In the use of the error diffusion matrix shown in
If the pixel of interest exists at a reference pixel position, the error buffer control unit 308 reads out a quantization error from the error buffer 309 based on position information output from the buffer reference determination unit 310, and supplies the position information and quantization error to the multiplication unit 306 (step S703). Then, the error buffer control unit 308 reads out the quantization error of a diffusion source pixel for the pixel of interest that is held in the error memory 305, and supplies the position information and quantization error of the diffusion source pixel to the multiplication unit 306 (step S704). The multiplication unit 306 multiplies the quantization error by a diffusion coefficient of the diffusion matrix shown in
The error addition unit 300 adds the diffusion error integration value input from the integration unit 307 and the value of the pixel of interest, and outputs the addition result to a quantization unit 301 (step S707). The quantization unit 301 quantizes the addition value input from the error addition unit 300 (step S708). A quantization error calculation unit 302 subtracts, from the quantization result, the addition value output from the error addition unit 300 and stores the resultant quantization error at a position corresponding to the pixel position of the pixel of interest in the error memory 305 (step S709).
The buffer storage determination unit 311 determines whether the pixel of interest exists at a spread pixel position (step S710). When the error diffusion matrix shown in
If the pixel of interest exists at a spread pixel position, the error buffer control unit 308 stores a quantization error output from the quantization error calculation unit 302 in the error buffer 309 based on position information output from the buffer storage determination unit 311 (step S711). The error buffer control unit 308 determines whether the pixel of interest exists in the overlapping processing region (step S712). If the pixel of interest exists in the overlapping processing region, the error buffer control unit 308 determines whether to output the quantization result (step S713). If the error buffer control unit 308 determines to output the quantization result, it controls the output unit 803 to output the quantization result (step S714). The error diffusion processing unit 102 determines whether error diffusion processing has ended for all the pixels of the image input by the image input unit 100 (step S715).
The processes in steps S701 to S714 are repeated till the end of error diffusion processing for all the pixels.
As described above, the reference pixel position in the presence of an overlapping processing region starts from the first line of a region, similar to that in the absence of an overlapping processing region. However, the spread pixel position in the present of an overlapping processing region does not end on the final line of a region but ends on the final line of the non-overlapping region of the region. This spread pixel position is a pixel position for which no quantization error exists in the error memory 305 in processing of the next band. Hence, when there is an overlapping processing region, a quantization error to be stored in the error buffer 309 cannot be determined by only a pixel position within the band of interest. The embodiment has exemplified a case in which an arbitrary position in the buffer storage determination unit 311 is determined as a spread pixel position based on a spread pixel position written in the register 802 and the position of the pixel of interest in accordance with a mode selected by the user. To maintain the continuity of error diffusion processing, a spread pixel position to be set in the register 802 is desirably determined based on the region division method and the shape of the error diffusion matrix. Even an arrangement in which the buffer storage determination unit 311 receives these pieces of information to determine a spread pixel position can also achieve appropriate error spread.
Aspects of the present invention can also be realized by a computer of a system or apparatus (or devices such as a CPU or MPU) that reads out and executes a program recorded on a memory device to perform the functions of the above-described embodiment(s), and by a method, the steps of which are performed by a computer of a system or apparatus by, for example, reading out and executing a program recorded on a memory device to perform the functions of the above-described embodiment(s). For this purpose, the program is provided to the computer for example via a network or from a recording medium of various types serving as the memory device (for example, computer-readable medium).
While the present invention has been described with reference to exemplary embodiments, it is to be understood that the invention is not limited to the disclosed exemplary embodiments. The scope of the following claims is to be accorded the broadest interpretation so as to encompass all such modifications and equivalent structures and functions.
This application claims the benefit of Japanese Patent Application Nos. 2010-188756, filed Aug. 25, 2010 and 2011-143392, filed Jun. 28, 2011, which are hereby incorporated by reference herein in their entirety.
Number | Date | Country | Kind |
---|---|---|---|
2010-188756 | Aug 2010 | JP | national |
2011-143392 | Jun 2011 | JP | national |