Difference between revisions of "PlayChessWithAWebCam"
Line 53: | Line 53: | ||
= Installation = | = Installation = | ||
Prerequisites: python3.7 (install script will check and try automatic installation in Ubuntu/MacOS) | Prerequisites: python3.7 (install script will check and try automatic installation in Ubuntu/MacOS) | ||
− | <source lang='bash' highlight="1,9-10" | + | <source lang='bash' highlight="1,9-10" line> |
git clone https://github.com/WolfgangFahl/play-chess-with-a-webcam | git clone https://github.com/WolfgangFahl/play-chess-with-a-webcam | ||
Cloning into 'play-chess-with-a-webcam'... | Cloning into 'play-chess-with-a-webcam'... |
Revision as of 16:48, 21 October 2019
OsProject | |
---|---|
edit | |
id | PlayChessWithAWebCam |
state | |
owner | Wolfgang Fahl |
title | Play Chess With A WebCam |
url | https://github.com/WolfgangFahl/play-chess-with-a-webcam |
version | 0.0.1 |
description | |
date | 2019/10/21 |
since | |
until |
Motivation
See MagneticSensorChessBoard1987 for the initial project of 1987. Time has moved on and the goals of the 1987 project can be achieved with less hardware and software in a more convenient manner these days.
State of Project
As of 2019-10-21 version 0.0.1 has not been release yet. The state of the project is development/alpha.
There is already a lof of stuff to try out and to participate in this open source project.
The scripts:
- still
- record
are already useful for taking pictures and movie recordings of your chess match. The detection of the board and moves is not fully operational yet.
If you'd like to experiment a bit you can run the tests which will show some debug output.
opencv tutorial stuff
Also in the opencvtutoral directory you'll find:
- colorcluster.py
- histogramm.py
- hough_lines.py
hough lines
python3 opencvtutorial/hough_lines.py testMedia/chessBoard002.jpg
histogramm / colorcluster
python3 opencvtutorial/histogramm.py testMedia/chessBoard006.jpg
python3 opencvtutorial/colorcluster.py testMedia/chessBoard006.jpg
Clusterization took 2.8 s for 1 channels
Clusterization took 4.5 s for 2 channels
Clusterization took 6.7 s for 3 channels
Installation
Prerequisites: python3.7 (install script will check and try automatic installation in Ubuntu/MacOS)
1git clone https://github.com/WolfgangFahl/play-chess-with-a-webcam
2Cloning into 'play-chess-with-a-webcam'...
3remote: Enumerating objects: 57, done.
4remote: Counting objects: 100% (57/57), done.
5remote: Compressing objects: 100% (40/40), done.
6remote: Total 385 (delta 29), reused 34 (delta 17), pack-reused 328
7Receiving objects: 100% (385/385), 1.79 MiB | 3.17 MiB/s, done.
8Resolving deltas: 100% (244/244), done
9cd play-chess-with-a-webcam
10scripts/install
11scripts/install
12checking that python3 is installed on os Linux ...
13/usr/bin/python3
14checking that pip3 is installed on os Linux ...
15installing pip3 from apt-package python3-pip
16Reading package lists... Done
17Building dependency tree
18Reading state information... Done
19The following package was automatically installed and is no longer required:
20 libevent-core-2.1-6
21Use 'sudo apt autoremove' to remove it.
22The following additional packages will be installed:
23 libexpat1-dev libpython3-dev libpython3.6-dev python-pip-whl python3-dev
24 python3-setuptools python3-wheel python3.6-dev
25Suggested packages:
26 python-setuptools-doc
27The following NEW packages will be installed:
28 libexpat1-dev libpython3-dev libpython3.6-dev python-pip-whl python3-dev
29 python3-pip python3-setuptools python3-wheel python3.6-dev
300 upgraded, 9 newly installed, 0 to remove and 40 not upgraded.
31Need to get 47,5 MB of archives.
32After this operation, 81,7 MB of additional disk space will be used.
33Do you want to continue? [Y/n] y
Usage
Command line usage
scripts/run -h
usage: ChessCam.py [-h] [--nouci] [--input INPUT] [--debug]
[--cornermarker CORNERMARKER] [--fullScreen]
ChessCam Argument Parser
optional arguments:
-h, --help show this help message and exit
--nouci Don't use the UCI interface.
--input INPUT Manually set the input device.
--debug show debug output
--cornermarker CORNERMARKER
filepath for an image of the cornermarker being used
--fullScreen Display output in fullScreen mode
Recording
Still images
scripts/still
Video of match
scripts/record
Testing
scripts/test
============================= test session starts =============================
platform darwin -- Python 3.7.4, pytest-5.2.1, py-1.8.0, pluggy-0.12.0
rootdir: /Users/wf/source/python/play-chess-with-a-webcam
plugins: cov-2.8.1
collected 11 items
src/test_Board.py . [ 9%]
src/test_ChessCam.py . [ 18%]
src/test_OpenCV_version.py . [ 27%]
src/test_Video.py ... [ 54%]
src/test_findBoard.py ..... [100%]
---------- coverage: platform darwin, python 3.7.4-final-0 -----------
Name Stmts Miss Cover
------------------------------------------------
src/Args.py 10 7 30%
src/Board.py 33 3 91%
src/BoardFinder.py 186 12 94%
src/Cell.py 10 4 60%
src/ChessCam.py 86 59 31%
src/InputManager.py 57 37 35%
src/MovementDetector.py 55 40 27%
src/StateDetector.py 92 75 18%
src/Video.py 133 48 64%
src/mathUtils.py 49 25 49%
src/test_Board.py 23 3 87%
src/test_ChessCam.py 4 0 100%
src/test_OpenCV_version.py 6 0 100%
src/test_Video.py 28 0 100%
src/test_findBoard.py 49 0 100%
------------------------------------------------
TOTAL 821 313 62%
============================= 11 passed in 25.18s =============================
Hardware
see e.g Raspberry_PI_Chessboard_Camera
Source Code
play-chess-with-a-webcam
see github fork at
Written in python2 migrated to python3.7. see https://unix.stackexchange.com/a/410851/38701 for selection your python version on Ubuntu