OpenCV Android Starter Project
Version 0.1 (this is the initial version and has not been fully tested)
##Prerequisites
- Eclipse must be installed
- You must have an Android Device with a Camera
##How to setup your development environment
- Download or clone repository
- Download the OpenCV for Android Library from http://opencv.org/downloads.html
- Extract the OpenCV library to a folder of your choice
- Open your eclipse workspace and press File->Import->General->Existing Projects into Workspace, then press next
- Next to Select root directory, browse to the folder where this project is located and press OK
- Untick Copy projects into workspace
- Press finish
- Press File->Import->General->Existing Projects into Workspace, then press next
- Next to Select root directory, browse to the folder where you extracted the Android OpenCV libraries to and press next
- Select only the OpenCV Library from the list
- Untick Copy projects into workspace
- Press finish
- Right click on the computer vision project and then press properties
- Select Android->Library->Add...
- Select the OpenCV Library and press OK
- Press OK
- Attempt to run the application, you should see a camera feed
##Troubleshooting ###Ubuntu 14.04 you may be required to install the lib32zl package
##How to use the code open the ProcessImageFragment.java file you will see this:
public class ProcessImageFragment extends CameraViewFragment
{
/**
* To process the camera frame use the inputFrame variable
* in this method, call inputFrame.rgba() to get
* a colour frame.
*/
@Override
public Mat onCameraFrame(CvCameraViewFrame inputFrame)
{
// Get the Colour Frame
Mat myFrame = inputFrame.rgba();
/**
* Place your image processing code here
*/
// Return the processed frame
return myFrame;
}
}
Place your image processing code in the OnCameraFrame method