You are on page 1of 12

Playing Card Recognition

Timothy Pelletier
Background/Proposed Solution
-Playing Card Recognition through image
processing

-Detection of multiple cards

-Re-orient each card (Hough Transform)

-Extraction of suit/number
Fig. 1: Sample card image implemented before
program
-Display/Indication of respective qualities
Final Program Overview
Individual
Test
Initialized

Pre-processing
(grayscale/binary
conversion, edge Number/Suit Extraction
detection, bounding
boxes

Canny Filter/Hough Cross-Correlation with


Transform (Line Number/Suit database
Identification)

Peak
Identification/Store Final
Upright Image Value
Transformation

Fig. 2: Final program flow diagram


Final Display
Card Detection
-Grayscale/binary conversion
-Filter out card features using binary image; use
filtered image to determine number of cards

-Draw “bounding boxes” around each


Fig. 3 (above): Initial bounding box
layout
card (only accept objects with length
greater than 10% of total image length)
Fig. 4 (left): Sub-image of
-Sub-image extraction using bounding individual playing card extracted

boxes
Canny Filter/Hough Transform (Edge/Line Detection)
● Canny Filter acts as edge
detector to outline playing card

● Hough transform applied to


properly derive the four major
line segments on playing card

○ Must check lines for


orthogonality with one
another

Fig. 5 (above): Individual playing card


after Canny filter (left) and with Hough
transform lines drawn on (right)
Upright Image Transformation
-Hough Transform gives lines

-Find line equations and check for


orthogonality

-Intersection points of orthogonal lines


indicate card corners Fig. 6 (above): Conversion from
extracted, angled playing card to desire,
upright format
-Projective transform aligns image

-2.5’’x3.5’’ card, use 500x700 pixel image


Extraction of Number & Suit
-Position of card rank in inches translates to
position in pixels

-Rank is on top .425’’x.575’’ corner

-85x115 corner cropped out

-Provides rank for each card

-Same process repeated for suit, different


section cropped
Fig. 7 (above): Conversion from
desired, upright position to number
“sub-sub-image”
Fast Normalized Cross-Correlation
-Created database of all isolated
ranks and suits

-Rank in question cross-correlated


with each rank in database

-Peak value determines final


quality

-Repeated with suit

**Please Note: All database values Fig. 8: Four fast normalized cross-
strictly created using Bicycle brand correlation examples. Ten is the card
in question, gives highest peak
cards
Final Display
-Code runs through each detected card
in individual image

-Stores values for each card

-Original image re-displayed with suit


and ranks of each card

Fig. 9: End result with identified card


components
Results
-Cards successfully detected and identified by program

-Final image displayed with card number and suit written on each card

-Cards detected and identified at varying angles

-Different quality photo testing still required


Application Limitations/Potential Considerations
Potential Issue Solution
Processing time is somewhat Code Suppression
inconvenient due to immense
amount of figures Additional Filtering

Overlapping playing cards as Percentage of image general


well as bounding boxes makeup
(additional lines identified)
Alternate coding methods
Derivation of slope during
parallel line pair identification
Questions?

You might also like