pascalrogalla / DartboardRecognition

Classic steeltip dartboard automatic throws recognition processor app using four webcams. C# / .NET / EMGU.CV

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DartboardRecognition

  • Work on this project is on hold. See next stuff in [OneHundredAndEighty] repo
  • The main idea to build classic steeltip dartboard-based stand with using four cameras and also write desktop application to work with.
  • This system will be automaticly detects another throw and point of impact of a dart.
  • C# / .NET Core 3.1 / EMGU.CV
  • Main community, united this idea is here
  • Version 1.3 released
  • Please keep in mind, that all of this stuff is under heavy development now. Problems of performance and optimization stays not on first place for me now. So I can't guarantee perfect work of this stuff on your "piece of sh*t" notebook. On my system (4.2 Ghz, 6 cores, 16RAM) all works correctly (with near 100% load ;-P ).

Скриншот 2019-11-09 19 26 52

Stand details

  • Now it is just debug-version of stand, but after all work complete and setup, it will be pretty-good made:

Stand

Something like that: model model model

To build stand, you need some necessary things:

1. Cameras

  • You need 4 cameras (In theory you can use only 2 cameras, but detection quality will be bad in nearly-sticked darts situations). Cameras must be same model. Recomended resolution of cameras is 1280x720. I use 4 camera modules (OV2710, 2MP 1080P HD, 85 HFOW, distortionless) on self-made handy standings:

cams

2. Light

  • For light I use 5 meters of 12V cold-light LED-strip

3. Dartboard

  • For debug-stand I use dummy plastic-foamed dartboard toy. I have regular Winmau dartboard, but it's on my wall now

4. Some DIY things and tools

  • Wood panels, carton panels, white paper, glue, scissors...

Recomendations:

  • Cams must be fixed tightly like this:

Скриншот 2019-11-09 13 14 59

  • To connect cams to PC I use this schema:

Untitled Diagram

  • Notice, that it can be situation, when all your connected cams will not be work together at same time - it can be if you trying to connect 4 cams in 1 usb hub and this hub in PC usb port (surprize! =)). It happens because there are not enough power in 1 PC usb port for working 4 cams at same time. You see all 4 cams connected via Control Panel but they don't work. To check this situation you can use CamCalibrator. Just run it 4 times at the same time and run in on all 4 cams. If not all cams translate image - you need to reconnect cams diffirent way.

App details

Get started

CamCalibrator

  • CamCalibrator is simple project to presetup camera when you fix it on stand. The idea is to stick dart into bull and run calibrator. You need to set camera like next screenshot. Blue line goes throught dart, red line lies on dartboard surface. Then you fix camera tightly. This position of cameras is correct for main app work. Setup all your cameras this way. Скриншот 2019-11-09 18 38 54

  • All connected to PC cameras will be print in textbox. Each of camera have ID, which you can check this way: Скриншот 2019-11-09 18 38 55

  • This ID's will be need soon.

DartboardRecognition

  • Main app also need some preSetup. Run DartboardRecognition, go to 'Setup' tab and fill Cams ID's boxes, Distance to Cam boxes, Cam FOV, Resolution boxes. Other boxes you can fill with defaul values like my: Скриншот 2019-11-09 18 53 04

  • All settings saves to DartboardRecognition.exe.config

  • Then check this boxes:
    Скриншот 2019-11-09 18 53 05

  • Go to 'Projection' tab and hit 'Start'. Cam window will open and you will be able to setup last things:

  • Threshold image. Move 'Threshold' slider to setup threshold. Скриншот 2019-11-09 19 04 51

  • You can see noise in the corners - we don't need it. Like this: Скриншот 2019-11-09 19 04 54

  • Stick dart into bull and setup ROI, surface and center like on image before

  • Then hit 'Calibrate' button

  • Do this instuctions with all of cams

  • Hit 'Stop' button

  • On 'Setup' tab check 'With detection' and uncheck 'Runtime capturing' and 'Show setup sliders' Скриншот 2019-11-09 19 20 56

  • All setup done, you can hit 'Start' and throw darts. Скриншот 2019-11-09 19 26 52

The main idea of app working process:

  • process

  • You throw next dart in dartboard

  • App takes image from every camera

  • From ROI gets tresholded-grayscaled image to find dart contour

  • From this images calculates dart rectangle contour (orange)

  • On this rectangle, through middle points calculates ray (blue) to surface (red)

  • Intersection of this ray and surface gives us point of impact (white) from one camera

  • Using information about POI from all 4 cameras, we can calculate actual dart POI on dartboard if draw rays from cameras setup points to cameras POIs

  • Thats how it works. Sounds simple, but there are many things to stuck with...

P.S. - If you like this stuff and if you want you can donate me for some beer ;-) (click "Sponsor" button in the top of a page)

About

Classic steeltip dartboard automatic throws recognition processor app using four webcams. C# / .NET / EMGU.CV


Languages

Language:C# 100.0%