Sign in to follow this  
LegoGBC

GBC Ball Counter - Version 2

Recommended Posts

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 by LegoGBC

Share this post


Link to post
Share on other sites

I for one would like to see the source code, the image analysis is relay neat

Share this post


Link to post
Share on other sites

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 by LegoGBC

Share this post


Link to post
Share on other sites

Awesome ball counter! It looks simple and great!

Is it public somewhere?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.