G.D. Illeperuma Department of Physics University of Colombo
USING IMAGE PROCESSING TECHNIQUES TO AUTOMATE CHESS GAME RECORDING 1
[email protected]
OBJECTIVES
Use a web camera to capture video of a chess game and analyze the video to determine the position of chess pieces. Use above information to automatically record the play in standard algebraic notation in real time.
2
[email protected]
ADVANTAGES Does not require special hardware Most of the chess boards can be used without modifications Can be implemented under standard game conditions Can record multiple games simultaneously Game positions can be easily published, printed or can be shared through the internet
3
[email protected]
DISADVANTAGES Requires a computer Determining the time between movement is still in the development phase
4
[email protected]
SETUP
Camera was positioned above the chess board Computer captured the video stream MATLAB / Simulink was used to analyze the images 5
[email protected]
Camera was set to (800 ×600) px with 1 fps frame rate. Initial setup was a board without any pieces Using the alternative colors of the squares of the board, board was separated from the background. Board was selected and cropped
550 500
Projected summation of gray values
450 400 350 300 250 200 150
100
0
50
100
150
200
250 Pixels
300
350
400
450
500
6
[email protected]
When the game was being played an image was captured every second and was compared with the image of the empty board. Black pieces decreased the brightness White pieces increased the brightness Shadows decreased brightness Glares increased brightness g
g
180
50
200
50
50 160
100
100
100 140
150
150
150
150
120
200 200
100
200
100
250 250
250
300
300
80
300
60
50
350
40
350
350
400
400
20
400 50
100
150
200
250
300
350
400
50
100
150
200
250
300
350
400
0
50
100
150
200
250
300
350
400
0
7
[email protected]
Using a threshold pixels with high brightness change were selected Using median filters salt and pepper noise was removed By analyzing the shape and size further identifications were made
8
[email protected]
By comparing the present position of chess pieces to the previous positions movement was detected Separate function converted these movements to standard algebraic chess notations.
Deduced board positions Image from camera
1 2 3 4 5 6 7 8 2
4
6
8
9
[email protected]
PROBLEMS FACED
If the image was captured while player is holding a chess piece, that image should not be processed further.. To identify such incidents a thin boarder around the board was compared with the initial boarder. Any sudden drop in brightness was identified as a ‘mid-movement image’ g 300
50 250
100 150
200
200 Itensity
250
150
300 100
350 400
50
450 50
100
150
200
250
300
350
400
450
500
0
1
2
3
4
6 5 Section
7
8
9
10
10
[email protected]
FURTHER DEVELOPMENT
A pizzo sensor attached to the board is noted to provide an electric impulse each time a chess piece is put on the board. Once connected to the ‘mic-input’ of the sound card of the PC, this signal may be used to determine exactly when the piece was put on the board. 11
[email protected]
CONCLUSIONS A standard personnel computer connected with a web camera can be used to record chess games. Simple programs written in Simulink can be used for the image processing and identification of chess pieces. Games can be recorded in real time.
12