Abstract:
An improved method and apparatus for rapidly, accurately and inexpensively counting stacked objects, preferably by imaging, from below, a stack of flat objects which is standing on its side, preferably on its long side. The objects need not be identical in surface appearance or in configuration. The objects preferably may be of substantially any size or thickness and need not be less than some maximum size or within some narrow range of thicknesses.

Description:
FIELD OF THE INVENTION 
     The present invention relates generally to methods and apparatus for counting objects and more particularly to methods and apparatus for counting stacked flat objects. 
     BACKGROUND OF THE INVENTION 
     U.S. Pat. Re. No. 27,869 to Willits et al describes apparatus for counting stacked sheets having no sheet separation requirements. The active area of a sensor array is matched to the width of a sheet and the sensor array traverses the stack. The signal output of the sensor array is stripped of unwanted components in a high gain, diode clamped capacitive input operation amplifier whose square wave output is processed and counted by a counting circuit. 
     U.S. Pat. No. 5,005,192 to Duss describes a system for counting flat objects in a stream of partially overlapping objects which are conveyed past a locus of impingement of ultrasonic waves. 
     U.S. Pat. No. 4,694,474 to Dorman et al describes a device for counting a stack of thin objects in which light is directed at the stack and a light sensor generates a signal proportional to the light reflected by the stack. 
     U.S. Pat. No. 5,040,196 to Woodward describes an instrument for counting stacked elements which images a portion of the side of the stack and then autocorrelates the image, while the instrument is stationary, and then cross-correlates the image as the instrument is moved. The result is a time varying signal whose repeating cycles, when counted, indicate the number of elements in the stack. 
     U.S. Pat. No. 3,971,918 to Saito counts stacked corrugated cardboards by scanning an end of the stack horizontally and vertically, using an array of photodiodes switched in turn by electric pulses. The outputs of the photodiodes are counted and compared to successively detect flat and corrugated sheets. 
     U.S. Pat. No. 4,912,317 to Mohan et al describes apparatus for counting stacked sheets whose apparent brightness is not uniform. The Mohan et al system normalizes the phase polarity of the sensor signal differential output, thereby avoiding the effects of brightness polarity reversals in the sensor output data. Mohan et al employs sensors whose effective imaged width on the stacked objects is very narrow relative to the individual objects. The data is differentially summed, then rectified to normalize phase polarity. 
     None of the above U.S. Patents teaches that the devices described therein are suitable for counting banknotes. 
     U.S. Pat. No. 5,324,921 describes a conventional sheet counting machine in which a photosensor is disposed across a bill passage downstream of a pulley. Emitted light is interrupted by each bill passing throught the light path and therefore the number of bills can be counted by counting the number of intervals during which light is not received by the light receiver. 
     A general text on image processing is Pratt, W. K, Digital image processing, Second Ed., Wiley 1991, New York. 
     The disclosures of all of the above publications and of the references cited therein are hereby incorporated by reference. 
     Brandt, Inc. of Bensalem, Pa. 19020, USA, markets a Model 8640D Note Counter accomodating notes of at least a minimum note size and thickness and no more than a maximum note size and thickness. The 8640D leafs through the banknotes in order to determine the number of banknotes. 
     SUMMARY OF THE INVENTION 
     The present invention seeks to provide an improved method and apparatus for rapidly, accurately and inexpensively counting stacked objects, preferably by imaging, from below, a stack of flat objects which is standing on its side, preferably on its long side. The objects need not be identical in surface appearance or in configuration. The objects preferably may be of substantially any size or thickness and need not be less than some maximum size or within some narrow range of thicknesses. 
     Preferably, the objects are not leafed through or otherwise moved while being imaged, in contrast to conventional devices for counting banknotes and documents such as the counting device described in U.S. Pat. No. 5,324,921 or the Brandt Note Counter. 
     This feature allows a loose or fastened together stack of objects, such as a stapled-together stack of papers, a rubber-banded stack of bills, or the pages of a bound volume, to be counted without being dismantled. 
     A stack preferably includes a plurality of objects which are generally pairwise adjacent, although not necessarily touching, wherein the edges of pairwise adjacent objects in the stack are at least roughly aligned. One example of a stack is a vertical stack which preferably includes a plurality of objects which are stacked one on top of another. Another example of a stack is a horizontal stack which preferably includes a plurality of objects standing one next to the other. Stacked flat objects may be disposed perpendicular to the ground or at any other orientation relative to the ground and may or may not be parallel to one another. 
     Preferably, the stacked objects are imaged by a matrix-CCD, and neither the CCD nor the stack of objects is moved during imaging. An advantage of this embodiment is that the counting apparatus may have no moving parts and therefore may be simple to manufacture, operate and maintain. 
     Alternatively, the stack may be manually or automatically caused to slide over the field of view of the optical sensor which images the stack or a moving line-CCD may replace the matrix-CCD. The motion may be provided specifically to facilitate counting or alternatively, objects in motion may be counted, utilizing the existing path of motion of the objects. 
     Optionally, a laser emitting device such as a laser diode or a He-Ne laser may provide light and an optical sensor suitable for sensing laser rays may be employed. The laser beam may travel along the side of the stack or alternatively, the stack may be slid manually or automatically relative to the stationary laser beam so as to enable the laser beam to scan a portion of each edge of each object and/or of each gap between each two adjacent objects. The reflected or transmitted beam is then processed in order to discern the number of objects in the stack. 
     In the present specification and claims, the surface area of a flat object is regarded as including two &#34;surfaces&#34; and at least one &#34;edge&#34;, where each edge is a nearly one-dimensional face of the object. If the object is rectangular, it has two surfaces and four edges. For example, a piece of paper has front and back surfaces and four edges. 
     The &#34;edge&#34; of an object within a stack is used herein to refer to a face of the stacked object which is parallel to the axis of the stack. 
     More generally, the term &#34;edge&#34; is employed herein to refer to a portion of an object which is imaged in order to count the number of objects. 
     The term &#34;side of a stack&#34; pertaining to a stack of flat objects, refers to one of the four faces of the stack which are formed of the edges of the stacked objects and not to the remaining two faces of the stack which are formed of a surface of the first object in the stack and a surface of the last object in the stack, respectively. 
     It is believed that the present invention is applicable to counting of flat round or curved objects. In this case, the &#34;side of the stack&#34; refers to a face of the stack which is formed of the edges of the stacked round objects. 
     According to a preferred embodiment of the present invention, counting is effected by imaging a side of the stack. In the resulting images, particularly if the objects are sheets of paper, the sheet edges are seen to be non-uniform, due to material wear, bent sheets, torn sheets, folded sheets and the tendency of paper to adopt a wave-like configuration. 
     There is thus provided in accordance with a preferred embodiment of the present invention a method for counting banknotes including providing a stack of banknotes and estimating the number of banknotes in the stack wherein the estimation process is characterized in that the mutual orientation of the banknotes is substantially maintained. 
     Also provided is apparatus for counting stacked objects including at least one optical sensor for simultaneously viewing a plurality of locations along a side of a stack of objects, the locations being arranged along the edges of the objects which form the side of the stack and image processing apparatus receiving an output from the optical sensor and providing an output indication of a number of objects in the stack. 
     Further in accordance with a preferred embodiment of the present invention, the optical sensor includes a plurality of sensing elements respectively viewing the plurality of locations along the side of the stack. 
     Still further in accordance with a preferred embodiment of the present invention, the optical sensor has a two-dimensional field of view. 
     Further in accordance with one preferred embodiment of the present invention, apparatus is provided for varying the position of the stack relative to the optical sensor. 
     Still further in accordance with one preferred embodiment of the present invention, the apparatus for varying includes apparatus for moving the stack. 
     Additionally in accordance with one preferred embodiment of the present invention, the apparatus for varying includes apparatus for moving the optical sensor relative to the stack. 
     Further in accordance with one preferred embodiment of the present invention, the optical sensor is operative to repeatedly view at least one location along the stack of objects. 
     Also provided, in accordance with one preferred embodiment of the present invention, is a method for counting stacked objects including viewing at least a portion of a side of a stack of objects at least under first illumination conditions and under second illumination conditions, and image processing apparatus receiving an output from the optical sensor including a first image of at least a portion of the stack under the first illumination conditions and a second image of at least a portion of the stack under the second illumination conditions, and operative to compare the two images and to provide an output indication of a number of objects in the stack. 
     Additionally provided, in accordance with a preferred embodiment of the present invention, is apparatus for counting stacked objects including at least one support for at least one stack of objects, at least one optical sensor disposed behind the at least one support for viewing at least a portion of a side of a stack of objects through the support, and image processing apparatus receiving an output from the optical sensor and providing an output indication of a number of objects in the stack. 
     Further in accordance with a preferred embodiment of the present invention, the support is transparent. 
     Still further in accordance with a preferred embodiment of the present invention, the support has at least one window formed therein. 
     Additionally in accordance with a preferred embodiment of the present invention, there is provided a method for counting banknotes including imaging a stack of banknotes from the side, and image-processing the resulting image in order to compute the number of banknotes in the stack. 
     Further in accordance with a preferred embodiment of the present invention, the apparatus also includes an object separator operative to separate objects in the stack from one another to facilitate counting thereof. 
     Further in accordance with a preferred embodiment of the present invention, the method also includes separating the banknotes in the stack from one another to facilitate counting thereof. 
     Additionally in accordance with a preferred embodiment of the present invention, the at least one optical sensor includes a plurality of optical sensors each of which is operative to view a plurality of locations along a side of a different stack. 
     Further in accordance with a preferred embodiment of the present invention, the at least one optical sensor includes a plurality of optical sensors each of which is operative to view at least a portion of a side of a different stack of objects. 
     Still further in accordance with a preferred embodiment of the present invention, a plurality of light sources illuminates the stacked objects. 
     Further in accordance with a preferred embodiment of the present invention, the first illumination conditions include ambient illumination. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS AND APPENDICES 
     The present invention will be understood and appreciated from the following detailed description, taken in conjunction with the drawings in which: 
     FIG. 1 is a simplified block diagram of sheet counting apparatus constructed and operative in accordance with a preferred embodiment of the present invention; 
     FIG. 2 is an example of a negative image of stacked sheet portions; 
     FIG. 3 is a logic diagram of the operation of the image processing and counting computer of FIG. 1; 
     FIG. 4 is a flowchart illustration of a method for implementing the image processing step of FIG. 3 based on selection of an appropriate sequence of image processing operations; 
     FIG. 5 is a flowchart illustration of a preferred method for implementing the sheet counting step of FIG. 3; and 
     FIG. 6 is a simplified block diagram of a modification of the sheet counting apparatus of FIG. 1 which is operative to count a plurality of stacks of objects. 
     Attached herewith are the following appendices which aid in the understanding and appreciation of one preferred embodiment of the invention shown and described herein: 
     Appendix A is a computer listing of a program entitled EZ --  MONEY.PAS, a program which implements a banknote counting method operative in accordance with a preferred embodiment of the present invention; and Appendix B is a computer listing of MODEX.ASM, a public domain software package. 
    
    
     DETAILED DESCRIPTION OF PREFERRED EMBODIMENTS 
     A portion of the disclosure of this patent document contains material which is subject to copyright protection. The copyright owner has no objection to the facsimile reproduction by anyone of the patent document or the patent disclosure, as it appears in the Patent and Trademark Office patent file or records, but otherwise reserves all copyright rights whatsoever. 
     FIG. 1 is a simplified block diagram of apparatus for counting stacked objects. The apparatus includes a support 10 for the stack of objects 20 to be counted, at least one light source 30, and a light sensor 40, such as a matrix-CCD or a line-CCD, operatively associated with a lens 50 for converting the image of the stack into electric signals. The optical apparatus may, optionally, include mirrors (not shown) for such functions as enlargement, focussing and/or changing direction. 
     The axis of the stack is indicated by reference number 54. 
     Alternatively, the support 10 may be omitted. The apparatus may optionally be portable such that counting of objects takes place by transporting the counting apparatus to the objects rather than by transporting the objects to the counting apparatus. 
     It is appreciated, however, that the support, if provided, may perform one or more of the following functions: 
     a. Alignment of the stack. 
     b. Separation of the stack, e.g. by providing a diagonally oriented support on which the stack is placed on its side such that the edges of the stack become separated due to the diagonal. 
     c. The support may serve as a track along which the stack is moved. 
     d. The support may be operative to electrostatically charge the stack, thereby to enhance separation of the objects. For example, the support may comprise a capacitor. 
     Depending on the optical characteristics of the lens and the CCD elements, magnification may be provided, so as to provide a suitable picture resolution, such as at least 5 pixels for the shortest dimension of the object and for the average gap between objects. One suitable depth of field value is about 5 mm. A suitable linear resolution is at least 500 dots per half-inch. The above numerical values are suitable for the specific equipment detailed below and are not intending to be limiting. 
     It is appreciated that a laser beam emitting device such as a laser diode or a He-Ne laser may be employed for light source 30 and an optical sensor suitable for sensing laser rays may be employed for sensor 40. 
     Preferably, the sensor and lens are disposed below the support 10 and the support 10 includes a transparent window 60 or a slit (not shown) through which the stack 20 can be imaged from below. The stack is placed on its side, preferably on its long side, and may optionally be manually guided along the long dimension of the transparent window 60, as indicated by arrow 100. In some applications, motion along arrow 100 may not require manual guidance since the stack is in motion, e.g. is travelling along a conveyor belt, due to processes other than counting which are being performed on the stack or with the aid of the stack. 
     Alternatively, the CCD comprises a line-CCD which can be moved parallel, or at any other suitable angle, to the long dimension of the transparent window. Preferably, however, the CCD comprises a matrix-CCD and neither the stack nor the matrix-CCD are moved during imaging. 
     The output of the sensor is fed to an image capturing unit 80 which transforms the analog data captured by the light sensor 40 in digital form to a RAM 68. An image processing and counting computer 70, associated with a conventional control device 84, analyzes the picture stored in the RAM in order to discern or &#34;count&#34; the number of objects in the stack. The counting capability may be implemented in software which is held in a ROM 94. 
     The result of &#34;counting&#34; the number of objects in the stack is displayed on a display device 90 such as an LCD. Optionally, diagnostic statistics or warning indications may also be displayed. 
     It is appreciated that information related to the counting process other than the number of objects may be derived and displayed. For example, it may be desirable to provide an indication of poor quality objects, such as bills. 
     In FIG. 1, illumination is provided, however, alternatively, only natural illumination may be employed. Furthermore, any suitable type of artificial illumination may be employed. Optionally, if artificial illumination is employed, the natural illumination is blocked out as by opaque blocking screens. 
     One or more light sources may be employed. Each of the one or more beams provided by the one or more light sources may be any color of light, or may have a selectable plurality of colors as by provision of a plurality of filters. Each beam may be focussed or divergent. The angle of each beam relative to the stack may be any fixed angle or may be varied by the user. The light itself may be coherent or non-coherent. Filters may be employed to control the wavelength of the light and/or the polarization of the light. 
     Optionally, the objects in the stack are processed so as to minimize the probability that two objects overlie one another and are consequently perceived as being a single object. For example, a plurality of apertures may be provided in the window through which airflows or air jets access the objects in order to enhance the separation thereof. Alternatively or in addition, the objects may be electrostatically charged such that they tend to repel one another and become separated from one another. Alternatively or in addition, a mechanical device may be provided to grip one side of the stack, typically the side opposite the side which is to be imaged, which has the effect of separating the edges of the objects which lie along the side of the stack which is to be imaged. 
     It is appreciated that the above two examples of how to minimize the probability of overlying objects are only examples and are not intended to be limiting. 
     FIG. 2 is an example of a negative image of stacked sheet portions. 
     As seen, the sheet edges are non-uniform, which may be due to material wear, bent sheets, torn sheets, folded sheets, the tendency of paper to adopt a wave-like configuration, and other factors. Therefore, different lines drawn perpendicular to the imaged edges create different sequences of intersection points with the images of the sheets. The sequences may differ as to the distances between corresponding intersection points and/or even as to the number of intersection points. For example, the bottom two intersection points on line A in FIG. 2 would probably correspond to a single intersection point on line B due to the lack of distance between the bottom two sheets in FIG. 2, at the location of line B. 
     For this reason, according to a preferred embodiment of the present invention, a two dimensional image of the stack is provided, or alternatively the stack is imaged with a linear sensor at a plurality of locations along the sheets, such as more than 400 locations. For example, the stack of FIG. 2 may be imaged at a plurality of locations including line A and line B. 
     FIG. 3 is a logic diagram of the operation of the comparing and counting computer of FIG. 1, which includes image processing and counting. 
     Image processing typically includes noise removal, sharpening, edge enhancement, filtering, and/or threshold limiting, any or all of which may be based on conventional methods such as those described in Pratt, W. K, Digital image processing,Second Ed., Wiley 1991, New York. A preferred image processing method is described below with reference to FIG. 4. 
     A preferred counting method is described below with reference to FIG. 5. 
     FIG. 4 is a flowchart illustration of a method for implementing the image processing step of FIG. 3 based on selection of an appropriate sequence of image processing operations from among a set of image processing &#34;primitives&#34;. The set of image processing &#34;primitives&#34; illustrated in FIG. 4 includes: 
     a. a negative imaging operation N, 
     b. a differential operation D along columns to emphasize changes between bills and background, 
     c. a static cut-off operation C which reduces noise using a threshold value set according to image brightness and contrast, 
     d. a dynamic cut-off operation X to reduce noise along rows (banknotes), 
     e. a dynamic cut-off operation Y to reduce noise between rows (banknotes), 
     f. a binarization operation B, 
     g. a smoothing operation S to reduce high-frequency noise, 
     h. a sharpening edge-enhancing operation P, 
     i. a hi-pass filtering operation H, 
     j. a thick line detecting filtering operation I for emphasizing banknote images; and 
     k. a line-detecting filtering operation L. 
     Suitable sequences of these image processing operations include: SSCDBS, SCPS, SIY, SIX, or simply C. 
     It is appreciated that a suitable image processing sequence need not be composed only of operations S, C, D, B, P, I, Y. A suitable image processing sequence may include other conventional image processing operations and/or the remaining image processing operations referred to in Appendix A and in FIG. 4, namely H (high pass filter), L (line detection filter), B (image binarization), N (negativing of image). 
     FIG. 5 is a flowchart illustration of a preferred method for implementing the sheet counting step of FIG. 3. Each column is searched for sequences of non-zero pixels. The number of such sequences is termed &#34;bills&#34; in FIG. 5. A histogram is constructed for &#34;bills&#34;. The output of the process is an indication of the central tendency of the histogram such as the modal value (peak) thereof and/or the mean value thereof. 
     FIG. 6 is a simplified block diagram of a modification of the sheet counting apparatus of FIG. 1 which is operative to count a plurality of stacks of objects, even simultaneously. As shown, the apparatus of FIG. 6 is similar to the apparatus of FIG. 1 except that image processing and counting computer 70, image capturing unit 80 and control unit 84 are associated with a plurality of stack inspecting subunits 110, only two of which are illustrated. Each stack inspecting subunit typically comprises a support 10, a light source 30, a light sensor 40, a lens 50, and a display device 90. 
     Appendix A is a computer listing of a program entitled EZ --  MONEY.PAS, a program which implements a banknote counting method operative in accordance with a preferred embodiment of the present invention. 
     The program employs several image processing methods to count banknotes in a picture file. 
     The picture file is an image which may be captured using a CORTEX frame grabber. The frame resolution is 512×512 pixels×256 gray levels/pixel. The program uses MODEX, a public domain software package written by Matt Pritchard. A computer listing of MODEX, entitled MODEX.ASM, is appended hereto and is referenced Appendix B. MODEX is employed as a graphics package, in order to process and display a 256 gray level picture, since this ability is not supported by the Turbo Pascal 6.0 Graphics Unit. 
     The program uses a subset of the MODEX graphics routines to handle two VGA pages, one being the source of the image processing operation and the other being the destination thereof. The program sets and gets pixel values and prints text. 
     The program uses the MODEX screen resolution, 320H×400V, which is smaller than the CORTEX image resolution but is sufficient in order to display the essential part of the image which stores the image of the banknotes to be counted. 
     To use the program of Appendix A to count a stack of banknotes, such as a stack of approximately one dozen Bank of Israel 20 New Sheqel denomination notes, the following equipment may be employed: 
     Hardware: 
     Computer--PC 386DX (40 Mhz, 128K Cache, 4 MB RAM, 340 MB hard disk, SVGA monitor). 
     Graphics card--Trident 8900CL (SVGA), 1 MB RAM onboard (manufactured by JUKO Electronics Industrial Co. Ltd. 208-770000-00A, Taiwan). 
     Frame grabber card--CORTEX-I, 256 Gray levels, 512H×512V resolution in CCIR/PAL mode (manufactured by Imagenation Corp., P.O. BOX 84568, Vancouver Wash. 98684-0568, USA). 
     Video camera--JAVELIN JE-7442 Hi-Resolution 2/3&#34; CCD camera (manufactured by JAVELIN Electronics, 19831 Magellan Dr., Torrance Calif. 90502-1188, USA). 
     Lens--Micro-Nikkor 55 mm Macro lens (manufactured by NIKON Corp., Fuji Bldg., 2-3, Marunouchi 3-chome, Chiyoda-ku, Tokyo 100, JAPAN). 
     Camera accessories--Cosmicar x2 C-Mount lens TV Extender, Video Camera tripod. 
     Software: 
     MS-DOS 6.2 (by MicroSoft Corp.). 
     Turbo Assembler 3.0 (by Borland International, Inc.) 
     Turbo Pascal 6.0 (by Borland International, Inc). 
     CORTEX frame grabber software (by Imagenation Corp). 
     MODEX SVGA graphics library (author: Matt Pritchard, P. 0. B. 140264, Irving, Tex. 75014-0264, USA; on Fido NET ECHO Conference: 80xxx), the listing of which is provided herein as 
     Appendix B; 
     EZ --  Money--TurboPascal version counting program whose listing is appended hereto as appendix A. 
     Bills-counting processes, the text files of which are set forth within the above description under the captions COUNT --  1. OPR, . . . COUNT --  5.OPR. 
     A preferred method for counting notes, using the above equipment, is as follows: 
     1. Install the CORTEX frame grabber card inside the computer. 
     2. Install CORTEX software in C: BANKNOTE directory. 
     3. Generate digital files whose contents are identical to the computer listings of Appendices A and B and name these files EZ --  MONEY.PAS and MODEX.ASM respectively. Put EZ --  MONEY.PAS and MODEX.ASM into C: BANKNOTE directory. 
     4. Compile MODEX.ASM using Turbo Assembler 3.0 in order to create MODEX.OBJ. 
     5. Compile EZ --  MONEY.PAS and link it to MODEX.OBJ using Turbo Pascal 6.0. 
     6. Mount the Micro Nikkor lens onto the Javelin camera with the Cosmicar TV Extender. 
     7. Attach the Javelin camera to the tripod and connect the camera video output to the CORTEX card input. 
     8. Place the stack of banknotes such that the stack&#39;s side (the edges of the bills) is in the viewing field of the camera. 
     9. Focus the lens on the bills&#39; edges: change aperture opening to match the environment luminance which may, for example, be ambient room light. 
     10. Run CORTEX utility program to grab the banknotes image to a CORTEX image file format, using the command C: BANKNOTE&gt;UTILITY GRAB.COM BANKNOTE.PIC. 
     11. Run EZ --  MONEY counting program on the default BANKNOTE.PIC image file by: 
     a. Interactive running (i.e. C: BANKNOTE) EZ --  MONEY); or 
     b. Running using any one of the counting processes, COUNT --  i.OPR to COUNT --  5.OPR, which are as follows: 
     
         ______________________________________      COUNT.sub.-- 1.OPR:      BANKNOTE.PIC      SSCDBS#      COUNT.sub.-- 2.OPR:      BANKNOTE.PIC      SCPS#      COUNT.sub.-- 3.OPR:      BANKNOTE.PIC      SIY#      COUNT.sub.-- 4.OPR:      BANKNOTE.PIC      SIX#      COUNT.sub.-- 5.OPR:      BANKNOTE.PIC      C#______________________________________ 
    
     For example, to run the EZ --  MONEY counting program using the first counting process, type: C: BANKNOTE&gt;EZ --  MONEY COUNT --  i.OPR. 
     The five counting processes listed above are sequences including one or more image processing operations, referred to in Appendix A and in FIGS. 3 and 4 as S, I, X, Y, C, P and D, and also including a counting process # which is operative to count banknotes in each column and give, as a result, the most frequent count. 
     It is appreciated that the above image processing operations can be combined into counting processes other than COUNT --  1.OPR, . . . , COUNT --  5.0PR. It is also appreciated that the above set of image processing combinations may be augmented by other conventional image processing operations such as but not limited to the following image processing operations which are referred to in Appendix A and in FIG. 4: 
     H (high pass filter), L (line detection filter), B (image binarization), N (negativing of image). 
     Preferably, at least one of the image processing operations employed operates on a multipixel area such as a 3×3 pixel matrix or a 3×5 pixel matrix, rather than operating on one pixel at a time. 
     Optionally, a neural network or other learning mechanism may be employed such that the counting apparatus shown and described herein may be trained to count correctly. 
     Alternatively, all five of the counting processes may be employed and the results thereof combined, as by a weighted average, to determine a final result. 
     The number of banknotes in the stack is displayed on the screen or is recorded on the counting-algorithm file, if supplied. The result is the `peak` value; in addition, the `average` value is written. 
     For example, when the negative of the banknote stack image of FIG. 2 was processed, the result was found to be 12. 
     The present invention is described herein in the context of a banknote counting application as for a cash register, automatic cash withdrawal device or other banknote handling device, in a bank, postal facility, supermarket, casino, transportation facility or household use. However, it is appreciated that the embodiments shown and described herein may also be useful for counting other objects, and particularly flat, stacked objects such as stacks of cardboard sheets, forms, bills, films, plates, metal foils, cards, and pages photocopied or to be photocopied by a photocopier. The counting device may, optionally, be portable and may be either battery-powered or powered by connection to an electric outlet. 
     It is appreciated that the software components of the present invention may, if desired, be implemented in ROM (read-only memory) form. The software components may, generally, be implemented in hardware, if desired, using conventional techniques. 
     It is appreciated that the particular embodiment described in the Appendices is intended only to provide an extremely detailed disclosure of the present invention and is not intended to be limiting. 
     It is appreciated that various features of the invention which are, for clarity, described in the contexts of separate embodiments may also be provided in combination in a single embodiment. Conversely, various features of the invention which are, for brevity, described in the context of a single embodiment may also be provided separately or in any suitable subcombination. 
     It will be appreciated by persons skilled in the art that the present invention is not limited to what has been particularly shown and described hereinabove. Rather, the scope of the present invention is defined only by the claims that follow. ##SPC1##