Software that enables you to connect your real life chess board to Lichess.org . Using computer vision it will detect the moves you make on your chess board. After that, if it's your turn to move in the online game, it will send your move to Lichess servers using Lichess Board API . It can also record or transcribe your over-the-board games as PGN, so they can be broadcast using Lichess Broadcaster . This project is Lichess-only version of my project Play online chess with real chess board .
You need to run the GUI to do the steps in Setup, Usage, Broadcast, Transcribe and Diagnostic sections and customize how you use the software.
- Generate a Lichess API Access Token. Then, enter the token to the GUI.
- Place your webcam near to your chessboard so that all of the squares and pieces can be clearly seen by it.
- Select a board calibration mode and follow its instructions.
-
Remove all pieces from your chess board.
-
Click the "Board Calibration" button.
-
Check that corners of your chess board are correctly detected and press key "q" to save detected chess board corners. You don't need to manually select chess board corners; it should be automatically detected by the program. The upper left square, which is covered by points (0,0), (0,1),(1,0) and (1,1) should be a8. You can rotate the image by pressing the key "r" to adjust that. Example chess board detection result:
- Place the pieces in their starting positions.
- Click the "Board Calibration" button.
- Please ensure your chess board is correctly positioned and detected. Guiding lines will be drawn to mark the board's edges:
- The line near the white pieces will be blue.
- The line near the black pieces will be green.
- Press any key to exit once you've confirmed the board setup.
- Click the "Start Game" button. The software will calibrate the board just before it begins move recognition.
- Place pieces of the chess board to their starting position.
- Start the Lichess game.
- Click the "Start Game" button.
- Wait until it says "game started".
- Make your move if it's your turn, otherwise make your opponent's move.
- Notice that it actually makes your move in the Lichess game, if it's your turn. Otherwise, wait until it says the starting and ending squares of the opponent's move. To save clock time, you may choose not to wait, but this is not recommended.
- Go to step 5.
-
Switch to the "Broadcast" tab and select the folder where PGN files will be saved. Also, select the same folder in the Lichess Broadcaster .
-
Enter the name of the PGN.
-
Fill in the PGN metadata.
-
Place pieces of the chess board to their starting position.
-
Click the "Start Game" button.
-
The players can now start playing, and the software will update the PGN after each move.
-
After the game ends, stop the software and assign the result of the game.
-
Switch to the "Transcribe" tab and select the video file to be transcribed.
-
Select the folder where PGN files will be saved. Also, select the same folder in the Lichess Broadcaster .
-
Enter the name of the PGN.
-
Fill in the PGN metadata.
-
Click the "Start Game" button.
-
The software will update the PGN after each move it transcribes.
-
After the software finishes the transcription, assign the result of the game.
You need to click the "Diagnostic" button to run the diagnostic process. It will show your chessboard in a perspective-transformed form, exactly as the software sees it. Additionally, it will mark white pieces with a blue circle and black pieces with a green circle, allowing you to verify if the software can detect the pieces on the chess board.
In this section you can find video content related to the software.
Playing a game on Lichess.org, using lichess-with-a-real-board software, created by Alper Karayaman.
SergeiKolupajev vs LastPawn Standing game on Lichess.org
- opencv-python
- python-chess
- numpy
- pyttsx3
- scikit-image
- pygrabber
- berserk