This is an augmented reality (AR) application in python. Basic chess rules are supported. Easy to use and you can make extensions easily if you want. Enjoy!
- Print
8x8board.pdf. It is designed for US letter sized papaer but it is also OK if you use any other kind of papers. - Install
python 3.5orpython 3.6. Usinganacondais recommended. - Run
pip install opencv-pythonto install opencv for python. - Run
pip install glfw,pip install PyOpenGLandpip install pywavefrontfor using OpenGL. - Run
pip install python-chessto install python-chess repository. See https://github.com/niklasf/python-chess for details. - Clone this repository by running
git clone https://github.com/zuoym15/ARchess.git
- Run
python caliberate camera.py. It will pop up a window. What you need to do is to move the 8x8 checkerboard in front of the camera until 30 frames is colleced. Make the variation of view angle & distance as large as possible. Camera intrinsic parameters will be computed and stored incamera_parameters.json. - Run
python ARchess.py --camera-id 0. Make sure the checkerboard is presented in the captured image and there is no occlusion. If you have multiple cameras connected, try camera_id from 0 and find out id of the camera you want to use. - If you want the pieces to be presented in 3d, run
python ARchess.py --camera-id 0 --d3-piece - Play by clicking on the pieces. Grid your mouse placed on is shown in
GREEN. Piece you select is shown inRED. Possible moves is shown inBLUE. your king becomesPINKif you are checked.
- No AI availible yet. We will consider adding an AI in the future.
- Pawn can only promote into Queen.
- No undo could be done.
- video demo: click here
- 2d-piece mode
- 3d-piece mode
- system overview (laptop + camera + checkerboard)