Jump to content
THIS IS THE TEST SITE OF EUROBRICKS! ×
THIS IS THE TEST SITE OF EUROBRICKS!

Recommended Posts

Posted (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 by LegoGBC
Posted (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 by LegoGBC
  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...