Monday, November 28, 2011

Android image processing (detecting motions)


               SDK Version: 
M3
In this tutorial I'm going to show you how to process an image and draw it's color histogram.
First you have to create a new Android project with the following parameters.
Project name: ViewfinderEE368
Check the box for Android 2.0.1
Application name: Viewfinder EE368
Package name: com.example.viewfinderee368
Check the box for Create Activity and enter: ViewfinderEE368
Min SDK Version: 6
Ok, now download this file, and overwrite the existing manifest in your workspace:
http://ee368.stanford.edu/Android/ViewfinderEE368/AndroidManifest.xml
At last, download this java class too, and copy it to your project:
http://ee368.stanford.edu/Android/ViewfinderEE368/ViewfinderEE368.java
Launch it!
Now you should see your camera's picture, some numbers, and the color histogram. Those numbers are very important for us, go ahead and play with it a little while, so you can understand the changes in those values. Once you know what changes are you interested in, you can implement a condition in your code to detect when it occours. The variables you should search for are:
imageRedMean; imageGreenMean; imageBlueMean
Happy developing!

No comments:

Post a Comment

thank you