Skip to content

API for detecting chess positions from images and analyzing them with the Stockfish engine.

Notifications You must be signed in to change notification settings

tbtiberiu/chess-snapshot-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Banner

Chess Snapshot API

The Chess Snapshot API provides an easy-to-use RESTful interface for detecting and analyzing chess positions from images. It utilizes the Chess Position Detector to convert a chessboard image into a FEN string and integrates the powerful Stockfish chess engine to determine the best move from any given position.

This API is intended for integration with a Flutter application, offering seamless support for the Chess Snapshot App.

Installation

Prerequisites

Requirements

Ensure that Python is installed on your machine. You can install the necessary dependencies using pip and the requirements.txt file.

pip install -r requirements.txt

Dependencies

  • OpenCV
  • Numpy
  • Flask
  • Stockfish
  • ...

These dependencies are necessary for image processing, detection algorithms, and chess analysis.

Usage

To use the Chess Snapshot API, follow these steps:

  1. Start the Flask Server:

    python app.py
  2. Expose the Server with Ngrok:

    ngrok http --domain=knowing-fit-poodle.ngrok-free.app 8080

Endpoints

  1. Get Chess Position (FEN String)

    • URL: /api/get_chess_position
    • Method: POST
    • Description: This endpoint accepts an image file of a chessboard and returns the FEN string representing the position on the board.
    • Response Example:
      {
        "fen": "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR"
      }
  2. Get Best Move

    • URL: /api/get_best_move
    • Method: POST
    • Description: This endpoint accepts a FEN string and returns the best move as calculated by Stockfish.
    • Response Example:
      {
        "best_move": "e2e4"
      }

Acknowledgments

This project is based on advanced computer vision techniques and was supervised by Lect. Dr. Ioana Cristina Plajer.

Read More: Chess Snapshot Full Documentation in Romanian (PDF)

Additional Resources

About

API for detecting chess positions from images and analyzing them with the Stockfish engine.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages