Category Archives: processing

Control sound with sound keys from Processing app on android

I was looking for a way to use sound controls on android to control remotely (from device) omxplayer running on raspberry pi:

sound-controls

Here is code how to do this easily on processing:


void keyPressed() {
    if (key == CODED && keyCode ==
        android.view.KeyEvent.KEYCODE_VOLUME_DOWN) {
        println ("Volume down");
    }
    if (key == CODED && keyCode ==
        android.view.KeyEvent.KEYCODE_VOLUME_UP) {
        println ("Volume up");
    }
}

Why I’m using Processing framework.

This is just to use full power of creativity part during doing boring programmer work.

I’ve watched this course which revealed for me the power of Processing:

https://class.coursera.org/digitalmedia-001/class

The whole point is that you don’t need to make your program excellent from the first day of development. It simply possible that you will not have enough time and motivation to complete.

My idea is to use Processing for quick prototyping and then (only if the application is promising – you can check this with real users) – go ahead with more powerful solution.

Firstly – create a mockup which is just broken but have the ability to communicate an idea to the user. Only after that – fix and polish it.

That is why Processing was created for – to test, experiment and create quickly without much hassle and development tools.

Tracking people from webcam with OpenCV

Spent last weekend on #douhack (in Donetsk), I have been creating a program to count number of people walking through the street in front of web camera.

This appeared not such a simple task. To recognize moving objects I have used simple technique of background subtraction, when later frame with image capture from camera is subtracted pixel-by-pixel from previous image and revealing the regions which were moved from one frame to another.

More advanced algorithm described in documentation (see referenced works).

For tracking the person which moves I have tried a few techniques, camshift algorithm didn’t really helped. The reason for this is that algorithms doesn’t have enough “memory” capacity to track objects which are disappeared behind the other objects on the street. So I did a hack to linearize the movement of the person to estimate where moved object will appear again.

Here is demo how it works (pretty lame anyway):

http://www.youtube.com/watch?v=gcONLfkFSNM

Also Github link with sources:

https://github.com/mgalushka/pedestrians-traffic-calc

I strongly recommend this book to understand the basics of OpenCV and objects tracking (if pdf is not available – give me a shot and I will update link).

Big special thanks to  Mateusz Stankiewicz for his blog post regarding the topic.

Finger recognition with processing and OpenCV

Still under impression after sleepless night of @24hackathon. I’ve did processing application which does object recognition of fingers (yes, similar to Leap Motion, but much more primitive – you need to use colored caps on fingers so application could track them by color).

Here is gthub link:

https://github.com/mgalushka/finger-bomb.git

And demo (no sound):

http://www.youtube.com/watch?v=-jBgzILdC-g

Thanks to OpenCV framework – without it I would never complete this. I did game wirh tracking movenent of finger with web cam.

I will create a post on how exactly I have implemented this. Stay tuned.

finger-bonb