Some of you might still remember that I asked for help in developing a die test.
Basically, what came out was: I roll it 150 times, I do some statistics, then I decide that it is "OK" or not.
Well, I decided to go to version 2.
... first test...
Box around it
Axis through
Raspberry Pi 3 with Pi Camera 2
Pi cam and Pi and motor fixed to the tower
I added a lamp and a reed sensor to stop it in the right place.
Now I can insert a die and it will roll it like, 160 times.
It takes a photo each time, and one photo without die.
After all, if I take the photo without die and I substract it from the photo with die, only the die should stay right?
Well, it wasn't exactly that easy; but the principle was right.
Those images are transferred via SSH to my big computer. That one is then searching the die, cuts it out and tries to read the number.
Yes, reading this is not easy. Sometimes the pips are bright as a sun, sometimes they are near invisible. OpenCV wasn't up to the job in 30% of the cases; statistics couldn't do the job in 20% other cases (but 20% different from the openCV difficulties)... KMeans couldn't do the job in 15% of the cases... again 15 different per cent from the other two. Of course I could just use all three methods and add the results, it would be a 98% fit. But then it would calculate more than a second per die, which seems awkward.
So I gave in and trained a neural net instead. That's kind of cheating because it means I don't solve the problem. Also, since two weeks my computer is training on a couple of die images and it still confuses a with a sometimes.
But: It works now, with just about 2%-3% errors. On this image, they are marked with their respective numbers. Click on it, you can try and find the one error in this picture collection.
I tested the Heroquest movement dice with it.
My suspicion came true! One of them strongly prefers to roll a 1, the other of the two strongly prefers the 3. Yes! I knew it! It was worth the work!
The third one, the one who was giving his images to this forum post prefers the 2, by the way
Two months of development and I can get a result quickly now!
I will upload my dataset on kaggle sometime soon, and my code on git hub. But today, I keep training it.