diff --git a/android/java.rst b/android/java.rst index 0b4a2888b..37b393bd8 100644 --- a/android/java.rst +++ b/android/java.rst @@ -3,4 +3,4 @@ Java API ******** -`Java API reference external link (JavaDoc) `_ \ No newline at end of file +Java API reference (JavaDoc): external `link `_. diff --git a/android/service/doc/BaseLoaderCallback.rst b/android/service/doc/BaseLoaderCallback.rst index d75003877..3258004c5 100644 --- a/android/service/doc/BaseLoaderCallback.rst +++ b/android/service/doc/BaseLoaderCallback.rst @@ -1,18 +1,20 @@ ********************************************* -Base Loader Callback Interface implementation +Base Loader Callback Interface Implementation ********************************************* .. highlight:: java .. class:: BaseLoaderCallback - Basic implementation of LoaderCallbackInterface. Logic of this implementation is well-described by the following scheme: + Basic implementation of ``LoaderCallbackInterface``. Logic of this implementation is + well-described by the following scheme: .. image:: img/AndroidAppUsageModel.png Using in Java Activity ---------------------- -There is a very base code snippet implementing the async initialization with BaseLoaderCallback. See the "15-puzzle" OpenCV sample for details. +There is a very base code snippet implementing the async initialization with ``BaseLoaderCallback``. +See the "15-puzzle" OpenCV sample for details. .. code-block:: java :linenos: @@ -42,7 +44,7 @@ There is a very base code snippet implementing the async initialization with Bas @Override protected void onResume() { - Log.i(TAG, "called onResume"); + Log.i(TAG, "Called onResume"); super.onResume(); Log.i(TAG, "Trying to load OpenCV library"); @@ -55,6 +57,7 @@ There is a very base code snippet implementing the async initialization with Bas Using in Service ---------------- -Default BaseLoaderCallback implementation treat application context as Activity and calls Activity.finish() method to exit in case of initialization failure. -To override this behavior you need to override finish() method of BaseLoaderCallback class and implement your own finalization method. - +Default ``BaseLoaderCallback`` implementation treats application context as ``Activity`` and calls +``Activity.finish()`` method to exit in case of initialization failure. +To override this behavior you need to override ``finish()`` method of ``BaseLoaderCallback`` class +and implement your own finalization method. diff --git a/android/service/doc/InstallCallbackInterface.rst b/android/service/doc/InstallCallbackInterface.rst index 950b8ec24..f4411f93f 100644 --- a/android/service/doc/InstallCallbackInterface.rst +++ b/android/service/doc/InstallCallbackInterface.rst @@ -28,7 +28,7 @@ void cancel() .. method:: void cancel() - Installation if package has been canceled. + Installation of package has been cancelled. void wait_install() ------------------- diff --git a/android/service/doc/Intro.rst b/android/service/doc/Intro.rst index 431909086..d0e9d7347 100644 --- a/android/service/doc/Intro.rst +++ b/android/service/doc/Intro.rst @@ -7,34 +7,38 @@ Introduction .. highlight:: java -OpenCV Manager is an Android service targeted to manage OpenCV library binaries on end users devices. It allows sharing the OpenCV dynamic libraries of different versions between applications on the same device. The Manager provides the following benefits\: +OpenCV Manager is an Android service targeted to manage OpenCV library binaries on end users devices. +It allows sharing the OpenCV dynamic libraries between applications on the same device. The Manager +provides the following benefits\: #. Less memory usage. All apps use the same binaries from service and do not keep native libs inside themselves; #. Hardware specific optimizations for all supported platforms; -#. Trusted OpenCV library source. All packages with OpenCV are published on Google Play service; +#. Trusted OpenCV library source. All packages with OpenCV are published on Google Play market; #. Regular updates and bug fixes; -Usage model for target user ---------------------------- +Usage model for end user +------------------------ .. image:: img/AndroidAppUsageModel.png First OpenCV app\: #. Any OpenCV-dependent app is installed from Google Play marketplace or manually; -#. At the first launch, it suggests installing OpenCV Manager; -#. Then OpenCV Manager is downloaded and installed, using Google Play marketplace service. -#. When Manager has ben started, the application suggests installing OpenCV library for the target device trough Google Play marketplace if it is necessary; -#. After installation is finished, the app may be launched to perform common tasks. +#. At the first launch, it suggests installation of OpenCV Manager; +#. Then OpenCV Manager is downloaded and installed, using the Google Play application. +#. When Manager has been started, the application suggests installation of OpenCV library for the + target device architecture if it is necessary; +#. After the installation is finished, the app may be launched. -Next OpenCV app\: +Subsequent launches of OpenCV apps\: -#. Any OpenCV-dependent app is installed from Google Play marketplace or manually; +#. Any OpenCV-dependent app is installed from Google Play market or manually; #. At the first launch, the app starts as usually; -#. If the selected version is not installed, OpenCV Manager suggests installing OpenCV library for the target device trough Google Play marketplace; -#. After installation is finished, the app may be launched to perform common tasks. +#. If the selected OpenCV version is not installed, OpenCV Manager suggests installing OpenCV + library for the target device through Google Play marketplace; +#. After the installation is finished, the app may be launched. -OpenCV Manager structure ------------------------- +Architecture of OpenCV Manager +------------------------------ .. image:: img/Structure.png \ No newline at end of file diff --git a/android/service/doc/JavaHelper.rst b/android/service/doc/JavaHelper.rst index 102b727d7..9a128db0a 100644 --- a/android/service/doc/JavaHelper.rst +++ b/android/service/doc/JavaHelper.rst @@ -12,23 +12,27 @@ boolean initDebug() .. method:: static boolean initDebug() - Loads and initializes OpenCV library from within current application package. Roughly it is analog of ``system.loadLibrary("opencv_java")``. + Loads and initializes OpenCV library from within current application package. Roughly it is + analog of ``system.loadLibrary("opencv_java")``. :rtype: boolean; :return: returns true if initialization of OpenCV was successful. -.. note:: This method is deprecated for production code. It is designed for experimantal and local development purposes only. If you want to publish your app use approach with async initialization. +.. note:: This method is deprecated for production code. It is designed for experimental and local + development purposes only. If you want to publish your app use approach with async + initialization. boolean initAsync() ------------------- .. method:: static boolean initAsync(String Version, Context AppContext, LoaderCallbackInterface Callback) - Loads and initializes OpenCV library using OpenCV Manager service. + Loads and initializes OpenCV library using OpenCV Manager. :param Version: OpenCV Library version. :param AppContext: application context for connecting to the service. - :param Callback: object, that implements LoaderCallbackInterface for handling connection status (see BaseLoaderCallback). + :param Callback: object, that implements ``LoaderCallbackInterface`` for handling connection + status (see ``BaseLoaderCallback``). :rtype: boolean; :return: returns true if initialization of OpenCV starts successfully. @@ -43,10 +47,3 @@ OpenCV version constants .. data:: OPENCV_VERSION_2_4_3 OpenCV Library version 2.4.3 - -Other constatnts ----------------- - -.. data:: OPEN_CV_SERVICE_URL - - Url for OpenCV Manager on Google Play (Android Market) \ No newline at end of file diff --git a/android/service/doc/LoaderCallbackInterface.rst b/android/service/doc/LoaderCallbackInterface.rst index 08bc16096..440b6b673 100644 --- a/android/service/doc/LoaderCallbackInterface.rst +++ b/android/service/doc/LoaderCallbackInterface.rst @@ -12,9 +12,9 @@ void onManagerConnected() .. method:: void onManagerConnected(int status) - Callback method that is called after OpenCV Library initialization. + Callback method that is called after OpenCV library initialization. - :param status: status of initialization (see Initialization Status Constants). + :param status: status of initialization (see "Initialization Status Constants" section below). void onPackageInstall() ----------------------- @@ -23,7 +23,7 @@ void onPackageInstall() Callback method that is called in case when package installation is needed. - :param callback: answer object with approve and cancel methods and package description. + :param callback: answer object with ``install`` and ``cancel`` methods and package description. Initialization status constants ------------------------------- @@ -34,15 +34,15 @@ Initialization status constants .. data:: MARKET_ERROR - Google Play (Android Market) cannot be invoked + Google Play (Android Market) application cannot be invoked .. data:: INSTALL_CANCELED - OpenCV library installation was canceled by user + OpenCV library installation was cancelled by user .. data:: INCOMPATIBLE_MANAGER_VERSION - Version of OpenCV Manager Service is incompatible with this app. Service update is needed + Version of OpenCV Manager is incompatible with this app. Manager update is needed. .. data:: INIT_FAILED diff --git a/android/service/doc/UseCases.rst b/android/service/doc/UseCases.rst index ff26410e7..bbc7da02c 100644 --- a/android/service/doc/UseCases.rst +++ b/android/service/doc/UseCases.rst @@ -3,38 +3,7 @@ Manager Workflow .. _manager_selection: -OpenCV Manager selection ------------------------- - -Since version 1.7 several packages of OpenCV Manager is built. Every package includes OpenCV library -for package target platform. The internal library is used for most cases, except the rare one, when -arm-v7a without NEON instruction set processor is detected. In this case additional binary package -for arm-v7a is used. The new package selection logic in most cases simplifies OpenCV installation -on end user devices. In most cases OpenCV Manager may be installed automatically from Google Play. -For such case, when Google Play is not available, i.e. emulator, developer board, etc, you can -install it manually using adb tool. - -.. code-block:: sh - :linenos: - - adb install OpenCV-2.4.3-android-sdk/apk/OpenCV_2.4.3_Manager_2.0_.apk - -Use table to determine right OpenCV Manager package: - -+----------------------------+-----------------+-----------------------------------------------------+ -| Hardware Platform | Android version | Package name | -+============================+=================+=====================================================+ -| Intel x86 | >= 2.3 | OpenCV_2.4.3_Manager_2.0_x86.apk | -+----------------------------+-----------------+-----------------------------------------------------+ -| MIPS | >= 2.3 | OpenCV_2.4.3_Manager_2.0_mips.apk | -+----------------------------+-----------------+-----------------------------------------------------+ -| armeabi (arm-v5, arm-v6) | >= 2.3 | OpenCV_2.4.3_Manager_2.0_armeabi.apk | -+----------------------------+-----------------+-----------------------------------------------------+ -| armeabi-v7a (arm-v7a-NEON) | >= 2.3 | OpenCV_2.4.3_Manager_2.0_armv7a-neon.apk | -+----------------------------+-----------------+-----------------------------------------------------+ -| armeabi-v7a (arm-v7a-NEON) | 2.2 | OpenCV_2.4.3.1_Manager_2.3_armv7a-neon-android8.apk | -+----------------------------+-----------------+-----------------------------------------------------+ - +.. include:: ../readme.txt First application start ----------------------- @@ -51,7 +20,7 @@ If OpenCV library installation has been approved\: .. image:: img/LibInstallAproved.png -If OpenCV library installation has been canceled\: +If OpenCV library installation has been cancelled\: .. image:: img/LibInstallCanceled.png diff --git a/android/service/engine/src/org/opencv/engine/manager/ManagerActivity.java b/android/service/engine/src/org/opencv/engine/manager/ManagerActivity.java index 7c4b8e4c7..6f604fb87 100644 --- a/android/service/engine/src/org/opencv/engine/manager/ManagerActivity.java +++ b/android/service/engine/src/org/opencv/engine/manager/ManagerActivity.java @@ -402,10 +402,16 @@ public class ManagerActivity extends Activity protected String NormalizeVersion(String OpenCVersion, String PackageVersion) { + if (OpenCVersion == null || PackageVersion == null) + return "unknown"; + int dot = PackageVersion.indexOf("."); - return OpenCVersion.substring(0, OpenCVersion.length()-1) + "." + - OpenCVersion.toCharArray()[OpenCVersion.length()-1] + "." + - PackageVersion.substring(0, dot) + " rev " + PackageVersion.substring(dot+1); + if (dot == -1 || OpenCVersion.length() == 0) + return "unknown"; + else + return OpenCVersion.substring(0, OpenCVersion.length()-1) + "." + + OpenCVersion.toCharArray()[OpenCVersion.length()-1] + "." + + PackageVersion.substring(0, dot) + " rev " + PackageVersion.substring(dot+1); } protected String ConvertPackageName(String Name, String Version) diff --git a/android/service/readme.txt b/android/service/readme.txt index 69b6236e6..7da05853a 100644 --- a/android/service/readme.txt +++ b/android/service/readme.txt @@ -1,28 +1,33 @@ -OpenCV Manager selection -======================== +How to select the proper version of OpenCV Manager +-------------------------------------------------- -Since version 1.7 several packages of OpenCV Manager is built. Every package includes OpenCV library -for package target platform. The internal library is used for most cases, except the rare one, when -arm-v7a without NEON instruction set processor is detected. In this case additional binary package -for arm-v7a is used. The new package selection logic in most cases simplifies OpenCV installation -on end user devices. In most cases OpenCV Manager may be installed automatically from Google Play. -For such case, when Google Play is not available, i.e. emulator, developer board, etc, you can -install it manually using adb tool: +Since version 1.7 several packages of OpenCV Manager are built. Every package is targeted for some +specific hardware platform and includes corresponding OpenCV binaries. So, in most cases OpenCV +Manager uses built-in version of OpenCV. Separate package with OpenCV binaries is currently used in +a single rare case, when an ARMv7-A processor without NEON support is detected. In this case an +additional binary package is used. The new package selection logic in most cases simplifies OpenCV +installation on end user devices. In most cases OpenCV Manager may be installed automatically from +Google Play. - adb install OpenCV-2.4.3-android-sdk/apk/OpenCV_2.4.3.2_Manager_2.4_.apk +If Google Play is not available (i.e. on emulator, developer board, etc), you can install it +manually using adb tool: -Use table to determine right OpenCV Manager package: +.. code-block:: sh -+----------------------------+-----------------+-----------------------------------------------------+ -| Hardware Platform | Android version | Package name | -+============================+=================+=====================================================+ -| Intel x86 | >= 2.3 | OpenCV_2.4.3.2_Manager_2.4_x86.apk | -+----------------------------+-----------------+-----------------------------------------------------+ -| MIPS | >= 2.3 | OpenCV_2.4.3.2_Manager_2.4_mips.apk | -+----------------------------+-----------------+-----------------------------------------------------+ -| armeabi (arm-v5, arm-v6) | >= 2.3 | OpenCV_2.4.3.2_Manager_2.4_armeabi.apk | -+----------------------------+-----------------+-----------------------------------------------------+ -| armeabi-v7a (arm-v7a-NEON) | >= 2.3 | OpenCV_2.4.3.2_Manager_2.4_armv7a-neon.apk | -+----------------------------+-----------------+-----------------------------------------------------+ -| armeabi-v7a (arm-v7a-NEON) | 2.2 | OpenCV_2.4.3.2_Manager_2.4_armv7a-neon-android8.apk | -+----------------------------+-----------------+-----------------------------------------------------+ + adb install OpenCV-2.4.3-android-sdk/apk/OpenCV_2.4.3.2_Manager_2.4_.apk + +Use the table below to determine proper OpenCV Manager package for your device: + ++------------------------------+--------------+-----------------------------------------------------+ +| Hardware Platform | Android ver. | Package name | ++==============================+==============+=====================================================+ +| armeabi-v7a (ARMv7-A + NEON) | >= 2.3 | OpenCV_2.4.3.2_Manager_2.4_armv7a-neon.apk | ++------------------------------+--------------+-----------------------------------------------------+ +| armeabi-v7a (ARMv7-A + NEON) | = 2.2 | OpenCV_2.4.3.2_Manager_2.4_armv7a-neon-android8.apk | ++------------------------------+--------------+-----------------------------------------------------+ +| armeabi (ARMv5, ARMv6) | >= 2.3 | OpenCV_2.4.3.2_Manager_2.4_armeabi.apk | ++------------------------------+--------------+-----------------------------------------------------+ +| Intel x86 | >= 2.3 | OpenCV_2.4.3.2_Manager_2.4_x86.apk | ++------------------------------+--------------+-----------------------------------------------------+ +| MIPS | >= 2.3 | OpenCV_2.4.3.2_Manager_2.4_mips.apk | ++------------------------------+--------------+-----------------------------------------------------+ diff --git a/doc/_themes/blue/static/default.css_t b/doc/_themes/blue/static/default.css_t index 492b46ea4..e2127db1d 100644 --- a/doc/_themes/blue/static/default.css_t +++ b/doc/_themes/blue/static/default.css_t @@ -394,4 +394,12 @@ div.body ul.search li { div.linenodiv { min-width: 1em; text-align: right; +} + +div.sphinxsidebar #searchbox input[type="text"] { + width:auto; +} + +div.sphinxsidebar #searchbox input[type="submit"] { + width:auto; } \ No newline at end of file diff --git a/doc/tutorials/introduction/android_binary_package/O4A_SDK.rst b/doc/tutorials/introduction/android_binary_package/O4A_SDK.rst index b426c5c1e..7aed35121 100644 --- a/doc/tutorials/introduction/android_binary_package/O4A_SDK.rst +++ b/doc/tutorials/introduction/android_binary_package/O4A_SDK.rst @@ -159,8 +159,8 @@ Get the OpenCV4Android SDK unzip ~/Downloads/OpenCV-2.4.3-android-sdk.zip -.. |opencv_android_bin_pack| replace:: OpenCV-2.4.3-android-sdk.zip -.. _opencv_android_bin_pack_url: http://sourceforge.net/projects/opencvlibrary/files/opencv-android/2.4.3/OpenCV-2.4.3-android-sdk.zip/download +.. |opencv_android_bin_pack| replace:: OpenCV-2.4.3.2-android-sdk.zip +.. _opencv_android_bin_pack_url: http://sourceforge.net/projects/opencvlibrary/files/opencv-android/2.4.3/OpenCV-2.4.3.2-android-sdk.zip/download .. |opencv_android_bin_pack_url| replace:: |opencv_android_bin_pack| .. |seven_zip| replace:: 7-Zip .. _seven_zip: http://www.7-zip.org/ @@ -186,6 +186,8 @@ Import OpenCV library and samples to the Eclipse Each sample included into the |opencv_android_bin_pack| is a regular Android project that already references OpenCV library.Follow the steps below to import OpenCV and samples into the workspace: + .. note:: OpenCV samples are indeed **dependent** on OpenCV library project so don't forget to import it to your workspace as well. + * Right click on the :guilabel:`Package Explorer` window and choose :guilabel:`Import...` option from the context menu: @@ -213,13 +215,21 @@ Import OpenCV library and samples to the Eclipse and you have to wait some time while it is building OpenCV samples. Just give a minute to Eclipse to complete initialization. - .. note :: After the initial import, on a non-Windows (Linux and Mac OS) operating system Eclipse + .. warning :: After the initial import, on a non-Windows (Linux and Mac OS) operating system Eclipse will still show build errors for applications with native C++ code. To resolve the issues, please do the following: Open :guilabel:`Project Properties -> C/C++ Build`, and replace "Build command" text to ``"${NDKROOT}/ndk-build"`` (remove .cmd at the end). + .. note :: In some cases the build errors don't disappear, then try the following actions: + + * right click on ``OpenCV Library`` project -> :guilabel:`Android Tools -> Fix Project Properties`, + then menu :guilabel:`Project -> Clean... -> Clean all` + * right click on the project with errors -> :guilabel:`Properties -> Android`, make sure the + ``Target`` is selected and is ``Android 3.0`` or higher + * check the build errors in the :guilabel:`Problems` view window and try to resolve them by yourselves + .. image:: images/eclipse_cdt_cfg4.png :alt: Configure CDT :align: center @@ -235,14 +245,14 @@ Import OpenCV library and samples to the Eclipse Running OpenCV Samples ---------------------- -At this point you should be able to build and run the samples. Keep in mind, that ``face-detection``, -``Tutorial 3`` and ``Tutorial 4`` include some native code and require Android NDK and CDT plugin -for Eclipse to build working applications. If you haven't installed these tools see the corresponding -section of :ref:`Android_Dev_Intro`. +At this point you should be able to build and run the samples. Keep in mind, that +``face-detection``, ``Tutorial 3` and ``Tutorial 4`` include some native code and +require Android NDK and CDT plugin for Eclipse to build working applications. If you haven't +installed these tools, see the corresponding section of :ref:`Android_Dev_Intro`. -Also, please consider that ``Tutorial 0`` and ``Tutorial 1`` samples use Java Camera API that -definitelly accessible on emulator from the Android SDK. -Other samples use OpenCV Native Camera which may not work with emulator. +.. warning:: Please consider that some samples use Android Java Camera API, which is accessible + with an AVD. But most of samples use OpenCV Native Camera which **may not work** with + an emulator. .. note:: Recent *Android SDK tools, revision 19+* can run ARM v7a OS images but they available not for all Android versions. @@ -282,6 +292,40 @@ Well, running samples from Eclipse is very simple: If you have no access to the *Market*, which is often the case with emulators - you will need to install the packages from OpenCV4Android SDK folder manually. See :ref:`manager_selection` for details. + .. code-block:: sh + :linenos: + + /platform-tools/adb install /apk/OpenCV_2.4.3_Manager_armv7a-neon.apk + + .. note:: ``armeabi``, ``armv7a-neon``, ``arm7a-neon-android8``, ``mips`` and ``x86`` stand for + platform targets: + + * ``armeabi`` is for ARM v5 and ARM v6 architectures with Android API 8+, + + * ``armv7a-neon`` is for NEON-optimized ARM v7 with Android API 9+, + + * ``arm7a-neon-android8`` is for NEON-optimized ARM v7 with Android API 8, + + * ``mips`` is for MIPS architecture with Android API 9+, + + * ``x86`` is for Intel x86 CPUs with Android API 9+. + + If using hardware device for testing/debugging, run the following command to learn + its CPU architecture: + + .. code-block:: sh + + adb shell getprop ro.product.cpu.abi + + If you're using an AVD emulator, go :menuselection:`Window > AVD Manager` to see the + list of availible devices. Click :menuselection:`Edit` in the context menu of the + selected device. In the window, which then pop-ups, find the CPU field. + + You may also see section :ref:`manager_selection` for details. + + + When done, you will be able to run OpenCV samples on your device/emulator seamlessly. + * Here is ``Tutorial 2 - Use OpenCV Camera`` sample, running on top of stock camera-preview of the emulator. .. image:: images/emulator_canny.png @@ -289,6 +333,7 @@ Well, running samples from Eclipse is very simple: :alt: Tutorial 1 Basic - 1. Add OpenCV - running Canny :align: center + What's next =========== diff --git a/doc/tutorials/introduction/android_binary_package/android_dev_intro.rst b/doc/tutorials/introduction/android_binary_package/android_dev_intro.rst index 8855c5bd9..a735bc8a7 100644 --- a/doc/tutorials/introduction/android_binary_package/android_dev_intro.rst +++ b/doc/tutorials/introduction/android_binary_package/android_dev_intro.rst @@ -78,7 +78,7 @@ Development in Java You need the following software to be installed in order to develop for Android in Java: -#. **Sun JDK 6** +#. **Sun JDK 6** (Sun JDK 7 is also possible) Visit `Java SE Downloads page `_ and download an installer for your OS. @@ -103,9 +103,10 @@ You need the following software to be installed in order to develop for Android Here is Google's `install guide `_ for the SDK. - .. note:: If you choose SDK packed into a Windows installer, then you should have 32-bit JRE - installed. It is not a prerequisite for Android development, but installer is a x86 - application and requires 32-bit Java runtime. + .. note:: You can choose downloading ``ADT Bundle package`` that in addition to Android SDK Tools includes + Eclipse + ADT + CDT plugins, Android Platform-tools, the latest Android platform and the latest + Android system image for the emulator - this is the best choice for those who is setting up Android + development environment the first time! .. note:: If you are running x64 version of Ubuntu Linux, then you need ia32 shared libraries for use on amd64 and ia64 systems to be installed. You can install them with the @@ -215,45 +216,11 @@ You need the following software to be installed in order to develop for Android #. **CDT plugin for Eclipse** + If you selected for installation the ``NDK plugins`` component of Eclipse ADT plugin (see the picture above) your Eclipse IDE + should already have ``CDT plugin`` (that means ``C/C++ Development Tooling``). 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. - Make sure your Eclipse IDE has the :abbr:`CDT(C/C++ Development Tooling)` plugin - installed. Menu :guilabel:`Help -> About Eclipse SDK -> Installation Details`. - - .. image:: images/eclipse_about_cdt_0.png - :alt: CDT in Eclipse About - :align: center - - .. - - .. image:: images/eclipse_about_cdt_1.png - :alt: CDT in Eclipse About - :align: center - - .. note:: If you're using the latest ADT plugin for Eclipse (version 20 and above), most likely - you already have the CDT plugin and don't need to install it. - - .. image:: images/eclipse_about_cdt_1.png - :alt: CDT in Eclipse About - :align: center - - To install the `CDT plugin `_ use menu - :guilabel:`Help -> Install New Software...`, then paste the CDT 8.0 repository URL - http://download.eclipse.org/tools/cdt/releases/indigo as shown in 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 - - ``CDT Main Features`` should be enough: - - .. image:: images/eclipse_inst_cdt_2.png - :alt: Configure builders - :align: center - - That's it. Compilation of C++ code is fully integrated into Eclipse building process now. Android application structure @@ -336,9 +303,9 @@ and exceptions are used in C++, it also should be created. Example of the file : APP_CPPFLAGS := -frtti -fexceptions APP_ABI := all -.. note:: We recommend setting ``APP_ABI := all`` for all targets. If you want to specify the - target explicitly, use ``armeabi`` for ARMv5/ARMv6, ``armeabi-v7a`` for ARMv7, ``x86`` - for Intel Atom or ``mips`` for MIPS. +.. note:: We recommend setting ``APP_ABI := all`` for all targets. If you want to specify the + target explicitly, use ``armeabi`` for ARMv5/ARMv6, ``armeabi-v7a`` for ARMv7, ``x86`` + for Intel Atom or ``mips`` for MIPS. .. _NDK_build_cli: @@ -348,6 +315,11 @@ Building application native part from command line Here is the standard way to compile C++ part of an Android application: +.. warning:: We strongly reccomend using ``cmd.exe`` (standard Windows console) instead of Cygwin on + **Windows**. Use the latter if only you're absolutely sure about, what you're doing. Cygwin + is not really supported and we are unlikely to help you in case you encounter some + problems with it. So, use it only if you're capable of handling the consequences yourself. + #. Open console and go to the root folder of an Android application .. code-block:: bash @@ -361,7 +333,7 @@ Here is the standard way to compile C++ part of an Android application: /ndk-build .. note:: On Windows we recommend to use ``ndk-build.cmd`` in standard Windows console (``cmd.exe``) - rather than the similar ``bash`` script in ``Cygwin`` shell. + rather than the similar ``bash`` script in ``Cygwin`` shell. .. image:: images/ndk_build.png :alt: NDK build @@ -401,12 +373,19 @@ Eclipse build process. We recommend the approach based on Eclipse (e.g. ``"X:\\Apps\\android-ndk-r8"`` or ``"/opt/android-ndk-r8"``). **On Windows** an environment variable can be set via - :guilabel:`My Computer -> Properties -> Advanced -> Environment variables` and restarting Eclipse. + :guilabel:`My Computer -> Properties -> Advanced -> Environment variables`. On Windows 7 it's also possible to use `setx `_ command in a console session. **On Linux** and **MacOS** an environment variable can be set via appending a ``"export VAR_NAME=VAR_VALUE"`` line to the :file:`"~/.bashrc"` file and logging off and then on. + .. note:: It's also possible to define the ``NDKROOT`` environment variable within Eclipse IDE, + but it should be done for every new workspace you create. If you prefer this option better than setting system + environment variable, open Eclipse menu :guilabel:`Window -> Preferences -> C/C++ -> Build -> Environment`, + press the :guilabel:`Add...` button and set variable name to ``NDKROOT`` and value to local Android NDK path. + +#. After that you need to **restart Eclipse** to apply the changes. + #. Open Eclipse and load the Android app project to configure. #. Add C/C++ Nature to the project via Eclipse menu :guilabel:`New -> Other -> C/C++ -> Convert to a C/C++ Project`. @@ -463,11 +442,20 @@ Eclipse build process. We recommend the approach based on Eclipse :: + # for NDK r8 and prior: ${NDKROOT}/platforms/android-9/arch-arm/usr/include ${NDKROOT}/sources/cxx-stl/gnu-libstdc++/include ${NDKROOT}/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include ${ProjDirPath}/../../sdk/native/jni/include + :: + + # for NDK r8b and later: + ${NDKROOT}/platforms/android-9/arch-arm/usr/include + ${NDKROOT}/sources/cxx-stl/gnu-libstdc++/4.6/include + ${NDKROOT}/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include + ${ProjDirPath}/../../sdk/native/jni/include + The last path should be changed to the correct absolute or relative path to OpenCV4Android SDK location. This should clear the syntax error notifications in Eclipse C++ editor. @@ -476,16 +464,6 @@ Eclipse build process. We recommend the approach based on Eclipse :alt: Configure CDT :align: center - .. note:: The latest Android NDK **r8b** uses different STL headers path. So if you use this NDK - release add the following **Include** paths list instead: - - :: - - ${NDKROOT}/platforms/android-9/arch-arm/usr/include - ${NDKROOT}/sources/cxx-stl/gnu-libstdc++/4.6/include - ${NDKROOT}/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include - ${ProjDirPath}/../../sdk/native/jni/include - Debugging and Testing ===================== @@ -666,8 +644,8 @@ execute :command:`adb devices` command. You will see the list of attached device :alt: List of attached devices :align: center -MacOS host computer -^^^^^^^^^^^^^^^^^^^ +Mac OS host computer +^^^^^^^^^^^^^^^^^^^^ No actions are required, just connect your device via USB and run ``adb devices`` to check connection. What's next diff --git a/doc/tutorials/introduction/android_binary_package/images/eclipse_about_cdt_0.png b/doc/tutorials/introduction/android_binary_package/images/eclipse_about_cdt_0.png deleted file mode 100644 index 79e43690b..000000000 Binary files a/doc/tutorials/introduction/android_binary_package/images/eclipse_about_cdt_0.png and /dev/null differ diff --git a/doc/tutorials/introduction/android_binary_package/images/eclipse_about_cdt_1.png b/doc/tutorials/introduction/android_binary_package/images/eclipse_about_cdt_1.png deleted file mode 100644 index 9b2c9b136..000000000 Binary files a/doc/tutorials/introduction/android_binary_package/images/eclipse_about_cdt_1.png and /dev/null differ diff --git a/doc/tutorials/introduction/android_binary_package/images/eclipse_about_cdt_2.png b/doc/tutorials/introduction/android_binary_package/images/eclipse_about_cdt_2.png deleted file mode 100644 index c061a2074..000000000 Binary files a/doc/tutorials/introduction/android_binary_package/images/eclipse_about_cdt_2.png and /dev/null differ diff --git a/modules/imgproc/src/hough.cpp b/modules/imgproc/src/hough.cpp index 6b5c2e45c..3e737d8bb 100644 --- a/modules/imgproc/src/hough.cpp +++ b/modules/imgproc/src/hough.cpp @@ -118,8 +118,8 @@ icvHoughLinesStandard( const CvMat* img, float rho, float theta, float ang = 0; for(int n = 0; n < numangle; ang += theta, n++ ) { - tabSin[n] = (float)(sin(ang) * irho); - tabCos[n] = (float)(cos(ang) * irho); + tabSin[n] = (float)(sin((double)ang) * irho); + tabCos[n] = (float)(cos((double)ang) * irho); } // stage 1. fill accumulator diff --git a/modules/java/generator/src/java/android+JavaCameraView.java b/modules/java/generator/src/java/android+JavaCameraView.java index ce50d66a9..c3d8f564e 100644 --- a/modules/java/generator/src/java/android+JavaCameraView.java +++ b/modules/java/generator/src/java/android+JavaCameraView.java @@ -124,7 +124,7 @@ public class JavaCameraView extends CameraBridgeViewBase implements PreviewCallb params.setPreviewSize((int)frameSize.width, (int)frameSize.height); List FocusModes = params.getSupportedFocusModes(); - if (FocusModes.contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO)) + if (FocusModes != null && FocusModes.contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO)) { params.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO); } diff --git a/modules/ts/misc/perf_tests_timing.py b/modules/ts/misc/perf_tests_timing.py new file mode 100644 index 000000000..70d2aa2f0 --- /dev/null +++ b/modules/ts/misc/perf_tests_timing.py @@ -0,0 +1,106 @@ +#!/usr/bin/env python + +import testlog_parser, sys, os, xml, glob, re +from table_formatter import * +from optparse import OptionParser +from operator import itemgetter, attrgetter +from summary import getSetName, alphanum_keyselector + +if __name__ == "__main__": + usage = "%prog .xml [...]" + parser = OptionParser(usage = usage) + + parser.add_option("-o", "--output", dest = "format", + help = "output results in text format (can be 'txt', 'html' or 'auto' - default)", + metavar = 'FMT', default = 'auto') + + (options, args) = parser.parse_args() + if 1 != len(args): + parser.print_help() + exit(0) + + options.generateHtml = detectHtmlOutputType(options.format) + + # expand wildcards and filter duplicates + file = os.path.abspath(args[0]) + if not os.path.isfile(file): + sys.stderr.write("IOError reading \"" + file + "\" - " + str(err) + os.linesep) + parser.print_help() + exit(0) + + # read all passed files + test_sets = [] + try: + tests = testlog_parser.parseLogFile(file) + if tests: + test_sets.append((os.path.basename(file), tests)) + except IOError as err: + sys.stderr.write("IOError reading \"" + file + "\" - " + str(err) + os.linesep) + except xml.parsers.expat.ExpatError as err: + sys.stderr.write("ExpatError reading \"" + file + "\" - " + str(err) + os.linesep) + + if not test_sets: + sys.stderr.write("Error: no test data found" + os.linesep) + quit() + + # find matches + setsCount = len(test_sets) + test_cases = {} + + name_extractor = lambda name: str(name) + + for i in range(setsCount): + for case in test_sets[i][1]: + name = name_extractor(case) + if name not in test_cases: + test_cases[name] = [None] * setsCount + test_cases[name][i] = case + + testsuits = [] # testsuit name, time, flag for failed tests + + prevGroupName = None + suit_time = 0 + has_failed = False + for name in sorted(test_cases.iterkeys(), key=alphanum_keyselector): + cases = test_cases[name] + + groupName = next(c for c in cases if c).shortName() + if groupName != prevGroupName: + if prevGroupName != None: + testsuits.append({'name': prevGroupName, 'time': suit_time, \ + 'failed': has_failed}) + has_failed = False + suit_time = 0 + prevGroupName = groupName + + for i in range(setsCount): + case = cases[i] + if not case is None: + if case.get('status') == 'run': + suit_time += case.get('time') + if case.get('status') == 'failed': + has_failed = True + + tbl = table() + + # header + tbl.newColumn('name', 'Name of testsuit', align = 'left', cssclass = 'col_name') + tbl.newColumn('time', 'Time (ms)', align = 'left', cssclass = 'col_name') + tbl.newColumn('failed', 'Failed tests', align = 'center', cssclass = 'col_name') + + # rows + for suit in sorted(testsuits, key = lambda suit: suit['time'], reverse = True): + tbl.newRow() + tbl.newCell('name', suit['name']) + tbl.newCell('time', formatValue(suit['time'], '', ''), suit['time']) + if (suit['failed']): + tbl.newCell('failed', 'Yes') + else: + tbl.newCell('failed', ' ') + + # output table + if options.generateHtml: + tbl.htmlPrintTable(sys.stdout) + htmlPrintFooter(sys.stdout) + else: + tbl.consolePrintTable(sys.stdout) \ No newline at end of file diff --git a/modules/ts/misc/testlog_parser.py b/modules/ts/misc/testlog_parser.py index ce55b8b1d..f61b47bba 100755 --- a/modules/ts/misc/testlog_parser.py +++ b/modules/ts/misc/testlog_parser.py @@ -30,6 +30,7 @@ class TestInfo(object): self.parseLongMetric(xmlnode, "mean"); self.parseLongMetric(xmlnode, "stddev"); self.parseFloatMetric(xmlnode, "gstddev"); + self.parseFloatMetric(xmlnode, "time"); def parseLongMetric(self, xmlnode, name, default = 0): if xmlnode.hasAttribute(name): @@ -78,6 +79,8 @@ class TestInfo(object): val = self.metrix.get(name, None) if not val: return val + if name == "time": + return self.metrix.get("time") if name in ["gmean", "min", "mean", "median", "stddev"]: scale = 1.0 frequency = self.metrix.get("frequency", 1.0) or 1.0 diff --git a/samples/android/color-blob-detection/AndroidManifest.xml b/samples/android/color-blob-detection/AndroidManifest.xml index 9d0409282..d322ba27d 100644 --- a/samples/android/color-blob-detection/AndroidManifest.xml +++ b/samples/android/color-blob-detection/AndroidManifest.xml @@ -26,7 +26,7 @@ android:largeScreens="true" android:anyDensity="true" /> - + diff --git a/samples/android/tutorial-3-native/AndroidManifest.xml b/samples/android/tutorial-3-native/AndroidManifest.xml index 770474527..164b81d8d 100644 --- a/samples/android/tutorial-3-native/AndroidManifest.xml +++ b/samples/android/tutorial-3-native/AndroidManifest.xml @@ -26,7 +26,7 @@ android:largeScreens="true" android:anyDensity="true" /> - +