Abstract:
The present invention relates to a process for producing a skeleton from a binary image by using the compressed run data of the image instead of using natural expanded binary format of the image. A run length compressed image is a binary image (black/white) that is compressed by taking stripes of pixels of the same value and grouping them together into a single &#34;run&#34; of pixels. This compression technique saves significant amounts of memory on most binary images. It is an object of this present invention to enable the image to be skeletonized in its run length compressed format. This reduces the amount of data that needs to be stored in memory. Further, since the image is in &#34;runs&#34; and not pixels, the pixels that are not affected are not evaluated. By increasing available memory while reducing the amount of pixels to be evaluated, the speed for the process is increased on the order of several magnitudes.

Description:
BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     The present invention relates to a process for manipulating images using compressed run length data of the image. 
     2. Description of the Related Art 
     An image skeleton represents the basic structure of an image and is created by decomposing the widths of raster objects in the image to uniform single pixel widths. This simplifies the task of certain recognition systems from character recognition to geometrical recognition. 
     The current state of the art provides a process for skeletonization of an image by stripping one layer of pixels after another. The process continues until the set of pixels left form a one pixel wide line and is defined as separating two &#34;off&#34; areas. This process is known as raster &#34;thinning&#34; or &#34;erosion.&#34; 
     The problems associated with the current skeletonization processes include their relatively slow speed and extensive memory utilization requirements. In order to skeletonize the image using the current techniques, two copies of the image must be maintained in memory. For large images, this could mean storing an extraordinary, amount of data. The larger the data file, the greater the access time. Therefore, the process of data retrieval and storage increases in time with the increased amount of data stored. 
     Also, every pixel in the image is evaluated regardless of whether the pixel will be removed or ignored. This requires a substantial increase in the number of points to be evaluated and increases the amount of time required to complete the process. 
     The prior art discloses a number of devices utilizing appropriated methods and apparatus for skeletonization of images used in pattern recognition. For example, U.S. Pat. No. 3,975,709 to Beun et al. and U.S. Pat. No. 5,224,179 to Denker et al. disclose methods of image thinning or skeletonization utilizing at least 3×3 grid pixel by pixel analysis to thin a character of interest. 
     Another reference, U.S. Pat. No. 5,335,290 to Cullen et al., teaches a character recognition system by extracting run lengths for each scanline from the bit mapped representation of the document image and classifying the data as image, text or as a horizontal or vertical line. However, there is no teaching of the process of skeletonization by run length comparison which is needed to increase speed of the pattern recognition. 
     Still another reference, U.S. Pat. No. 4,491,960 to Brown, describes a pattern comparison system wherein a raster scan of a hand print produces a topography to be compared to a given parameters for identification. 
     Yet another reference, Zhang et al., &#34;A Fast Parallel Algorithm for Thinning Digital Patterns&#34;, discloses skeletonization via pixel by pixel comparison and removal of subsequent outer pixels for character thinning. 
     However, the prior art fails to address the problem of size of data files and speed of skeletonization and does not disclose, teach or even suggest the embodiments of the claimed invention. 
     SUMMARY OF THE INVENTION 
     To address the requirements described above, the present invention discloses a method, apparatus, and article of manufacture for producing a skeleton from a binary image by using the compressed run data of the image instead of using natural expanded binary format of the image. 
     A run length compressed image is a binary image, often black and white, that is compressed by taking stripes of pixels of the same value and grouping them together into a single &#34;run&#34; of pixels. The process analyzes three rows at a time and compares the runs in the encompassing external rows with the runs in the internal row. 
     Features of the invention are the process of erosion or skeletonization of the image in its length compressed format, which reduces the amount of data that needs to be stored in memory. Since the image is represented and analyzed in terms of &#34;runs&#34; and not pixels, the pixels that are not affected are not evaluated. By increasing available memory while reducing the number of pixels to be evaluated, the speed for the process is increased on the order of several magnitudes. 
     The disclosed computer-based method of reducing an image to its skeleton utilizes a two pass analysis process wherein each row of an image is analyzed with respect to adjacent rows. More specifically, the method comprises storing an image in a temporary buffer; reading the image from the temporary buffer and storing the image as a source image in a source image buffer as a series of rows, each row comprising one or more runs of on or off pixels; processing the source image row by row with respect to adjacent top and bottom rows using a two pass analysis process comprising a top-left analysis pass and a bottom-right analysis pass wherein the top-left analysis pass analyzes each run in each row of the source image and removes all on pixels adjacent to top and left off runs and wherein the bottom right analysis pass analyzes each run in each row of the source image and removes all on pixels adjacent to bottom and right off runs; building, after each run is processed in each analysis pass, a destination image in a destination buffer by storing non-removed pixels in the destination image; comparing, after each two pass analysis process, the destination image with the source image; replacing the source image with the destination image if the images differ; and repeating the two pass analysis process until the destination image is identical to the source image. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     Referring now to the drawings in which like reference numbers represent corresponding parts throughout: 
     FIG. 1 illustrates an exemplary hardware environment for the present invention; 
     FIG. 2 is a flowchart that illustrates the general logic of the present invention; 
     FIG. 3 illustrates a sample row comprised of various run lengths; 
     FIG. 4 illustrates the original image to be processed using the disclosed skeletonization method: 
     FIG. 5 illustrates the image of FIG. 4 after a top-left analysis pass is performed; 
     FIG. 6 illustrates a further skeletonization of the original image after a bottom-right analysis pass is performed; 
     FIG. 7 illustrates a further skeletonization of the original image after a subsequent top-left analysis pass is performed; and 
     FIG. 8 illustrates the final skeleton of the original image. 
    
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS 
     In the following description, reference is made to the accompanying drawings which form a part hereof, and which is shown, by way of illustration, several embodiments of the present invention. It is understood that other embodiments may be utilized and structural changes may be made without departing from the scope of the present invention. 
     Hardware Environment 
     FIG. 1 is an exemplary hardware environment used to implement the preferred embodiment of the invention. The present invention is typically implemented using a personal computer 100, which generally includes, inter alia, a processor 102, random access memory (RAM) 104, data storage devices 106 (e.g., hard, floppy, and/or CD-ROM disk drives, etc.), data communications devices 108 (e.g., modems, network interfaces, etc.), monitor 110 (e.g., CRT, LCD display, etc.), mouse pointing device 112 and keyboard 114. It is envisioned that attached to the personal computer 100 may be other devices such as read only memory (ROM), a video card, bus interface, printers, etc. Those skilled in the art will recognize that any combination of the above components, or any number of different components, peripherals, and other devices, may be used with the computer 100. 
     The present invention is usually implemented by one or more computer programs 118 that skeletonize a binary source image 120 to create a destination image 122. However, it should be understood that, in the alternative, the principles of the invention may also apply to specific utilities or functions within the operating system 116 itself. In general, the functions performed in the present invention, whether implemented as part of an operating system 116 or a specific computer program 118, will be referred to herein as &#34;computer programs&#34;. 
     Generally, the computer program 118 which implements the preferred embodiment of the invention is embodied in or readable from a computer-readable device, medium or carrier, e.g., one or more of the fixed and/or removable data storage data devices 106 and/or a remote device attached to the computer 100 via the data communications devices 108. Under control of operating system 116, the computer program 118 may be loaded from the data storage devices 106 or data communications devices 108 into the memory 104 of computer 100. The computer program 118 comprises instructions which, when read and executed by computer 100, cause the computer 100 to perform the steps necessary to execute the steps or elements of the present invention. 
     Those skilled in the art will recognize that the exemplary environment illustrated in FIG. 1 is not intended to limit the present invention. Indeed, those skilled in the art will recognize that other alternative hardware environments may be used without departing from the scope of the present invention. 
     Overview 
     An image or character of interest that is to undergo the process of skeletonization is scanned and stored in temporary memory in a first buffer where the pattern of the character will be read. The image pattern is then read and is stored as a plurality of discernible rows of &#34;on&#34; and &#34;off&#34; pixels which define the image. Furthermore, a particular row of the image can be characterized into smaller subsets of runs of &#34;on&#34; and &#34;off&#34; pixels or &#34;run lengths.&#34; A run length representation of a particular image can be expressed in a row index table. The first number for each row, which is set off from the remaining numbers, is the row number. The top row of an image would be expressed in the index table as row &#34;0&#34;. The second row would begin with &#34;1&#34; and so on for each additional row. Following the &#34;:&#34; is a series of numbers, which are set off from each other by commas. The first number in the set always indicates the number of &#34;off&#34; pixels in the first run length making up the row. If the first pixel in the row is &#34;on&#34; then the length of the first run would be zero. 
     FIG. 3 shows a single row of an image that is 13 pixels wide (pixels &#34;0&#34; through &#34;12&#34;). The index table representation for this row would be &#34;0:6,6,2&#34;. The first &#34;0&#34; defines the row while the numbers after the colon define the run lengths of the &#34;on&#34; and &#34;off&#34; runs that make up the row. Since the first number following the colon is the number of &#34;off&#34; pixels in the first run, the index table representation of FIG. 3 can be read to mean that the first run length in the row comprises six &#34;off&#34; pixels. The remaining numbers in the index table representation indicate a run of six &#34;on&#34; pixels, which is in run, followed by a final run comprising two &#34;off&#34; pixels. 
     In the method of skeletonization disclosed herein, the run lengths of adjacent rows of an image are compared in order to resolve the image into its skeleton. By analyzing &#34;runs&#34; or groups of pixels instead of single pixels, the disclosed skeletonization method resolves an image much faster than prior art methods. 
     The skeletonization method will be described with respect to FIG. 4, which shows an image that comprises three (3) rows each containing thirteen (13) pixels. The first row can be described by the index table representation &#34;0:9,5&#34;. The second and third rows can be described by the index table representations &#34;1:1,12,1&#34; and &#34;2:0,5,2,7&#34;, respectively. 
     General Logic 
     FIG. 2 is a flowchart that illustrates the general logic of the present invention. The general logic comprises two analysis passes of the image, in which each row of a source image is sequentially analyzed with respect to the rows above and below the row being analyzed. The rows in the analysis will be referred to hereinafter as the top, process and bottom rows, wherein the process row is the row being analyzed. 
     Block 200 represents the image processing program 118 looping through and selecting all rows of the source image from a source buffer. 
     Block 202 represents the image processing program 118 performing the first analysis pass, which is referred to as the &#34;top-left&#34; analysis pass. The goal of the &#34;topleft&#34; analysis pass is to remove all the &#34;on&#34; pixels that are adjacent to &#34;off&#34; pixels located above and to the left of each pixel of the selected row. 
     Block 204 represents the image processing program 118 performing the second analysis pass, which is referred to as the &#34;bottom-right&#34; analysis pass. The goal of the &#34;bottom-right&#34; analysis pass is to remove all the &#34;on&#34; pixels that are adjacent to &#34;off&#34; pixels located below and to the right of each &#34;off&#34; pixel of the selected row. 
     Of course, those skilled in the art will recognize that the &#34;top-left&#34; and &#34;bottom-right&#34; analyses passes described above could be reversed in order and still yield an identical skeleton. 
     Block 206 represents the image processing program 118 generating and storing a new destination image in a destination buffer. 
     Following the completion of each two-pass analysis, Block 208 represents the image processing program 118 comparing the new destination image stored in the destination buffer with the source image. 
     Block 210 is a decision block that determines whether the destination image is different from the source image. If not, control transfers to Block 212; otherwise, the logic terminates. 
     Block 212 represents the image processing program 118 storing the destination image in the source buffer, thereby replacing the source image. In other words, the destination image becomes the source image. Control is then transferred to Block 200, so that the two-pass analysis process is performed with respect to the replaced source image. 
     Detailed Logic 
     A more detailed description of the general logic of FIG. 3 is provided below. Further, the two-pass skeletonization method is explained in detail with respect to the images depicted in FIGS. 4-8. 
     I. Top-Left Analysis Pass 
     A. Preliminary Top-Left Analysis of Row &#34;0&#34; 
     The first, top-left, analysis pass begins with a preliminary analysis, which analyzes the first row, or row &#34;0&#34; of the image with respect to a &#34;virtual&#34; top row. The virtual top row comprises all &#34;off&#34; pixels and can be represented in index table format, as &#34;0:14&#34;. The process row in the preliminary analysis pass, which is the first actual row of the image, would be represented as &#34;0:9,5&#34; in index table format. Finally, the bottom row for the preliminary analysis pass, which is the second actual row of the image, is represented as &#34;1:1,12,1.&#34; 
     1. Analysis of First &#34;On&#34; Run 
     The analysis pass begins by scanning the process row until the first &#34;on&#34; run length is encountered. If the process row begins with an &#34;off&#34; run, then the initial &#34;off&#34; run is directly copied as the first run in the analyzed process run, which is stored in the secondary buffer. Referring to FIG. 4, since the process row begins with an initial run length comprising 9 &#34;off&#34; pixels, the first pass destination image created in the first pass destination buffer would be &#34;0:9&#34;. 
     The process then considers the first &#34;on&#34; run in the process row. Each &#34;on&#34; run is analyzed using a tripartite process, which performs distinct analyses for the first &#34;on&#34; pixel, the middle group of &#34;on&#34; pixels and the last or end &#34;on&#34; pixel in the run. In the example of FIG. 4, the first &#34;on&#34; run, begins in the 9th column and comprises a first &#34;on&#34; pixel in column 9, a middle group comprised of three &#34;on&#34; pixels located in columns 10, 11 and 12 and a last or end &#34;on&#34; pixel located in column 13. 
     a. Analysis of First Pixel in Process &#34;On&#34; Run 
     (i) Is First &#34;On&#34; Pixel a Removal Candidate? 
     The first part of the tripartite &#34;on&#34; run analysis process begins with an analysis of the first &#34;on&#34; pixel. Since we are analyzing the first &#34;on&#34; pixel during a &#34;top-left&#34; analysis pass, the first &#34;on&#34; pixel is always a candidate for removal since it is by definition, adjacent to an &#34;off&#34; pixel to its immediate left. However, in order to determine whether the first &#34;on&#34; pixel can in fact be removed, we must perform corner pixel connectivity and endpoint analyses. 
     (ii) Corner Connectivity and Endpoint Analyses for First &#34;On&#34; Pixel 
     The corner connectivity analysis compares the first &#34;on&#34; pixel of the process run with the runs located in the top and bottom rows that contain the column immediately preceding the column of the first &#34;on&#34; pixel of the process row. A corner connective condition is indicated if there is an &#34;on&#34; run in either adjacent row that ends in the column immediately preceding the first &#34;on&#34; pixel of the process row. This indicates that the first &#34;on&#34; pixel in the first &#34;on&#34; run of the process row is part of the skeleton of the image. Therefore, the process pixel is stored into the destination buffer as an &#34;on&#34; run following, the initial &#34;off&#34; run stored therein. 
     However, even if a first &#34;on&#34; pixel in a process run is not corner connected, it may nonetheless be part of the skeleton of the image if it is an &#34;endpoint&#34; pixel. Thus, if a first &#34;on&#34; pixel fails its corner connectivity test, an endpoint check must be performed in order to determine whether or not the first &#34;on&#34; pixel is, in fact, part of the skeleton of the image. Like the corner connectivity test, the endpoint check analyzes the runs in the top and bottom rows that contain the first &#34;on&#34; pixel of the process run. 
     If the comparison of the top and bottom adjacent rows indicates that the first &#34;on&#34; pixel of the process run falls intermediate &#34;off&#34; runs in the top and bottom rows that do not end in the same column as the first &#34;on&#34; pixel in the process run, then the first pixel in the process run is part of the skeleton of the image and cannot be deleted. 
     There is a special case for a process run that is only one pixel long. In this case, the single &#34;on&#34; pixel comprising the process run can only be deleted if the top adjacent run is an &#34;off&#34; run and the adjacent bottom run is an &#34;off&#34; run and is at least two pixels long. 
     In the example of FIG. 4, the runs of interest for the corner connectivity and endpoint analyses are the runs located in the virtual top row and row &#34;1&#34; containing column 8. In the example there are no &#34;on&#34; runs in either the virtual top row or the bottom row that end in column 8. Therefore, the first &#34;on&#34; pixel of the process run is not corner connected. Furthermore, since the first &#34;on&#34; pixel is not intermediate &#34;off&#34; runs in both the adjacent top and bottom rows, the first &#34;on&#34; pixel is not an endpoint pixel either. Thus, the first &#34;on&#34; pixel of the process run is not part of the skeleton and can be removed. The &#34;0:9&#34; destination image stored in the first pass destination buffer is therefore updated by adding &#34;1&#34; to the initial &#34;off&#34; run stored therein. Thus, the first pass destination image would be replaced with &#34;0:10&#34;, in index table format. 
     If, on the other hand, the analysis determined that the first &#34;on&#34; pixel were in fact either corner connected or an endpoint pixel, then the result would be that the first &#34;on&#34; pixel would remain as part of the skeleton of the image. In that case, the image stored in the first pass destination buffer would be updated by adding an &#34;on&#34; run comprising one pixel after the initial &#34;off&#34; run stored in the first pass destination buffer. 
     b. Analysis of &#34;Middle Group&#34; of &#34;On&#34; Pixels in Process Run 
     The next step in the process is the analysis of the &#34;middle&#34; group of pixels in the first &#34;on&#34; run. In the example of FIG. 4, the &#34;middle&#34; pixels are in columns 10, 11 and 12. Like the analysis performed with respect to the first &#34;on&#34; pixel of the process row, the middle pixel analysis comprises a comparison of the run of interest in the process row with runs located in the top and bottom rows. This comparison process begins with a sandwich analysis of the middle group of &#34;on&#34; pixels in the process row. 
     (i) Sandwich Analysis 
     A run length is said to be &#34;sandwiched&#34; if it is located intermediate runs in the top and bottom rows that begin at or before the first column of the process run and end at or after the last column of the process run. (In the example, the run of interest is the sub-run of &#34;on&#34; pixels comprising the middle group of &#34;on&#34; pixels in the process row: i.e. columns 10, 11 and 12.) 
     (ii) Removal Condition for a Sandwich Middle Group of Pixels 
     If the middle group of pixels is sandwiched, then the pixels are &#34;removal candidates&#34;. In the top-left analysis pass, a sandwiched middle group of pixels is removed if it is sandwiched between an &#34;off&#34; top run and an &#34;on&#34; bottom run. If the middle group of pixels is removed, then the destination image, which is stored in the destination buffer, is updated by adding an &#34;off&#34; run equal to the number of pixels removed to the destination image. In any other case, the middle group of pixels is not removed and the destination image is updated by adding the number of &#34;on&#34; pixels remaining to the number of &#34;on&#34; pixels in the preceding &#34;on&#34; run. 
     In the example of FIG. 4, the middle group of &#34;on&#34; pixels of the process run is sandwiched between an &#34;off&#34; run in the virtual top row and an &#34;on&#34; run in the bottom row. Therefore, the pixels are removal candidates, and since the removal condition is satisfied (i.e., top &#34;off&#34;/bottom &#34;on&#34;), the top run that contains the middle group of pixels is not part of the skeleton and is therefore removed. Thus, the image stored in the first pass destination buffer would be updated by adding a run of 3 &#34;off&#34; pixels to the existing run of 10 &#34;off&#34; pixels. The updated destination image would be expressed in index table format as &#34;0:13.&#34; 
     c. Analysis of End &#34;On&#34; Pixel in Process Run 
     Finally, the last or &#34;end&#34; pixel of the process run in the process row must be analyzed. 
     (i) Is End &#34;On&#34; Pixel a Removal Candidate? 
     The first step in the &#34;end&#34; pixel analysis is tailored to determine if the end pixel is a removal candidate. In a top-left analysis pass, an end pixel is a removal candidate only if the pixel in the top row directly above the end pixel in the process row is an &#34;off&#34; pixel. In the example of FIG. 4, since the pixel located in column 13 of the process row is located directly below an &#34;off&#34; pixel in the virtual top row, it is a removal candidate. 
     (ii) Corner Connectivity Analysis for End &#34;On&#34; Pixel 
     If an end pixel is a removal candidate, then a corner connectivity check must be performed for the end pixel of interest. An end pixel connectivity check comprises an analysis of the runs in the top and bottom rows that includes the column in which the end pixel falls. Since the end pixel is a removal candidate, it, by definition, is located to an adjacent &#34;off&#34; run in the top row. If the adjacent &#34;off&#34; run in the top row ends in the column in which the end pixel falls, then the column in the top row following the column of the end pixel would necessarily contain an &#34;on&#34; pixel. Thus the end pixel would be &#34;corner connected&#34; with the top row. As such, the end pixel would be a necessary part of the skeleton of the image. Likewise, if the end pixel is adjacent to an &#34;off&#34; run in the bottom row that ends in the column in which the end pixel falls, then the end pixel would be &#34;corner connected&#34; to the bottom row. 
     However, if the end pixel is located in the last column of the image, then it cannot be corner connected with either the top or bottom row since there would not be an &#34;on&#34; pixel located in the column following the column of the end pixel. Therefore, in the example of FIG. 4, the end pixel (which is located in column 13) would not only be a candidate for removal (since it is beneath an &#34;off&#34; pixel in the virtual top row) but it would also be removed since it is at the end of the image and cannot be corner connected. Thus, the image stored in the first pass destination buffer following the top-left analysis pass of the top row would be replaced with &#34;0:14&#34;. 
     B. Top-Left Analysis of Row &#34;1&#34; 
     The top-left analysis pass would continue with an analysis of the next row of the image. In the example of FIG. 4, the next row would be row &#34;1&#34;, which comprises an initial run of I &#34;off&#34; pixel followed by a middle run of 12 &#34;on&#34; pixels and a final run of 1 &#34;off&#34; pixel. In index table format, row &#34;1&#34; is represented as &#34;1:1,12,1&#34;. 
     It is important to note that each row that is processed during each analysis pass is compared with the image that exists in the source image buffer and not the new, temporary image that is created in the destination buffer as a result of the analysis. Therefore, in the example of FIG. 4, when the process indexes to the analysis of row &#34;1&#34;, row &#34;1&#34; is analyzed with respect to the top and bottom rows that are stored in the source buffer and so on with respect to the analyses of subsequent rows. 
     Returning to the example of FIG. 4, row &#34;1&#34; will now be analyzed to show the special case when a middle group of &#34;on&#34; pixels in the process row is not sandwiched between runs in both the top and bottom rows. In the example, the process row is &#34;1:1,12,1&#34; and is compared to the top and bottom rows of the image stored in the source buffer, which are &#34;0:9,5&#34; and &#34;2:0,5,2,7&#34;, respectively. 
     1. Analysis of First &#34;On&#34; Run 
     The analysis begins with an analysis of the first run of the process row to determine whether it is an &#34;off&#34; run or an &#34;on&#34; run. In this case, the first is an &#34;off&#34; run consisting of a single &#34;off&#34; pixel. Therefore, this single &#34;off&#34; pixel would be transferred to begin row &#34;1&#34; of the image stored in the first pass destination buffer. Thus, the image stored in the destination buffer would now be: 
     0:14; and 
     1:1 
     a. Analysis of First &#34;On&#34; Pixel in Process Run 
     Next, the first &#34;on&#34; pixel of the first &#34;on&#34; run of the process row is considered. As explained above, the first &#34;on&#34; pixel of a process run in a top-left analysis pass is always a candidate for removal. Furthermore, it is removed if it is not corner connected to an &#34;on&#34; run in either to top or bottom rows that ends in the column before the column containing the first &#34;on&#34; pixel in the process run and is not an endpoint pixel. 
     In the example of FIG. 4, the first &#34;on&#34; pixel of the process run is not corner connected. Additionally, the first &#34;on&#34; pixel is not sandwiched between &#34;off&#34; runs in both the top and bottom adjacent rows. Therefore, it is not part of the skeleton and is removed. Accordingly, an &#34;off&#34; pixel is added to the initial &#34;off&#34; run in the image stored in the destination buffer for row &#34;1&#34; thus, row &#34;1&#34; becomes &#34;1:2&#34;. 
     b. Analysis of Middle Group of &#34;On&#34; Pixels in Process Run 
     Next, the middle group of &#34;on&#34; pixels is analyzed. In the example of FIG. 4, the middle group of pixels are located in columns 2-11 of row &#34;1&#34;. 
     (i) Sandwich Check 
     The sandwich check indicates that the middle group of &#34;on&#34; pixels is not sandwiched between runs in both the top and bottom rows. In this case the sandwich check fails because the bottom row comprises an initial &#34;on&#34; run ending in column 4, followed by an &#34;off&#34; run comprising 2 &#34;off&#34; pixels in columns 5 and 6, followed by a final run of 7 &#34;on&#34; pixels. Since the middle group of &#34;on&#34; pixels is not sandwiched, the middle group must be broken down into &#34;sub-runs&#34;, each of which is sandwiched between runs in the top and bottom rows. Each sub-run must then be analyzed using the same tripartite test used for regular runs, in which the first, middle group and end &#34;on&#34; pixels are considered. 
     (ii) Sub-Run Analysis of Non-Sandwiched Middle Group 
     In the example of FIG. 4, the first sub-run of the middle group of &#34;on&#34; pixels would be located in columns 2, 3 and 4. This sub-run is sandwiched between a run of &#34;off&#34; pixels in the top row and a run of &#34;on&#34; pixels in the bottom row that ends at column 4. The sub-run analysis begins with an analysis of the first &#34;on&#34; pixel of the sub-run. Since we are analyzing the first &#34;on&#34; pixel during a top-left analysis pass, the first &#34;on&#34; pixel is always a candidate for removal since it is adjacent to an &#34;off&#34; pixel to its immediate left. However, in order to determine whether the first &#34;on&#34; pixel can in fact be removed, we must perform a corner pixel connectivity analysis. During a sub-run analysis the corner connective analysis only considers the bottom run corner connective condition, i.e., whether there is an &#34;off&#34; run that ends in the column preceding the column containing the first &#34;on&#34; pixel in the sub-run. If there is an &#34;off&#34; run that ends in the column preceding the column containing the first &#34;on&#34; pixel in the sub-run, then the first &#34;on&#34; pixel is corner connected and must remain as part of the skeleton of the image. In any other case, the first &#34;on&#34; pixel is removed. 
     In the example of FIG. 4, the pixel of interest is the pixel located in row &#34;1&#34; at column 2. In the example there is not an &#34;on&#34; run in the bottom row that ends in column 1. Therefore, the first &#34;on&#34; pixel of the sub-run is not part of the skeleton of the image and can be removed. The &#34;1:2&#34; index table image format stored in the first pass destination buffer for row &#34;1&#34; would be updated by adding &#34;1&#34; to the initial &#34;off&#34; run stored therein. Thus, row &#34;1&#34; of the image stored in the first pass destination buffer would be replaced with &#34;1:3&#34;. 
     The middle group of &#34;on&#34; pixels in the first sub-run comprises a single &#34;on&#34; pixel located in column 3. Since this pixel is sandwiched between an &#34;off&#34; run in the top row (row &#34;0&#34;) and an &#34;on&#34; run in the bottom row (row &#34;2&#34;), it is removed. Thus, row &#34;1&#34; of the image stored in the first pass destination buffer would be replaced with &#34;1:4&#34;. 
     Next, the end &#34;on&#34; pixel of the first sub-run is considered. An end pixel of a sub-run is a candidate for removal if the top row contains an &#34;off&#34; pixel in the same column as the end pixel of the sub-run and the bottom row contains an &#34;on&#34; pixel. In the example of FIG. 4, there is an &#34;off&#34; pixel in row &#34;0&#34;, column 4 and an &#34;on&#34; pixel in row &#34;2&#34;, column 4. Therefore the end &#34;on&#34; pixel of the first sub-run is a removal candidate. 
     Once an end &#34;on&#34; pixel is declared a removal candidate, the process analyzes the bottom &#34;on&#34; run to determine if it ends at the same column as the end &#34;on&#34; pixel in the sub-run being analyzed. If the bottom &#34;on&#34; run ends at the same column as the end &#34;on&#34; pixel of the sub-run, then the end &#34;on&#34; pixel is part of the skeleton and cannot be removed. On the other hand if the bottom &#34;on&#34; run does not end at the same column as the end &#34;on&#34; pixel of the sub-run, then the end &#34;on&#34; pixel is not part of the skeleton and is removed. In the example of FIG. 4, the &#34;on&#34; run in the bottom row containing the end &#34;on&#34; pixel of the process row ends at the same column as the end &#34;on&#34; pixel of the sub-run. Therefore, the end &#34;on&#34; pixel of this sub-run remains and the process adds an &#34;on&#34; run comprising a single pixel to the image stored in the destination buffer after the initial &#34;off&#34; run already stored therein, thus creating a new image for row &#34;1&#34; in the destination buffer of &#34;1:4,1&#34;. 
     The next sub-run is then considered. In the example this is a sub-run comprising &#34;on&#34; pixels in columns 5 and 6. The pixels of this sub-run are not candidates for removal since they are not sandwiched between a top adjacent run of &#34;off&#34; pixels and a bottom adjacent of &#34;on&#34; pixels. Therefore, they remain as part of the skeleton and the image stored in the destination buffer is updated to become &#34;1:4,3&#34;. 
     The next sub-run is then considered, which in the example is the run comprising &#34;on&#34; pixels in columns 7 and 8. The pixels in this sub-run are candidates for removal since they are sandwiched between a run of &#34;off&#34; pixels in the bottom row and a run of &#34;on&#34; pixels in the top row. Therefore, the first &#34;on&#34; pixel of the sub-run must be considered to determine if it is &#34;corner connected&#34;. 
     In the example of FIG. 4, the bottom row comprises an &#34;off&#34; run that ends in the column preceding the column of the first &#34;on&#34; pixel of the sub-run being analyzed. Therefore, the first &#34;on&#34; pixel of the sub-run is corner connected and must remain as part of the skeleton of the image. The image stored in the destination buffer must therefore be updated by adding an &#34;on&#34; pixel to the &#34;on&#34; run in the destination image. Thus, row &#34;1&#34; of the destination image would now comprise &#34;1:4,4&#34;. 
     Since the sub-run being analyzed contains only two &#34;on&#34; pixels it does not have a middle group of pixels. Therefore, the next pixel analyzed is the pixel that is located in column 8, which is analyzed as an end pixel. As explained above, an end pixel is a removal candidate if it is sandwiched between an &#34;off&#34; run in the top row and an &#34;on&#34; run in the bottom row, which is the case for the end pixel being considered in this sub-run. Since the end pixel in this sub-run is a removal candidate, a corner connectivity check must be performed in order to determine whether it can be removed. In this case, since the &#34;on&#34; run in the bottom row that contains the end pixel in the process sub-run does not end at the same column as the end pixel in the sub-run, then the end pixel is removed and an &#34;off&#34; run is added to the end of the row &#34;1&#34; image stored in the destination buffer. Thus, the destination image is updated to include a row &#34;1&#34; comprising &#34;1:4,4,1&#34;. If a sub-run is only one pixel long, then the single pixel is analyzed as both a first pixel and an end pixel to determine if it is part of the skeleton of the image. 
     Likewise, the next sub-run of &#34;on&#34; pixels is considered, which comprises the pixels falling in columns 9, 10 and 11. (Note that the pixel in column 12 is not a part of this sub-run since it will be analyzed as the end pixel of the entire middle group of pixels.) The first step is again an analysis to determine if the pixels of the sub-run are removal candidates. In the example, since the sub-run is not sandwiched between an &#34;off&#34; run in the top row and an &#34;on&#34; run in the bottom row, the pixels making up the sub-run are not candidates for removal and must remain as a part of the destination image stored in the destination buffer. Thus, row &#34;1&#34; of the destination image is updated to become &#34;1:4,4,1,3&#34;. The sub-run analysis is now complete. 
     c. End Pixel Analysis of Process Run 
     Since the remaining &#34;on&#34; pixel in the process run is (i.e., the &#34;on&#34; pixel located in column 12) an end &#34;on&#34; pixel, it is first analyzed to determine whether it is a candidate for removal. If the end &#34;on&#34; pixel is located below an &#34;off&#34; run in the top row, then it is a candidate for removal. This is not the case for the end &#34;on&#34; pixel being analyzed in row &#34;1&#34; of FIG. 4. Therefore, the end &#34;on&#34; pixel is not removed and an &#34;on&#34; pixel is added to the last &#34;on&#34; run in the destination image. Thus, row &#34;1&#34; of the destination image is updated to become &#34;1:4,4,1,4&#34;. Finally, since the process row ends with a run of &#34;off&#34; pixels, the &#34;off&#34; run is simply added as a final &#34;off&#34; run to the row of interest in the destination image. Therefore, row &#34;1&#34; of the destination image becomes &#34;1:4,4,1,4,1&#34;. 
     C. Top-Left Analysis of Row &#34;2&#34; 
     The top-left analysis pass is then performed with respect to row &#34;2&#34; of the image, which requires a comparison between the run lengths in row &#34;2&#34; and the run lengths appearing in the top row, which is row &#34;1&#34; of the source image, and a virtual bottom row comprising, a single run of all &#34;off&#34; pixels. 
     1. Analysis of First &#34;On&#34; Run 
     The new process row begins with a run comprising 5 &#34;on&#34; pixels. Since the first &#34;on&#34; pixel is located in the first column of the image, there are no &#34;on&#34; runs in either the top or bottom rows that end in the &#34;immediately preceding column.&#34; Thus, the first &#34;on&#34; pixel fails the corner connectivity test. Furthermore, since the first &#34;on&#34; pixel is not sandwiched between &#34;off&#34; runs in both the top and bottom rows that end in the column containing the first &#34;on&#34; pixel (in this case only the &#34;off&#34; run appearing in row &#34;1&#34; ends in column &#34;0&#34;), the first &#34;on&#34; pixel is not part of the skeleton of the image. Therefore it is removed and the destination image for row &#34;2&#34; would begin with an initial run of one &#34;off&#34; pixel, which, in index table format, is &#34;2:1&#34;. 
     Next, the middle group of &#34;on&#34; pixels in the first &#34;on&#34; run is considered. This group, which comprises the &#34;on&#34; pixels in columns 1, 2 and 3 are contained by an &#34;on&#34; run in the top row and an &#34;off&#34; run in the bottom row. Therefore, they are not candidates for removal and remain as part of the skeleton of the image. Thus, the destination image for row &#34;2&#34; is updated by adding a run of 3 &#34;on&#34; pixels after the initial run of 1 &#34;off&#34; pixel. In index table format, the new destination image for row &#34;2&#34; becomes &#34;2:1,3&#34;. 
     Finally, the end &#34;on&#34; pixel in the first &#34;on&#34; run of row &#34;2&#34; is analyzed. Since the end &#34;on&#34; pixel is located between an &#34;on&#34; run in the top row and an &#34;off&#34; run in the bottom row, it is not a candidate for removal and thus remains as part of the skeleton. Therefore, the new destination image for row &#34;2&#34; becomes &#34;2:1,4&#34;. 
     Finally, the last run of 2 &#34;off&#34; pixels is added to the destination image as an &#34;off&#34; run following the previous &#34;on&#34; run. Therefore, the destination image for row &#34;2&#34; becomes &#34;2:1,4,2&#34;. 
     2. Analysis of Next &#34;On&#34; Run 
     The next run of &#34;on&#34; pixels is now considered. The first &#34;on&#34; pixel of this next process run fails its corner connectivity test, since it is not located intermediate an &#34;on&#34; run in either the top or bottom row that ends in the column preceding the column containing the first &#34;on&#34; pixel of the process run. Additionally, since the first &#34;on&#34; pixel is not located between &#34;off&#34; runs in both the top and bottom rows that end in the same column as the first &#34;on&#34; pixel of this next process run, it is not part of the skeleton and is removed. Accordingly, an &#34;off&#34; since pixel is added to the preceding &#34;off&#34; run of the destination image, which yields a new destination image for row &#34;2&#34; of &#34;2:1,4,3&#34;. 
     Next, the middle group of &#34;on&#34; pixels is considered. In this case, it is sandwiched between an &#34;on&#34; run in the top row and an &#34;off&#34; run in the bottom row. Therefore, the pixels in the middle group cannot be removed and row &#34;2&#34; of the destination image is updated to become &#34;2:1,4,3,5&#34;. 
     Finally, the end &#34;on&#34; pixel of the process run is considered. In the example of FIG. 4, the end pixel is located below an &#34;off&#34; run in the top row so it is a candidate for removal and, since it is at the right-most edge of the image it cannot be corner corrected. Therefore, it must be removed. Thus, the destination image for row &#34;2&#34; following the top-left analysis pass becomes &#34;2:1,4,3,5&#34;. 
     Since the example of FIG. 4 comprises an image having only three rows, the top-left analysis pass is now complete and the destination image for the three rows are: 
     0: 14; 
     1: 4,4,1,4,1; and 
     2: 1,4,3,5,1, 
     which are shown in image format in FIG. 5. The destination image from the top-left analysis pass now becomes the source image for the second bottom-right analysis pass. As indicated earlier, the bottom-right analysis pass is tailored to remove all the &#34;on&#34; pixels that are adjacent to &#34;off&#34; pixels on the bottom and right. 
     II. Bottom-Right Analysis Pass 
     The bottom-right analysis pass is similar to the top left analysis pass with the following exceptions. First, &#34;on&#34; pixels are not automatically candidates for removal. They are only removal candidates if they are sandwiched between a top &#34;off&#34; run and a bottom &#34;on&#34; run. (The corner connectivity check for first &#34;on&#34; pixels in the bottom-right analysis pass is identical to the top-left analysis pass corner connectivity check.) Additionally, sandwiched middle &#34;on&#34; pixels are only removed if they are sandwiched between bottom &#34;off&#34; and top &#34;on&#34; runs. Finally, during the second pass analysis an end &#34;on&#34; pixel is always a candidate for removal since it is, by definition, adjacent to an &#34;off&#34; pixel to its immediate right. Nonetheless, an end &#34;on&#34; pixel is only removed if it is not &#34;corner connected&#34; and is not an &#34;endpoint&#34; pixel. The corner connectivity check for an end &#34;on&#34; pixel in a bottom-right analysis pass looks to the top and bottom rows to see if there is an &#34;off&#34; run in either row that ends in the same column as the end &#34;on&#34; pixel in the process run. If there is, then the end &#34;on&#34; pixel is kept as part of the skeleton. Otherwise, it is only kept as part of the skeleton if it is an &#34;endpoint&#34; pixel, which is indicated if it is sandwiched between &#34;off&#34; runs in both the top and bottom rows that do not start in the same column as the end &#34;on&#34; pixel. As with the endpoint check for the top-left analysis pass there is a special case for a process run that is only one pixel long. In this case, the end pixel can only be deleted if it is sandwiched between adjacent &#34;off&#34; runs in the top and bottom rows and the adjacent &#34;off&#34; top is at least two pixels long. 
     A. Bottom-Right Analysis of Row &#34;0&#34; 
     Turning now to FIG. 5, the bottom-right analysis pass begins with an analysis of row &#34;0&#34; in comparison to a virtual top row comprising all &#34;off&#34; pixels and a bottom row comprising row &#34;1&#34; of the new source image (1:4,4,1,4,1). Since, in the example of FIG. 5, the row &#34;0&#34; comprises a single run of &#34;off&#34; pixels, it is directly copied to the destination image as &#34;0:14&#34;. 
     B. Bottom-Right Analysis of Row &#34;1&#34; 
     Next, row &#34;1&#34; is analyzed with respect to rows &#34;0&#34; and &#34;2&#34; as the top and bottom rows, respectively. Since row &#34;1&#34; begins with a run of &#34;off&#34; pixels, the &#34;off&#34; run is copied directly to the destination image, which becomes &#34;1:4&#34;. 
     1. Analysis of First &#34;On&#34; Run 
     a. Analysis of First &#34;On&#34; Pixel 
     Then, the first &#34;on&#34; run is processed as the process run. The first step of this process is to determine if the first &#34;on&#34; pixel of the process run is a removal candidate. Since the second analysis pass is a &#34;bottom-right&#34; analysis, a first &#34;on&#34; pixel is a candidate for removal only if it is sandwiched between a bottom &#34;off&#34; run and a top &#34;on&#34; run. In the example of FIG. 5, the first &#34;on&#34; pixel of the process run is not a candidate for removal, so it remains and the destination image is updated to become &#34;1:4,1&#34;. (Note that if it were a candidate for removal, then connectivity checks identical to the first analysis pass would have to be performed.) 
     b. Analysis of Middle Group of &#34;On&#34; Pixels 
     Like the top-left analysis pass, the next step of the bottom-right analysis pass analyzes the middle group of &#34;on&#34; pixels in the process run. The first part of this analysis is a containment check. In the example of FIG. 5, the middle group of &#34;on&#34; pixels in the process run, which comprises the &#34;on&#34; pixels located in columns 5 and 6, is sandwiched between &#34;off&#34; runs in both the top and bottom rows. In the bottom-right analysis pass, a sandwiched middle group of &#34;on&#34; pixels is removed only if it is sandwiched between a top &#34;on&#34; run and a bottom &#34;off&#34; run. Since this is not the case in the example, the middle group of &#34;on&#34; pixels is not removed and is added to the preceding &#34;on&#34; run stored in row &#34;1&#34; of the destination image. Thus, row &#34;1&#34; of the destination image now becomes &#34;1:4,3&#34;. 
     c. Analysis of End &#34;On&#34; Pixel 
     The end &#34;on&#34; pixel of the process run is now considered. During the bottom-right analysis pass, an end &#34;on&#34; pixel is automatically a candidate for removal since it is, by definition, adjacent to a right &#34;off&#34; pixel. However, an end &#34;on&#34; pixel is only removed if it is not &#34;corner connected&#34; and is not an &#34;endpoint&#34; pixel. 
     The corner connectivity check looks at the top and bottom rows to determine if either row includes an &#34;off&#34; run that ends in the same column as the end &#34;on&#34; pixel in the process run. (This indicates that the end &#34;on&#34; pixel is corner connected to an &#34;on&#34; pixel in either the top or bottom row, which is located in the column to the right of the column containing the end &#34;on&#34; pixel of the process run.) If there is, then the end &#34;on&#34; pixel is part of the skeleton and cannot be removed. Otherwise, the end &#34;on&#34; pixel is eliminated unless it is an &#34;endpoint&#34; pixel. In the example of FIG. 5, there is an &#34;off&#34; run in the bottom row that ends in column 7, which is the column in which the end &#34;on&#34; pixel resides. Therefore, the end &#34;on&#34; pixel is corner connected and is part of the skeleton and cannot be removed. Thus, row &#34;1&#34; of the image stored in the destination buffer becomes &#34;1:4,4&#34;. 
     Since the succeeding run is an &#34;off&#34; run, it is copied directly to the destination buffer, where row &#34;1&#34; of the image becomes &#34;1:4,4,1&#34;. 
     2. Analysis of Next &#34;On&#34; Run 
     The next &#34;on&#34; run becomes the new process run and is analyzed as above. In short, since the first pixel is not a candidate for removal it is kept. Likewise, since the middle group of pixels in the new process run are sandwiched between a bottom &#34;on&#34; run and a top &#34;off&#34; run, they cannot be removed. Next, the end &#34;on&#34; pixel connectivity check fails. 
     Finally, the &#34;endpoint&#34; check fails since the end &#34;on&#34; pixel is not sandwiched between &#34;off&#34; runs in both the top and bottom rows that do not start in the same column as the end &#34;on&#34; pixel. Therefore, the end pixel is not a part of the skeleton and is therefore removed. 
     Thus, after the second &#34;on&#34; run is processed, row &#34;1&#34; of the destination image becomes &#34;1:4,4,1,5&#34;. Finally, since the last run in the process row is an &#34;off&#34; run it is copied directly to row &#34;1&#34; of the destination image, which becomes &#34;1:4,4,1,3,2&#34;. 
     C. Bottom-Right Analysis of Row 
     Next, row &#34;2&#34; is processed by comparing it to row &#34;1&#34; and a virtual bottom row containing a single &#34;off&#34; run. The bottom-right analysis pass for row &#34;2&#34; yields a destination image for row &#34;2&#34; of &#34;2:1,3,4,1,5&#34;. This final destination image resulting from the bottom-right analysis pass is shown in FIG. 6. 
     III. Comparison of Destination Image With Source Image 
     The next step in the process is a comparison of the destination image, which comprises: 
     0: 14 
     1: 4,4,1,3,2 
     2: 1,3,4,1,5 
     with the source image, which comprises: 
     0: 14 
     1: 4,4,1,4,1 
     2: 1,4,3,5,1 
     Since the destination image is different from the source image, the image has not been resolved to its skeleton. Therefore, the destination image becomes the new source image and the process is repeated. 
     IV. Repeat Top-Left and Bottom Right Analysis Passes 
     A. Top-Left Analysis Pass 
     Repeating the top-left analysis, using the new source image yields a destination image identical to the new source image, which can be represented as 
     0:14 
     1:4,4,1,3,2 
     2:1,3,4,1,5. 
     This image is shown in image format in FIG. 7. 
     B. Bottom-Right Analysis Pass 
     The bottom-right pass analysis is then performed using the destination image as the second pass source image which results in the following destination image: 
     0:14 
     1:4,4,1,3,2 
     2:1,3,4,1,5. 
     This image is shown in FIG. 8. Since the destination/source image comparison indicates that the destination image is identical to the source image, the image has been resolved into its skeleton and the skeletonization process is complete. 
     Conclusion 
     This concludes the description of the preferred embodiment of the invention. The following describes some alternative embodiments for accomplishing the present invention. 
     For example, any type of computer, such as a mainframe, minicomputer, work station or personal computer, could be used with the present invention. In addition, any computer program, application or operating system performing skeletonization could benefit from the present invention. 
     In another example, the order of accomplishing the analysis passes or processing the image in terms of columns of &#34;vertical&#34; run lengths, which are compared to adjacent columns, could be modified without departing from the spirit and scope of the invention. 
     Those skilled in the art will recognize that additional applications and functions may also be implemented using the steps of the present invention. In addition, the present invention can be integrated closely with many different image processing applications. 
     In summary, the present invention discloses a method, apparatus, and article of manufacture for reducing an image to its skeleton utilizes a two pass analysis process wherein each row of an image is analyzed with respect to adjacent rows. More specifically, the present invention stores an image in a temporary buffer, reads the image from the temporary buffer and stores the image as a source image in a source image buffer as a series of rows, wherein each row comprises one or more runs of on or off pixels, processes the source image row by row with respect to adjacent top and bottom rows using a two pass analysis process comprised of a top-left analysis pass and a bottom-right analysis pass, wherein the top-left analysis pass analyzes each run in each row of the source image and removes all on pixels adjacent to top and left of runs and wherein the bottom right analysis pass analyzes each run in each row of the source image and removes all on pixels adjacent to bottom and right of runs, builds, after each run is processed in each analysis pass, a destination image in a destination buffer by storing non-removed pixels in the destination image, compares, after each two pass analysis process, the destination image with the source image, replaces the source image with the destination image if the images differ, and repeats the two pass analysis process until the destination image is identical to the source image. 
     The foregoing description of the preferred embodiment of the invention has been presented for the purposes of illustration and description. It is not intended to be exhaustive or to limit the invention to the precise form disclosed. Many modifications and variations are possible in light of the above teaching. It is intended that the scope of the invention be limited not by this detailed description, but rather by the claims appended hereto.