ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Other Software > Developer's Corner

Dice analyzer machine project

<< < (5/19) > >>

mouser:
currently it's python code using opencv machine vision library, both known to run well on raspberry pi.
pure cross-platform commandline tool, no gui.

i will eventually have to write c-for-python-module versions of a few of my key python routines in order to get them running fast enough to be suitable for a raspberry pi.

some unknowns:
issues regarding using a cheap raspberry pi camera.
coding eventual GUI interface using touchscreen raspberry pi touchscreen.

cranioscopical:
The heart of the problem is getting something fully automatic and reliable
-mouser (January 20, 2016, 06:04 AM)
--- End quote ---

I had a go at this but… no dice.
 

Ath:
currently it's python code using opencv machine vision library, both known to run well on raspberry pi.
pure cross-platform commandline tool, no gui.
-mouser (January 23, 2016, 05:07 AM)
--- End quote ---
Great, I love cross-platform solutions :Thmbsup:

some unknowns:
issues regarding using a cheap raspberry pi camera.
-mouser (January 23, 2016, 05:07 AM)
--- End quote ---
I don't have one of those, but have not heard bad things about the 'original' RPi camera, it seems to be quite reliable as there are several projects using them, even for recognizing the surroundings in semi-autonomous robots.

coding eventual GUI interface using touchscreen raspberry pi touchscreen.
-mouser (January 23, 2016, 05:07 AM)
--- End quote ---
I have that touchscreen, but I still have issues with typing on it, even using the recommended on-screen-keyboard drivers, and also the screen-space is quite limited at 1280x800 800x480 pixels, even using a webbrowser is a chore :tellme:
The touch-input for moving the mouse is comparable to a 7" tablet, but Raspbian Jessie is not yet very optimized for touch interaction :huh:

mouser:
Here's a screenshot showing the tool extracting the foreground label of a "camoflaged" die.

For dice with clear foreground vs background contrast, an automatic thresholding filter is used to automatically separate foreground from background, but with "noisy" colored die, the user must "calibrate" the die by clicking on a pixel in the camera image that is part of the foreground label.    At that point the system finds the major colors in the image (k-means clustering) to quantize colors (about 8 classes works fine) in the LAB colorspace, and identifies foreground as color-quantized pixels closest to the foreground color.

With foreground pixels identified, the shape of the die (and other tunable per-die-type parameters) are used to try to identify only the top die face and exclude any foreground labeling/graphics which are on side faces.  This can be tricky, and works best if die is fairly well centered under the camera.  Certain dice shapes are harder than others because they have irregular shapes (d10 for example).  In the screenshot below you can see the white circle on the 3rd image from the bottom left indicating the area in which the program expects the current die fact to be circumscribed.  This case is fairly simple -- but there are cases where it's non-trivial to determine when a label belongs to the front die face or a neighboring one.

Dice analyzer machine project

mouser:
And here's a screenshot of the tool running in "guessing" mode with that same die.

On the top left you see the live camers image, with inset view of the extracted foreground facing die label.
On the bottom left you see the training image for the 20 that the program saw in a previous labeling/training stage.
Note that it has ONE photo of EACH die face that it uses as it's prototype -- there is no training procedure per se, it's just one example of each die face.  In fact as you can see in this case, it's not even of the same die, just another d20 with similar font.

Then on right hand side you see the results of trying to match against it's stored set of 20 prototypes, showing the top 4 candidate matches, rotated and scaled in an attempt to find the best aligning match.  The right-hand window of each pair shows the "difference mask" after some processing.  So you can see how the "20" is the best match -- which you can see reported at the bottom. (confidence score reflects the difference between best match score and next-best match score).

Dice analyzer machine project

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version