I’m trying to build a simple application that will recognize the values of two 6-sided dice. I’m looking for some general pointers, or maybe even an open source project.
The two dice will be black and white, with white and black pips respectively. Their distance to the camera will always be the same, but their position and orientation on the playing surface will be random.
Dice http://www.freeimagehosting.net/uploads/9160bdd073.jpg
(not the best example, the surface will be a more distinct color and the shadows will be gone)
I have no prior experience with developing this kind of recognition software, but I would assume the trick is to first isolate the faces by searching for the square profile with a dominating white or black color (the rest of the image, i.e. the table/playing surface, will in distinctly different colors), and then isolate the pips for the count. Shadows will be eliminated by top down lighting.
I’m hoping the described scenario is so simple (read: common) it may even be used as an “introductory exercise” for developers working on OCR technologies or similar computer vision challenges.
Update:
I did some further googling and came across this video which strangely enough is exactly what I'm looking for. It also seems it's the OpenCV project is my best bet so far, I'll try and use it with this other project, OpenCVDotNet or Emgu CV.
Update:
Still struggling, can't get Emgu CV to work.
Ideas, pointers, thoughts, etc are still very much welcome!
While image training is "non-trivial" as @Brian said, that will actually be a pretty easy program to write. What you need to do is develop haar classifiers for the dice. You will need 6 classifiers total. The classifiers are the key to good image recongnition, and haar classifiers are the best there are right now. They take a long time to make. Here are some good links to get you familiarized with haar cascades:
http://www.computer-vision-software.com/blog/2009/11/faq-opencv-haartraining/
http://www.cognotics.com/opencv/docs/1.0/haartraining.htm
http://note.sonots.com/SciSoftware/haartraining.html
Check out this guys youtube video and then download his source from the link he provides in the video to see how he applied the cascade files in EmguCV. It will be something for you to build on.
http://www.youtube.com/watch?v=07QAhRJmcKQ
This site posts the link to some source for nice little tool that adds a little automation to cropping the images and creating the index files needed for the creation of the haar cascades. I used it a few months back and I couldn't get it to work right, but I modified it and it worked great for haar (not HMM). If you want the version I modified post back and I will get it to you.
http://sandarenu.blogspot.com/2009/03/opencv-haar-training-resources.html
While I have little technical assistance to offer you, the maker of the Dice-O-Matic mark II may be able to help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With