This tutorial was tested using Ubuntu 10.04 and Windows 7 SP1 operating systems. Nevertheless, it should also work on any other **OS**\ es supported by Android SDK (including Mac OS X). If you encounter errors after following the steps described here, feel free to contact us via *android-opencv* discussion group https://groups.google.com/group/android-opencv/ and we will try to help you.
This tutorial was tested using Ubuntu 10.04 and Windows 7 SP1 operating systems.
Nevertheless, it should also work on any other **OS**\ es supported by Android SDK (including Mac OS X).
If you encounter errors after following the steps described here, feel free to contact us via `android-opencv <https://groups.google.com/group/android-opencv/>`_ discussion group and we will try to help you.
Quick environment setup for Android development
===============================================
If you are making a clean environment installation then you can try **T**\ egra **A**\ ndroid **D**\ evelopment **P**\ ack (*TADP*) released by *NVIDIA*:
If you are making a clean environment installation then you can try `Tegra Android Development Pack <http://developer.nvidia.com/tegra-android-development-pack>`_
(**TADP**) released by **NVIDIA**:
It will cover all of the environment set up automatically and you can go to the next step :ref:`Get_the_OpenCV_package_for_Android_development` right after automatic setup.
@ -45,9 +46,10 @@ You need the following tools to be installed:
#. **Sun JDK 6**
Visit http://www.oracle.com/technetwork/java/javase/downloads/index.html and download installer for your OS.
Visit `Java SE Downloads page <http://www.oracle.com/technetwork/java/javase/downloads/>`_ and download installer for your OS.
Here is a detailed :abbr:`JDK (Java Development Kit)` installation guide for Ubuntu and Mac OS: http://source.android.com/source/initializing.html#installing-the-jdk (only JDK sections are applicable for OpenCV)
Here is a detailed :abbr:`JDK (Java Development Kit)``installation guide <http://source.android.com/source/initializing.html#installing-the-jdk>`_
for Ubuntu and Mac OS (only JDK sections are applicable for OpenCV)
..note:: OpenJDK is not usable for Android development because Android SDK supports only Sun JDK.
If you use Ubuntu, after installation of Sun JDK you should run the following command to set Sun java environment:
@ -58,9 +60,9 @@ You need the following tools to be installed:
#. **Android SDK**
Get the latest Android SDK from http://developer.android.com/sdk/index.html
Get the latest ``Android SDK`` from http://developer.android.com/sdk/index.html
Here is Google's install guide for SDK http://developer.android.com/sdk/installing.html
Here is Google's `install guide <http://developer.android.com/sdk/installing.html>`_ for SDK.
..note:: If you choose SDK packed into Windows installer, then you should have 32-bit JRE installed. It is not needed for Android development, but installer is x86 application and requires 32-bit Java runtime.
@ -80,36 +82,34 @@ You need the following tools to be installed:
You need the following SDK components to be installed:
* *Android SDK Tools, revision12* or newer
* *Android SDK Tools, revision14* or newer
Older revisions should also work, but they are not recommended.
* *SDK Platform Android 2.2, API 8, revision 2* (also known as *android-8*)
This is minimal platform supported by OpenCV Java API. And it is set as default for OpenCV distribution. It is possible to use newer platform with OpenCV package, but it requires to edit OpenCV project settings.
* *SDK Platform Android 3.0, API 11* (also known as *android-11*)
The minimal platform supported by OpenCV Java API is **Android 2.2** (API 8). This is also the minimum API Level required for the provided samples to run.
See the ``<uses-sdk android:minSdkVersion="8"/>`` tag in their **AndroidManifest.xml** files.
But for successful compilation of some samples the **target** platform should be set to Android 3.0 (API 11) or higher. It will not block them from running on Android 2.2+.
..image:: images/android_sdk_and_avd_manager.png
:height:400px
:alt:Android SDK and AVD manager
:height:500px
:alt:Android SDK Manager
:align:center
See `Adding SDK Components
<http://developer.android.com/sdk/adding-components.html>`_ for help with installing/updating SDK components.
See `Adding SDK Components <http://developer.android.com/sdk/adding-components.html>`_ for help with installing/updating SDK components.
#. **Eclipse IDE**
Check the `Android SDK System Requirements
<http://developer.android.com/sdk/requirements.html>`_ document for a list of Eclipse versions that are compatible with the Android SDK.
For OpenCV 2.4.0 we recommend Eclipse 3.6 (Helios) or later versions. They work well for OpenCV under both Windows and Linux.
Check the `Android SDK System Requirements <http://developer.android.com/sdk/requirements.html>`_ document for a list of Eclipse versions that are compatible with the Android SDK.
For OpenCV 2.4.0 we recommend Eclipse 3.7 (Indigo) or later versions. They work well for OpenCV under both Windows and Linux.
If you have no Eclipse installed, you can download it from this location:
http://www.eclipse.org/downloads/
If you have no Eclipse installed, you can get it from the `download page <http://www.eclipse.org/downloads/>`_.
#. **ADT plugin for Eclipse**
This instruction is copied from http://developer.android.com/sdk/eclipse-adt.html#downloading
. Please, visit that page if you have any troubles with ADT plugin installation.
This instruction is copied from `Android Developers site <http://developer.android.com/sdk/eclipse-adt.html>`_.
Please, visit `that page <http://developer.android.com/sdk/eclipse-adt.html#downloading>`_if you have any troubles with :abbr:`ADT(Android Development Tools)` plugin installation.
Assuming that you have Eclipse IDE installed, as described above, follow these steps to download and install the ADT plugin:
@ -136,7 +136,7 @@ You need the following tools to be installed:
Get the OpenCV package for Android development
==============================================
#. Go to the http://sourceforge.net/projects/opencvlibrary/files/opencv-android/ and download the latest available version. Currently it is |opencv_android_bin_pack_url|_
#. Go to the `OpenCV dowload page on SourceForge <http://sourceforge.net/projects/opencvlibrary/files/opencv-android/>`_ and download the latest available version. Currently it is |opencv_android_bin_pack_url|_
#. Create new folder for Android+OpenCV development.
@ -175,23 +175,29 @@ Open OpenCV library and samples in Eclipse
:alt:Choosing C:\Work\android-opencv\ as workspace location
:align:center
#. Configure your ADT plugin
#. Configure your ADT plugin (if needed)
..important:: In most cases the ADT plugin finds Android SDK automatically, but sometimes it fails and shows the following prompt:
..important:: ADT plugin settings are workspace-dependent. So you have to repeat this step each time when you create a new workspace.
..image:: images/eclipse_1a_locate_sdk.png
:alt:Locating Android SDK
:align:center
Once you have created a new workspace, you have to point the ADT plugin to the Android SDK directory. This setting is stored in workspace metadata, as result this step is required each time when you are creating new workspace for Android development. See `Configuring the ADT Plugin
<http://developer.android.com/sdk/eclipse-adt.html#configuring>`_ document for the original instructions from *Google*.
Select :guilabel:`Use existing SDKs` option, browse for Android SDK folder and click :guilabel:`Finish`.
To make sure the SDK folder is set correctly do the following step taken from `Configuring the ADT Plugin <http://developer.android.com/sdk/eclipse-adt.html#configuring>`_ document from *Google*:
* Select :menuselection:`Window --> Preferences...` to open the Preferences panel (Mac OS X: :menuselection:`Eclipse --> Preferences`):
..image:: images/eclipse_2_window_preferences.png
:height:400px
:alt:Select Window > Preferences...
:align:center
* Select :guilabel:`Android` from the left panel.
You may see a dialog asking whether you want to send usage statistics to *Google*. If so, make your choice and click :guilabel:`Proceed`. You cannot continue with this procedure until you click :guilabel:`Proceed`.
You may see a dialog asking whether you want to send usage statistics to *Google*. If so, make your choice and click :guilabel:`Proceed`. You cannot continue with this procedure until you click :guilabel:`Proceed`.
If the SDK folder isn't set you'll see the following:
@ -199,7 +205,9 @@ Open OpenCV library and samples in Eclipse
* For the SDK Location in the main panel, click :guilabel:`Browse...` and locate your Android SDK directory.
* Click :guilabel:`Apply` button at the bottom right corner of main panel:
* Click :guilabel:`Apply` button at the bottom right corner of main panel.
If the SDK folder is already set correctly you'll see something like this:
..image:: images/eclipse_4_locate_sdk.png
:alt:Locate Android SDK
@ -245,6 +253,20 @@ Open OpenCV library and samples in Eclipse
To help Eclipse to understand that there are no any errors choose OpenCV library in :guilabel:`Package Explorer` (left mouse click) and press :kbd:`F5` button on your keyboard. Then choose any sample (except first samples in *Tutorial Base* and *Tutorial Advanced*) and also press :kbd:`F5`.
Sometimes more advanced manipulations are needed:
* The provided projects are configured for `android-11` target that can be missing platform in your Android SDK. After right click on any project select :guilabel:`Properties` and then :guilabel:`Android` on the left pane. Click some target with `API Level` 11 or higher:
..image:: images/eclipse_8a_target.png
:alt:Updating target
:align:center
* Sometimes a project needs fixing its project properties. After right click on any project select :guilabel:`Android Tools` and then :guilabel:`Fix Project Properties` in sub-menu:
..image:: images/eclipse_8b_fix_props.png
:alt:Fixing project properties
:align:center
After this manipulation Eclipse will rebuild your workspace and error icons will disappear one after another:
@ -257,16 +279,14 @@ Open OpenCV library and samples in Eclipse
:alt:OpenCV package imported into Eclipse
:align:center
..note:: If you are importing only OpenCV library without samples then instead of second refresh command (:kbd:`F5`) you might need to make :menuselection:`Android Tools --> Fix Project Properties` from project context menu.
Running OpenCV Samples
======================
At this point you should be able to build and run all samples except two from Advanced tutorial (these samples require Android NDK to build working applications, see the next tutorial :ref:`Android_Binary_Package_with_NDK` to learn how to compile them).
Also I want to note that only ``Tutorial 1 Basic - 0. Android Camera`` and ``Tutorial 1 Basic - 1. Add OpenCV`` samples are able to run on Emulator from Android SDK. Other samples are using OpenCV Native Camera which does not work with emulator.
Also I want to note that only ``Tutorial 0 - Android Camera`` and ``Tutorial 1 - Add OpenCV`` samples are able to run on Emulator from Android SDK. Other samples are using OpenCV Native Camera which does not work with emulator.
..note:: Latest *Android SDK tools, revision 12* can run ARM v7 OS images but *Google* does not provide such images with SDK.
..note:: Latest *Android SDK tools, revision 19* can run ARM v7a OS images but *Google* provides such image for Android 4.x only.
Well, running samples from Eclipse is very simple:
@ -290,7 +310,7 @@ Well, running samples from Eclipse is very simple:
* Select the :guilabel:`Android Application` option and click :guilabel:`OK` button. Eclipse will install and run the sample.
Here is ``Tutorial 1 Basic - 1. Add OpenCV`` sample detecting edges using Canny algorithm from OpenCV:
Here is ``Tutorial 1 - Add OpenCV`` sample detecting edges using Canny algorithm from OpenCV:
@ -17,17 +17,18 @@ This tutorial describes a fast way how to create and build Android applications
Please note that before starting this tutorial you should fulfill all the steps, described in the tutorial :ref:`Android_Binary_Package`.
This tutorial was tested using Ubuntu 10.04 and Windows 7 SP1 operating systems.
Nevertheless, it should also work on Mac OS X. If you encounter errors after following the steps described here, feel free to contact us via *android-opencv* discussion group https://groups.google.com/group/android-opencv/ and we will try to help you.
Nevertheless, it should also work on Mac OS X. If you encounter errors after following the steps described here, feel free to contact us via
`android-opencv <https://groups.google.com/group/android-opencv/>`_ discussion group and we will try to help you.
Prerequisites: Setup NDK
========================
To compile C++ code for Android platform you need Android **N**\ ative **D**\ evelopment **K**\ it (*NDK*).
To compile C++ code for Android platform you need ``Android Native Development Kit`` (*NDK*).
You can get the latest version of NDK from the page http://developer.android.com/sdk/ndk/index.html.
You can get the latest version of NDK from the `download page <http://developer.android.com/sdk/ndk/index.html>`_.
To install Android NDK just extract the archive to some folder on your computer. (Here is installation instructions on the NDK home page: http://developer.android.com/sdk/ndk/index.html#installing)
To install Android NDK just extract the archive to some folder on your computer. (Here is `installation instructions <http://developer.android.com/sdk/ndk/index.html#installing>`_ on the NDK home page.)
..note:: Before start you can read official Android NDK documentation which is in the Android NDK archive, in the folder :file:`docs/`.
@ -53,7 +54,7 @@ Usually code of an Android application has the following structure:
- :file:`AndroidManifest.xml`
- :file:`default.properties`
- :file:`project.properties`
- :file:`... other files ...`
@ -77,11 +78,13 @@ Also the root folder should contain the following files
It can be created using Eclipse wizard or :command:`android` tool from Android SDK
* :file:`default.properties` is a text file containing information about target Android platform and other build details.
* :file:`project.properties` is a text file containing information about target Android platform and other build details.
This file is generated by Eclipse or can be created with :command:`android` tool from Android SDK
..note:: Both files (:file:`AndroidManifest.xml` and :file:`default.properties`) are required to compile the C++ part of the application (NDK build system uses information from these files). If any of these files does not exist, compile the Java part of the project before the C++ part.
..note:: Both files (:file:`AndroidManifest.xml` and :file:`project.properties`) are required to compile the C++ part of the application (NDK build system uses information from these files). If any of these files does not exist, compile the Java part of the project before the C++ part.
.._NDK_build_cli:
Theory: How to build Android application having C++ native part (from command line)
@ -103,11 +106,11 @@ Here is the standard way to compile C++ part of an Android application:
<path_where_NDK_is_placed>/ndk-build
..note:: If you are working in *cygwin* shell and encounter an error saying that NDK does not find some *cygwin*\ 's path then you might need to define the following environment variable:
..code-block:: bash
..note:: On Windows we recomend use of ``ndk-build.cmd`` in standard Windows console (``cmd.exe``) rather than the similar ``bash`` script in ``Cygwin`` shell.
export NDK_USE_CYGPATH=1
..image:: images/ndk_build.png
:alt:NDK build
:align:center
#. After executing this command the C++ part of the source code is compiled.
@ -134,95 +137,66 @@ After that the Java part of the application can be (re)compiled (using either *E
Theory: How to build Android application having C++ native part (from *Eclipse*)
There are several possible ways to integrate compilation of C++ code by Android NDK into Eclipse compilation process. We recommend the approach taken from this site: http://mobilepearls.com/labs/ndk-builder-in-eclipse/
There are several possible ways to integrate compilation of C++ code by Android NDK into Eclipse compilation process.
We recommend the approach based on Eclipse :abbr:`CDT(C/C++ Development Tooling)` Builder.
..important::This instructions should be applied for each Android project in *Eclipse* workspace. So if you have 3 projects having C++ part then you need to configure 3 builders.
..important::Make sure your Eclipse IDE has the :abbr:`CDT(C/C++ Development Tooling)` plugin installed. (Menu ``Help`` -> ``About Eclipse SDK`` -> ``Installation Details``)
Below is an adapted version of this guide:
..image:: images/eclipse_inst_details.png
:alt:Configure builders
:align:center
#. Navigate to :guilabel:`Package Explorer` window and expand your project having JNI resources.
To install the `CDT plugin <http://eclipse.org/cdt/>`_ use menu ``Help`` -> ``Install New Software...``,
then paste the CDT 8.0 repository URL http://download.eclipse.org/tools/cdt/releases/indigo as shown on the picture below and click :guilabel:`Add...`, name it *CDT* and click :guilabel:`OK`.
..image:: images/eclipse_inst_cdt.png
:alt:Configure builders
:align:center
If you can not see :file:`libs` folder under this project then you need to create it manually. (It will be required on step 7, but you need to create it before you open project properties.)
#. Right click on your project in :guilabel:`Package Explorer` window and select :guilabel:`Properties`.
``CDT Main Features`` should be enough:
..image:: images/eclipse_inst_cdt_2.png
:alt:Configure builders
:align:center
..important:: This instructions should be applied for each Android project in *Eclipse* workspace having native (JNI) part to build.
#. In the :guilabel:`Properties` dialog select :guilabel:`Builders` menu and press the :guilabel:`New...` button:
#. Right click on your project in :guilabel:`Package Explorer` window and select :guilabel:`New` -> :guilabel:`Other`:
..image:: images/eclipse_builders.png
:alt:Configure builders
..image:: images/eclipse_cdt_cfg1.png
:alt:Configure CDT
:align:center
#. In the resulting dialog select the :guilabel:`Program` type and press :guilabel:`OK` button:
#. Select :guilabel:`C/C++` -> :guilabel:`Convert to C/C++ project`:
..image:: images/eclipse_builder_types.png
:alt:Choose builder type
..image:: images/eclipse_cdt_cfg2.png
:alt:Configure CDT
:align:center
#. In the :guilabel:`Main` tab fill the following fields:
* :guilabel:`Name` - any name for your builder. ("Tutorial 2.1 Builder" in my case.)
..note:: This name has to be unique for each project in your workspace.
* :guilabel:`Location` - full path to :command:`ndk-build` tool.
+ *UNIX*
Just put full path to :command:`ndk-build` into this filed. Also you can add some options to the :guilabel:`Arguments:guilabel:` fied, for example ``-B`` option.
+ *Cygwin*
- Instead of path to the :command:`ndk-build` tool you need to put full path to *cygwin*\ 's :program:`bash.exe` location. E.g: :file:`C:\\cygwin\\bin\\bash.exe`.
- Put full path to :command:`ndk-build` into the :guilabel:`Arguments` field E.g. :file:`C:\\Android\\android-ndk-r6\\ndk-build`.
- Go to the :guilabel:`Environment` tab and define an environment variable:
* :envvar:`PATH` - full path to the *cygwin* tools. E.g. :file:`C:\\cygwin\\bin`
..image:: images/eclipse_windows_environment.png
:alt:Define environment variables
:align:center
* :guilabel:`Working Directory` - put path to your project into this field. Instead of hardcoding full path you can click :guilabel:`Browse Workspace...` button and select your project.
:alt:Select resources folder to refresh automatically
:align:center
..image:: images/eclipse_cdt_cfg3.png
:alt:Configure CDT
:align:center
#. Go to the last tab :guilabel:`Build options`. Make sure that all checkboxes are set as shown on the next screen:
#. Right click on your project in :guilabel:`Package Explorer` window and select :guilabel:`Properties`, then :guilabel:`C/C++ Build` in the left pane.
Unckeck :guilabel:`Use default build command` and put ``ndk-build`` invocation in the :guilabel:`Build command` edit box and click :guilabel:`Apply` :
#. Next, click the :guilabel:`Specify resources...` button.
#. Select :guilabel:`Builders` in the left pane, select :guilabel:`"CDT Builder"`, press :guilabel:`Edit` button on the righ and set check-boxes as on the picture below for automatic rebuild of JNI part:
#. Select :file:`jni` folder of your project and click the :guilabel:`Finish` button:
#. Finally press :guilabel:`OK` in the builder configuration and project properties dialogs. If you have automatic build turned on then console showing build log should appear:
#. Use menu :guilabel:`Project` -> :guilabel:`Clean...` to make sure that NDK build is invoked on the project build:
..image:: images/eclipse_NDK_build_success.png
:alt:Select resources to build
:align:center
..image:: images/eclipse_ndk_build.png
:alt:Select resources folder to refresh automatically
:align:center
Theory: The structure of :file:`Android.mk` and :file:`Application.mk` scripts
This sample shows how you can mix OpenCV Java API and native C++ code.
To build these samples you need to:
#. Fulfill all the steps, described in the tutorial :ref:`Android_Binary_Package`.
#. Setup one builder for *"Tutorial 2 Advanced - 1. Add Native OpenCV"* project (as described in :ref:`Android_NDK_integration_with_Eclipse`)
#. Setup second builder for *"Tutorial 2 Advanced - 2. Mix Java+Native OpenCV"* project (repeat the steps from :ref:`Android_NDK_integration_with_Eclipse`)
#. Clean these projects (in the main Eclipse menu: :menuselection:`Project --> Clean...`)
#. Run Eclipse build command (if option :guilabel:`Build Automatically` is not set)
* *Sample - face-detection*
This sample illustrates usage of both simple OpenCV face detector via Java API and advanced detection based face tracker via JNI and C++.
Before OpenCV 2.4.2 for Android these projects are not configured to use CDT for building their native part , so you can do it yourself.
Practice: Create an Android application, which uses OpenCV
To build your own Android application, which uses OpenCV from native part, the following steps should be done:
#. The archive with OpenCV binary package should be downloaded and extracted to some folder (as example, into the home folder)
#. We recommend to use an environment variable to specify the location of OpenCV package. Full or relative path hardcoded in :file:`jni/Android.mk` will also work.
#. The archive with OpenCV binary package should be downloaded and extracted to some folder (e.g. ``C:\Work\android-opencv\OpenCV-2.4.0``)
So, the environment variable :envvar:`OPENCV_PACKAGE_DIR` should be defined.
The value of the variable should points to the folder, where the OpenCV package has been extracted.
#. You can use an environment variable to specify the location of OpenCV package or just hardcode full or relative path in the :file:`jni/Android.mk` of your projects.
#. The file :file:`jni/Android.mk` should be written for the current application using the common rules for the file.
As an example, on *UNIX* you can add add the following line into the hidden file :file:`.bashrc` placed in your home folder:
..code-block:: bash
export OPENCV_PACKAGE_DIR = <path to the extracted OpenCV package>
Then relogin (or better reboot your computer).
..attention:: without rebooting (or logout) this change might not work.
For detailed information see the Android NDK documentation from the Android NDK archive, in the file
:menuselection:`My Computer (Right Click on Icon) --> Properties (Link) --> Advanced System Settings (Link) --> Advanced (Tab) --> Environment Variables (Button) --> System variables (Section)`
include C:\Work\android-opencv\OpenCV-2.4.0\share\OpenCV\OpenCV.mk
* *Windows XP*
should be inserted into the :file:`jni/Android.mk` file right after the line
:menuselection:`My Computer (Right Click on Icon) --> Properties (Link) --> Advanced (Tab) --> Environment Variables (Button) --> System variables (Section)`
..code-block:: make
Create new variable :envvar:`OPENCV_PACKAGE_DIR` and similarly to *UNIX* relogin or reboot.
include $(CLEAR_VARS)
If you are setting NDK builder as described above in :ref:`Android_NDK_integration_with_Eclipse`, then you can define this variable in builder settings. It can be done on third :guilabel:`Environment` tab of the builder configuration window (we have already added some variables to this tab on *Windows* but skipped it for other platforms).
Several variables can be used to customize OpenCV stuff, they should be set **before** the ``"include ...\OpenCV.mk"`` line:
#. The file :file:`jni/Android.mk` should be written for the current application using the common rules for the file.
..code-block:: make
For detailed information see the Android NDK documentation from the Android NDK archive, in the file
Copies necessary OpenCV dynamic libs to the project ``libs`` folder in order to include them into the APK.
..code-block:: make
include $(OPENCV_PACKAGE_DIR)/share/OpenCV/OpenCV.mk
OPENCV_CAMERA_MODULES:=off
should be inserted into the :file:`jni/Android.mk` file right after the line
Skip native OpenCV camera related libs copying to the project ``libs`` folder.
..code-block:: make
include $(CLEAR_VARS)
..note:: If your application utilize both native (C++) OpenCV and its Java API you need to put the following line before including :file:`OpenCV.mk` to avoid conflict between C++ and Java builders:
..code-block:: make
OPENCV_LIB_TYPE:=STATIC
OPENCV_CAMERA_MODULES:=off
Perform static link with OpenCV. By default dynamic link is used and the project JNI lib depends on ``libopencv_java.so``.
#. The file :file:`Application.mk` should exist and should contain lines
@ -353,25 +306,4 @@ To build your own Android application, which uses OpenCV from native part, the f
is recommended for the applications targeting modern ARMs
#. To build the C++ code the Android NDK script :command:`ndk-build` should be run in the root directory of application.
Then the C++ source code using OpenCV will be built by Android NDK build system.
After that the Java part of the application can be rebuild and the application can be installed on an Android device.
Note that this step requires calling the :command:`ndk-build` script from the console. Instead of this step you can use integration of Android NDK into Eclipse
as stated above in the section :ref:`Android_NDK_integration_with_Eclipse` .
Additional C++ support in Eclipse
==================================
Note that you can install additional C++ plugins in Eclipse:
#. Open :guilabel:`Help / Install New Software`. This shows the :guilabel:`Install` dialog.
#. In the :guilabel:`Work with` drop-down list choose :guilabel:`Helios - http://download.eclipse.org/releases/helios` (or :guilabel:`Indigo - http://download.eclipse.org/releases/indigo` depending on your Eclipse version) and wait while the list of available software is loaded.
#. From the list of available software select :menuselection:`Programming Languages --> C/C++ Development Tools`.
#. Click :guilabel:`Next`, click :guilabel:`Next` again, accept the agreement, and click the :guilabel:`Finish` button.
#. When installation is finished, click :guilabel:`Reload`
#. Either use :ref:`manual <NDK_build_cli>```ndk-build`` invocation or :ref:`setup Eclipse CDT Builder <Android_NDK_integration_with_Eclipse>` to build native JNI lib before Java part [re]build and APK creation.
#. Create a temporary directory, which we denote as <cmake_binary_dir>, where you want to put the generated Makefiles, project files as well the object filees and output binaries
#. Enter the <cmake_binary_dir> and type
..code-block:: bash
cmake [<some optional parameters>] <path to the OpenCV source directory>
For example
#. Make symbolic link for Xcode to let OpenCV build scripts find the compiler, header files etc.
If everything's fine, after a few minutes you will get ~/<my_working_directory>/ios/opencv2.framework. You can add this framework to your Xcode projects.
@ -16,7 +16,7 @@ Installation by using the pre-built libraries
1. Open up a web browser and go to: http://sourceforge.net/projects/opencvlibrary/files/opencv-win/
#. Open the folder for the latest version (currently this is 2.4).
#. Open the folder for the latest version (currently this is 2.4.1).
#. Choose a build you want to use and download it. The naming conventions used will show what kind of support they offer. For example:
@ -60,10 +60,10 @@ If you are building your own libraries you can take either the source files from
..container:: enumeratevisibleitemswithsquare
+ stable and tested build - http://code.opencv.org/svn/opencv/branches/2.4 (the number at the end will change with every new realease, so change it to that)
+ stable and tested build - http://code.opencv.org/svn/opencv/tags/2.4.1 (the number at the end will change with every new realease, so change it to that)
+ development build - http://code.opencv.org/svn/opencv/trunk/
While the later one may contain a couple of new and experimental algorithms, performance increases and interface improvements, be aware, that it may also contain many-many bugs. Using the first one is recommended in most of the cases. That is unless you are extending the OpenCV library itself or really need to most up to date version of it.
While the later one may contain a couple of new and experimental algorithms, performance increases and interface improvements, be aware, that it may also contain some bugs. Using the first one is recommended in most of the cases. That is unless you are extending the OpenCV library itself or really need the most up to date version of it.
Building the OpenCV library from scratch requires a couple of tools installed beforehand:
@ -287,11 +287,11 @@ Building the library
+ *BUILD_DOCS* -> It creates two projects for building the documentation of OpenCV (there will be a separate project for building the HTML and the PDF files). Note that these aren't built together with the solution. You need to make an explicit build project command on these to do so.
+ *BUILD_EXAMPLES* -> OpenCV comes with many example applications from which you may learn most of the libraries capabilities. This will also come handy to easily try out if OpenCV is fully functional on your computer.
+ *BUILD_JAVA_SUPPORT* -> At the moment this has no real meaning on the Windows platform. Ignore it.
+ *BUILD_NEW_PYTHON_SUPPORT* -> Self-explanatory. Create the binaries to use OpenCV from the Python language.
+ *BUILD_PACKAGE* -> Prior to version 2.3 with this you could build a project that will build an OpenCV installer. With this you can easily install your OpenCV flavor on other systems. For the latest source files of OpenCV it generates a new project that simply creates zip archive with OpenCV sources.
+ *BUILD_SHARED_LIBS* -> With this you can control to build DLL files (when turned on) or static library files (\*.lib) otherwise.
+ *BUILD_TESTS* -> Each module of OpenCV has a test project assigned to it. Building these test projects is also a good way to try out, that the modules work just as expected on your system too.
+ *BUILD_PERF_TESTS* -> There are also performance tests for many OpenCV functions. If you're concerned about performance, build them and run.
+ *BUILD_opencv_python* -> Self-explanatory. Create the binaries to use OpenCV from the Python language.
Press again the *Configure* button and ensure no errors are reported. If this is the case you can tell CMake to create the project files by pushing the *Generate* button. Go to the build directory and open the created **OpenCV** solution.
Depending on just how much of the above options you have selected the solution may contain quite a lot of projects so be tolerant on the IDE at the startup.