Commit 2124de80 authored by Suenghoon Park's avatar Suenghoon Park

Merge branch 'master' of git://github.com/Itseez/opencv into ocl_hough

parents 8a1d6a1b 132b5d64
...@@ -3,4 +3,4 @@ Java API ...@@ -3,4 +3,4 @@ Java API
******** ********
`Java API reference external link (JavaDoc) <http://docs.opencv.org/java/>`_ Java API reference (JavaDoc): external `link <http://docs.opencv.org/java/>`_.
\ No newline at end of file
********************************************* *********************************************
Base Loader Callback Interface implementation Base Loader Callback Interface Implementation
********************************************* *********************************************
.. highlight:: java .. highlight:: java
.. class:: BaseLoaderCallback .. 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 .. image:: img/AndroidAppUsageModel.png
Using in Java Activity 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 .. code-block:: java
:linenos: :linenos:
...@@ -42,7 +44,7 @@ There is a very base code snippet implementing the async initialization with Bas ...@@ -42,7 +44,7 @@ There is a very base code snippet implementing the async initialization with Bas
@Override @Override
protected void onResume() protected void onResume()
{ {
Log.i(TAG, "called onResume"); Log.i(TAG, "Called onResume");
super.onResume(); super.onResume();
Log.i(TAG, "Trying to load OpenCV library"); 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 ...@@ -55,6 +57,7 @@ There is a very base code snippet implementing the async initialization with Bas
Using in Service Using in Service
---------------- ----------------
Default BaseLoaderCallback implementation treat application context as Activity and calls Activity.finish() method to exit in case of initialization failure. Default ``BaseLoaderCallback`` implementation treats application context as ``Activity`` and calls
To override this behavior you need to override finish() method of BaseLoaderCallback class and implement your own finalization method. ``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.
...@@ -28,7 +28,7 @@ void cancel() ...@@ -28,7 +28,7 @@ void cancel()
.. method:: void cancel() .. method:: void cancel()
Installation if package has been canceled. Installation of package has been cancelled.
void wait_install() void wait_install()
------------------- -------------------
......
...@@ -7,34 +7,38 @@ Introduction ...@@ -7,34 +7,38 @@ Introduction
.. highlight:: java .. 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; #. 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; #. 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; #. Regular updates and bug fixes;
Usage model for target user Usage model for end user
--------------------------- ------------------------
.. image:: img/AndroidAppUsageModel.png .. image:: img/AndroidAppUsageModel.png
First OpenCV app\: First OpenCV app\:
#. Any OpenCV-dependent app is installed from Google Play marketplace or manually; #. Any OpenCV-dependent app is installed from Google Play marketplace or manually;
#. At the first launch, it suggests installing OpenCV Manager; #. At the first launch, it suggests installation of OpenCV Manager;
#. Then OpenCV Manager is downloaded and installed, using Google Play marketplace service. #. Then OpenCV Manager is downloaded and installed, using the Google Play application.
#. When Manager has ben started, the application suggests installing OpenCV library for the target device trough Google Play marketplace if it is necessary; #. When Manager has been started, the application suggests installation of OpenCV library for the
#. After installation is finished, the app may be launched to perform common tasks. 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; #. 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; #. If the selected OpenCV version is not installed, OpenCV Manager suggests installing OpenCV
#. After installation is finished, the app may be launched to perform common tasks. 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 .. image:: img/Structure.png
\ No newline at end of file
...@@ -12,23 +12,27 @@ boolean initDebug() ...@@ -12,23 +12,27 @@ boolean initDebug()
.. method:: static 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; :rtype: boolean;
:return: returns true if initialization of OpenCV was successful. :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() boolean initAsync()
------------------- -------------------
.. method:: static boolean initAsync(String Version, Context AppContext, LoaderCallbackInterface Callback) .. 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 Version: OpenCV Library version.
:param AppContext: application context for connecting to the service. :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; :rtype: boolean;
:return: returns true if initialization of OpenCV starts successfully. :return: returns true if initialization of OpenCV starts successfully.
...@@ -43,10 +47,3 @@ OpenCV version constants ...@@ -43,10 +47,3 @@ OpenCV version constants
.. data:: OPENCV_VERSION_2_4_3 .. data:: OPENCV_VERSION_2_4_3
OpenCV Library 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
...@@ -12,9 +12,9 @@ void onManagerConnected() ...@@ -12,9 +12,9 @@ void onManagerConnected()
.. method:: void onManagerConnected(int status) .. 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() void onPackageInstall()
----------------------- -----------------------
...@@ -23,7 +23,7 @@ void onPackageInstall() ...@@ -23,7 +23,7 @@ void onPackageInstall()
Callback method that is called in case when package installation is needed. 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 Initialization status constants
------------------------------- -------------------------------
...@@ -34,15 +34,15 @@ Initialization status constants ...@@ -34,15 +34,15 @@ Initialization status constants
.. data:: MARKET_ERROR .. data:: MARKET_ERROR
Google Play (Android Market) cannot be invoked Google Play (Android Market) application cannot be invoked
.. data:: INSTALL_CANCELED .. data:: INSTALL_CANCELED
OpenCV library installation was canceled by user OpenCV library installation was cancelled by user
.. data:: INCOMPATIBLE_MANAGER_VERSION .. 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 .. data:: INIT_FAILED
......
...@@ -3,38 +3,7 @@ Manager Workflow ...@@ -3,38 +3,7 @@ Manager Workflow
.. _manager_selection: .. _manager_selection:
OpenCV Manager selection .. include:: ../readme.txt
------------------------
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_<platform_name>.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 |
+----------------------------+-----------------+-----------------------------------------------------+
First application start First application start
----------------------- -----------------------
...@@ -51,7 +20,7 @@ If OpenCV library installation has been approved\: ...@@ -51,7 +20,7 @@ If OpenCV library installation has been approved\:
.. image:: img/LibInstallAproved.png .. image:: img/LibInstallAproved.png
If OpenCV library installation has been canceled\: If OpenCV library installation has been cancelled\:
.. image:: img/LibInstallCanceled.png .. image:: img/LibInstallCanceled.png
......
...@@ -402,10 +402,16 @@ public class ManagerActivity extends Activity ...@@ -402,10 +402,16 @@ public class ManagerActivity extends Activity
protected String NormalizeVersion(String OpenCVersion, String PackageVersion) protected String NormalizeVersion(String OpenCVersion, String PackageVersion)
{ {
if (OpenCVersion == null || PackageVersion == null)
return "unknown";
int dot = PackageVersion.indexOf("."); int dot = PackageVersion.indexOf(".");
return OpenCVersion.substring(0, OpenCVersion.length()-1) + "." + if (dot == -1 || OpenCVersion.length() == 0)
OpenCVersion.toCharArray()[OpenCVersion.length()-1] + "." + return "unknown";
PackageVersion.substring(0, dot) + " rev " + PackageVersion.substring(dot+1); 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) protected String ConvertPackageName(String Name, String Version)
......
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 Since version 1.7 several packages of OpenCV Manager are built. Every package is targeted for some
for package target platform. The internal library is used for most cases, except the rare one, when specific hardware platform and includes corresponding OpenCV binaries. So, in most cases OpenCV
arm-v7a without NEON instruction set processor is detected. In this case additional binary package Manager uses built-in version of OpenCV. Separate package with OpenCV binaries is currently used in
for arm-v7a is used. The new package selection logic in most cases simplifies OpenCV installation a single rare case, when an ARMv7-A processor without NEON support is detected. In this case an
on end user devices. In most cases OpenCV Manager may be installed automatically from Google Play. additional binary package is used. The new package selection logic in most cases simplifies OpenCV
For such case, when Google Play is not available, i.e. emulator, developer board, etc, you can installation on end user devices. In most cases OpenCV Manager may be installed automatically from
install it manually using adb tool: Google Play.
adb install OpenCV-2.4.3-android-sdk/apk/OpenCV_2.4.3.2_Manager_2.4_<platform_name>.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
+----------------------------+-----------------+-----------------------------------------------------+ adb install OpenCV-2.4.3-android-sdk/apk/OpenCV_2.4.3.2_Manager_2.4_<platform>.apk
| Hardware Platform | Android version | Package name |
+============================+=================+=====================================================+ Use the table below to determine proper OpenCV Manager package for your device:
| 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 | | Hardware Platform | Android ver. | Package name |
+----------------------------+-----------------+-----------------------------------------------------+ +==============================+==============+=====================================================+
| armeabi (arm-v5, arm-v6) | >= 2.3 | OpenCV_2.4.3.2_Manager_2.4_armeabi.apk | | armeabi-v7a (ARMv7-A + NEON) | >= 2.3 | OpenCV_2.4.3.2_Manager_2.4_armv7a-neon.apk |
+----------------------------+-----------------+-----------------------------------------------------+ +------------------------------+--------------+-----------------------------------------------------+
| armeabi-v7a (arm-v7a-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-v7a (arm-v7a-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 |
+------------------------------+--------------+-----------------------------------------------------+
...@@ -394,4 +394,12 @@ div.body ul.search li { ...@@ -394,4 +394,12 @@ div.body ul.search li {
div.linenodiv { div.linenodiv {
min-width: 1em; min-width: 1em;
text-align: right; 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
...@@ -159,8 +159,8 @@ Get the OpenCV4Android SDK ...@@ -159,8 +159,8 @@ Get the OpenCV4Android SDK
unzip ~/Downloads/OpenCV-2.4.3-android-sdk.zip 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| 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-android-sdk.zip/download .. _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| .. |opencv_android_bin_pack_url| replace:: |opencv_android_bin_pack|
.. |seven_zip| replace:: 7-Zip .. |seven_zip| replace:: 7-Zip
.. _seven_zip: http://www.7-zip.org/ .. _seven_zip: http://www.7-zip.org/
...@@ -186,6 +186,8 @@ Import OpenCV library and samples to the Eclipse ...@@ -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 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: 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 * Right click on the :guilabel:`Package Explorer` window and choose :guilabel:`Import...` option
from the context menu: from the context menu:
...@@ -213,13 +215,21 @@ Import OpenCV library and samples to the Eclipse ...@@ -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 and you have to wait some time while it is building OpenCV samples. Just give a minute to
Eclipse to complete initialization. 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 will still show build errors for applications with native C++ code. To resolve the
issues, please do the following: issues, please do the following:
Open :guilabel:`Project Properties -> C/C++ Build`, and replace "Build command" text Open :guilabel:`Project Properties -> C/C++ Build`, and replace "Build command" text
to ``"${NDKROOT}/ndk-build"`` (remove .cmd at the end). 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 .. image:: images/eclipse_cdt_cfg4.png
:alt: Configure CDT :alt: Configure CDT
:align: center :align: center
...@@ -235,14 +245,14 @@ Import OpenCV library and samples to the Eclipse ...@@ -235,14 +245,14 @@ Import OpenCV library and samples to the Eclipse
Running OpenCV Samples Running OpenCV Samples
---------------------- ----------------------
At this point you should be able to build and run the samples. Keep in mind, that ``face-detection``, At this point you should be able to build and run the samples. Keep in mind, that
``Tutorial 3`` and ``Tutorial 4`` include some native code and require Android NDK and CDT plugin ``face-detection``, ``Tutorial 3` and ``Tutorial 4`` include some native code and
for Eclipse to build working applications. If you haven't installed these tools see the corresponding require Android NDK and CDT plugin for Eclipse to build working applications. If you haven't
section of :ref:`Android_Dev_Intro`. 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 .. warning:: Please consider that some samples use Android Java Camera API, which is accessible
definitelly accessible on emulator from the Android SDK. with an AVD. But most of samples use OpenCV Native Camera which **may not work** with
Other samples use OpenCV Native Camera which may not work with emulator. an emulator.
.. note:: Recent *Android SDK tools, revision 19+* can run ARM v7a OS images but they available not .. note:: Recent *Android SDK tools, revision 19+* can run ARM v7a OS images but they available not
for all Android versions. for all Android versions.
...@@ -282,6 +292,40 @@ Well, running samples from Eclipse is very simple: ...@@ -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. 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:
<Android SDK path>/platform-tools/adb install <OpenCV4Android SDK path>/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. * Here is ``Tutorial 2 - Use OpenCV Camera`` sample, running on top of stock camera-preview of the emulator.
.. image:: images/emulator_canny.png .. image:: images/emulator_canny.png
...@@ -289,6 +333,7 @@ Well, running samples from Eclipse is very simple: ...@@ -289,6 +333,7 @@ Well, running samples from Eclipse is very simple:
:alt: Tutorial 1 Basic - 1. Add OpenCV - running Canny :alt: Tutorial 1 Basic - 1. Add OpenCV - running Canny
:align: center :align: center
What's next What's next
=========== ===========
......
...@@ -78,7 +78,7 @@ Development in Java ...@@ -78,7 +78,7 @@ Development in Java
You need the following software to be installed in order to develop for Android 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 <http://www.oracle.com/technetwork/java/javase/downloads/>`_ Visit `Java SE Downloads page <http://www.oracle.com/technetwork/java/javase/downloads/>`_
and download an installer for your OS. 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 ...@@ -103,9 +103,10 @@ You need the following software to be installed in order to develop for Android
Here is Google's `install guide <http://developer.android.com/sdk/installing.html>`_ for the SDK. Here is Google's `install guide <http://developer.android.com/sdk/installing.html>`_ for the SDK.
.. note:: If you choose SDK packed into a Windows installer, then you should have 32-bit JRE .. note:: You can choose downloading ``ADT Bundle package`` that in addition to Android SDK Tools includes
installed. It is not a prerequisite for Android development, but installer is a x86 Eclipse + ADT + CDT plugins, Android Platform-tools, the latest Android platform and the latest
application and requires 32-bit Java runtime. 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 .. 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 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 ...@@ -215,45 +216,11 @@ You need the following software to be installed in order to develop for Android
#. **CDT plugin for Eclipse** #. **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 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 compilation process. We recommend the approach based on Eclipse
:abbr:`CDT(C/C++ Development Tooling)` Builder. :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 <http://eclipse.org/cdt/>`_ 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 Android application structure
...@@ -336,9 +303,9 @@ and exceptions are used in C++, it also should be created. Example of the file : ...@@ -336,9 +303,9 @@ and exceptions are used in C++, it also should be created. Example of the file :
APP_CPPFLAGS := -frtti -fexceptions APP_CPPFLAGS := -frtti -fexceptions
APP_ABI := all APP_ABI := all
.. note:: We recommend setting ``APP_ABI := all`` for all targets. If you want to specify the .. 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`` target explicitly, use ``armeabi`` for ARMv5/ARMv6, ``armeabi-v7a`` for ARMv7, ``x86``
for Intel Atom or ``mips`` for MIPS. for Intel Atom or ``mips`` for MIPS.
.. _NDK_build_cli: .. _NDK_build_cli:
...@@ -348,6 +315,11 @@ Building application native part from command line ...@@ -348,6 +315,11 @@ Building application 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:
.. 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 #. Open console and go to the root folder of an Android application
.. code-block:: bash .. code-block:: bash
...@@ -361,7 +333,7 @@ Here is the standard way to compile C++ part of an Android application: ...@@ -361,7 +333,7 @@ Here is the standard way to compile C++ part of an Android application:
<path_where_NDK_is_placed>/ndk-build <path_where_NDK_is_placed>/ndk-build
.. note:: On Windows we recommend to use ``ndk-build.cmd`` in standard Windows console (``cmd.exe``) .. 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 .. image:: images/ndk_build.png
:alt: NDK build :alt: NDK build
...@@ -401,12 +373,19 @@ Eclipse build process. We recommend the approach based on Eclipse ...@@ -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"``). (e.g. ``"X:\\Apps\\android-ndk-r8"`` or ``"/opt/android-ndk-r8"``).
**On Windows** an environment variable can be set via **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 <http://ss64.com/nt/setx.html>`_ command in a console session. On Windows 7 it's also possible to use `setx <http://ss64.com/nt/setx.html>`_ command in a console session.
**On Linux** and **MacOS** an environment variable can be set via appending a **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. ``"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. #. 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`. #. 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 ...@@ -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}/platforms/android-9/arch-arm/usr/include
${NDKROOT}/sources/cxx-stl/gnu-libstdc++/include ${NDKROOT}/sources/cxx-stl/gnu-libstdc++/include
${NDKROOT}/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include ${NDKROOT}/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include
${ProjDirPath}/../../sdk/native/jni/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. 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. 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 ...@@ -476,16 +464,6 @@ Eclipse build process. We recommend the approach based on Eclipse
:alt: Configure CDT :alt: Configure CDT
:align: center :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 Debugging and Testing
===================== =====================
...@@ -666,8 +644,8 @@ execute :command:`adb devices` command. You will see the list of attached device ...@@ -666,8 +644,8 @@ execute :command:`adb devices` command. You will see the list of attached device
:alt: List of attached devices :alt: List of attached devices
:align: center :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. No actions are required, just connect your device via USB and run ``adb devices`` to check connection.
What's next What's next
......
...@@ -118,8 +118,8 @@ icvHoughLinesStandard( const CvMat* img, float rho, float theta, ...@@ -118,8 +118,8 @@ icvHoughLinesStandard( const CvMat* img, float rho, float theta,
float ang = 0; float ang = 0;
for(int n = 0; n < numangle; ang += theta, n++ ) for(int n = 0; n < numangle; ang += theta, n++ )
{ {
tabSin[n] = (float)(sin(ang) * irho); tabSin[n] = (float)(sin((double)ang) * irho);
tabCos[n] = (float)(cos(ang) * irho); tabCos[n] = (float)(cos((double)ang) * irho);
} }
// stage 1. fill accumulator // stage 1. fill accumulator
......
...@@ -124,7 +124,7 @@ public class JavaCameraView extends CameraBridgeViewBase implements PreviewCallb ...@@ -124,7 +124,7 @@ public class JavaCameraView extends CameraBridgeViewBase implements PreviewCallb
params.setPreviewSize((int)frameSize.width, (int)frameSize.height); params.setPreviewSize((int)frameSize.width, (int)frameSize.height);
List<String> FocusModes = params.getSupportedFocusModes(); List<String> 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); params.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO);
} }
......
#!/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 <log_name>.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
...@@ -30,6 +30,7 @@ class TestInfo(object): ...@@ -30,6 +30,7 @@ class TestInfo(object):
self.parseLongMetric(xmlnode, "mean"); self.parseLongMetric(xmlnode, "mean");
self.parseLongMetric(xmlnode, "stddev"); self.parseLongMetric(xmlnode, "stddev");
self.parseFloatMetric(xmlnode, "gstddev"); self.parseFloatMetric(xmlnode, "gstddev");
self.parseFloatMetric(xmlnode, "time");
def parseLongMetric(self, xmlnode, name, default = 0): def parseLongMetric(self, xmlnode, name, default = 0):
if xmlnode.hasAttribute(name): if xmlnode.hasAttribute(name):
...@@ -78,6 +79,8 @@ class TestInfo(object): ...@@ -78,6 +79,8 @@ class TestInfo(object):
val = self.metrix.get(name, None) val = self.metrix.get(name, None)
if not val: if not val:
return val return val
if name == "time":
return self.metrix.get("time")
if name in ["gmean", "min", "mean", "median", "stddev"]: if name in ["gmean", "min", "mean", "median", "stddev"]:
scale = 1.0 scale = 1.0
frequency = self.metrix.get("frequency", 1.0) or 1.0 frequency = self.metrix.get("frequency", 1.0) or 1.0
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
android:largeScreens="true" android:largeScreens="true"
android:anyDensity="true" /> android:anyDensity="true" />
<uses-sdk android:minSdkVersion="8" /> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="11" />
<uses-permission android:name="android.permission.CAMERA"/> <uses-permission android:name="android.permission.CAMERA"/>
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
android:largeScreens="true" android:largeScreens="true"
android:anyDensity="true" /> android:anyDensity="true" />
<uses-sdk android:minSdkVersion="8" /> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="11" />
<uses-permission android:name="android.permission.CAMERA"/> <uses-permission android:name="android.permission.CAMERA"/>
......
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