Sources and resources for project LynxSight are organized in Eclipse Android
projects. Eclipse is used because of availability and suitability of tools used in
developing of project. Setting up Eclipse IDE is section 1.2. Besides setting up the IDE
Android development tools ADT and NDK for native development are presented. In
this section are also presented used third-party libraries such Tesseract OCR tool and
OpenCV library to increase of officiency of manipulating with rastr-based images.
Finally, requirement of the majority of Android-based devices compatibility should be
met. Therefore Android support modul is integrated to the project to ensure smoothly
run of application on devices with older version of OS Android. Some of mentioned
development tools are integrated to Tegra Android development pack presented by
NVIDIA. Usage of this pack is highly recommended for unexperienced, but also
becouse of development efficiency experienced developers too.
1.1.1 Operating system
• Windows XP (32-bit), Vista (32- or 64-bit), or Windows 7 (32- or 64-bit)
• Mac OS X 10.5.8 or later (x86 only)
• Linux (tested on Ubuntu Linux, Lucid Lynx) o GNU C Library (glibc) 2.7 or later is required. o On Ubuntu Linux, version 8.04 or later is required. o 64-bit distributions must be capable of running 32-bit applications.
1.1.2 Eclipse IDE
• Eclipse 3.6.2 (Helios) or greater
Note: Eclipse 3.5 (Galileo) is no longer supported with the latest version of ADT.
• Eclipse JDT plugin (included in most Eclipse IDE packages)
• JDK 6 (JRE alone is not sufficient)
• Android Development Tools plugin (recommended)
• Not compatible with GNU Compiler for Java (gcj)
1.1.3 Other development enviroments
• JDK 6 (JRE alone is not sufficient)
• NDK
• For all development platforms, GNU Make 3.81 or later is required. Earlier versions of GNU Make might work but have not been tested.
• A recent version of awk (either GNU Awk or Nawk) is also required.
• For Windows, Cygwin 1.7 or higher is required. The NDK will not work with Cygwin 1.5 installations.
• Apache Ant 1.8 or later
• Not compatible with Gnu Compiler for Java (gcj)
Note: Some Linux distributions may include JDK 1.4 or Gnu Compiler for Java, both of which are not supported for Android development.
There are two approaches to properly set up development enviroment for running
project LynxSight. First is download and install all development tools separatelly and
avoid installing development tools which could be useless. Second approach expects
download and installation of Tegra android development pack. This option si
recommended for developers less experienced in android development and also every
developer which has not configured his enviroment yet. Consider properly which
approach would you choose before started developing.
1.2.1 Tegra android development pack
Tegra android development pack includes all software tools required to develop
for Android platform. The pack is availiable to download at
https://developer.nvidia.com/tegra-android-development-pack. Before downloading
registering at NVIDIA developer zone and signing up is required. To be able to get the
pack you have to apply Tegra registered developer program. After application it is
necessary to wait until your request is approved. After installation file is run you are
forced to choose which tools you want to download and install.
Select
• Eclipse IDE
• Android Software development kit (SDK including ADT)
• Android Native development kit (NDK)
• Cygwin (when using Windows OS)
• Apache Ant
LynxSight System reference
• Java development kit (JDK)
• OpenCV for Android platform
Use of current version of development tools is highly recommended option.
Download and installation can take even several hours according to local internet
connection and variety of selected Android SDK versions. It is recommended to install
tools for every version since Android API 7.
Notice where are tools installed and properly set system enviroment variables to
Cygwin, Android SDK, JDK, NDK and Apache ant. To set system enviroment variables
go to Control panel – System – Advanced system settings – Enviroment variables. Edit
Path variable with addition of Path of mentioned tools above if they have not been set
yet.
1.2.2 Integrating Eclipse IDE
Different status of developer means different configuration. If you are using Tegra
android development pack, your Eclipse IDE should be binded with Android SDK and
NDK. If it is not, or different approach is used, including building enviroment from
scratch or adding tools to existing Eclipse enviroment, several steps should be
performed.
To import LynxSight project to Eclipse IDE go to File – Import – Existing Projects
into Workspace, select Browse and find destination of Eclipse project LynxSight in file
system. Project appears in local Workspace. Probably it would contains errors and
additional configuration is required.
1.2.3 Android Development Tools
In Tegra version check if Android SDK is properly set. Android SDK is core of
Android Development Tools. Android development tools provide tools to compile,
debug, run and test android applications. Also Android device emulator is included. At
Windows – Preferences – Android check SDK Location which should match the
location of Android SDK in file system.
In non Tegra version when Android SDK is not present, install perform the
following steps:
1.2.4 Android NDK
In Tegra version check if Android Native Developmen Kit (NDK) Path is properly
set. The NDK is a toolset that allows you to implement parts of your app using native-
code languages such as C and C++. At Windows – Preferences – Android - NDK check
the NDK Location which should match the location of Android NDK in file system. In
project LynxSight native modul Tesseract and OpenCV for Android are used.
In non Tegra version download Android NDK from
http://developer.android.com/tools/sdk/ndk/index.html and unzip to the file system.
Then set the NDK path as was described above.
If project was imported incorrectly, or there is need for creating new project and
importing source and resource files manually, follow the following steps. Right click to
the project – Android tools – Add native support. Check if jni directory was generated.
1.2.5 Tesseract for Android
Project LynxSight already contains tess-two.jar library in libs directory. It also
contains required .so files liblept and libtess in libs/armeabi and libs/armeabi-v7a
folders. If you build your project using Windows you may use this compilated libraries.
However, if you build your project in another operating system you should build
Tesseract engine by yourself. Download the source or clone this git repository at
https://github.com/rmtheis/tess-two. This project contains tools for compiling the
Tesseract, Leptonica, and JPEG libraries for use on Android. It contains an Eclipse
Android library project that provides a Java API for accessing natively-compiled
Tesseract and Leptonica APIs. Go to your Android.mk file and add the following lines
between include $(CLEAR_VARS) and include $(BUILD_SHARED_LIBRARY:
APP_PLATFORM := android-7
Use command line to build Tesseract 3.02 toolset for Android. Set current
directory to directory where you downloaded tess-two project. Now you are going to
build tesseract for your OS enviroment. Make sure you have set enviroment variables to
android NDK, android SDK and Apache ant. Variable --path means path to your tess-
two project.
cd <project-directory>/tess-two ndk-build android update project --path . ant release After succesfull build of tesseract project import tesseract project to your
Workspace. Then right click to the project Tesseract – Properties – Android –Check Is
library radio button. After that copy tess-two.jar library from Tesseract project build
folder to libs folder of your project. Also copy content of Tesseract libs folder to your
libs folder. It contains required native .so libraries for tesseract and leptonica support.
Then right click to your project – Android tools – Fix Project properties to make sure
tesseract tools are ready to use.
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 resolce the
issues, please do the following: Open Project Properties -> C/C++ Build, and replace
“Build command” text to "${NDKROOT}/ndk-build" (remove .cmd at the end). </project-directory>
1.2.6 OpenCV for Android
OpenCV is toolset for image processing. It is important element of LynxSight
project becouse of presence of Decomposition modul. OpenCV for Android toolset is
also integrated in Tegra android development pack.
Once using Tegra android development kit, OpenCV toolset project should be
installed. Find the project in NVIDIA pack and inport to the Workspace. Reference your
project to project of OpenCV or reference to it’s library. To reference to OpenCV
project right click to the project OpenCV – Properties – Android – Check Is library
radio button and then right click to your project – Properties – Android – Add and select
library project OpenCV for Android. Make also sure, that OpenCV is placed in the
same directory.
Another way, which is more common is to import OpenCV .jar library to your
project. Once the OpenCV project is labeled as Library project, opencv library –
2.4.5.jar is placed in its bin folder. Copy this library to the libs folder of your project.
The same way is Tesseract for Android imported.
If you are not using Tegra android development pack, download OpenCV for
android SDK at http://sourceforge.net/projects/opencvlibrary/files/opencv-android/ .
Unzip the pack into the particular folder and notice the path. Follow the instructions like
Tegra pack user described above.
Go to your Android.mk file and add the following lines between include
$(CLEAR_VARS) and include $(BUILD_SHARED_LIBRARY:
OPENCV_CAMERA_MODULES:=on OPENCV_INSTALL_MODULES:=on An example is shown on Pic. 1.
Pic 1 Example of Android.mk file used in project LynxSight
For more information abou setting up the OpenCV for Android toolset follow the
instructions at:
http://docs.opencv.org/doc/tutorials/introduction/android_binary_package/O4A_S
DK.html#get-the-opencv4android-sdk
1.2.7 Android support v7
Although there is a presumption, that software developed with official android
development tools should be able to run at most android based devices, the whole
system involve and older version use not to respect new features. That is why Android
support v7 is used. In project LynxSight it brings compatible action bar to all Android
versions since Android SDK version 7.
To get Android support v7 library follow the following instructions:
Fill metadata in uses-sdk tab in your Android manifest file. MinSdkVersion field is
required.
<uses-sdk android:minsdkversion="7" android:targetsdkversion="17">
After installing the particular packages in your AVD manager notice their location
and import project Android support v7 appcompat to your Workspace. Then put a
reference from your project to the Android support project. It is important to use project
reference instead of library reference becouse resource files in Android support project.
Putting a project reference process is described in OpenCV and also Tesseract section.
For troubleshooting and more details about Android support v7 setup follow
http://developer.android.com/tools/support-library/setup.html </uses-sdk>