Card recognition Justin Pinkul Blackjack Needed information - - PowerPoint PPT Presentation

card recognition
SMART_READER_LITE
LIVE PREVIEW

Card recognition Justin Pinkul Blackjack Needed information - - PowerPoint PPT Presentation

Card recognition Justin Pinkul Blackjack Needed information Position Value Orientation Scale Assumptions Same deck of cards Fixed viewing angle Comparable lighting The algorithm Grayscale template-matching


slide-1
SLIDE 1

Card recognition

Justin Pinkul

slide-2
SLIDE 2

Blackjack

Needed information

  • Position
  • Value
  • Orientation
  • Scale
slide-3
SLIDE 3

Assumptions

  • Same deck of cards
  • Fixed viewing angle
  • Comparable lighting
slide-4
SLIDE 4

The algorithm

Grayscale template-matching invariant to rotation scale, translation, brightness and contrast Three step filtering process

slide-5
SLIDE 5

The algorithm

Step 1: circular sampling

slide-6
SLIDE 6

Circular sampling

slide-7
SLIDE 7

Circular sampling

slide-8
SLIDE 8

Circular sampling

slide-9
SLIDE 9

The algorithm

Step 2: radial sampling

slide-10
SLIDE 10

Radial sampling

slide-11
SLIDE 11

Radial sampling

slide-12
SLIDE 12

Radial sampling

slide-13
SLIDE 13

Radial sampling

slide-14
SLIDE 14

Radial sampling

slide-15
SLIDE 15

The algorithm

Step 3: normal template matching

  • Probable scale known from circle sampling
  • Probable rotation known from radius

sampling

slide-16
SLIDE 16

Pseudo Code - circularTest

main

I = image G = template scales = 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85 radius = 0, 8, 16, 24, 32, 45 pass1, probScales = circularTest(I, G, scales, radius) pass2, probAngles = radialTest(I, G, scales, radius, pass1, probScales) templateMatch(I, G, pass2, probScales, probAngles)

slide-17
SLIDE 17

Pseudo Code

circularTest(I, G, scales, radius) for scale = all scales resizedQ = resize Q to the scale for len = all radius (xcen, ycen) = center of resizedQ qScore[scale, length] = getCircleAverage(resizedQ xcen, ycen ,len) end end for all (x,y) in I for len = all radius iScore[x, y, length] = getCircleAverage(I, x, y, len) end end

slide-18
SLIDE 18

Pseudo Code - circularTest cont.

for all (x,y) in I for scale = all scales iRadiusAvgs = iScore(x,y, ...) qRadiusAvgs = qScores(scale, ...) cor = correlate(iRadiusAvgs, qRadiusAvgs) add cor to correlations end pass1(x,y) = max(correlations) > threshold1 probableScale(x,y) = scales(index of max(correlations)) end end

slide-19
SLIDE 19

Pseudo Code - radiusTest

radiusTest(I, G, scales, radius, pass1, probScales) r = largest radius for theta = all test angels (cenx, ceny) = the center of Q qScores[theta] = getRadiusAverage(Q, theta, cenx, ceny, r) end for all (x,y) in I if pass1(x,y) iR = r * probScales(x,y) iScores[x,y,theta] = getRadiusAverage(Q, theta, x, y, iR) end end

slide-20
SLIDE 20

Pseudo Code - radiusTest cont.

for all (x,y) in I if pass1(x,y) for theta = all angels iAngAvgs = iScores(x,y,...) for all orientations shifted = shift qScores to the new orientation cor = correlate(iAngAvgs, shifted) add cor to correlations end pass2(x,y) = max(correlations) > threshold2 probRadius = radius(index of max(correlations)) end end end end

slide-21
SLIDE 21

Results

slide-22
SLIDE 22
slide-23
SLIDE 23
slide-24
SLIDE 24
slide-25
SLIDE 25
slide-26
SLIDE 26
slide-27
SLIDE 27
slide-28
SLIDE 28

Limitations

  • Template size
  • Speed
slide-29
SLIDE 29

Future work

  • Partially visible cards
  • Automated process for choosing scale and

radius samples

  • Variable viewing angles
  • Real time analysis with a video camera
slide-30
SLIDE 30

Questions?

slide-31
SLIDE 31

References

De Araújo, Sidnei. "Grayscale Template-Matching Invariant to Rotation, Scale, Translation, Brightness and Contrast." Advances in Image and Video Technology. By Hae Kim. Heidelberg: Springer Berlin, 2007. 100-13. Print.