Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Playing dart

Subject: Playing dart

From: Ronald Haderer

Date: 20 Oct, 2010 18:44:04

Message: 1 of 6

I want to design a Dart matching via webcam. That means I have a dartboard, recorded by a webcam. The software (only matlab code, no simulink) should then detect where the arrows stuck and calculate the reached points.

I started trying to get the location of the arrows by substracting the images (with and without arrow). Maybe a better solution is doing it by color recognition, so that only green arrows recognized, for example.

I would be thankful for your suggestions/ideas to start solving such a problem. There are so many functions in matlab I still dont know, Im just at the beginning to learn it. So maybe it isn't as difficult as I think.

Subject: Playing dart

From: Sean

Date: 20 Oct, 2010 20:01:19

Message: 2 of 6

"Ronald Haderer" <rhaderer@live.de> wrote in message <i9nd9k$1f3$1@fred.mathworks.com>...
> I want to design a Dart matching via webcam. That means I have a dartboard, recorded by a webcam. The software (only matlab code, no simulink) should then detect where the arrows stuck and calculate the reached points.
>
> I started trying to get the location of the arrows by substracting the images (with and without arrow). Maybe a better solution is doing it by color recognition, so that only green arrows recognized, for example.
>
> I would be thankful for your suggestions/ideas to start solving such a problem. There are so many functions in matlab I still dont know, Im just at the beginning to learn it. So maybe it isn't as difficult as I think.

If your camera is fixed and the lighting is about the same, why doesn't subtracting a background image (dartboard) work?

You would have to have a map of the dartboard defined, so that once given a shot you could figure out how much it's worth or what number is cleared etc. That should be trivial though.

Subject: Playing dart

From: ImageAnalyst

Date: 20 Oct, 2010 21:37:16

Message: 3 of 6

Start with posting a few photos to http://drop.io

Subject: Playing dart

From: Ronald Haderer

Date: 22 Oct, 2010 17:06:04

Message: 4 of 6

So, I decided to start like this:

The picture is taking obliquely from below, so that the head of the arrow is seen. The board will be white, the arrows have bright colors and a black head. This way the arrowhead can be detected easily -> pixel with low values (black). Looks like this:

vid = videoinput('winvideo', 1, 'YUY2_1280x1024');
pic_yuv = getsnapshot(vid);

pic_zomm=pic_yuv(400:700,400:800,1); %zoom in area I'm interested in

hit=find(pic_zoom<20);

Now I have some pixels (hit) that show me where the arrow stucks. Now I need to find a way to tell Matlab, which area has how much points. I would say the distance and angle between webcam and board should be constant. Now I have to lay a sample of the lines and sectors or something like that over the picture and then...?

Subject: Playing dart

From: Sean

Date: 22 Oct, 2010 17:26:04

Message: 5 of 6

"Ronald Haderer" <rhaderer@live.de> wrote in message <i9sg9r$iqa$1@fred.mathworks.com>...
> So, I decided to start like this:
>
> The picture is taking obliquely from below, so that the head of the arrow is seen. The board will be white, the arrows have bright colors and a black head. This way the arrowhead can be detected easily -> pixel with low values (black). Looks like this:
>
> vid = videoinput('winvideo', 1, 'YUY2_1280x1024');
> pic_yuv = getsnapshot(vid);
>
> pic_zomm=pic_yuv(400:700,400:800,1); %zoom in area I'm interested in
>
> hit=find(pic_zoom<20);
>
> Now I have some pixels (hit) that show me where the arrow stucks. Now I need to find a way to tell Matlab, which area has how much points. I would say the distance and angle between webcam and board should be constant. Now I have to lay a sample of the lines and sectors or something like that over the picture and then...?

Hmm well to start I would define the 6 annuli that are point multipliers/bull's eye:
1) double ring
2) outer single ring
3) triple ring
4) inner single ring
5) single bull's eye
6) double bull's eye

You can do this by following this thread here:
http://www.mathworks.com/matlabcentral/newsreader/view_thread/291115
to create the masks and then labeling. Then you need to define the sectors that count 1:20. Thinking about it quickly I would do this with the poly2mask function to create 20 masks labelled 1:20, though there are probably better ways.

Depending on what game you're playing you need to figure out what to do with the results. If it's just a score game like 301 all you need to do is calculate the number hit multiplied by the multiplier. If it's a game like no score cricket where you need three of each to clear out the number of that have been hit, then have a seven element vector of zeros for 15:21 (21 being bull's eye), and increment it every time there's a hit. When it's all threes the game is over. Actually, if you're only playing cricket there's no reason to define all of the sectors above as any adjacent ones that don't count don't matter.

Sorry if this is too much, I like darts :)

Subject: Playing dart

From: rusty fetterov

Date: 30 May, 2011 04:19:04

Message: 6 of 6

i was playing darts today and i had the same idea. did you ever finish this?

"Sean " <sean.dewolski@nospamplease.umit.maine.edu> wrote in message <i9shfc$434$1@fred.mathworks.com>...
> "Ronald Haderer" <rhaderer@live.de> wrote in message <i9sg9r$iqa$1@fred.mathworks.com>...
> > So, I decided to start like this:
> >
> > The picture is taking obliquely from below, so that the head of the arrow is seen. The board will be white, the arrows have bright colors and a black head. This way the arrowhead can be detected easily -> pixel with low values (black). Looks like this:
> >
> > vid = videoinput('winvideo', 1, 'YUY2_1280x1024');
> > pic_yuv = getsnapshot(vid);
> >
> > pic_zomm=pic_yuv(400:700,400:800,1); %zoom in area I'm interested in
> >
> > hit=find(pic_zoom<20);
> >
> > Now I have some pixels (hit) that show me where the arrow stucks. Now I need to find a way to tell Matlab, which area has how much points. I would say the distance and angle between webcam and board should be constant. Now I have to lay a sample of the lines and sectors or something like that over the picture and then...?
>
> Hmm well to start I would define the 6 annuli that are point multipliers/bull's eye:
> 1) double ring
> 2) outer single ring
> 3) triple ring
> 4) inner single ring
> 5) single bull's eye
> 6) double bull's eye
>
> You can do this by following this thread here:
> http://www.mathworks.com/matlabcentral/newsreader/view_thread/291115
> to create the masks and then labeling. Then you need to define the sectors that count 1:20. Thinking about it quickly I would do this with the poly2mask function to create 20 masks labelled 1:20, though there are probably better ways.
>
> Depending on what game you're playing you need to figure out what to do with the results. If it's just a score game like 301 all you need to do is calculate the number hit multiplied by the multiplier. If it's a game like no score cricket where you need three of each to clear out the number of that have been hit, then have a seven element vector of zeros for 15:21 (21 being bull's eye), and increment it every time there's a hit. When it's all threes the game is over. Actually, if you're only playing cricket there's no reason to define all of the sectors above as any adjacent ones that don't count don't matter.
>
> Sorry if this is too much, I like darts :)

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us