Commit de153f01 authored by Andrey Kamaev's avatar Andrey Kamaev

Fixed several opencv version references

parent 81a54154
...@@ -14,7 +14,7 @@ boolean initDebug() ...@@ -14,7 +14,7 @@ boolean initDebug()
------------------- -------------------
.. method:: static boolean initDebug() .. method:: static boolean initDebug()
Load and initialize OpenCV library from current application package. Roughly it is analog of system.loadLibrary("opencv_java") Load and initialize OpenCV library from current application package. Roughly it is analog of system.loadLibrary("opencv_java")
:rtype: boolean :rtype: boolean
......
...@@ -150,7 +150,7 @@ if(OpenCV_LIB_PATH AND EXISTS "${OpenCV_LIB_PATH}/OpenCVConfig.cmake") ...@@ -150,7 +150,7 @@ if(OpenCV_LIB_PATH AND EXISTS "${OpenCV_LIB_PATH}/OpenCVConfig.cmake")
endif() endif()
else() else()
if(NOT OpenCV_FIND_QUIETLY) if(NOT OpenCV_FIND_QUIETLY)
message(WARNING "Found OpenCV 2.4.0 Windows Super Pack but it has not binaries compatible with your configuration. message(WARNING "Found OpenCV 2.4.2 Windows Super Pack but it has not binaries compatible with your configuration.
You should manually point CMake variable OpenCV_DIR to your build of OpenCV library.") You should manually point CMake variable OpenCV_DIR to your build of OpenCV library.")
endif() endif()
set(OpenCV_FOUND FALSE CACHE BOOL "" FORCE) set(OpenCV_FOUND FALSE CACHE BOOL "" FORCE)
......
...@@ -8,16 +8,16 @@ Using C++ OpenCV code with Android binary package ...@@ -8,16 +8,16 @@ Using C++ OpenCV code with Android binary package
The Android way is writing all your code in Java. But somethimes it is not enough and you need to go to a native level and write part of your application in C/C++. The Android way is writing all your code in Java. But somethimes it is not enough and you need to go to a native level and write part of your application in C/C++.
This is important when you already have some computer vision functionality which is written in C++ and uses OpenCV, and you want to use it in your Android application, This is important when you already have some computer vision functionality which is written in C++ and uses OpenCV, and you want to use it in your Android application,
but do not want to rewrite the C++ code to Java. but do not want to rewrite the C++ code to Java.
In this case the only way is to use JNI mechanism. In this case the only way is to use JNI mechanism.
It means, that you should add a class with native methods wrapping your C++ functionality into the Java part of your Android application. It means, that you should add a class with native methods wrapping your C++ functionality into the Java part of your Android application.
This tutorial describes a fast way how to create and build Android applications containing OpenCV code written in C++. It shows how to build an application which uses OpenCV inside its JNI calls. This tutorial describes a fast way how to create and build Android applications containing OpenCV code written in C++. It shows how to build an application which uses OpenCV inside its JNI calls.
Please note that before starting this tutorial you should fulfill all the steps, described in the tutorial :ref:`Android_Binary_Package`. 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. 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 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. `android-opencv <https://groups.google.com/group/android-opencv/>`_ discussion group and we will try to help you.
...@@ -32,10 +32,10 @@ To install Android NDK just extract the archive to some folder on your computer. ...@@ -32,10 +32,10 @@ To install Android NDK just extract the archive to some folder on your computer.
.. note:: Before start you can read official Android NDK documentation which is in the Android NDK archive, in the folder :file:`docs/`. .. note:: Before start you can read official Android NDK documentation which is in the Android NDK archive, in the folder :file:`docs/`.
The main article about using Android NDK build system you can read in the file :file:`ANDROID-MK.html`. The main article about using Android NDK build system you can read in the file :file:`ANDROID-MK.html`.
Also some additional useful information you can read in the files Also some additional useful information you can read in the files
:file:`APPLICATION-MK.html`, :file:`NDK-BUILD.html`, and in the files :file:`CPU-ARM-NEON.html`, :file:`CPLUSPLUS-SUPPORT.html`, :file:`PREBUILTS.html`. :file:`APPLICATION-MK.html`, :file:`NDK-BUILD.html`, and in the files :file:`CPU-ARM-NEON.html`, :file:`CPLUSPLUS-SUPPORT.html`, :file:`PREBUILTS.html`.
Theory: Android application structure Theory: Android application structure
===================================== =====================================
...@@ -67,22 +67,22 @@ where ...@@ -67,22 +67,22 @@ where
+ the :file:`libs` folder will contain native libraries after successful build, + the :file:`libs` folder will contain native libraries after successful build,
+ and the :file:`jni` folder contains C/C++ application source code and NDK's build scripts :file:`Android.mk` and :file:`Application.mk`. + and the :file:`jni` folder contains C/C++ application source code and NDK's build scripts :file:`Android.mk` and :file:`Application.mk`.
These scripts control the C++ build process (they are written in Makefile language).
These scripts control the C++ build process (they are written in Makefile language).
Also the root folder should contain the following files
* :file:`AndroidManifest.xml` file presents essential information about application to the Android system Also the root folder should contain the following files
(name of the Application, name of main application's package, components of the application, required permissions, etc)
* :file:`AndroidManifest.xml` file presents essential information about application to the Android system
(name of the Application, name of main application's package, components of the application, required permissions, etc)
It can be created using Eclipse wizard or :command:`android` tool from Android SDK It can be created using Eclipse wizard or :command:`android` tool from Android SDK
* :file:`project.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 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:`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. .. 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: .. _NDK_build_cli:
...@@ -90,7 +90,7 @@ Also the root folder should contain the following files ...@@ -90,7 +90,7 @@ Also the root folder should contain the following files
Theory: How to build Android application having C++ native part (from command line) Theory: How to build Android application having C++ native part (from command line)
=================================================================================== ===================================================================================
Here is the standard way to compile C++ part of an Android application: Here is the standard way to compile C++ part of an Android application:
#. Open console and go to the root folder of Android application #. Open console and go to the root folder of Android application
...@@ -114,7 +114,7 @@ Here is the standard way to compile C++ part of an Android application: ...@@ -114,7 +114,7 @@ Here is the standard way to compile C++ part of an Android application:
#. After executing this command the C++ part of the source code is compiled. #. After executing this command the C++ part of the source code is compiled.
After that the Java part of the application can be (re)compiled (using either *Eclipse* or :command:`ant` build tool). After that the Java part of the application can be (re)compiled (using either *Eclipse* or :command:`ant` build tool).
.. note:: Some parameters can be set for the :command:`ndk-build`: .. note:: Some parameters can be set for the :command:`ndk-build`:
...@@ -148,18 +148,18 @@ We recommend the approach based on Eclipse :abbr:`CDT(C/C++ Development Tooling) ...@@ -148,18 +148,18 @@ We recommend the approach based on Eclipse :abbr:`CDT(C/C++ Development Tooling)
To install the `CDT plugin <http://eclipse.org/cdt/>`_ use menu ``Help`` -> ``Install New Software...``, 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`. 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 .. image:: images/eclipse_inst_cdt.png
:alt: Configure builders :alt: Configure builders
:align: center :align: center
``CDT Main Features`` should be enough: ``CDT Main Features`` should be enough:
.. image:: images/eclipse_inst_cdt_2.png .. image:: images/eclipse_inst_cdt_2.png
:alt: Configure builders :alt: Configure builders
:align: center :align: center
.. important:: OpenCV 2.4.2 for Android package contains samples projects pre-configured to use CDT Builder for JNI part build via ``ndk-build``. .. important:: OpenCV 2.4.2 for Android package contains samples projects pre-configured to use CDT Builder for JNI part build via ``ndk-build``.
#. Define the ``NDKROOT`` environment variable containing the path to Android NDK in your system (e.g. **"X:\\Apps\\android-ndk-r8"** or **"/opt/android-ndk-r8"**) #. Define the ``NDKROOT`` environment variable containing the path to Android NDK in your system (e.g. **"X:\\Apps\\android-ndk-r8"** or **"/opt/android-ndk-r8"**)
...@@ -174,13 +174,13 @@ then paste the CDT 8.0 repository URL http://download.eclipse.org/tools/cdt/rele ...@@ -174,13 +174,13 @@ then paste the CDT 8.0 repository URL http://download.eclipse.org/tools/cdt/rele
#. Use menu :guilabel:`Project` -> :guilabel:`Clean...` to make sure that NDK build is invoked on the project build: #. Use menu :guilabel:`Project` -> :guilabel:`Clean...` to make sure that NDK build is invoked on the project build:
.. image:: images/eclipse_ndk_build.png .. image:: images/eclipse_ndk_build.png
:alt: Select resources folder to refresh automatically :alt: Select resources folder to refresh automatically
:align: center :align: center
Theory: The structure of :file:`Android.mk` and :file:`Application.mk` scripts Theory: The structure of :file:`Android.mk` and :file:`Application.mk` scripts
============================================================================== ==============================================================================
The script :file:`Android.mk` usually have the following structure: The script :file:`Android.mk` usually have the following structure:
.. code-block:: make .. code-block:: make
...@@ -211,7 +211,7 @@ Practice: Build samples from OpenCV binary package ...@@ -211,7 +211,7 @@ Practice: Build samples from OpenCV binary package
OpenCV binary package includes 3 samples having JNI resources: OpenCV binary package includes 3 samples having JNI resources:
* *Tutorial 3 (Advanced) - Add Native OpenCV* * *Tutorial 3 (Advanced) - Add Native OpenCV*
This sample illustrates how you can use OpenCV in C++ but without OpenCV Java API. This sample illustrates how you can use OpenCV in C++ but without OpenCV Java API.
* *Tutorial 4 (Advanced) - Mix Java+Native OpenCV* * *Tutorial 4 (Advanced) - Mix Java+Native OpenCV*
...@@ -221,7 +221,7 @@ OpenCV binary package includes 3 samples having JNI resources: ...@@ -221,7 +221,7 @@ OpenCV binary package includes 3 samples having JNI resources:
* *Sample - face-detection* * *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++. This sample illustrates usage of both simple OpenCV face detector via Java API and advanced detection based face tracker via JNI and C++.
.. important:: Before OpenCV **2.4.2** for Android these projects were not configured to use CDT for building their native part , so you can do it yourself. .. important:: Before OpenCV **2.4.2** for Android these projects were not configured to use CDT for building their native part , so you can do it yourself.
Practice: Create an Android application, which uses OpenCV Practice: Create an Android application, which uses OpenCV
...@@ -238,7 +238,7 @@ To build your own Android application, which uses OpenCV from native part, the f ...@@ -238,7 +238,7 @@ To build your own Android application, which uses OpenCV from native part, the f
For detailed information see the Android NDK documentation from the Android NDK archive, in the file For detailed information see the Android NDK documentation from the Android NDK archive, in the file
:file:`<path_where_NDK_is_placed>/docs/ANDROID-MK.html` :file:`<path_where_NDK_is_placed>/docs/ANDROID-MK.html`
#. The line #. The line
.. code-block:: make .. code-block:: make
...@@ -274,15 +274,15 @@ To build your own Android application, which uses OpenCV from native part, the f ...@@ -274,15 +274,15 @@ To build your own Android application, which uses OpenCV from native part, the f
.. code-block:: make .. code-block:: make
APP_STL := gnustl_static APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -fexceptions APP_CPPFLAGS := -frtti -fexceptions
Also the line Also the line
.. code-block:: make .. code-block:: make
APP_ABI := armeabi-v7a APP_ABI := armeabi-v7a
is recommended for the applications targeting modern ARMs
is recommended for the applications targeting modern ARMs
#. 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. #. 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.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment