Simple shape detector – Android Application

Again a little more on the apps that I am developing for my master thesis… While checking what’s new in the exergaming area and the solutions that are offered on the market I learned about interactive walls and I really liked their purpose. There are ones where a part of the wall lights and the player has to hit there and then another different part of the wall lights and the player has to hit that as soon as possible.  More about them can be read here http://www.exergamefitness.com/twall.htm  or wherever you can find on the internet.

It was all nice and great until I saw the prices of these walls… One of them was about 15k dollars which seemed too much! This is why these walls are only available in the labs or special playing rooms.  OK I am not saying that there are no such walls sold maybe all over America or other parts of the world but schools in Macedonia wouldn’t agree to buy one such wall. So I thought can’t this be somehow done using a simple mobile phone? It would cost not more than 500 dollars (if we take in consideration the most expensive smart phones on the market).  It would be available at any time and any place and there would be no need for children to go in special places intended for exergaming but they could do it whenever they feel like it…

So I started working on a mobile app that would make any white wall interactive. This should be done by sticking papers with different colors and shapes on it and make a shape detecting app.  So the first thing that I thought of was the OpenCV library and the miracles it can do but after a couple of simple tests I did on the phone that I have for testing purposes -T-Mobile Pulse I realized that I couldn’t make it real-time. This device is just not fast enough. Then I checked for some other libraries available and I found jjil – Jon’s Java Imaging Library, for mobile image processing but that didn’t help me as well. It was still not real-time…* It was time for me to read some more about shape detection. The book that helped me the most was Digital image processing – An Algorithmic introduction using Java. Having a white wall and colored shapes I went straight to the part that talked about Regions in Binary images and got couple of ideas about how current shapes can be determined. Actually the process turned out to be really simple. I think that anyone would understand when seeing this picture.

The first and last black pixels are determined and the black pixels are counted. If we compare the math formulas for areas of square, circle and triangle (a^a, a^2Π/4, a^2√3/4)  we could see that the square is more than 85%, circle between 85% and 70% and the triangle is between 70% and 55% of the area between the two pixels. After I finished writing the code doing all this simple math and did the first tests I was surprised that it worked immediately! 🙂

There is the making-of the testing wall in my room.

Here you can see a video of the app.

This app is later extended as a memory game showing the player an array of shapes that he has to remember and “hit” with the phone. ASA I have some more free time I’ll post the code on GitHub so that people having more creative ideas than me could use it. In the next posts I’ll write something more about how the testing of the apps went with primary school students.

*NOTE: I still encourage people to test this libraries further and use them since they are pretty cool! 🙂

Advertisements

13 Responses to Simple shape detector – Android Application

  1. Luan Dang says:

    thanks!

  2. Pingback: Plant Leaf Identification for android : Android Community - For Application Development

  3. xenonforlife says:

    Finally which library did you use? Or did you just use the android.hardware.camera and the camera callbacks?

  4. Sir, please help me. I’m a computer science student here in the Philippines, and currently doing my thesis. My thesis is a game that has the same concept of your android application. Can you please teach how did you do it. I’m new at android programming but i have knowledge on programming in java and c++.

  5. Hello, your app is great. I want to know if this is possible using eclipse IDE? I am using eclipse with opencv and i want to create the exact app like the one that you have created. Can you please send me the codes? here is my email urgentfury25@rocketmail.com Thanks in advance. More powers to you. GodBless.

  6. Sir, please upload this android application in github. i really need it badly please sir. im begging you. or kindly please send this to my email. kevin_cute_1990@yahoo.com . thankyou very much..

  7. Genie says:

    You share interesting things here. I think that your website can go
    viral easily, but you must give it initial boost
    and i know how to do it, just type in google (with quotes) for
    – “mundillo traffic increase make your website go viral”

  8. mudesser says:

    Hello, your app is great. I want to know if this is possible using eclipse IDE? I am using eclipse with opencv and i want to create the exact app like the one that you have created. Can you please send me the codes? here is my email mudessernazer@gmail.com Thanks in advance

  9. I’m graduated project relevant issue.But I don’t do this using Opencv.Can you send me your code ?

  10. selva says:

    Interesting Post. i am looking for a similar code. Do you this code available in public?

    • karevask says:

      Hi all,

      this code is quite old and I have to find it somewhere and maybe upload it on Git.
      I will let you know soon when I find some free time to do that.

      Regards,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: