Giter Site home page Giter Site logo

goat's Introduction

Go Automatic Tallier (GoAT)

CI

Automatically tally score for Go boards from an image.


Table of Contents


Getting Started

git clone -b main [email protected]:koisland/GoAT.git
cd GoAT

Conda

conda create --name GoAT python=3.10
conda activate GoAT
pip install -r requirements.txt

Docker

docker build . -t go_at:latest

Usage

Currently, usage is limited to the command-line with main.py as the entrypoint.

By default, black is marked as 1.0 and white is 0.0.

usage: main.py [-h] -i INPUT -s SCORING [-k] [-cb CAP_BLK] [-cw CAP_WHT]

Calculate score from a Go board image.

options:
  -h, --help            show this help message and exit
  -i INPUT, --input INPUT
                        Input image.
  -s SCORING, --scoring SCORING
                        Scoring method.
  -k, --komi            Apply komi.
  -cb CAP_BLK, --cap_blk CAP_BLK
                        Captured black stones by white.
  -cw CAP_WHT, --cap_wht CAP_WHT
                        Captured white stones by black.

For example, this command reads docs/images/9_9.png, a digital image of a board and scores it using Chinese scoring with komi applied to White.

Conda

python main.py -i docs/images/9_9.png -s Chinese -k

Docker

docker run go_at:latest -i docs/images/9_9.png -s Chinese -k

{'Black': 44, 'White': 44.5}


Scoring

Both Chinese and Japanese scoring methods are available with komi as a toggle-able option.

By default, komi is set to 7.5 for Chinese scoring and 6.5 for Japanese scoring.

Japanese scoring is a WIP.

  • Currently can handle scenarios without seki.

Imaging

Accomplished through use of packages:

  • opencv-python
  • numpy
  • statistics.

General workflow is as follows:

  1. Gaussian Blur ->
  2. Global Threshold (Two for each piece type)->
  3. Distance Transform (Only black) ->
  4. Contour Detection ->
  5. Cluster Pixels ->
  6. Map Pixels to Dimensions ->
  7. Generate Board

Several assumptions are made about the --input image.

  • The image that only encompasses the digital board
    • A real-world image would require manually trimming such that the image only contains the board.
    • Lighting conditions are another issue that could be handled with localized histogram equalization with cv2's clahe.

goat's People

Contributors

koisland avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.