Bookmark and Share

Software Topics

Developing OpenCV Applications on Android
4 replies [Last post]
Eric Gregori
Eric Gregori's picture
Offline
Last seen: 4 years 16 weeks ago
Level 6: Enchanter
Joined: 2011-08-16
Points: 202

Last month Google took a big step in making Android development significantly easier by introducing ADT bundles.

In the past, creating an Android host development system required downloading various software tools from across the internet.  The process was not complex but never seemed to go as smoothly as expected.  In the past you would expect to spend one or two days setting up a host development system.

The ADT bundle makes setting up a host development system as easy as donloding a single file and clicking on it.  The ADT bundle includes all the software tools in a single ziped-up file.  You still need to download a JRE seperately, but you may already have one installed on your machine.  

My experience using the ADT bundle was on a Macbook Air.  I download the ADT bundle for Mac from the Android developers website ( http://developer.android.com/sdk/index.html ) and unzipped it.  It worked directly out of the box ( I must have installed a JRE sometime in the past ).  After unzipping the file, simply click on the Eclipse executable and you are up and running.  By default, the latest SDK is preloaded ( it was API 17 ).

 

 

Of-course the first thing I wanted to do after getting the Android tools working was to build OpenCV4Android.  This process is not as smooth.  I downloaded the OpenCV4Android SDK ( http://sourceforge.net/projects/opencvlibrary/files/opencv-android/2.4.3/OpenCV-2.4.3-android-sdk.zip/download ) and unzipped it.

Unfortunately, the OpenCV SDK has a bug. The fix is described here ( http://answers.opencv.org/question/4209/build-errors-after-opencv-library-import/ ).   Remove .settings folder from <OpenCV-2.4.3-android-sdk>/sdk/java folder before import to Eclipse.

After downloading and unzipping the SDK, go into the sdk and delete the .setting file in the path specified above.  

Importing the OpenCV SDK into Eclipse is done using these instructions ( http://docs.opencv.org/doc/tutorials/introduction/android_binary_package/O4A_SDK.html ) "Import OpenCV Library and Samples into Eclipse".

After importing the OpenCV sdk,  you have to modify some of the sample and tutorial project properties accordin to this note: 

Note

 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 Project Properties -> C/C++ Build, and replace “Build command” text to "${NDKROOT}/ndk-build" (remove .cmd at the end).

 

At this point, all the OpenCV examples and tutorials built.

 

 

 

Next step,  getting the ADB working.

 

 

 

 

 

Nitin Garg
Offline
Last seen: 4 weeks 1 day ago
Level 1: Prestidigitator
Joined: 2019-09-23
Points: 4

Install Jelly beans OS in your phone devices & it will be work. 

Android App Development Company

Eric Gregori
Eric Gregori's picture
Offline
Last seen: 4 years 16 weeks ago
Level 6: Enchanter
Joined: 2011-08-16
Points: 202

The OpenCV4Android Java API documentation can be hard to find.  Here is the link.

 

http://docs.opencv.org/java/

 

 

Eric Gregori
Eric Gregori's picture
Offline
Last seen: 4 years 16 weeks ago
Level 6: Enchanter
Joined: 2011-08-16
Points: 202

I decided to look into the Android graphical layout tool to design the GUI for my latest project.   I have always created my GUI's programmatically in the past, but this tool makes it easy to create GUI's by simply dragging and dropping widgets on the screen.

The experience is similar to creating GUI's using Visual Studio.  Clicking on the widgets brings its properties into focus in the window on the lower left.  

http://developer.android.com/tools/help/adt.html#graphical-editor

http://www.techotopia.com/index.php/Designing_an_Android_User_Interface_...

Eric Gregori
Eric Gregori's picture
Offline
Last seen: 4 years 16 weeks ago
Level 6: Enchanter
Joined: 2011-08-16
Points: 202

If you are likely enough to have Android 4.2 (Jelly Bean) installed on your device, you will mote that the developer menu is not available.

 

To enable it (   http://developer.android.com/about/versions/jelly-bean.html    ):

 

The Android 4.2 system includes a variety of new developer options that make it easier to create great looking apps that perform well. The new options expose features for debugging and profiling your app from any device or emulator.

On devices running Android 4.2, developer options are hidden by default, helping to create a better experience for users. You can reveal the developer options at any time by tapping 7 times on Settings > About phone > Build number on any compatible Android device.

I guess there is no place like home?