This article from http://blog.csdn.net/hellogv/, reference must indicate the source!
Android-opencv is a transplanted version of opencv on Android phones, while cvcamera is a sample of this transplanted version. This document describes how to install and use Android-opencv.
- Android-opencv Installation
Opencv is based on C ++, so Android-opencv must also rely on ndk (android-ndk-r4-crystax) to compile. PS: on the installation and use of android-ndk-r4-crystax and cygwin, this article no longer nagging, see http://blog.csdn.net/hellogv/archive/2010/12/23/6094127.aspx
The installation steps are as follows:
- SVN checkout http://android-opencv.googlecode.com/svn/trunk/, download source code
- Make sure that the system path contains D:/cygwin/bin; D:/cygwin/android-ndk-r4-crystax; (the directory you decide, the path must contain the bin of cygwin and the path of the android-ndk-r4-crystax)
- Copy the android-ndk-r4-crystax to the/cygwin/home/gv/android-ndk-r4-crystax, compile Android-opencv, after the compilation is successful, you can delete this copy.
- Run cygwin, to the opencv directory, input sh build. Sh for compilation, if the compilation is successful, it will be in the/opencv/Android/libs/generate armeabi and armeabi-v7a two folders, which contain libandroid-opencv.so.
PS: if a file is missing during compilation, search and download it from the Internet.
- Open the eclipse and import opencv project. The project is located in/opencv/Android /. PS: if a file is missing, you need to search and download it from the Internet.
- After the opencv project is compiled, you can export it, select the JAR file of Java, remove the two folders [OBJ] and [libs] during export, androidmanifest. XML and default. properties. The output file name is opencv. jar and export settings are as follows:
- Download swigwin-1.3.39, add D:/cygwin/swigwin-1.3.39 in system path (storage location custom), restart
- Open cygwin, go to/samples/cvcamera/, input sh build. Sh, and start to compile JNI of cvcamera. After successful compilation, libcvcamera. So will be generated.
- Copy/opencv/Android/libs to/samples/cvcamera/Because cvcamera requires both libandroid-opencv.so and libcvcamera. So
- Import the cvcamera project and add opencv. jar to the libraries
- Compile the cvcameraproject and generate the cvcamera.apk (with the size of 6.06mb)
The cvcamera program runs as follows: