LegoGBC Posted April 5, 2014 Posted April 5, 2014 (edited) Hi I've made a GBC ball counter which uses an android smartphone and an app I wrote in order to detect and count GBC balls. Iv'e done this before (here), but this time I tried something different: counting the balls directly from the GBC track, without a special module. The counter uses the phone's camera to scan a row of pixels (most of them positioned on the track itself). If it detects a drastic change in one of the pixels' colors, it registers a pass and does some calcucations (such as balls / second). It also waits 200ms before scanning for balls again, so the counter won't register the same ball twice. Also included is a small algorithm that will ignore changes in lighting, to prevent false positives. More information: - 100% accuracy rate - never misses a ball or counts the same ball twice - Can handle up to 5 (!) balls per second, which is 5 times more than the GBC standard - The app uses the camera preview mode (~20 fps) - Coded in Java for android devices. I hope you'll like it :) Edited April 5, 2014 by LegoGBC Quote
PV-Productions Posted April 5, 2014 Posted April 5, 2014 Great extension! I will update the Counter page as soon as possible: http://pv-productions.com/lego-gbc-ball-counters/ Quote
LegoGBC Posted April 7, 2014 Author Posted April 7, 2014 Thanks, maybe I'll soon have the time to release it for all users Quote
kieran Posted April 7, 2014 Posted April 7, 2014 I for one would like to see the source code, the image analysis is relay neat Quote
LegoGBC Posted April 8, 2014 Author Posted April 8, 2014 (edited) I for one would like to see the source code, the image analysis is relay neat Heres a small part of it private boolean MeasureColors(Bitmap bitmap) { int x = bitmap.getHeight() - 1; for (int i = 0; i < x - 1; i++) if (Color.red(bitmap.getPixel(500, i)) - 60 > prevR) return true; return false; } (prevR is the red channel of a pixel on the black background) Theres a lot more, tough. This is just the method which measures the colors and returns true/false if theres a significant change in one of the pixels. There are also methods which convert the received byte[] data to a usable bitmap (you need to first convert from YUV image to jpeg, write the jpeg to a byte array stream and read from it later on with a regular bitmap) , check for light change, calcucate BPS, handle the 200ms break after each ball etc... Edited April 8, 2014 by LegoGBC Quote
syclone Posted July 21, 2015 Posted July 21, 2015 Awesome ball counter! It looks simple and great! Is it public somewhere? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.