Image conversion

Abstract: A method for optimal discrete rendering of images is disclosed. The present invention provides a technique for efficiently converting an original sampled image into a bitmap suitable for a specific output device. The method includes explicit printer and perception effects, and employs local permutations of bits, to find optimal bit settings. A continuous-tone image is first sampled to form a sampled image (12), through which a series of swaths are defined. For each swath (14i) in turn, an iterative procedure examines a column of bits (16) at a time, determining which configuration of the column of bits yields a minimal local difference value between the trial bitmap and the sampled image. While holding the rest of the trial bitmap constant, the column of bits is permuted and the difference value calculated, for each configuration of the column's look-ahead bits (22). To determine the difference values, local printer (17a) and perception (17b) models calculate effects between bits, while a local comparison model calculates the difference between the trial bitmap and the sampled image. The printable bitmap resulting from the methods of the present invention can be displayed by the output device to provide a faithful duplication of the original image.

Description: The present invention is a method for rendering two-dimensional continuous-tone images on bi-level digital output devices. Increasingly sophisticated and powerful computer resources are able to manipulate a variety of generic data types. Text data and organized databases were the earliest of data types. Currently, graphics and image data are being created, transferred and manipulated in general purpose computer systems. These new forms of data pose new problems for the computer systems designer. To the user, displaying an image on any of a wide variety of devices must be as transparent as displaying ASCII text documents. Office video displays with differing gray level capacity, laser printers, and home dot-matrix printers, all of various resolutions and aspect ratios, must render a given image in a similar way. To achieve this transparency of display, each output device should have a dedicated pre-processor that transforms generic digital image data to a form tailored to the characteristics peculiar to that device. The binary nature of a given output device, for example a laser printer or video display, creates particular problems in rendering continuous-tone images. Outside of photographic film and some thermal sensitive materials, there does not exist a practical method of producing true continuous-tone hard copy. Computer hard copy devices are almost exclusively binary in nature. An output device is binary if the lowest resolvable image portion (often called a pixel or bit) is either on or off, not some intermediate value in between. While the video displays associated with workstations and terminals are certainly capable of true continuous-tone representations, they are often implemented with frame buffers that provide high spatial resolution rather than full gray-scale capability. Digital half-toning techniques, implemented in an output pre-processor system, comprise any algorithmic process which creates the illusion of continuous-tone image from careful arrangement of binary picture elements. Since most output devices are designed for display of binary dot-matrix text or graphics, digital half-toning provides the mechanism to display images on them as well. An adequate digital half-toning technique must contend with two particular problems. Both problems stem from the interactions of local groups of displayed pixels in the final perception of the rendered image. First, peculiarities in the output device may allow neighboring pixel intensities to affect other pixels. For example, a printer may allow the bleeding of dye or toner from one localized pixel to another, altering the printed image. Second, the human eye itself tends to read groups of pixels together. This effect is often used to advantage to create the illusion of continuous-tone color in video displays. However, the effects of low-level processing by the human eye and brain can alter the perception of a theoretically accurate display of an image, leading to further undesired results. WO-A-90/04898 discloses a method of generating a halftone image with an electronic digital computer, wherein a set of minimum visual noise binary bit patterns is provided for each density level in a digital image signal. A portion of the binary bit pattern is modularly selected from the corresponding pattern of the set by addressing the bit pattern with lower significant bits, and employing the selected portion to form the halftone image. A satisfactory method for rendering continuous-tone images onto any available binary display must take into account both display interactions and perceptual interactions in the processing of images. Such a method should allow a variety of different display system characteristics to be used interchangeably, without great difficulty, in order to process an image for a given display. In addition, the method should explicitly take into account the interactions of pixels on each other, both in the physical output of the display and in the perception by the human eye and brain. The method should also permit the processing of images for a given display system in a minimum amount of time, and without requiring inordinate amounts of computational power. The present invention provides a novel and efficient algorithm for converting a two-dimensional continuous-tone image into a bitmap suitable for printing or display from a bi-level digital output device. The invention accounts for both the effects of the output device and the characteristics of eye-brain reception on local neighborhoods of pixels to provide an output image closely resembling the original image in a reasonable amount of time. According to the invention there is provided a method for converting a continuous tone original image to a printable binary bitmap for use by an output printing device, comprising the steps of: a. defining a printer model for describing how the output printing device produces an output image from a given binary bitmap; b. defining a perception model for describing how a human eye perceives the output image; c. defining a comparison model for comparing the original image with the printable binary bitmap; d. sampling the original image to form a sampled pixel image; e. constructing a plurality of parallel swaths through the sampled image, each swath being a linear path of adjacent pixels, each path having width of n pixels; f. defining a linear array of columns of pixels for each swath, each column being one pixel wide and having the same number of pixels high as the width of the swath, with each column for each swath being numbered consecutively; g. choosing a configuration of bit values for a first column of pixels of an ith swath to be analyzed and defining a first neighborhood and a second neighborhood of pixels, each of which surround and include the first column of pixels, the second neighborhood being contained in the first neighborhood, the first and second neighborhoods including a number p of columns of pixels, and q columns of non-image pixels having preset values; h. choosing a configuration of bit values for a first set of look-ahead pixels adjacent to the first column of pixels and within the ith swath, the first set of look-ahead pixels including a set of k consecutive columns of pixels of the ith swath; i. applying the printer model to the first neighborhood to provide a convolved value for the bits in the first neighborhood; j. applying the perception model to the second neighborhood to provide a perceived value of the convolved values in the second neighborhood; k. applying the comparison model to compare the perceived value of the convolved values of the second neighborhood with a perceived value of the pixels of the sampled image of the second neighborhood to arrive at a difference value for each chosen bit of a subset of columns of pixels of the ith swath lying within the second neighborhood; I. calculating a combined difference value from the difference values of the subset of columns; m. storing the combined difference value along with the configuration of bit values of the first column of pixels; n. altering the configuration of bit values of the first column of pixels of the ith swath; o. repeating steps i. through n. 2 n times until all of the configurations of bit values of the first column of pixels of the ith swath have been used; p. determining which of the configurations of bit values of the first column of pixels provides a least combined difference value for the chosen configuration of bit values of the first set of look-ahead pixels, by comparing the stored combined difference values; q. altering the configuration of bit values of the first set of look-ahead pixels of the ith swath; r. repeating steps i. through q. up to 2 n.k times until all of the configurations of bit values of the first set of look-ahead pixels of the ith swath have been used; and s. storing a configuration of bit values of the first column of pixels for each of the configuration of bit values of the first set of look-ahead pixels, the stored configuration of bit values of the first column of pixel, providing a least combined difference value for a respective configuration of bit values of the first set of look-ahead pixels. The inventive procedure begins with an original two-dimensional continuous-tone monochrome image. The original image is first decomposed into a lower resolution bitmap by laying a coordinate grid over the original image and assigning a grey-scale intensity value to each pixel of the grid, using standard sampling techniques. For convenience, the grid of pixels for the original image has the same spacing and dimensions as that corresponding to the output device's images, although the present method may be extended to instances where this is not the case. The present invention converts this original sampled image, being an array of multiple intensity values, into a printable bitmap, being an array of only on and off values. Throughout the description, printing is understood to include actual printing from dot matrix, laser or other printers and also the displaying of images on any video display, and any other display technology. First, a printer model applicable to the particular output device is specified. The printer model is an algorithm for describing how the printer takes a particular printable bitmap and produces a given output. Often, various ink and paper interactions, such as non-linear or non-digital response of the imaging medium, dot spread or distortion, dot overlap, etc., prevent a rigorous one-to-one correspondence between the binary bitmap input and the printed bitmap output, or rendering. The printer model captures the essential aspects of the peculiarities in the device's output, and may be specified by printing and testing various binary test patterns. The printer model is a local model in the sense that the value of the printer model at a given point depends only upon a small number of nearby pixels in the bitmap. The simple printer model used in the current description takes into account the intensities of the 8 nearest neighbors of a given pixel in calculating the central pixel's output intensity. Second, a perception model for describing how the eye and brain perceive a bi-level output image is provided. The eye and brain, in receiving a printed bitmap, tend to read each pixel as some combination of nearby pixels. The perception model captures in a very approximate way the effects produced by this low-level processing by the eye and brain. A simple model used in the current description computes the perceived intensity of each output pixel as a weighted average of the printed pixel intensities in the nine-by-nine neighborhood centered around that pixel, similar to the operation of the printer model. The application of the perception model onto the rendered output of the printer model provides a perceived bitmap image, or perception. Third, a comparison model provides a method of comparing the perception of the original image with the perception of the printed image. The comparison is local in a similar way as the printer and perception models are local: it should be expressible as the sum of quantities, one quantity per pixel, with each quantity depending only on the values of the two images in some small neighborhood of a particular pixel. For the present description, a relatively simple comparison model subtracts the intensity value of the pixel of the perceived printed image from that of the corresponding pixel of the perceived original image and adds the absolute difference values for each pixel to arrive at an overall difference value for the two images. The printer model describes how a given bitmap image emerges from a given output device: neighboring pixels may affect the physical intensity of a given pixel, so that the entire printed bitmap has been altered neighborhood-by-neighborhood. The perception model characterizes how each pixel of the printed bitmap is seen by the eye and brain, given each pixel's immediate neighborhood. And the comparison model describes how an individual might compare the perception of the printed image with the perception of the original. The three models, the printer, perception and comparison models, both describe how a bitmap image is printed, perceived and compared with the original image, and provide procedural tools for altering the bitmap before printing to more closely match the original image. The present invention uses these models to analyze alternative bitmaps of the original image, before any bitmap has been sent to an actual printer or other output device, to more faithfully reproduce the original image. Simply comparing every permutation of the printable bitmap with the original sampled image would be a needlessly complex task. Instead, the present invention provides a dynamic programming algorithm for simplifying this task and yielding extremely close bitmap renderings of original images in an acceptable length of time. To simplify the problem of permuting a sampled image to form an acceptable printable bitmap, a series of parallel swaths through the image are used to perform only local permutations, one swath at a time. A swath signifies here a linear path of adjacent bits or pixels in the bitmap, having a constant width of n bits. Each column of n bits in a swath is numbered starting with one and ending with the length of the swath in pixels. Depending on the particular printer and perception models chosen, a certain number of columns of non-image bits will be added at the beginning and the end of the swath as a border and are typically preset to a single value. For convenience, these non-image bits are preset and held at 0. To analyze and choose the proper settings for the bits within the current swath, all the bits of the image outside the swath are held constant. Then, the next swath in turn is analyzed and altered, and so on until the entire image has been processed. As a first step in the processing of an individual swath, the first column of n bits is chosen as the current column to analyze. A number k of consecutive columns of "look-ahead" bits after the first column are also selected. An array of all possible configurations of the look-ahead bits will be attached in computer memory to the index for the current column of bits. In addition, a first and second neighborhood of pixels are defined around the current column of bits. The size of these neighborhoods is provided by the printer and perception models. The perception model defines the boundaries of the second neighborhood, being here a three-by-three square of bits around each bit in the current column. The first neighborhood is larger and accounts for printer effects at each pixel in the second smaller neighborhood. Here, for example, each pixel in the second neighborhood is affected by pixels in a three-by-three neighborhood centered around it. Hence, the first printer model neighborhood will comprise the area of the second perception model neighborhood plus a one pixel border around the second neighborhood's perimeter. Some portion of the bits of these two neighborhoods will comprise the look-ahead bits, a large number will include those bits of the image held constant outside the current swath, and, especially for the first few and last few columns, a certain number of bits may be non-image bits outside the actual sampled image which may be assigned the intensity value of zero. For each possible configuration of the look-ahead bits, values for the current column of bits are selected which minimize the local difference between the printed image and the original image. Several sub-steps accomplish this selection. Keeping the particular configuration of the look-ahead bits constant, the current column of bits is permuted one configuration at a time. For each configuration of the current column, the printer model is applied to the first neighborhood around the first column, providing a close approximation to how the printer device would render the current configuration of the bitmap for those pixels within the second neighborhood. Applying the perception model to the pixels in the second neighborhood (rendered by the printer model) yields a close approximation to how the eye and brain would perceive the printed pixels in the column itself. Finally, the comparison model calculates the overall difference between the perceived values of the current column and the perceived values of the original image, recording that combined difference value with the particular configuration of the current column. After all configurations of the column bits have been made, the configuration which yields theleast difference between printed image and original image is stored along with the particular configuration of look-ahead bits to which it belongs. The same process is repeated to find the optimal current column of bits for each possible combination of its look-ahead bit set, keeping the rest of the bitmap constant. The next step in the process assigns the succeeding column of bits in the swath to be the current column, and adjusts the columns of look-ahead bits accordingly. Again, for every configuration of look-ahead bits, the values of bits for the new current column are permuted to find the optimal set of bits which minimize the combined difference value between the printed image and the original image. One change is made, however, in that the combined difference value calculated at each column is cumulative, taking into account the difference values determined for the previous columns of bits. This summing of difference values may be done because successive analysis steps for each current column are linked. A particular combination of permuted values of the current column combined with its permuted set of look-ahead bits yields a single configuration of look-ahead bits for the previous "current" column, the one we just examined. Given this configuration of look-ahead bits, one has already calculated which combination of the previous column's bits to choose to minimize the cumulative combined difference value. Working backwards, all the optimal choices for previous columns may be looked up once we select a configuration for the current column. Since these values are set, as are the bits outside the swath, one can again calculate the combined difference value for all columns up to and including the current column, for each configuration of the current column's values, given each configuration of that column's set of look-ahead bits. The process of choosing optimal values for a current column for each configuration of its look-ahead columns, to minimize the cumulative combined difference value, is repeated for each column of bits in turn, until the last column of image bits is reached. Since the look-ahead bits for the last column are set at one value (in other words, they are non-image bits which have only one configuration), calculating the optimal values for the last column given its look-ahead bits yields only one set of optimal bit values. These values are the "best" values to choose for this last column, given the behavior of the printer and reception by the eye and brain. The procedure then cascades backwards, since the last column of values combined with the next k-1 look-ahead values (all zeros) determines the look-ahead values for the next-to-last column. One needs to only look up which set of values for the next-to-last column minimize the combined difference value, given the established set of look-ahead values, and another column of values has been determined. Now the bits of the next-to-last and last columns and the next k-2 look-ahead columns provide the configuration for the look-ahead bits of the next column working backwards. Again, given this selection of look-ahead bits, the optimal values for the column may be looked up from the previous calculations. The procedure continues backwards until the first column is reached and all bits for all columns in the swath have been chosen. At this point, the combined difference value between the perceived printed image and the perceived original image has been minimized for the current swath. The procedure described for the first swath is repeated for all swaths in the image. Giving a time of calculation vs. quality of image trade-off, the overall process may be conducted several times across the sampled image, until the printable bitmap relaxes into a bitmap providing a very close rendition of the original image. For instance, after the first swaths are laid out in a vertical path and analyzed from left to right, another set of swaths laid out horizontally and analyzed from top to bottom may be processed, and so on. The marginal benefits gained from each pass of the processing algorithm would typically decrease as the number of passes increases. The printable bitmap resulting from the present invention, once processed by the output device, should provide a faithful duplication of the original image. The present invention, by including explicit printer and perception effects, and by employing a local configuration of bits to find local optimal choices given future selections of the look-ahead bits, provides a technique for efficiently and successfully converting an original sampled bitmap into a bitmap suitable for a specific output device. The present invention will now be described by way of example with reference to the accompanying drawings, in which: Figure 1 is a schematic depiction of a bitmap, with a swath, current bit column and look-ahead bits displayed in accordance with the present invention; Figure 2A is a representation of a two-dimensional printer model; Figure 2B is a representation of a two-dimensional perception model; Figure 3 is a schematic depiction of a bitmap, showing a first and second neighborhood superimposed upon the bitmap; Figure 4 is a schematic depiction of a bitmap, revealing non-swath bit areas and non-image bit areas; Figure 5 is a schematic depiction of a bitmap, representing operation of the printer and perception models, and Figure 6 is a schematic depiction of a bitmap, with a current bit column advanced one bit ahead, in accordance with the present invention. To illustrate the present invention, it is helpful to first examine a related one-dimensional problem. In this related problem, a hypothetical one-dimensional continuous-tone image is converted to a binary one-dimensional bitmap. To accomplish the conversion process, the printer, perception and comparison models must be specified. For the sake of illustration, a simple printer model may be used. The model is shown in Table 1 below. The model represents the combined non-linear and non-digital effects of an actual output device, because of imaging medium, dot spread or distortion, dot overlap, etc. To use the printer model, a computation means samples three contiguous bitmap bits (for example, "1-1-0") and uses the printer look-up table given in Table 1 to calculate the actual intensity of center bit as displayed. The contiguous bitmap trio 1-1-0, according to Table 1, would result in the output of 0.8 for the center bit (what should theoretically have been a "1" in intensity). The printer model used in Table 1 is relatively simple, being a (0.2,0.6,0.2) convolution kernel applied to each successive bitmap trio. By applying the printer model to each bit of the bitmap, i.e., convolving it with its neighboring bits, the resultant printed bitmap (the rendering) can be calculated. The more accurate the printer model in duplicating non-linear printer effects, the more accurate this calculation will be. Printer Model Adjacent Bitmap Bits Printed Center Bit i - 1 i i + 1 i 0 0 0 0.0 0 0 1 0.2 1 0 0 0.2 1 0 1 0.4 0 1 0 0.6 0 1 1 0.8 1 1 0 0.8 1 1 1 1.0 Once the printer model has been applied to the initial bitmap, yielding the bitmap rendering, the perception model can be applied. The perception model, as discussed above, provides an approximate version of the low-level processing of the human eye and brain. For the present example, a simple perception model uses the following computation. For each rendered pixel location, the pixel's value multiplied by 2 is summed with the values of the two adjacent pixels. In essence, this calculation constitutes a low-pass filter with a (1,2,1) convolution kernel. After the perception model has been applied to the rendered bitmap, the new perception of the bitmap can be compared with an original paradigm image, using a comparison model, to determine how far from ideal the perceived image is. The comparison model used in the present description simply sums the absolute values of the pixel-by-pixel differences in the intensities of the two images. The following Table 2 illustrates the operation of the three models on a trial bitmap. The trial bitmap is compared with a desired paradigm image, shown in the second column. To account for the edges of the image (whether a one-dimensional image as in the present example, or the more usual two-dimensional image), calculations involving the borders of the bitmap may simply supply a 0 value for any non-existent non-image pixels beyond the bitmap boundary. Referring to the first row of Table 2, the neighbors of the first bit of the trial bitmap (value = 0) are 0 and 1. The 0 neighbor has been arbitrarily supplied, since the bitmap ends at bit number 1. Application of the printer model to the first bit and its neighbors yields a rendered bit having a value of 0.2. The perception model is next applied to the neighborhood around the rendered bit number one (the values are: 0.0 (supplied since the non-image bit is outside the bitmap boundary), 0.2, and 0.6). The perception model yields a perceived value of 1.0 at bit number 1. Finally, the comparison model takes the absolute value of the difference between the perceived value of the trial bitmap bit (1.0) and the perceived value of the original image (0.9) to yield a "badness" value for that bit of 0. 1. The 0.9 value for the perceived value of the original image bit is found by applying the same perception model to the image values found in column two. (For example, the calculation would be 1*(0.0) + 2*(0.3) + 1*(0.3) = 0.9). "Badness" indicates the difference in perceived value of the printed trial bitmap pixel and the sampled image pixel. Summing all the badness values for all the trial bitmap bits yields an overall badness value of 5.2. Since the overall badness value of a particular trial bitmap may be calculated, the methods of the present invention enable the determination of the trial bitmap which minimizes this badness value. The method relies on the locality of the individual models, i.e. that a calculation for a given pixel or bit depends only on some local neighborhood of pixels. For the particular models chosen in the present example, the partial badness calculated over the first three bit locations does not depend at all upon the bitmap values for locations 6 through 9. The perceived value of last bit 3 depends upon the rendered value of bit 4 through operation of the perception model, while the rendered value of bit 4 depends upon the trial bit 5, through operation of the printer model. In this way, the perceived value of bit 3 is linked to the trial bitmap value of bit 5, but to no further bits. The localness of each model effectively cuts off, after a certain point, the dependency of the perceived value of a given bit from the rest of the bit values. The problem of finding the optimal one-dimensional trial bitmap can be expressed as a set of related subproblems, each of the form: Subproblem i : Construct a table which calculates, for every possible setting of bits i + 1 , i 2, i + 3, i + 4, the minimum partial badness for cells 1 through i + 2, along + with the setting for bit i which attains this minimum. In this formalism, i represents the bit currently being considered and i + 1, i + 2, i + 3, i + 4 are "look-ahead bits". Since there are 2exp4 = 16 possible combinations of the look-ahead bits, and 2 possible states for bit i , the table would have 32 combinations. Half of these combinations would be eliminated as not minimizing the partial badness for a particular look-ahead configuration. The first subproblem 1 is easily solved by examining all 32 cases and retaining the 16 yielding a lower partial badness value. A portion of the table is shown below in Table 3: For each configuration of look-ahead bits 2 through 5, two possible values for bit 1 exist, 0 and 1. For the particular look-ahead bit configuration 1-0-0-0, letting bit 1 equal 0 yields a partial badness of 0.8, while a value of 1 yields a partial badness of 3.0. Hence, value 0 is retained as the optimal value for bit 1 given the particular configuration of look-ahead bits. Successive subproblems are slightly different. Subproblem 2 tabulates the ways to minimize the partial badness of cells 1 through 4 for each setting of bits 3, 4, 5 and 6, to find the optimal values for bit number 2. Table 4 illustrates a partially filled-in table of these calculations. Configuration Table for Subproblem 2.... Bit Number Value for Bit # 2 Badness for Cells 1 to 4 3 4 5 6 0 0 0 0 ... ... ... 1 0 0 0 ? ? ... For each configuration of the look-ahead bits 3 through 6, alternative values of bit 2 are attempted. Once a particular value for bit 2 is selected, bits 2 through 5 provide a complete set of look-ahead bits for bit 1, as used in the preceding sub-problem 1. Thus, the results of the preceding calculations can be consulted to recall the optimal value of bit 1 given the particular values of its look-ahead bits, thereby setting the values for bits 1 through 6. Using these values and the printer and perception models, the overall badness for bits 1 through 4 can be calculated for both values of bit 2, allowing an optimal value of bit 2 to be selected. The solution of the remaining sub-problems proceeds in the same way, selecting alternative values for the current bit for a particular configuration of look-ahead bits. In each successive sub-problem, the value of the current bit, combined with a subset of its look-ahead bits, provides a configuration of look-ahead bits for the preceding sub-problem. Hence, the table constructed from the preceding sub-problem can be consulted, the configuration of look-ahead bits used as an index, and the optimal value of the current-minus-1 bit determined. Then, the value of the current-minus-1 bit, the current bit and a portion of the current bit's look-ahead bits provide a configuration of look-ahead bits for the current-minus-2 subproblem, and so on. In this fashion, alternately selecting the value of an ith bit, and a particular configuration of the ith bit's look-ahead bits, completely determines the values of bits 1 through i + 4. From these values and the printer and perception models, the minimum badness for bits 1 through i + 2 can be determined. Finally, solving for the optimal value of the final bit in the last sub-problem determines the minimum badness for the whole bitmap. The final sub-problem constructs a table with only one row, since all the look-ahead bits fall outside the image and are all set to zero (in other words, there is only one possible configuration of look-ahead bits). Having completed the last sub-problem, the optimal settings for all the bits of the bitmap may be easily determined by tracing backwards through the solutions to the subproblems. Me last table yields the setting for the last bit, the last bit and the next-to-last table yield the optimal setting for the next-to-last bit, and so on, ending finally with the first table and all previously determined bits, which combined yield the optimal value for bit 1. The method of solution demonstrated for the one-dimensional image case may be adapted to find near-optimal solutions for the two-dimensional case. Because of the extra dimension, the table-building scheme described above can no longer be used to find an exact solution. However, the techniques provide an efficient and practical method for calculating near-optimal two-dimensional solutions. The present invention adapts the one-dimensional method to optimize a given image over one narrow swath of pixels at a time. This simplifies the problem of permuting a sampled image to form an acceptable printable bitmap. A swath 14 signifies here a linear path of adjacent bits or pixels in the bitmap 12, having a constant width of n bits. In the present example, n is equal to 2, as shown in FIG. 1. Each column of n bits in a swath is numbered starting with one and ending with the length of the swath in bits. As discussed above, depending on the particular printer and perception models chosen, a certain number of columns of non-image bits will be added at the each end of the swath as a border and are typically preset to a single value. For the particular models used in the present discussion (having three-by-three neighborhoods around each pixel) two columns of non-image bits are required at the beginning of the swath; four columns are needed at the end. For convenience, these non-image bits are preset and held at 0. To analyze and choose the proper settings for the bits within the current swath, all the bits of the image outside the swath are held constant. Then, the next swath in turn is analyzed and altered, and so on, until the entire image has been processed. In adapting the printer and perception models discussed above to the two-dimensional case, they can simply become two-dimensional square convolutions around a particular bit or pixel. For instance, the printer model 17a can convolve the three-by-three neighborhood around a pixel using the same kernel as before (i.e. the center pixel value is multiplied by 0.6 and added to its eight nearest neighbor's values each multiplied by 0.2, as shown in FIG. 2A). In the same way, the perception model 17b convolves the three-by-three neighborhood around a pixel using the (1,2,1) kernel, as shown in FIG. 2B. The comparison model can remain the same, merely adding the absolute difference between the perceived values for individual printed bits and the perception of an ideal image. As a first step in the processing of an individual ith swath 14i of a sampled image 12, the first column 16a of n bits is chosen as the current column to analyze. A number k of consecutive columns of "look-ahead" bits after the first column is also selected. In the present example, k is equal to 4. An array of all possible configurations of the look-ahead bits will be attached in computer memory to the index for the current column of bits. In addition, a first and second neighborhood of pixels are defined around the current column of bits. The size of these neighborhoods is provided by the printer and perception models 17a and 17b. The perception model defines the boundaries of the second neighborhood 18a, shown in FIG. 3, being here a three-by-three square of bits around each bit in the current column and a certain number of the look-ahead columns of bits. In the present case, two further columns beyond the current column are included in the second neighborhood. Those bits within the second neighborhood and within the swath will be used in the comparison step to determine the minimum badness of the printed and perceived image. The first neighborhood 20a is larger and accounts for printer effects at each pixel in the second smaller neighborhood. Here, for example, each pixel in the second neighborhood is affected by pixels in a three-by-three neighborhood centered around it. Hence, the first printer model neighborhood 20a will comprise the area of the second perception model neighborhood 18a plus a one pixel border around the second neighborhood's perimeter. Some portion of the bits of these two neighborhoods will comprise the look-ahead bits (area 22a, shown in FIG. 4), a large number will include those bits of the image held constant outside the current swath (areas 24a and 24b), and, especially for the first few and last few columns, a certain number of bits may be non-image bits outside the actual sampled image to which may be assigned the intensity value of zero (area 26). FIG. 5 illustrates the two-dimensional operation of the printer and perception models. To find the rendered value of bit B, the printer model 17a convolution values shown in FIG. 2A are applied to the three-by-three neighborhood 28 around B, neighborhood 28 lying within the first neighborhood 20a. Then, to find the perceived value of A, the perception model 17b convolution values shown in FIG. 2B are applied to the rendered values of the three-by-three neighborhood 30 around pixel A. All pixels B in neighborhood 30 would have similar neighborhoods 28 around them to apply the printer model to, and all pixels A within the swath of interest would have similar neighborhoods 30 around them. The set of all neighborhoods 30 for all pixels A in a given set of columns in the current swath constitute the second neighborhood 18a; the set of all neighborhoods 28 around all values B in the second neighborhood 18a constitute the first neighborhood 20a. For each possible configuration of the look-ahead bits 22a, values for the current column 16a of bits are selected which minimize the local difference between the printed image and the original image. Several sub-steps accomplish this selection. First, keeping the particular configuration of the k columns of look-ahead bits constant, the current column of bits 16a is permuted one configuration at a time. Next, for each configuration of the current column 16a, the printer model 17a is applied to the first neighborhood 20a around the first column 16a, providing a close approximation to how the printer device would render the current configuration of the bitmap for those pixels within the second neighborhood 18a. Then, applying the perception model 17b to the pixels in the second neighborhood 18a (rendered by the printer model) yields a close approximation to how the eye and brain would perceive the printed pixels in the column itself. Finally, the comparison model calculates the overall difference between the perceived values of the current column (and a given number of look-ahead columns within the second neighborhood 18a, here chosen to be two) and the perceived values of the original image, recording that combined difference value with the particular configuration of the current column 16a. After all configurations of the column bits 16a have been made, the configuration which yields the least difference between printed image and original image is stored along with the particular configuration of look-ahead bits to which it belongs. The same process is repeated to find the optimal current column of bits 16a for each possible combination of its look-ahead bit set 22a, keeping the rest of the bitmap 12 constant. The next step in the process assigns the succeeding column of bits 16b in swath 14i to be the current column, and adjusts the k columns 22b of look-ahead bits accordingly, as shown in FIG. 6. Again, for every configuration of look-ahead bits 22b, the values of bits for the new current column 16b are permuted to find the optimal set of bits which minimize the combined difference value between the printed image and the original image. First neighborhood 20b and second neighborhood 18b are also adjusted accordingly. One change is made, however, in that the combined difference value calculated at each column 16b is cumulative, taking into account the difference values determined for the previous columns of bits (16a, etc.). This summing of difference values may be done because successive analysis steps for each current column are linked. A particular combination of permuted values of the current column 16b combined with its permuted set of look-ahead bits 22b yields a single configuration of look-ahead bits 22a for the previous "current" column 16a, the one just examined. Knowing this configuration of look-ahead bits, the combination of the previous column's bits 16a has already been calculated to know which to choose to minimize the cumulative combined difference value. Working backwards, all the optimal choices for previous columns may be looked up once a configuration for the current column is selected. Since these values are set, as are the bits outside the swath, the combined difference value for all columns up to and including the current column can be calculated, for each configuration of the current column's values, given each configuration of that column's set of look-ahead bits. The process of choosing optimal values for a current column for each configuration of its look-ahead columns, to minimize the cumulative combined difference value, is repeated for each column of bits in turn, until the last column of image bits is reached. Since the look-ahead bits for the last column are set at one value (in other words, they have only one configuration,being all non-image bits set at zero), calculating the optimal values for the last column given its look-ahead bits yields only one set of optimal bit values. These values are the "best" values to choose for this last column, given the behavior of the printer and reception by the eye and brain. The procedure then cascades backwards, since the last column of values combined with the next k-1 look-ahead values (all zeros) determines the look-ahead values for the next-to-last column. As described above, one can refer to the already calculated set of minimal values for the next-to-last column, given an established set of look-ahead values, to determine another column of bit values. Then, the bits of the next-to-last and last columns and the k-2 look-ahead columns provide the configuration for the look-ahead bits of the next column working backwards. Again, given the particular selection of look-ahead bits, the optimal values for the column may be looked up from the previous calculations. The procedure continues backwards until the first column is reached and all bits for all columns in the swath have been chosen. At this point, the combined difference value between the perceived printed image and the perceived original image has been minimized for the current swath. The procedure described for the first swath is repeated for all swaths 14i in the image. Giving a time of calculation vs. quality of image trade-off, the overall process may be conducted several times across the sampled image, until the printable bitmap relaxes into a bitmap providing a very close rendition of the original image. For instance, after the first swaths are laid out in a vertical path and analyzed from left to right, another set of swaths laid out horizontally and analyzed from top to bottom may be processed, and so on. The marginal benefits gained from each pass of the processing algorithm would typically decrease as the number of passes increases. The printable bitmap resulting from the present invention, once processed by the output device, should provide a faithful duplication of the original image. The present invention, by including explicit printer and perception effects, and by employing a local configuration of bits to find local optimal choices given future selections of the look-ahead bits, provides a technique for efficiently and successfully converting an original sampled image into a bitmap suitable for a chosen output device. The methods and apparatus for optimal discrete rendering of images disclosed are applicable to any image rendering application. In particular, although the present embodiment has been described with reference to continuous-tone monochrome images, the same inventive procedures may be readily applied to color image applications.

Claims: A method for converting a continuous tone original image to a printable binary bitmap for use by an output printing device, comprising the steps of: a. defining a printer model (17a) for describing how the output printing device produces an output image from a given binary bitmap; b. defining a perception model (17b) for describing how a human eye perceives the output image; c. defining a comparison model for comparing the original image with the printable binary bitmap; d. sampling the original image to form a sampled pixel image (12); e. constructing a plurality of parallel swaths (14) through the sampled image (12), each swath (14) being a linear path of adjacent pixels, each path having width of n pixels; f. defining a linear array of columns of pixels (16a, 16b, etc.) for each swath (14), each column (16) being one pixel wide and having the same number of pixels high as the width of the swath, with each column (16) for each swath (14) being numbered consecutively; g. choosing a configuration of bit values for a first column of pixels (16a) of an ith swath (14i) to be analyzed and defining a first neighborhood (20a) and a second neighborhood (18a) of pixels, each of which surround and include the first column of pixels (16a), the second neighborhood being contained in the first neighborhood, the first and second neighborhoods including a number p of columns of pixels (16), and q columns of non-image pixels having preset values (26); h. choosing a configuration of bit values for a first set of look-ahead pixels (22a) adjacent to the first column of pixels (16a) and within the ith swath (14i), the first set of look-ahead pixels (22a) including a set of k consecutive columns of pixels of the ith swath (14i); i. applying the printer model (17a) to the first neighborhood (20a) to provide a convolved value (28) for the bits in the first neighborhood (20a); j. applying the perception model (17b) to the second neighborhood (18a) to provide a perceived value (30) of the convolved values in the second neighborhood (18a); k. applying the comparison model to compare the perceived value of the convolved values of the second neighborhood (18a) with a perceived value of the pixels of the sampled image (12) of the second neighborhood (18a) to arrive at a difference value for each chosen bit of a subset of columns of pixels of the ith swath (14i) lying within the second neighborhood (18); l. calculating a combined difference value from the difference values of the subset of columns; m. storing the combined difference value along with the configuration of bit values of the first column of pixels (16a); n. altering the configuration of bit values of the first column of pixels (16a) of the ith swath (14i); o. repeating steps i. through n.2 n times until all of the configurations of bit values of the first column of pixels (16a) of the ith swath (14i) have been used; p. determining which of the configurations of bit values of the first column of pixels (16) provides a least combined difference value for the chosen configuration of bit values of the first set of look-ahead pixels (22a), by comparing the stored combined difference values; q. altering the configuration of bit values of the first set of look-ahead pixels (22) of the ith swath (14i); r. repeating steps i. through q. up to 2 n.k times until all of the configurations of bit values of the first set of look-ahead pixels (22a) of the ith swath (14i) have been used, and s. storing a configuration of bit values of the first column of pixels (16) for each of the configuration of bit values of the first set of look-ahead pixels (22), the stored configuration of bit values of the first column of pixels (16) providing a least combined difference value for a respective configuration of bit values of the first set of look-ahead pixels (22). The method as Claimed in Claim 1, comprising the further steps of: t. choosing a configuration of bit values of a jth column of pixels (16b) of the ith swath (14i); u. determining a jth set of look-ahead pixels (22b) adjacent to the jth column of pixels (16b) and within the ith swath (14i), the jth set of look-ahead pixels (22b) including a set of k consecutive columns of pixels of the ith swath (14i), the jth set of look-ahead pixels (22b) having a configuration of bit values; v. applying the printer model (17a) to a first neighborhood (20b) around the jth column of pixels (16b) to provide a convolved value for the bits in the first neighborhood (20b); w. applying the perception model (17b) to a second neighborhood (18b) within the first neighborhood (20b) around the jth column of pixels (16b) to provide a perceived value of the convolved values in the second neighborhood (18b); x. applying the comparison model to compare the perceived value of the convolved values of the second neighborhood (18b) with a perceived value of the pixels of the sampled image (12) of the second neighborhood (18b) to arrive at a difference value for each chosen bit of a subset of columns of bits of the ith swath (14i) lying within the second neighborhood (18b); y. calculating a combined difference values from the difference value of the subset of columns; z. storing the combined difference value along with the configuration of bit values of the jth column of pixels (16b); aa. altering the configuration of bit values of the jth column of pixels (16b) of the ith swath (14i); ab. repeating steps v. through aa. 2 n times until all of the configurations of bit values of the jth column of pixels (16b) of the ith swath (14i) have been used; ac. determining which of the configurations of bit values of the jth column of pixels (16b) provides a least combined difference value for the bit values of the jth set of look-ahead pixels (22b), by comparing the stored combined difference values; ad. altering the configuration of bit values of the jth set of look-ahead pixels (22b) of the ith swath (14i); ae. repeating steps v. through ad. up to 2 n.k times until all of the configurations of bit values of the jth set of look-ahead bits (22b) of the ith swath (14i) have been used; af. storing a configuration of bit values of the jth column of pixels (16b) for each of the configurations of bit values of the jth set of look-ahead pixels (22b), the stored configuration of bit values of the jth column of pixels (16b) providing a least combined difference value for a respective configuration of bit values of the jth set of look-ahead pixels (22b) ag. letting j equal j + 1; ah. repeating steps t. through ag. until j equals p + 1; ai. assigning a stored configuration of bit values of a pth column of pixels to the pth column of pixels of the ith swath, and aj. assigning one of the stored configurations of bit values for a (p-1)th column of pixels of the ith swath to the (p-1)th column of pixels, the assigned configuration of bit values minimizing a combined difference value for a configuration of bit values of a (p-1)th set of look-ahead pixels of the (p-1)th column of pixels, the configuration of bit values of the (p-1)th set of look-ahead pixels being determined by the assigned configuration of bit values of the pth column of pixels and the preset bit values of q-1 columns of the columns of non-image pixels. The method as recited in Claim 2 further comprising: ak. assigning one of the stored configurations of bit values of an rth column of pixels of the ith swath to the rth column of pixels, the assigned configuration of bit values minimizing a combined difference value for a configuration of bit values of an rth set of look-ahead pixels of the rth column of pixels, the configuration of bit values of the rth set of look-ahead pixels being determined by a set of previously assigned bit values of an (r+1)th through an (r+k)th column of pixels; al. assigning r equal to r - 1; and am. repeating steps ak. through al. until r equals 0. The method as recited in Claim 3 further comprising: an. repeating steps g. through am. for each swath of a set of the swaths (14) of the sampled image (12).

Inventors: PLASS MICHAEL F, PLASS, MICHAEL F.
Applicants: XEROX CORP, XEROX CORPORATION
Application year: 1991
Main classification: G06K15
IPC codes: B41J2, G06K15, G06T5, H04N1