Playing Card Recognizer ECE 4025 February 28, 2002 Group 5 Robert Barrett Jason Hodkin Chung Tse Mar Jay Silver David Winkler Yu Ming Wu
Motivation Short-term: –Demonstrate effectiveness and usefulness of character recognition Long-term: Design autonomous on-line card playing system
Project Scope Image Restrictions: –One card per image –No occlusion of card –High contrast solid background –Constant light source Image Allowances: –Scaling –Rotation –Font style
How does it work? System diagram Down Sample & Convert to Binary High Resolution Color Image Binary Image of Card Corner Label Connected Objects & Flood Fill Card Area Cross- correlate with Templates Compute Scores and Compare Card Value and Suit Use Major Axis to Find Corners for Scaling and Rotation Extract Corner for Comparison
Color to Gray Scale Conversion [R G B] Y R U R V R Y G U G V G Y B U B V B = Y U V We are only interested in intensity (Y) [R G B] YRYGYBYRYGYB = intensity Y R = Y G =0.587 Y B =0.114
Gray Scale to Binary Conversion If grayScaleValue > mean + 2* Pixel = 1; Else, Pixel =
Labeling Identify blobs Determine characteristics of blobs Area = 24 Area = 4 Area = 5
Flood Fill FloodFill ( pixelToEliminate ) FloodFill ( allNeighboringPixels) Erase all neigboring pixels end
Calculate Angle of Major Axis of Best Fit Ellipse (orientation)
Rotate
Isolate the Important Information Right Side of Card Bottom of Card Top of Card Left Side of Card Scan each row and column for a white pixel
Locate Identifiable Symbol and isolate it top left bottom right
Choose an Appropriate Template and Scale to Match the Template Choose a font that should be consistent with most card fonts, but that is different from the data set. Template Image Freecell (A card game on most windows OS’s)
Take a Normalized Cross Correlation [X(r+m,c+n)*H(r,c)] = Correlation(m,n) nm
Take a Normalized Cross Correlation
Highest “Score” is a Match Max Corr is Max Corr is
Implementation Overview EVM Correlation Calculation Templates Final Result Color to Binary HOST Corner Extraction Scaling Label Flood FillRotate Decision Model RTDX Camera
Implementation Overview Image File Decision Model HOST Corner Extraction Scaling RTDX EVM Correlation Calculation Templates Final Result
Realtime Constraint Realtime constraint depends on the application –How fast the cards change –Bounded by camera frame rate Set goal of 1 frame/second
Computational Complexity 1 frame/second 64x64 = 4096 pixels/template 100 cross-correlations/template 13 templates for number, 4 templates for suite 100 * 4096 * 17 * 1 = 7 Million MACs/second
Next Steps Implementing processing on EVM –Cross-correlation Implementing processing on host –Corner extraction –Scaling –Decision model and display Synchronizing host with EVM using RTDX API