SlideShare a Scribd company logo
Autor Conducător științific
Universitatea
Politehnica
București
Facultatea de
Automatică și
Calculatoare
Catedra de
Calculatoare
Hearthstone Helper - Using Optical
Character Recognition Techniques For
Cards Detection
Costin-Gabriel CHIRU, Florin Oprea
costin.chiru@cs.pub.ro
Introduction
• Purpose: capture, process and analyze images
from the video stream of the Hearthstone
game in order to obtain relevant information
on the conduct of parties in this game
• Constraint: results should be offered in real-
time on a regular computer / tablet
• Methodology: apply different techniques for
extracting information from the images and
then use this information to identify and log
the cards that have been played.
09.09.2016 AIMSA 2016 1
Heartstone (Heroes of Warcraft)
• Free-to-play online game developed by Blizzard (2014)
• Turn-based game involving 2 players in a 1vs1 match
• Each player has his/her own deck of cards with 30 cards
• Each player start with 30 life points and the purpose of
the game is to play their cards so that to destroy the
opponent before they are themselves defeated
• The game features between 814 and 1003 different
cards used to cast spells, summon minions to help in the
battle or equip weapons
– They are classified in 5 categories based on their rarity and
usefulness and in 10 different classes according to their
availability to all the heroes, or to a specific one.
09.09.2016 AIMSA 2016 2
Application Usefulness
• By monitoring the game, the application is able to
memorize the cards that have been played and
thus:
– the player knows what remaining cards he/she has and
can compute the likelihood of extracting a particular
card
– he/she knows which cards will no longer be available in
the opponent deck (the decks may contain at most two
cards of the same type, or only one if it is a legendary
card)
– the player can predict the most probable deck of the
opponent based on the cards played so far, previous
history, opponent's rating, game style and current
meta-game.
09.09.2016 AIMSA 2016 3
Theoretical Background (1)
• To determine real time in-game events,
methods that are fast, efficient and accurate
are needed both for image capturing and for
cards recognition.
• Image capturing: acquire sufficient game
snapshots per seconds to detect changes
– Using API provided by Windows that allows direct
access to the opened windows from the
operating system
– up to 15 frames per second without
overwhelming the CPU
09.09.2016 AIMSA 2016 4
Theoretical Background (2)
• Cards recognition: needed to
– detect when a new card appeared (to avoid
continuous processing of video stream)
• Using Background Subtraction
– recognize different pictures based on the elements
from them. Can be done by:
• comparing their histograms (colors distribution)
• key points matching: choose specific points of interest and
then find the association between them.
• using key points in combination with decision trees (to
accelerate the execution)
• using perceptual hashes
• using OCR on the text appearing in the pictures and
comparing the text
09.09.2016 AIMSA 2016 5
Implementation Details (1)
• First of all, the Windows API was used to extract
the snapshots  extract information from the
snapshots
• Resolution might be large involving a large
processing time  only analyze specific regions
in the images to determine the start and end of a
game (analyzed areas are about 10 times smaller
than the original image)
• Next step: identify the moments of time when
these areas contain images of cards using
Background Subtraction and analyze the frames
sufficiently highlighted
09.09.2016 AIMSA 2016 6
Implementation Details (2)
09.09.2016 AIMSA 2016 7
Implementation Details (3)
• Next, we investigated the methods for image
recognition:
– Histograms: bad results due to the fact that all the
images were created from the same template
– Key points matching - invariant to rotation, scaling or
brightness: SURF (Speeded up robust features) and
SIFT (Scale-invariant feature transform) in
combination with Flann (Fast Library for approximate
nearest neighbor) for matching the key points
• Can be done offline for the cards from the DB, but the
matching algorithm might take minutes (~ 1000 cards *
tenths of a second for each card)  can’t be used for real-
time recognition
• For heroes recognition, SURF and Flann takes ~ 3 seconds
(only 9 possible heroes)  acceptable for this part  used
09.09.2016 AIMSA 2016 8
Implementation Details (4)
09.09.2016 AIMSA 2016 9
Implementation Details (5)
– Apply OCR techniques: used Tesseract and specified
specific text areas that help determining the playing
card (the card name and its attributes - cost, attack
and life points)
• Binarized the picture  better results for OCR and smaller
execution times
• Wavy text  problems for the recognition engine  had to
post-process the OCR output:
– compute the Levenshtein distance between the obtained text
and the cards name and
– use the attribute values returned by the OCR to filter out cards
• Very fast: took between 0.1 and 1.5 s
• Using OCR, the whole process (from capturing
the window image to the card classification) < 2 s
09.09.2016 AIMSA 2016 10
Application Output
• The GUI is to inform the player about relevant
changes in the application:
– the status of the application,
– the cards that have been played,
– the remaining cards
09.09.2016 AIMSA 2016 10
• The information
is updated in
real-time as the
cards are played
Cards Identification (1)
• Stormwind Knight:
– Cards from the DB with their
scores:
• "Silver Hand Knight": 2,
• "Stormwind Knight": 10,
• "Blood Knight": 10
• "The Black Knight": 2
– Use Levenshtein Distance:
• "Stormwind Knight": 9, 11, 11, 4, 8, 5
• "Blood Knight": 11, 12, 15, 8, 12, 10
– and cards’ attributes
• "Stormwind Knight": 4, 2, 5
• "Blood Knight": 3, 3, 3
• The card is correctly identified
09.09.2016 AIMSA 2016 12
• Kor'kron Elite :
– Do not contain any words from
the DB:
– Use cards’ attributes (4, 4, 3):
• "Kor’kron Elite"
• "Houndmaster”
• "Spellbreaker”
– And then Levenshtein Distance:
• "Kor’kron Elite": 4, 6, 2, 5, 3, 4
• "Houndmaster": 11, 13, 11, 10,
11, 12
• "Spellbreaker": 12, 14, 13, 11, 12
• The card is correctly
identified
09.09.2016 AIMSA 2016 12
Cards Identification (2)
Runtime and Errors
• Results obtained using an Intel(R) Core(TM) i7-4500U CPU @ 2.40 GHz
• Time analysis:
– Detection of a new game (SURF & FLANN): avg. 0.104s
– of the heroes of the two players (SURF & FLANN): avg. 0.346s
– Cards’ detection (OCR):
• Accuracy: system average accuracy was 99.1%.
– Errors due to partial occlusion of the card that needs to be detected.
– GUI offers the possibility of manually correcting the errors.
09.09.2016 AIMSA 2016 12
Type of cards OCR attributes OCR names Total
Cards extracted by the user 0.0146 0.7305 1.0159
Cards played by the opponent 0.0086 0.8234 0.9361
Type of cards Identified cards Errors
Cards extracted by the user 209 1
Cards played by the opponent 227 3
Total 436 4
Conclusions
• We presented an application whose purpose was to
monitor in-game events that occur in the Hearthstone
game
• Main requirement was to be quick enough to provide
answers in real time
• For the recognition of the analyzed images, we have
tried two categories of methods:
– One based on the picture recognition: using histograms or
using algorithms for key point matching  time
consuming
– one based on OCR use only the text from the pictures
 fast and accurate
• The application helps players in making the right
decisions or in taking calculated risks, thus improving
their performance and gaming experience
09.09.2016 AIMSA 2016 12
Questions
09.09.2016 AIMSA 2016 12
Thank you very much!

More Related Content

ODP
Chance detection in football broadcasts
PPTX
Gpu with cuda architecture
PDF
Computer hardware
PPTX
98 374 Lesson 03-slides
DOCX
Addmen omr software solution for omr based golf score card
DOCX
High and Low Card Game For IOs
PPTX
Kinect2 hands on
PDF
PlayStation®3 Leads Stereoscopic 3D Entertainment World
Chance detection in football broadcasts
Gpu with cuda architecture
Computer hardware
98 374 Lesson 03-slides
Addmen omr software solution for omr based golf score card
High and Low Card Game For IOs
Kinect2 hands on
PlayStation®3 Leads Stereoscopic 3D Entertainment World

Similar to Hearthstone helper using optical character recognition techniques for cards detection (20)

PDF
Beginners guide to khepera robot soccer
PDF
Multiplayer Networking Game
PPTX
Computer system Hardware components.pptx
PPTX
Computer system Hardware components.pptx
PDF
Dedicated Game Servers
PPTX
98 374 Lesson 02-slides
PDF
C PROGRAM CODE FOR SNAKE AND LADDER GAME
PPTX
Next generation mobile gp us and rendering techniques - niklas smedberg
PPTX
98 374 Lesson 04-slides
PPTX
Developing and optimizing a procedural game: The Elder Scrolls Blades- Unite ...
PPTX
ptes oral pathology by deds deds des.pptx
PDF
EE4214+Real+Time+Embedded+System
PDF
IMQA Poster
DOCX
CLUSTERED PEER-TO-PEER COMMUNICATION SYSTEM FOR MULTIPLAYER ONLINE GAMES
PPTX
Slot Yield Presentation 2015
PDF
Rover dan set dasar South Insight V2 merevolusi survei tanah dan konstruksi
PDF
DS_Report
PPT
Hardware devices
PPTX
98 374 Lesson 06-slides
Beginners guide to khepera robot soccer
Multiplayer Networking Game
Computer system Hardware components.pptx
Computer system Hardware components.pptx
Dedicated Game Servers
98 374 Lesson 02-slides
C PROGRAM CODE FOR SNAKE AND LADDER GAME
Next generation mobile gp us and rendering techniques - niklas smedberg
98 374 Lesson 04-slides
Developing and optimizing a procedural game: The Elder Scrolls Blades- Unite ...
ptes oral pathology by deds deds des.pptx
EE4214+Real+Time+Embedded+System
IMQA Poster
CLUSTERED PEER-TO-PEER COMMUNICATION SYSTEM FOR MULTIPLAYER ONLINE GAMES
Slot Yield Presentation 2015
Rover dan set dasar South Insight V2 merevolusi survei tanah dan konstruksi
DS_Report
Hardware devices
98 374 Lesson 06-slides
Ad

More from University Politehnica Bucharest (20)

PPT
PhD Thesis - Influence of Repetitions on Discourse and Semantic Analysis
PPT
Time series analysis for sales prediction
PPTX
Identification and Classification of the Most Important Moments in Students’ ...
PPTX
Digital Services Development Using Statistics Tools to Emphasize Pollution Ph...
PPTX
Identifying cyclic words with the help of google
PPT
Expression of Political Opinions in Press
PPT
Determine the time period when a text was written using time series analysis
PPT
Using machine learning to generate predictions based on the information extra...
PPT
Movie recommender system using the user's psychological profile
PPT
Tracing the paths between concepts in large bio medical corpora
PPT
The collection and analysis of public data - Bucharest case study
PPT
Archaisms and neologisms identification in texts
PPT
Unsupervised system for automatic grading of bachelor and master thesis
PPT
Tweets topic modelling across different countries prezentarea
PPT
Sentiment based text segmentation
PPTX
Creativity detection in texts
PPT
Nlp based heuristics for assessing participants in cscl chats
PPT
Detecting discourse creativity in chat conversations
PPT
PDF
2012 Presidential Elections on Twitter - An Analysis of How the US and French...
PhD Thesis - Influence of Repetitions on Discourse and Semantic Analysis
Time series analysis for sales prediction
Identification and Classification of the Most Important Moments in Students’ ...
Digital Services Development Using Statistics Tools to Emphasize Pollution Ph...
Identifying cyclic words with the help of google
Expression of Political Opinions in Press
Determine the time period when a text was written using time series analysis
Using machine learning to generate predictions based on the information extra...
Movie recommender system using the user's psychological profile
Tracing the paths between concepts in large bio medical corpora
The collection and analysis of public data - Bucharest case study
Archaisms and neologisms identification in texts
Unsupervised system for automatic grading of bachelor and master thesis
Tweets topic modelling across different countries prezentarea
Sentiment based text segmentation
Creativity detection in texts
Nlp based heuristics for assessing participants in cscl chats
Detecting discourse creativity in chat conversations
2012 Presidential Elections on Twitter - An Analysis of How the US and French...
Ad

Recently uploaded (20)

PPTX
GEN. BIO 1 - CELL TYPES & CELL MODIFICATIONS
PPT
The World of Physical Science, • Labs: Safety Simulation, Measurement Practice
PPTX
INTRODUCTION TO EVS | Concept of sustainability
PDF
bbec55_b34400a7914c42429908233dbd381773.pdf
PDF
AlphaEarth Foundations and the Satellite Embedding dataset
PDF
Biophysics 2.pdffffffffffffffffffffffffff
PPTX
ECG_Course_Presentation د.محمد صقران ppt
PPTX
7. General Toxicologyfor clinical phrmacy.pptx
PDF
The scientific heritage No 166 (166) (2025)
PPTX
2Systematics of Living Organisms t-.pptx
PPTX
EPIDURAL ANESTHESIA ANATOMY AND PHYSIOLOGY.pptx
PDF
Phytochemical Investigation of Miliusa longipes.pdf
PDF
Placing the Near-Earth Object Impact Probability in Context
PDF
An interstellar mission to test astrophysical black holes
PPT
protein biochemistry.ppt for university classes
PDF
Sciences of Europe No 170 (2025)
PPTX
Classification Systems_TAXONOMY_SCIENCE8.pptx
PDF
Formation of Supersonic Turbulence in the Primordial Star-forming Cloud
PPTX
ognitive-behavioral therapy, mindfulness-based approaches, coping skills trai...
PPTX
BIOMOLECULES PPT........................
GEN. BIO 1 - CELL TYPES & CELL MODIFICATIONS
The World of Physical Science, • Labs: Safety Simulation, Measurement Practice
INTRODUCTION TO EVS | Concept of sustainability
bbec55_b34400a7914c42429908233dbd381773.pdf
AlphaEarth Foundations and the Satellite Embedding dataset
Biophysics 2.pdffffffffffffffffffffffffff
ECG_Course_Presentation د.محمد صقران ppt
7. General Toxicologyfor clinical phrmacy.pptx
The scientific heritage No 166 (166) (2025)
2Systematics of Living Organisms t-.pptx
EPIDURAL ANESTHESIA ANATOMY AND PHYSIOLOGY.pptx
Phytochemical Investigation of Miliusa longipes.pdf
Placing the Near-Earth Object Impact Probability in Context
An interstellar mission to test astrophysical black holes
protein biochemistry.ppt for university classes
Sciences of Europe No 170 (2025)
Classification Systems_TAXONOMY_SCIENCE8.pptx
Formation of Supersonic Turbulence in the Primordial Star-forming Cloud
ognitive-behavioral therapy, mindfulness-based approaches, coping skills trai...
BIOMOLECULES PPT........................

Hearthstone helper using optical character recognition techniques for cards detection

  • 1. Autor Conducător științific Universitatea Politehnica București Facultatea de Automatică și Calculatoare Catedra de Calculatoare Hearthstone Helper - Using Optical Character Recognition Techniques For Cards Detection Costin-Gabriel CHIRU, Florin Oprea costin.chiru@cs.pub.ro
  • 2. Introduction • Purpose: capture, process and analyze images from the video stream of the Hearthstone game in order to obtain relevant information on the conduct of parties in this game • Constraint: results should be offered in real- time on a regular computer / tablet • Methodology: apply different techniques for extracting information from the images and then use this information to identify and log the cards that have been played. 09.09.2016 AIMSA 2016 1
  • 3. Heartstone (Heroes of Warcraft) • Free-to-play online game developed by Blizzard (2014) • Turn-based game involving 2 players in a 1vs1 match • Each player has his/her own deck of cards with 30 cards • Each player start with 30 life points and the purpose of the game is to play their cards so that to destroy the opponent before they are themselves defeated • The game features between 814 and 1003 different cards used to cast spells, summon minions to help in the battle or equip weapons – They are classified in 5 categories based on their rarity and usefulness and in 10 different classes according to their availability to all the heroes, or to a specific one. 09.09.2016 AIMSA 2016 2
  • 4. Application Usefulness • By monitoring the game, the application is able to memorize the cards that have been played and thus: – the player knows what remaining cards he/she has and can compute the likelihood of extracting a particular card – he/she knows which cards will no longer be available in the opponent deck (the decks may contain at most two cards of the same type, or only one if it is a legendary card) – the player can predict the most probable deck of the opponent based on the cards played so far, previous history, opponent's rating, game style and current meta-game. 09.09.2016 AIMSA 2016 3
  • 5. Theoretical Background (1) • To determine real time in-game events, methods that are fast, efficient and accurate are needed both for image capturing and for cards recognition. • Image capturing: acquire sufficient game snapshots per seconds to detect changes – Using API provided by Windows that allows direct access to the opened windows from the operating system – up to 15 frames per second without overwhelming the CPU 09.09.2016 AIMSA 2016 4
  • 6. Theoretical Background (2) • Cards recognition: needed to – detect when a new card appeared (to avoid continuous processing of video stream) • Using Background Subtraction – recognize different pictures based on the elements from them. Can be done by: • comparing their histograms (colors distribution) • key points matching: choose specific points of interest and then find the association between them. • using key points in combination with decision trees (to accelerate the execution) • using perceptual hashes • using OCR on the text appearing in the pictures and comparing the text 09.09.2016 AIMSA 2016 5
  • 7. Implementation Details (1) • First of all, the Windows API was used to extract the snapshots  extract information from the snapshots • Resolution might be large involving a large processing time  only analyze specific regions in the images to determine the start and end of a game (analyzed areas are about 10 times smaller than the original image) • Next step: identify the moments of time when these areas contain images of cards using Background Subtraction and analyze the frames sufficiently highlighted 09.09.2016 AIMSA 2016 6
  • 9. Implementation Details (3) • Next, we investigated the methods for image recognition: – Histograms: bad results due to the fact that all the images were created from the same template – Key points matching - invariant to rotation, scaling or brightness: SURF (Speeded up robust features) and SIFT (Scale-invariant feature transform) in combination with Flann (Fast Library for approximate nearest neighbor) for matching the key points • Can be done offline for the cards from the DB, but the matching algorithm might take minutes (~ 1000 cards * tenths of a second for each card)  can’t be used for real- time recognition • For heroes recognition, SURF and Flann takes ~ 3 seconds (only 9 possible heroes)  acceptable for this part  used 09.09.2016 AIMSA 2016 8
  • 11. Implementation Details (5) – Apply OCR techniques: used Tesseract and specified specific text areas that help determining the playing card (the card name and its attributes - cost, attack and life points) • Binarized the picture  better results for OCR and smaller execution times • Wavy text  problems for the recognition engine  had to post-process the OCR output: – compute the Levenshtein distance between the obtained text and the cards name and – use the attribute values returned by the OCR to filter out cards • Very fast: took between 0.1 and 1.5 s • Using OCR, the whole process (from capturing the window image to the card classification) < 2 s 09.09.2016 AIMSA 2016 10
  • 12. Application Output • The GUI is to inform the player about relevant changes in the application: – the status of the application, – the cards that have been played, – the remaining cards 09.09.2016 AIMSA 2016 10 • The information is updated in real-time as the cards are played
  • 13. Cards Identification (1) • Stormwind Knight: – Cards from the DB with their scores: • "Silver Hand Knight": 2, • "Stormwind Knight": 10, • "Blood Knight": 10 • "The Black Knight": 2 – Use Levenshtein Distance: • "Stormwind Knight": 9, 11, 11, 4, 8, 5 • "Blood Knight": 11, 12, 15, 8, 12, 10 – and cards’ attributes • "Stormwind Knight": 4, 2, 5 • "Blood Knight": 3, 3, 3 • The card is correctly identified 09.09.2016 AIMSA 2016 12
  • 14. • Kor'kron Elite : – Do not contain any words from the DB: – Use cards’ attributes (4, 4, 3): • "Kor’kron Elite" • "Houndmaster” • "Spellbreaker” – And then Levenshtein Distance: • "Kor’kron Elite": 4, 6, 2, 5, 3, 4 • "Houndmaster": 11, 13, 11, 10, 11, 12 • "Spellbreaker": 12, 14, 13, 11, 12 • The card is correctly identified 09.09.2016 AIMSA 2016 12 Cards Identification (2)
  • 15. Runtime and Errors • Results obtained using an Intel(R) Core(TM) i7-4500U CPU @ 2.40 GHz • Time analysis: – Detection of a new game (SURF & FLANN): avg. 0.104s – of the heroes of the two players (SURF & FLANN): avg. 0.346s – Cards’ detection (OCR): • Accuracy: system average accuracy was 99.1%. – Errors due to partial occlusion of the card that needs to be detected. – GUI offers the possibility of manually correcting the errors. 09.09.2016 AIMSA 2016 12 Type of cards OCR attributes OCR names Total Cards extracted by the user 0.0146 0.7305 1.0159 Cards played by the opponent 0.0086 0.8234 0.9361 Type of cards Identified cards Errors Cards extracted by the user 209 1 Cards played by the opponent 227 3 Total 436 4
  • 16. Conclusions • We presented an application whose purpose was to monitor in-game events that occur in the Hearthstone game • Main requirement was to be quick enough to provide answers in real time • For the recognition of the analyzed images, we have tried two categories of methods: – One based on the picture recognition: using histograms or using algorithms for key point matching  time consuming – one based on OCR use only the text from the pictures  fast and accurate • The application helps players in making the right decisions or in taking calculated risks, thus improving their performance and gaming experience 09.09.2016 AIMSA 2016 12
  • 17. Questions 09.09.2016 AIMSA 2016 12 Thank you very much!

Editor's Notes

  • #7: overloads
  • #14: Cards containing words: 1 p / contained word 5p / contained word in position
  • #18: \