Skip to content

HES-SO · Image processing II · 2023 · with David Crevoiserat

Connect Four, read by a webcam

A webcam reads a real Connect Four board, and an AI picks its next move.

Python · OpenCV · Alpha-beta

The situation

webcamHough + HSVnext movealpha-betafive moves deep

An image processing project, in pairs. The webcam finds the grid with Hough circles and reads each token's colour with HSV masks; an alpha-beta search, five moves deep, picks the next move. The game starts once the grid is empty, in front of a white background, with decent light.

Results

moves ahead, alpha-beta search
5

Image processing II project, HES-SO, 2023. With David Crevoiserat.

It plays live against a person, on a real board.

Next