Anti-aliasing method for graphic display

Abstract: A method for determining the values of pixels in a resulting image having a greater number of pixels than an original image describes a technique for calculating the values of the new pixels in the resulting image. A rectangular region centered on a junction of four pixels in the original image is used as the basis for calculation. This rectangular region contains one-fourth of the adjacent original pixels, and is divided into 8 triangular regions. All of the pixels of the resulting image within a triangular region are given the same color, and the color assigned to the pixels in each such triangular region is a function of the colors of the four adjacent pixels in the original image.

Description: The present invention relates to the generating images in a computer system by selective assignment of a color to each of a pluralities of pixels on a display surface of a display device, and more specifically to a method for anti-aliasing raster images resulting from a computer translation of an original raster image to a resulting raster image having a greater number of pixels than the original raster image. Computer text and graphics are typically displayed using a raster image. The raster image is a rectangular array of rectangular picture elements known as pixels. Raster images can be displayed on CRT monitors in monochrome or various colors. Raster images are also used to display text and graphics on printers, plotters, and other display devices. One problem encountered when displaying a raster image is that of aliasing. Aliasing is the jagged, stair-step appearance when lines and edges are displayed which are neither vertical nor horizontal. This problem is more noticeable when a small number of large pixels are used for a given area. Increasing the resolution of the display device, thereby increasing the number of pixels per unit area, improves the appearance of the raster image. One of the more successful anti-aliasing algorithms involves edge blur. Along the edge of the diagonal or curved line, where stair-steps occur, there is ordinarily a sharp transition between the pixels that are drawn in the different colors of the two regions. The staircase appearance occurs because pixels of one color lay immediately adjacent to those of another color, making the jagged transition between them noticeable. With an edge blur algorithm, however, it is possible to average the color values of the two regions along the edge and then display missing pixels in the staircase using this in-between color. The result is a blurring or softening of the edge, smoothing over the transition between the colors of the different regions. One disadvantage of this approach is that the display device must be able to display colors which are intermediate between the colors of the two different regions. It is sometimes desirable to enlarge a raster image to create a large graphic printout or display. The larger display or printout usually has more pixels for displaying the image than the original image. A simple method to enlarge the original raster image is to simply enlarge the original pixels, mapping them to the pixels of the enlarged image. If, for example, the zoom factor is 8, each pixel of the original image becomes an 8x8 square of pixels in the resulting image. If the pixels are simply enlarged in this manner, each of the 64 pixels in a square corresponding to an original pixel is simply given the same color value as the original pixel. This gives the same appearance as using very large pixels in the resulting image, and the stair-step phenomena is generally more noticeable than in the original image. Use of intermediate colors for these large pixels does not completely solve the problem. A known process for converting a raster image of a given pixel density to a corresponding magnified raster image of an increased pixel density includes a first step dealing with the original image and a second step dealing with the converted image (EP-A-0336776). In the first step, a region defined by four adjacent pixel centers is divided into four sections corresponding to that adjacent pixel centers. Such sections may consist of eight triangular sections four of which forming an inner rectangular region centered within a surrounding rectangular region defined by the center points of the adjacent pixels. In the second step, the area of a converted pixel of the magnified image which lies within the defined region of the original image when both images are superimposed is projected onto that region. From the proportions of the area of the converted pixel projected onto said sections the concentration of the converted pixels is calculated and the result is quantized to a binary value which is made one to designate the color black when the calculated concentration is greater or equal to 0,5 and is made zero to designate white when the calculated value is smaller than 0,5. The calculation may be performed by logic operations which within a predetermined short range of one of the four adjacent original pixel centers derive the concentration values to be calculated from the concentration value of the nearest original pixel regardless of the concentrations in the other three pixels. Herein the boundary lines for defining such short range is determined by x±y=±1/2. In spite of this simplification and although the known process is applied only to black and white images it still requires complex processing. It is furthermore known to smooth abrupt variations in the contour of a stored raster image by storing the image signal of that abrupt variation in adjacent empty addresses of the contour (GB-A-2 120 899). This smoothing process is performed at an enlarged raster image in which abrupt contour variations are determined by scanning and comparing the addresses of the image signals in a diagonal direction. It would be desirable to provide a method for anti-aliasing which is suitable for use when a colored raster image is enlarged, or otherwise translated to a resulting image having more pixels than the original. It would also be desirable to provide such a method which uses only the original image colors in order to retain sharpness of the image. It would further be desirable for such a method to be relatively simple to implement and fast in operation. It is therefore an object of the present invention to provide an anti-aliasing method suitable for use when an original raster image is translated to a resulting image containing more pixels than the original, such as an enlarged image. It is another object of the present invention to provide such a method which utilizes only the colors present in the original image, without requiring the generation of intermediate colors. It is another object of the present invention to provide such a method which is easily implemented and fast in operation. Therefore, according to the present invention, a method for determining the values of pixels in a resulting image having a greater number of pixels than an original image describes a technique for calculating the values of the new pixels in the resulting image. A rectangular region centered on a junction of four pixels in the original image is used as the basis for calculation. This rectangular region contains one-fourth of the adjacent original pixels, and is divided into 8 triangular regions. All of the pixels of the resulting image within a triangular region are given the same color, and the color assigned to the pixels in each such triangular region is a function of the colors of the four adjacent pixels in the original image. The novel features believed characteristic of the invention are set forth in the appended claims. The invention itself however, as well as a preferred mode of use, further objects and advantages thereof, will best be understood by reference to the following detailed description of an illustrative embodiment when read in conjunction with the accompanying drawings, wherein: Figure 1 illustrates a small portion of a raster image; Figure 2 is a diagram illustrating the location of a rectangular region used in the calculation of pixel colors for a resulting raster image; Figure 3 illustrates the rectangular region of Figure 2 divided into 8 triangular regions; Figure 4 is a flowchart illustrating the steps of a preferred implementation of the present invention; and Figure 5 illustrates the results of applying the method of Figure 4 to a portion of the raster image of Figure 1. Figure 1 shows a portion of a raster image 10 formed from a plurality of pixels. The pixels of Figure 1 are divided into four rows R1, R2, R3 and R4, and four columns C1, C2, C3 and C4. Pixels can be referred to by their coordinates, so that pixel 12 is identified by the location (R2, C4) and pixel 14 is identified by the location (R4, C2). The pixels of Figure 1 are shown in two colors: shaded and not shaded. The invention will be illustrated below in conjunction with pixels having only two colors, but, as will be appreciated by those skilled in the art, also applies to multi-color images. Figure 2 shows the four adjacent pixels in the upper left hand corner of Figure 1. Shading of the pixels is omitted in Figure 2 for clarity. When raster image 10 is to be enlarged, a method for calculating the pixel colors in the resulting image utilizes rectangular region 16. Rectangular region 16 has the same shape as each of the pixels, which is square as shown in Figures 1 and 2. Rectangular region 16 is centered on the intersection point 18 of the four pixels. In Figure 2, the four pixels illustrated are shown as being slightly spaced apart both for clarity and because adjacent pixels are actually separated by a small space in some types of displays. Rectangular region 16 is considered to include the nearest one-fourth of each adjacent pixel. Figure 3 illustrates logical regions 1-8 into which rectangular region 16 is divided. Regions 1 and 5 correspond to the lower right hand corner of pixel (R1, C1) of Figure 2. Regions 2 and 6 correspond to the lower left hand corner of pixel (R1, C2). The remaining regions likewise correspond to the remaining pixels adjacent to intersection point 18. The numbered regions will be used in connection with the detailed description of the preferred method for assigning pixel colors as described in connection with Figure 4. Figure 4 is a flowchart of the calculations necessary to assign colors to all of the pixels within one rectangular region 16. In order to determine the colors of all of the pixels in the resulting array, the calculation outlined in Figure 4 is performed for a rectangular region 16 for the intersection point 18 between every set of four adjacent pixels in the array. The calculation of Figure 4 is therefore performed a number of times equal to (N-1)*(M-1) for an N X M array of pixels. Referring to Figure 4 considered in conjunction with Figure 3, the first step 30 is to assign colors to the pixels located in regions 1, 2, 3, 4. The pixels in these regions are assigned the same color as the color of the original pixel of which each region is a part. Therefore, for example, considering rectangular region 16 of Figure 2, regions 1, 3, and 4 are assigned the shaded color, while region 2 is assigned the unshaded color. The next step is to perform the conjunctive logical comparisons of step 32. If the color of region 1 is equal to the color of region 2, region 3, and region 4, the YES branch is taken. When this condition occurs, all four of the original pixels have the same color, and the entire area of rectangular region 16 is assigned this color. Therefore, regions 5, 6, 7, and 8 are assigned the same color as region 1 is step 34. If the NO branch is taken from step 32, the test shown in step 36 is performed. This is a comparison to see whether the color of region 1 is the same as the color of 4, and the color or region 2 is the same as that of region 3. If this is the case, the four original pixels formed a checkerboard pattern using two colors, and no changes will be made within the area encompassed by rectangular region 16. Thus, if the result of test 36 is true, control skips ahead to step 38 which assigns interior triangular regions 5, 6, 7, and 8 to have the same color as their adjacent exterior triangular regions 1, 2, 3, 4. After step 38, processing is complete. If the result of step 36 is NO, control passes to step 40. In step 40, the color of region 1 is compared to the color of region 4. If they are the same color, control passes to step 42. If this point is reached in the flowchart, it is known that the upper left and lower right pixels have the same color, while the lower left and upper right pixels are of differing colors. This means that a line is formed by the upper left and lower right pixels, and all of the interior regions 5, 6, 7, 8 are given the same color as region 1. If the result of step 40 is NO, the test of step 42 is performed. This test is analogous to that performed in step 40, except that a check is made to see whether the same colors are found in regions 2 and 3. If so, control passes to step 46. If this point in the flowchart is reached, it is known that regions 2 and 3 have the same color, while regions 1 and 4 have dissimilar colors. Therefore, all of the interior triangular regions 5, 6, 7, 8 are assigned the same color as region 2. If the result of step 44 is NO, control passes to step 38. As described above, step 38 assigns each of the interior triangular regions the same color as their adjacent exterior triangular region. If step 38 is reached, it is known that one of three situations has occurred with respect to the four adjacent pixels. If control passes from step 44 to step 38, either each of the adjacent pixels is a different color from all of the others, or any adjacent pixels of the same color are vertically or horizontally adjacent. If control has reached step 38 from step 36, the two color checkerboard pattern described above occurs. In either event, the four corners of the rectangular region 16 are given the same value as the original pixels from which they are derived. The precise conditions tested, and the order in which the tests are made, need not be exactly as shown in Figure 4. Any set of tests which colors regions 1-8 in the same manner as described above can be used. The general rule is to color all of the interior triangles 5-8 the same color as two diagonally opposite exterior triangular regions 1 and 4, or 2 and 3, unless the checkerboard pattern occurs. Figure 5 illustrates the effect of the method of Figure 4 on a portion of the raster image of Figure 1. The four original pixels (R2, C2), (R2, C3), (R3, C2), and (R3, C3) are shown. In this example, the zoom, or magnification, factor is 8, meaning that each original pixel is translated to an 8x8 region of pixels in the resulting image. If the pixels of Figure 1 were translated unchanged into Figure 5, a large stair-step would be evident. Applying the method of Figure 4 to the various intersection points of Figure 1 gives the result of Figure 5, wherein the upper right hand corners of the (R2, C2) and (R3, C3) regions are set to the non-shaded color, and the lower left triangular region of (R2, C3) is shaded. Since the edges of the triangles of Figure 3 pass through pixels of the zoomed image, it is necessary to determine whether pixels lying on both sides of a diagonal line are to be assigned the same color as the outside triangular region or interior triangular region. In the example of Figure 5, the assumption is made that pixels lying along a diagonal line of Figure 3 are assigned the same color as the outside triangular region. This causes the slight bump in the line found in the (R2, C3) quadrant of Figure 5. It will be appreciated by those skilled in the art that the comparisons and assignments shown in Figure 4 can be performed very quickly, even when the original raster image has a large number of pixels. The quality of the zoomed, resulting image is improved quite dramatically. No intermediate colors need to be generated, so that the sharpness of the transitions between differently colored regions is maintained in the enlarged image. The method described above can be used when a raster image is converted to be shown on a CRT display having a greater number of pixels than that of the original display. It is also suitable for use when a raster image is to be greatly enlarged so that it can be printed on a printer or plotter. This allows, for example, an image suitable for viewing on a CRT display to be enlarged and printed on a large chart suitable for showing to an auditorium. The detailed embodiment described above can be generalized to include more than eight triangular regions if desired. For example, if diagonal lines are drawn between the corners of rectangular region 16 in Figure 3, 16 triangular regions would result. These can be assigned colors as a function of the four adjacent pixels. It is also possible to center such a 16-piece region on a pixel instead of an intersection, and color the triangular regions as a function of the eight surrounding pixels. Dividing the rectangular region 16 into a large number of triangular regions is not preferred because it is computationally expensive. Also, the information content of the original pixels is much lower than that of the resulting image, and performing complex interpolations usually does not improve the resulting image to a degree which justifies the extra computation. It is usually more fruitful to simply recreate the original image at a higher resolution if possible. While the invention has been particularly shown and described with reference to a preferred embodiment, it will be understood by those skilled in the art that various changes in form and detail may be made therein without departing from the scope of the invention as defined in the appended claims.

Claims: A method for anti-aliasing raster images resulting from a computer translation of an original raster image to a resulting raster image having a greater number of pixels than the original raster image, said method including the steps of a) defining in the original image pixel groups of four pixels meeting at intersections, b) defining a rectangular region by the center points of said four pixels of the original image, said rectangular region being divided into eight triangular regions, four of said triangular regions forming an inner rectangular region centered within said defined rectangular region, and four of said triangular regions forming exterior triangular regions adjacent to said triangular regions of said inner rectangular region, characterized by the following steps: c) assigning to each of said four exterior triangular regions of the original raster image a color which is the same as the color of the adjacent one of said group of four pixels in the original image; d) if exactly one pair of diagonally opposite ones of said exterior triangular regions has the same color then assigning that color to all of said triangular regions of said inner rectangular region, else assigning to each triangular region of said inner rectangular region the same color as the adjacent exterior triangular region has; e) mapping each of said triangular regions of the original raster image to selected pixels of said resulting image and assigning the colors assigned by step d) to the triangular regions of the original raster image to the corresponding ones of said selected pixels of said resulting raster image. The method of claim 1, wherein all of the triangular regions have the same size. The method of claim 1, characterized in that in advance of step d) assigning to each of said four exterior triangular regions of the original raster image the color of said group of four pixels if all of said four pixels have the same color. The method of claim 1, characterized by comparing in one step the colors of both pairs of diagonally opposite ones of said exterior triangular regions of the original raster image and, if the compared colors are the same, assigning the color of each of said pairs of diagonally opposite ones of said exterior triangular regions to the adjacent ones of said triangular regions of said inner rectangular region. The method of one of the claims 1 to 4, further comprising the step of displaying the resulting image on a display device. The method of claim 5, wherein the display device is a video monitor. The method of claim 5, wherein the display device is a printer.

Inventors: WILLIAMSON WILLIE JR, WILLIAMSON, WILLIE, JR.
Applicants: IBM, INTERNATIONAL BUSINESS MACHINES CORPORATION
Application year: 1990
Main classification: G09G1
IPC codes: G06T3, G09G1, G09G5