Inspiration

Our love of darts

What it does

Uses computer vision with one webcam to get the score from the location of darts in a dartboard. Scores are then calculated and tracked for each player.

How we built it

Computer Vision

The main aspect of this project is using OpenCV in Python to be able to track the location of a dart.

  1. Calibrate board by clicking 4 square markers around the dart board to align the centre of board.
  2. Calibrate distances by clicking D20 -> D6 -> D3 -> D11 -> BULL.
  3. Normalized distance between board edges to fit into a range from -1 to 1, x and y.
  4. Background substruction to detect any motion in frame.
  5. Extract the specific frame when dart has landed.
  6. Contain the contours of the dart.
  7. Find lowest y-value contour.
  8. Calculate x and y location from contour, scale down range to 1,-1.
  9. Send x and y to server.

Server and Client

Server is created in Python, Client is created in C++ using sockets.

  1. Server waits for CV to send x and y coords.
  2. Server sends x and y coords one at a time to client.
  3. Client recieves coords.

GUI

GUI is created in C++ using the Hello ImGUI library.

  1. GUI recieves coords from client.
  2. Uses polar coordinates to caluclate score form x and y values.
  3. Displays score and allows for correction by user if incorrect.
  4. Displays distribution of darts to allow analysis post game

Challenges we ran into

We had to go through many iterations of webcam placement and dart detection. We started with 2 webcams taped to the dartboard itself but ended up with only 1 webcam placed on a tripod infront of the dartboard instead.

The GUI library that we intended on using as a team, was broken during the hackathon resulting in us not being able to install it and use it, meaning we had to learn a new library instead.

Accomplishments that we're proud of

  • Accurate dart tracking system.
  • Robust networking solution.
  • High quality GUI.
  • Efficient calculations for score positioning

What we learned

  • Python
  • OpenCV
  • NumPy
  • C++
  • Boost ASIO
  • Hello ImGUI

What's next for Automatic Darts Scoring

  • Replace OpenCV with AI model, for more accurate scoring and more lenient camera placement
  • Add AI voiceover for scores
  • Add games

Built With

Share this project:

Updates