CS6320:  SW Engineering of Web Based Systems

 

 

Android and Imaging

  • assumes you have setup the Android software development environment

  • discusses how to implement image processing operations on an Android-based mobile device (e.g., the Motorola DROID, HTC DROID ERIS, Google Nexus One).
  • Android also comes with a vast library of useful functions, including functions for user interfaces, image/bitmap manipulation, and camera control.

 

Part I: Creating the Software Development Environment

Assume you have done this already.

If you encountered problems, please take a look at the tips on these sites

       

http://developer.android.com/sdk/index.html

http://developer.android.com/sdk/installing.html

http://developer.android.com/sdk/eclipse-adt.html

 

 

Linking Your Phone to Your Computer (if you have one)

  1. Turn on your phone.
  2. Go to the home screen.
  3. Select Menu > Settings > Applications > Development and then enable USB debugging.
  4. After you have downloaded updates for the Android SDK in Eclipse above, the USB driver should have been included. Install the USB driver on your computer, following the tips on these pages:

http://developer.android.com/guide/developing/device.html#setting-up

http://developer.android.com/sdk/win-usb.html

 

(Note: You may need to restart your computer after installing the USB driver in order for the phone to show up in Eclipse.)

 

Part II: Developing Image Processing Programs for Android

Now that the Google Android SDK, the Java Runtime, and the Eclipse IDE are all set up on your computer, we are ready to start writing image processing programs that can run an Android-compatible mobile device.

 

 

 

Viewfinder Example

Now, having grasped the fundamentals of building and running an Android application, we will create a more complicated project involving the onboard camera and real-time image processing.  

 

  1. Create a new Android project with the following parameters.

 

Project name: Viewfinder

Check the box for Android 2.0.1 (or later)

Application name: Viewfinder

Package name: com.example.viewfinder

Check the box for Create Activity and enter: Viewfinder

Min SDK Version: 6

 

  1. Copy the text in the following document into AndroidManifest.xml. This defines the main activities and permissions for this program.

 

AndroidManifest.xml

 

  1. Copy the text in the following document into src : com.example.viewfinder : Viewfinder.java. This defines the classes in this program.

         Viewfinder.java

 

  1. Check to make sure everything is copied correctly into the project. If there are compilation errors, a red X will appear in the Package Explorer.

  2. Select Run and in the Device Chooser dialog, select your phone. You should see something like Figure 1 on your phone or the simulator image on the simulator. Point the camera at different objects around you to see how the mean, standard deviation, and histogram of each color channel changes dynamically. You are augmenting the viewfinder in real time!

 

 

Figure 1. “Viewfinder” program running on Android-based phone.

 

 

Real-time Phone Debugging in Eclipse

It is actually possible to view real-time messages from the phone in Eclipse, which can be very helpful for debugging and code development.

  1. Select Window > Open Perspective > DDMS.
  2. A new tab entitled “DDMS” should appear next to the default “Java” tab. Click on the “DDMS” tab.
  3. Select Window> Show View > LogCat. The LogCat view shows a sequential list of real-time messages from the phone. In particular, error messages in red can be very useful when trying to debug a problem.


[1] Parts of this tutorial borrow explanations from the official Android developers’ website (developer.android.com).

© Lynne Grewe