AUTOMATIC DETERMINATION OF BLANK PAGES AND BOUNDING BOXES FOR BINARY IMAGES

Abstract: A method, and apparatus (10) for executing the method, for processing digitized image data representative of a page (14). The method includes the steps of (a) processing the image data on a scanline by scanline basis to partition the image data into a plurality of rows and columns of NxM arrays (14a) of image pixels. The step of partitioning includes the steps of, for each row of an NxM array of image pixels, (b) detecting occurrences, if any, along any scanline of an image pixel having a foreground value; for a non-zero number of detected occurrences within one NxM array of image pixels, (c) incrementing a corresponding array row count and a corresponding array column count; and (d) for at least one detected occurrence, adjusting the boundary of a bounding box so as to enclose the at least one detected occurrence and substantially all previsously detected occurrences. The method includes the terminal steps of examining the boundary of the bounding box and, if the boundary is set at an initial unrealizable condition, declaring the page to be blank, else if the boundary is not set at the initial condition, declaring that the binary image of the page includes information within the boundary of the bounding box. Methods for deriving an iconic image of the digitized image data are also described.

Description: AUTOMATIC DETERMINATION OF BLANK PAGES AND BOUNDING BOXES FOR BINARY IMAGES. FIELD OF THE INVENTION: This invention relates generally to document processing systems and, in particular, to a document processing system that includes an optical scanner for inputting data representative of information appearing on a page of a document. BACKGROUND OF THE INVENTION; One well known technique to enter one or more pages of a document into a document processing system employs an optical scanner to sense differences in optical contrast that occur on a surface of a page. The differences in optical contrast are converted to binary information (pixels) at a predetermined or selected resolution, such as 200 dots per inch (dpi) , and are output in a scan line format. The output data may be subsequently processed to identify an informational content of the scanned image. Optical character recognition (OCR) is one well known processing technique that is used to convert the image pixels to recognized alphanumeric characters. One problem that arises in systems that digitize document and other types of pages is in identifying blank pages and partially blank pages. For example, if a number of pages of a double sided document are automatically fed through a document scanner some of these pages may be blank (text only on one side) , or partially blank. In that the page image data is typically compressed or otherwise processed prior to storage, it can be appreciated that inefficiencies occur when a totally or partially blank page is input to a data compression algorithm. That is, it would be desirable to rapidly identify a page as being blank so that the page image can be discarded without being further processed. In like manner, if a page is only partly covered by text or graphics, it would be desirable to input to a subsequent process, or to display, only that portion of the page image that contains information, and to ignore the remainder of the page image. SUMMARY OF THE INVENTION It is thus an object of this invention to rapidly determine that a binary image of a page has no informational content, so as to avoid expending any system resources to further handle or process the binary image. It is another object of this invention to rapidly determine what portion of a binary image of a page has no informational content, so as to avoid expending any system resources to further handle or process the identified portion and to minimize the display of blank areas . It is a further object of this invention to enable a merging of an operation that determines which area, if any, of an input image has an informational content with a generation of a reduced iconic image or stamp of the input image. The foregoing and other problems are overcome and the objects of the invention are realized by a method, and apparatus for executing the method, for processing digitized image data representative of a page. The method includes the steps of (a) processing the image data on a scanline by scanline basis to partition the image data into a plurality of rows and columns of NxM arrays or subarrays of image pixels. The step of partitioning includes the steps of, for each row of an NxM array of image pixels, (b) detecting occurrences, if any, along any scanline of an image pixel having a foreground value; for a non-zero number of detected occurrences within one NxM array of image pixels, (c) incrementing a corresponding array row count and a corresponding array column count; and (d) for at least one detected occurrence, adjusting the boundary of a bounding box in accordance with the array row and column counts so as to enclose the at least one detected occurrence and substantially all previously detected occurrences. The method includes the terminal steps of examining the boundary of the bounding box and, if the boundary is set at an initial unrealizable condition, declaring the page to be blank, else if the boundary is not set at the initial condition, declaring that the binary image of the page includes information within the boundary of the bounding box. Methods are also described for deriving an iconic image of the digitized image data, the methods being based on the pixel-content of the NxM arrays. BRIEF DESCRIPTION OF THE DRAWINGS The above set forth and other features of the invention are made more apparent in the ensuing Detailed Description of the Invention when read in conjunction with the attached Drawings, wherein: Fig. 1 is a simplified block diagram of a document processing system that is constructed and operated in accordance with this invention; Fig. 2 illustrates exemplary arrays of 16X16 pixel tiles; Fig. 3 is logic flow diagram of a presently preferred method of this invention; Figs. 4a-4c illustrate exemplary bounding boxes that are obtained at the termination of the method of this invention; and Fig. 5 depicts the relationship of individual pixels of an iconic image of a document page to individual ones of NxM arrays of document image pixels in accordance with an aspect of this invention. DETAILED DESCRIPTION OF THE INVENTION Fig. 1 illustrates a document processing system 10 that is constructed and operated in accordance with this invention. A conventional document scanner 12 is employed to detect an optical contrast resulting from printed text and graphical images that appear on a surface of a scanned document page 14. As employed herein a "page" is intended to encompass any substrate capable of having indicia, such as symbols, text, and graphics, that are written, deposited, or imprinted thereon. Relative motion between the scanner 12 and the page 14 causes the scanner 12 to output on signal line(s) 12a a sequence of binary ones and zeros that are indicative of the optical contrast that is sensed by the scanner. By example, a binary one indicates the presence of a dark area on the page 14 (a portion of a character or a graphical image) , while a binary zero indicates an absence of a dark area (the background or "whitespace") . As employed herein the binary ones and zeros are each referred to as a pixel. The binary information is output in a scanline format, wherein a scanline is oriented perpendicularly to the scan direction (indicated by the arrow A) . As such, a single scanline will typically include pixels from only portions characters. As an example, and assuming the resolution of the scanner 12 is 200 dpi and that the page 14 is 8.5 inches wide, a scanline can comprise up to 1700 discrete pixels (8.5 X 200) . Typical scanner resolutions are in the range of 100 dots (or pixels) per inch (along the scanline) to 400 dpi. Coupled to the signal line(s) 12a, and hence to the output of the scanner 12, is a scanner interface 16. In this embodiment of the invention the scanner interface 16 is constructed and operated so as to execute the method of this invention, as will be described in detail below. An output of the scanner interface 16 is coupled via a bus 16a to a document storage module 18. Storage module 18 may be embodied within semiconductor memory, magnetic or optical disk memory, magnetic or optical tape, or any form suitable for storing the digitized document page data. As shown, the storage module 18 has three stored document pages represented as page data blocks 18a. Each of the blocks 18a is preferably compressed, using known data compression techniques, prior to storage. As such, and as is indicated in Fig. 1, each block may occupy a different amount of storage space within the storage module 18. Accessing of the document storage 18 and display of the pages is controlled by a document processor 20. This processor is bidirectionally coupled to the document storage module 18 via bus 20a, and is also coupled to conventional user interface devices such as a CRT display 22, having a display screen 22a, and keyboard 24. In that the scanned document pages may include graphical information in addition to text, the display 22 preferably also includes graphical capabilities. The document processor 20 may have word processing and editing capabilities, although for a document archiving application these capabilities may not be required or desirable . It should be realized that the components 16-24 may all be incorporated within a single data processor 26, such as a personal computer. In this case, the scanner interface 16 may be a software module that is invoked to process the output of the scanner 12, which may be coupled to a parallel or a serial port of the data processor 26 in a conventional manner. Also in this case, the buses 16a and 20a may be the same system bus, whereby the scanner interface software and the document processor software are interfaced to the main memory and mass storage components of the data processor 26. In a further embodiment of this invention the scanner 12 can be made an integral component of the data processor 26. As such, it should be understood that the embodiment of the document processing system 10 of Fig. 1 is intended to be viewed as an exemplary embodiment of this invention, and is in no way intended to be viewed as a limitation upon the practice of this invention. In accordance with this invention, and referring to Fig. 2, the binary image data that represents the page 14 is received from the scanner 12 and is logically divided by the scanner interface 16 during the execution of the method of this invention into a plurality of tiles 14a, each tile being comprised of an NxM array of pixels. In a presently preferred embodiment of this invention N and M are both equal to 16, although this value does not represent a limitation upon the practice of this invention. A top margin, left margin, and right margin (not shown) of predetermined size is established so as to eliminate any noise that may generated due to the edges of the document page 14 as it is scanned. Each pixel tile 14a will include from zero to 16X16=256 pixels having the foreground value (e.g., binary 1) . Referring to Fig. 3, for each of the pixel tiles 14a a determination is made as to whether the pixel tile includes at least one foreground pixel. Various statistics are retained during a single pass over the digital page image, the statistics indicating, for each row and each column of the pixel tiles, a number of pixel tiles 14a that are populated with at least one foreground pixel. The resulting vectors enable a rapid determination of which pages are blank, that is which pages are devoid of informational content and, for non- blank pages, an extent of a bounding box that encloses substantially all of the image containing an informational content. The accurate and rapid determination of blank pages is important to achieve processing speed and storage efficiencies, in that blank pages need no further processing, such as compression, and are not required to be stored. However, blank pages may be compressed along with non-blank pages, in that the compressed blank image will typically be of a small size. For a non-blank image, the determination of the coordinates of the bounding box about the informational content of the page can speed the compression operation, and can also aid in fitting the meaningful part of the image to a window on the screen of the display 22. More particularly, during the execution of the method the binary image of the page 14 is divided, on a scanline by scanline basis, into rows and columns of 16x16 pixel tiles, and it is determined for each tile whether the tile is populated with at least one foreground pixel. After a complete row of tiles is processed, what is retained is the number of populated tiles in that row and for each column of tiles, that is, an updated number of populated tiles . The edges of the bounding box are determined from these vectors, to 16- pixel granularity, as are the 0.1 and 99.9 percentile points in both directions (vertically and horizontally) . That is, a determination is made of the boundary of an image area that contains approximately 100% of the foreground pixels, it being assumed that the location of the foreground pixels corresponds to the location of the informational content (text, graphics, or text and graphics) that is recorded on the surface of the page. The bounding box is maintained current for the partial image up to and including the last complete group of 16 scanlines (the last tier of tiles) . As is indicated in Fig. 4a and described below, the bounds of the bounding box are meaningless before the first foreground pixel has been detected. Because of possible edge artifacts, the borders or margins along the top, left, and right edges of the image are considered vacant. In a presently preferred embodiment of the invention the margins each have a width of approximately 0.16 inches. The measurement of the margin width (in pixels) is obtained from a user- supplied parameter that specifies the resolution (dots per inch) of the scanner 12. The following pseudocode illustrates the presently preferred embodiment of the method of this invention. The pseudocode listing is intended to be read in conjunction with the logic flow diagram of Fig. 3. The text following a | is a continuation of text from a preceding line. Initialization (Block A) This step operates to: check parameters for validity; record image specifications; calculate (in pixel units) and record marginal area to " (ignore; and zero arrays and other values. Scanline Processing (Blocks B-J) Each scanline that is generated by the scanner 16 is processed as follows: if still in top margin border to skip, return (Blocks |B and C) ; if starting set of 16 lines, zero occupancy flags Iacross scanline; for each word, where a word is comprised of two I contiguous bytes of pixels (Block D) ; if word has a foreground pixel (Block E) ; set the flag for this column of pixel tiles I (Block F) ; increment scanlines of pixels accumulated, and if accumulated lines of pixels not equal to 16, return I (Block G) ; reset to zero the number of scanlines of pixels a c c u m u l a t e d (Block H) ; zero count of populated pixel tiles for this row of pixel tiles; for each flag, if flag is set increment count of populated pixel tiles for Ithis column of pixel tiles; increment count of populated pixel tiles for Ithis row of pixel tiles; store count of populated pixel tiles for this row of Ipixel tiles; if count is zero, return; find 0.1 and 99.9 percentile points in row and column [arrays of pixel tiles; continue to process scanlines until done (Blocks I,J) • The following C-language routine can be employed to find the 0.1 and 99.9 percentile boundaries that contain substantially all of the pixels. In this routine "wordswide" is the scanwidth in words. /* find 0.1 and 99.9 percentile boundaries, convert them to pixels */ marginmax = boxptr->total / 1000; lefsum = 0; lefcol = -1; ritsum = 0; ritcol = wordswide; topsum = 0; toprow = -1; botsum = 0; botrow = haverows; while (lefsum <= marginmax) lefsum += col [++lefcol] ; while (ritsum <= marginmax) ritsum += col [—ritcol]; while (topsum <= marginmax) topsum += row[++toprow] ; while (botsum <= marginmax)botsum += row[—botrow]; boxptr->lef = lefcol*16; boxptr->rit = ritcol*16 + 15; boxptr->top = toprow*16; boxptr->bot = botrow*16 + 15; return; Referring to Fig. 4a, the bounding box is initially set so that the left edge (LE) is positioned off the right of the image page, the right edge (RE) is positioned off the left of the image page, the top edge (TE) is positioned off the bottom of the image page, and the bottom edge (BE) is positioned off the top of the image page. At the termination of the method if the bounding box still has this "inverted" configuration, it can be assumed that the page image contained no foreground pixels and is therefore blank. That is, the detection of a foreground pixel did not occur during the execution of the method and the edges of the bounding box were not updated accordingly. This page image is assumed to be devoid of informational content, and no further processing or storage is required. Fig. 4b illustrates an exemplary final bounding box for a page image that contains a significant amount of text and graphics. As can be seen, the updating of the bounding box during the execution of the method has resulted in the four edges being repositioned so as to enclose most of the page image. Fig. 4c illustrates an exemplary final bounding box for a page image that contains text in only one portion, while the remainder is blank. For this case the resulting bounding box clearly indicates that only approximately 40% of the page need be compressed and stored, thereby improving the efficiency of these further processing steps - Having thus described a first aspect of this invention, an extension of the teaching of this invention is now described. The perusal of an image to determine the bounds of useful information (or blank page) is similar in some respects to producing for that page an iconic image (commonly called a "stamp" or "thumbnail") , particularly when a 200 dpi image is to be reduced by a linear factor of 16. In this case the area previously considered as a "tile" or NxM pixel array for the bounding-box determination is equivalent to the area that is "compressed" to a single pixel for generating the iconic image. Both computations are input intensive in exactly the same way. A large savings in I/O and computation time can therefore result from merging the two processes, if and when the user desires the generation of such stamps. There are several cases to consider, herein enumerated and described below as modifications and/or augmentations of the foregoing disclosure that was referenced to Figs. l-4c. Reference is now made to Fig. 5, where individual ones of the NxM pixel tiles of the original document image are equivalent or reduced to, by example, one pixel of the iconic (simplified) displayable image of the document page. As will be described below, whether a given one of the pixels of the iconic image is on or off is a function of the pixel content of the corresponding one of the NxM pixel tiles. It should be realized that a pixel being "on or off" may be an over-simplification, in that in some embodiments of this invention the gray scale value or the color value of each pixel of the iconic image may be a function of the pixel content of the NxM pixel tiles. In general, a visual characteristic of each pixel of the iconic image is a function of the pixel content of the corresponding one, or ones, of the NxM pixel tiles . If the generation of an iconic image is not desired then the stamp-making is not merged into the determination of the bounding box or blank page. For this condition the image need not be divided into tiles, and instead the top and bottom bounds can as readily be determined to pixel accuracy, whereas left and right bounds can be determined to word-size or byte-size granularity (i.e. the "tiles" become word or byte-wide and pixel-high) . It should be noted that, in all instances, the amount of computation required, if any, for subsequent processing of the stamp image is significantly less than that involved in scanning the full input image. This is a result of the fact that the stamp image typically contains less than half of one percent of the input image's area. Case 1: Each 1-bit of the stamp represents the presence of at least one foreground pixel, or no such pixels, in the NxM subpart of the input image. The contents of the inner loop: if(* (getptr+i) ) flags [i] = 1; remains the same but at the completion of, for example, 16 lines the flag bits are packed into a line of pixels of the icon. The flags, as before, are also used to determine the bounding area of the meaningful image. At the end of processing the entire image, the iconic image may be clipped on any or all sides (not necessarily as much proportionally as the actual image is) and enlarged. Case 2. Each 1-bit of the iconic image represents the number of pixels in the NxM array being more than some threshold. The inner loop above, formerly coded so as to note the presence of foreground pixels per NxM subarea, is rewritten so as to COUNT the foreground pixels in each such subarea. The inner loop is thus constructed so as add to the count, such as by a table lookup, the number of 1-bits in each non-zero word: if ( (word = * (getptr+i ) ) ! = 0 ) count [i ] += (bitof [word» 8 ] + bitsof [word & OxFF] ) . Alternatively, the image can be picked up byte by byte: count[i] += bitsof[*getbytptr++] . For the stamp, and after summing bits in each set of, by example, 16 lines, the total for each 16x16 (or NxM) area is compared with a threshold to determine whether to use a 1 or 0 as the corresponding pixel . For the bounding box or blank page determination described above, sums of pixels can be maintained, rather than sums of populated tiles, in each row and column of tiles. The bounding box and blank page determinations are otherwise substantially as described above. Case 3: For this instance each pixel of the stamp depends on some local relationship of counts of pixels in the NxM image. Counts of pixels per tile are collected as in Case 2. However, at least the last three such rows of tile counts are retained so that a stamp pixel representing a middle row tile can be based on pixel counts of the eight neighboring tiles. By example, in Fig. 5 the pixel corresponding to the row 3, column 3 (3,3) 16x16 pixel tile has a visual characteristic that is a function of at least a portion of the pixel content of the (2,2), (2,3), (2,4), (3,4), (4,4), (4,3), (4,2) and (3,2) tiles. The stamp-making method in this case may, for example, follow the teachings of set forth in commonly assigned U.S. Patent 5,161,213, issued 11/3/92 to the inventor of the subject matter of this patent application. The disclosure of U.S. Patent 5,161,213 is thus incorporated by reference herein in its entirety. The bounding box and blank page determination are performed as in Case 2. Case 4: For this instance no stamp is required. Therefore the tiling, fixed throughout the processing of an image, is not required. Instead, counts are kept of 1-bits per row of pixels and per byte-wide or word-wide column. Processing of the counts of pixels proceeds in the manner of processing of counts of populated tiles as described above with respect to Figs. l-4c. The result is pixel size-accurate for upper and lower bounds of the bounding box, and byte-size (or word-size) accurate for the left and right bounds . Case 5: For this instance no stamp is required, and the bounding box is defined by positions of the uppermost, bottommost, leftmost and rightmost 1-bit, which is determined to pixel-accuracy. It is not necessary in this case to maintain pixel counts (as in case 4) , but instead to simply monitor lines from the top and, for each line in which some leftmost pixel has been found, to also scan from the right to locate the rightmost pixel. A test is then performed to determine whether one or both located leftmost and rightmost pixels are at lateral extremes (as determined thus far) . It is noted that lateral pixel accuracy may not be desirable, because this implies that a shifting operation will subsequently be performed on the entire image to realign byte/word boundaries. Such a shifting operation is time consuming as compared to simply removing large background margins. There is little if any processing overhead for maintaining top-to-bottom pixel accuracy and, as a result, pixel accuracy can be maintained for these dimensions. Case 6: No stamp is required for this last instance. The bounding box is defined by the positions of uppermost, bottommost, rightmost and leftmost, by example, 0.1 percentile and 99.9 percentile rows and columns of pixels. This is an extension of the method of case 5, but more elaborate in that row and column counts are retained in the neighborhood of the extremes detected thus far. This may not be preferred for some implementations, since the improvement in the display of other subsequent processing is slight as compared to the additional computation time. The methods of this invention may be executed within the scanner interface 16 so as to pre-process in real time the output of the scanner 14, one scanline at a time. The methods of the invention may also be employed to pre-process already stored binary image data prior to compression, optical character recognition and/or display. The methods for forming the iconic image may be performed in the scanner 16 or in the document processor 20. Although described above in the context of specific dimensions, values for foreground and background pixels, scanline resolutions and the like, it should be realized that a number of changes can be made to these parameters without departing from the scope of the teaching of this invention. Furthermore, it can be realized that the individual blocks of the logic flow diagram of Fig. 3 can be implemented in whole or in part by circuitry, such as programmed processors or dedicated circuits, that operate to execute the described f nctions. Thus, while the invention has been particularly shown and described with respect to a preferred embodiment thereof, it will be understood by those skilled in the art that changes in form and details may be made therein without departing from the scope and spirit of the invention.

Claims: CLAIMS What is claimed is: 1. A method for processing digitized image data representative of a page, comprising the steps of: processing the image data on a scanline by scanline basis to partition the image data into a plurality of rows and columns each of which is comprised of at least one NxM array of image pixels; the step of partitioning including the steps of, for each pixel row in an NxM array of image pixels, detecting occurrences, if any, along each scanline of an image pixel having a foreground value; for a detected image foreground pixel along a scanline, indicating that the NxM array, within which the foreground pixel is located, is occupied by at least one foreground pixel; for a foreground-occupied NxM array of image pixels, incrementing a corresponding array row count and a corresponding array column count; and for at least one detected occurrence, adjusting the boundary of a bounding box in accordance with the array row and column counts so as to enclose the at least one detected occurrence and substantially all previously detected occurrences . 2. A method as set forth in claim 1, and including the terminal steps of: examining the boundary specification of the bounding box; and, if the boundary specification is set at an initial condition, declaring the page to be blank. 3. A method as set forth in claim 1, and including the terminal steps of: examining the boundary specification of the bounding box; and, if the boundary specification is not set at an initial condition, declaring that the binary image of the page includes information within the boundary of the bounding box. 4. A method as set forth in claim 1 wherein the step of partitioning includes a step of ignoring image pixels that correspond to at least one page border having a predetermined width. 5. A method as set forth in claim 1 and including the additional step of generating a displayable image of the image data, the displayable image having a plurality of pixels individual ones of which represent a plurality of image pixels of the image data. 6. A method as set forth in claim 1 and including the additional step of generating a displayable image of the image data, the displayable image having a plurality of pixels individual ones of which correspond to one of the NxM arrays. 7. A method as set forth in claim 1 and including the additional step of generating a displayable image of the image data, the displayable image having a plurality of pixels individual ones of which have a visual characteristic that is a function of a number of foreground pixels of at least one of the NxM arrays. 8. A method as set forth in claim 1 and including the additional step of generating a displayable image of the image data, the displayable image having a plurality of pixels individual ones of which have a visual characteristic that is a function of the numbers of foreground pixels of one of the NxM arrays and of a plurality of neighboring ones of the NxM arrays. 9. Apparatus for processing digitized image data representative of a page, comprising: means for processing the image data on a scanline by scanline basis to partition the image data into a plurality of rows and columns each of which is comprised of at least one NxM array of image pixels; said partitioning means including means for processing in turn each pixel row in an NxM array of image pixels, and including means for detecting occurrences, if any, along each scanline of an image pixel having a foreground value; means, responsive to at least one detected occurrence within one NxM array of image pixels, for incrementing a corresponding array row count and a corresponding array column count; and means, responsive to at least one detected occurrence, for adjusting the boundary of a bounding box in accordance with the array row and column counts so as to enclose the at least one detected occurrence and substantially all previously detected occurrences. 10. Apparatus as set forth in claim 9, and further including means, that is responsive to a last scanline being processed, for examining the boundary of the bounding box; and, if the boundary is set at an initial condition, for declaring the page to be blank. 11. Apparatus as set forth in claim 9, and further including means, that is responsive to a last scanline being processed, for examining the boundary of the bounding box; and, if the boundary is not set at an initial condition, for declaring that the binary image of the page includes information within the boundary of the bounding box. 12. Apparatus as set forth in claim 9 wherein said partitioning means operates to ignore image pixels that correspond to at least one page border having a predetermined width, 13. Apparatus as set forth in claim 9 and further comprising means for generating a displayable image of the image data, the displayable image having a plurality of pixels individual ones of which represent a plurality of image pixels of the image data. 14. Apparatus as set forth in claim 9 and further comprising means for generating a displayable image of the image data, the displayable image having a plurality of pixels individual ones of which correspond to one of the NxM arrays. 15. Apparatus as set forth in claim 9 and further, comprising means for generating a displayable image of the image data, the displayable image having a plurality of pixels individual ones of which have a visual characteristic that is a function of a number of foreground pixels of at least one of the NxM arrays. 16. Apparatus as set forth in claim 9 and further comprising means for generating a displayable image of the image data, the displayable image having a plurality of pixels individual ones of which have a visual characteristic that is a function of the numbers of foreground pixels of one of the NxM arrays and of neighboring ones of the NxM arrays .

Inventors: KNOWLTON KENNETH C, KNOWLTON, KENNETH, C.
Applicants: WANG LABORATORIES, WANG LABORATORIES, INC.
Application year: 1995
Main classification: H04N1
IPC codes: G06F3, G06K9, G06T1, G06T5, H04N1