Algorithm sorts colored casino chips
Mechanical machines for sorting casino chips have been available for 15 years. Early models used photodiodes...
Andrew Wilson, Editor, firstname.lastname@example.org
Mechanical machines for sorting casino chips have been available for 15 years. Early models used photodiodes to recognize the different colored chips. Recently, casinos have begun to print complex graphic symbols on their gaming chips that include photographs, holograms, and custom patterns. An international supplier of gaming equipment approached Active Silicon (Uxbridge, Middlesex, UK; www.activesilicon.co.uk) to rebuild an existing design using off-the-shelf machine-vision components to recognize these symbols.
"Design requirements for the vision system mandated an easy-to-learn, low-maintenance, high-reliability inspection machine that could operate 24 hours per day for a year without calibration or maintenance," says Colin Pearce, managing director of Active Silicon, "and all at a cost of less than $3000." In addition, the mechanical portion of the old system had to remain the same for the new system.
During operation, a mechanized hopper with a conveyor belt containing cups is used to scoop chips from within the machine and feed them so they pass under a sensor and then move on to a sorting head. This head contains solenoids that eject the chips into the correct column, so that a dealer can easily retrieve them.
To image the casino chips, a CX-161 video board camera from Panasonic Vision Systems (Secaucus, NJ, USA; www.panasonic.com/visionsystems) is interfaced to an Active Silicon LFG frame grabber housed in an industrial PC. A xenon strobe light provides a short flash that freezes the motion of the moving conveyor belt. Custom electronics provide strobe/camera synchronization from an optical shaft encoder supplied by Encoder Technology (Leatherhead, UK; www.encoder-technology.com). This eliminates potential vertical synchronisation artifacts when using a strobe with a free-running camera. "By using the programmable CX-161 camera, white balance and gain can be optimized and fixed to match the spectrum and brightness of the xenon strobe," says Pearce.
For the operating system (OS), Active Silicon chose ROM-DOS from Datalight (Bothell, WA; www.datalight.com). Available for less than $10 per license in volume, this OS requires only 2 Mbytes to store both the application software and the operating system.
Active Silicon developed a proprietary algorithm, now patented in more than 30 countries, to recognize the various colors of chips and cope with varying chip conditions, such as dirt build-up. Classifying objects at a rate of ten per second from 40 stored references, the algorithm is orientation-independent and can 'learn' new objects from a single image. Based on histogram analysis of HSI color space, the algorithm can also cope with the variation and degradation of objects over time.
During operation, the casino chips are digitized in YUV 4:2:2 (YCbCr) format at a resolution of 384 × 288 pixels and an extracted circular region of interest. "YUV is an excellent color format to use as it is easily converted into HSI color space using a look-up table (LUT) based on the 'U' and 'V' components," says Pearce. This is accomplished using
Hue = Arc tan (U/V)
Saturation = min (R, G, B)
where R = Y + 1.402.V, G = Y - 0.344.U - 0.714.V, B = Y + 1.772.U, and Y = intensity.
An LUT generates the hue value and a matrix operation, followed by a simple nonlinear test that generates the saturation figure. Intensity is the same as the Y value. The LUT can also be programmed to deal with low values of U and V (that is, gray objects); for example, arc tan (0/0) can be defined to be a fixed value rather than extend toward infinity. Once the data are in HSI format, a histogram is generated for each component.
"This operation is performed once on the reference image and then in real time for each object to be recognized. These histograms represent the signature of each object. The histograms from new objects on the conveyor belt are generated and compared to the reference histograms based on a limited sliding correlation to account for strobe intensity variations.
"The correlation technique is based on the sum of the differences for each element in the histogram and then normalized to give a percentage match. Resulting matches are weighted with a bias toward hue, although saturation and intensity are vital components in the classification of gray-scale objects. Weighting toward the hue provides the benefit of robust classification of colored objects as they become dirty. Objects must be captured in sharp focus with no motion blur; otherwise, individual red/green dots may be seen by the camera as monochromatic yellow instead of separate hue values for red and green," adds Pearce.