Thanks in advance
D'Anna Orazio
initialization:
0. acquire an image of the dartboard without any darts on it
1. threshold the image by color 1
1.1 find the connected components
2. threshold the image by color 2
2.1 find the connected components
3. throw one calibration dart
3.1 acquire image and make difference-image with image from 0.
3.2 identify position with biggest change (this is an extreme
oversimplification, if at all then only holding if the cam-direction
is orthogonal to the dartboard)
3.3 search through list of connected components for component
on this position
4. initialize memory map with same size as image and set all pixels
in this component-area to the score
5. search through all the components and find the nearest neighbours
(centroid-distances), give them their scores (register it in the
map).
repeat until all components are done. after that, all components
have their scores. (use a recursive function or stack).
in game:
1. same as 3.
2. same as 3.1, but use last image for differencing,
beginning with image from 0.
3. same as 3.2
4. just look in memory map on the position and print score
There are functions in OpenCV for every step...
greets
jb
An idea that might need 2 cameras because of one dart covering another, but
it's easy(ish) to do:-
Place a camera on the ceiling or floor looking at the board at an acute
angle.
Calibrate the board by hand, by creating an ellipse drawing program and
simply cover the boards edge and record this ellipse.. This can be automated
if you want - but do that later. My guess is it would have to be really
accurate though.
Set up the software so you can detect changes from empty board to darted.
The furthest change point is the tip of the buried dart head for each dart,
beacuase of the acute angle used.
Use the relative point position to the ellipse and calculate the dart
position.
You'll need a high res camera that keeps focus across the board too.
Just an idea...maybe crap.... : )
VC
Hi VC and JB. thanks a lot for your reply.
To do some trial i took photos of my professional dartboard(which is
used during the world champion) from an acute angle(i fixed a
photocamera not in front of the dartboard but in the left side to take
exaclty the Board that is attached on a red door ).So that input-image
is in the RGB space.
I realized a little program that simply draws an Elllipse on the
original image by using a hand-rectangle as exactly as possible.i
obtained this rectangle as image and i extracted the ellipse inside
it.
Then i processed this ellipse image via Canny and Normal and
Adaptative Threshold, i combined the result to obtain a binary image
which contain only the section of dartboard without any number . Of
course the previous speech doesn't consider the acute angle of the
camera because we try to map the original acute ellipse to an Ellipse
in the plane XY so maybe some error would happen during the counting
score.
Now i have to label the sectors of the final Binary image just to
record the score-points that i have to assigned if a Dart arrive on
that section. I don't know how to do it. sometime i can't find some
relative point corrisponding to the dart head because it is black like
some sector of the dartboard...So i think that i have to do something
at the beginning to increase the contrast or something like this...
Right in this way?
I hope You can help me
Greets
Orazio D'Anna