Skip to content

Algorithm that recognizes the state of the game Catan based on the image of the board. Written in Python (OpenCV)

Notifications You must be signed in to change notification settings

Vieja/Catan-Image-Recognition

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Catan-Image-Recognition

Python, OpenCV

Alt text Alt text

Based on a picture of the game board, the algorithm recognizes the state of the game the Settlers of Catan, i.e. the arrangement of hexagonal fields representing the resources and the placement of players' pieces (red, blue and orange players).

In the first step it tries to isolate the board itself from the photo in order to omit irrelevant elements on the background. Then, each field type is sequentially located, starting with the most outstanding. The fields are found based on a selection of pixels belonging to to the preset range of HSV values. In order to facilitate the search for next fields, previously found ones are removed from the processed photo. As some fields are similar in color, at some point it is necessary to scale the saturation of the image, additionally a median filter was also used.

The players' pawns are found similarly. Cities and settlements are distinguished from roads by their shape similar to a circle (cities have a round base, while settlements, despite their irregular shape, approximate a circle quite well).

Some images presenting the process:

About

Algorithm that recognizes the state of the game Catan based on the image of the board. Written in Python (OpenCV)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published