Difference between revisions of "Android support"

From BoofCV
Jump to navigationJump to search
(Clarified several points about android support)
(Rewrote for new Android support)
Line 1: Line 1:
= Android Support =
= Android Support =


'''BoofCV and required jars will all run on Android as is without any modifications.''' However, since Android does not support swing be sure not to call any GUI functions provided in the library or else it will crashAll the core functions in BoofCV are compatible with Android. It is not necessary to remove the classes from the jars which invoke swing, just don't call them.
BoofCV will work without modification on Android systems, however to call image processing routines you will need to convert Bitmap into BoofCV image types.  Converting image using pixel RGB values is extremely slow, instead use the optimized conversion routinesThese routines are provided as an optional add-on in the integration directoryThese routines have been tested on Android 2.3.3 API and will most likely work on even earlier versions.


The one key piece of functionality missing for running on Android is a function that converts Android Bitmaps into BoofCV images.  [[User:Maarten_Van_Lier|Maarten]] has provided unoptimized source code for converting bitmaps into BoofCV images at his thesis website [http://dl.dropbox.com/u/16413201/BoofCV%20v0.2%20Partial%20Android%20Port.zip].
* [http://boofcv.org/javadoc/integration/boofcv/android/ConvertBitmap.html ConvertBitmap JavaDoc]


Better and more complete Android support will be added in the futureContributions of welcome.
A free diagnostic Android app is available in the Google Play store.  The app will run a series of benchmarks and can be used to visually inspect the correctness of conversion routines.  To help BoofCV development please submit the resultsSee the wiki link for more information on the benchmark app.


== Partial Android Port of BoofCV v0.2 ==
* [[Android_benchmark_app|Benchmark App Wiki]]
* [https://play.google.com/store/apps/details?id=boofcv.benchmark.android Benchmark in Play Store]


For his [[Projects_Using_BoofCV|master thesis]], [[User:Maarten_Van_Lier|Maarten]] made a partial port of BoofCV v0.2 to Android.  Note that the changes listed below are not neccisary to use BoofCV on Android.  The original jar than you can download from the website will work just fine.  However, additional work is need to compile the source code with out Swing.
= Compiling =


In this port, the following was done to get it working:
Source code for Android integration can be found in the 'boofcv/integration/android' directory.  An ant script is provided for compiling the jar file, but needs to be modified so that it points towards your Android API installation. A pre-compiled jar is provided at the usual download location.
* Just use the EJML, GeoRegression and libpja libraries that BoofCV uses, they work on Android as is.
* Modify the core.image.ConvertBufferedImage class to the core.image.ConvertBitmap class. This new class uses BufferedImages and Android API calls to do the same as the ConvertBufferedImage class. The implementation is not as efficient as the original one, though.
* Leave out the gui package because of the java swing windows that were used. It was not needed for the thesis.
* Leave out problematic methods in io.image.UtilIO and remove other classes in io.image, io.video and io.wrapper.images, because they use java swing window calls. They were not needed for the thesis.
* Leave out the methods in testing.BoofTesting that used the BufferedImage class.


Basically, code for loading images was ported, while code to show windows was left out.
= Problems? =
The code is available here[http://dl.dropbox.com/u/16413201/BoofCV%20v0.2%20Partial%20Android%20Port.zip]. Note that this is an incomplete port that may not have what you need, or may not work as expected.
 
* If you try to compile BoofCV in an Android you will get errors due to the swing code. The solution to this problem is to not compile it inside the Android app and instead just link to its jars.

Revision as of 15:34, 22 July 2012

Android Support

BoofCV will work without modification on Android systems, however to call image processing routines you will need to convert Bitmap into BoofCV image types. Converting image using pixel RGB values is extremely slow, instead use the optimized conversion routines. These routines are provided as an optional add-on in the integration directory. These routines have been tested on Android 2.3.3 API and will most likely work on even earlier versions.

A free diagnostic Android app is available in the Google Play store. The app will run a series of benchmarks and can be used to visually inspect the correctness of conversion routines. To help BoofCV development please submit the results. See the wiki link for more information on the benchmark app.

Compiling

Source code for Android integration can be found in the 'boofcv/integration/android' directory. An ant script is provided for compiling the jar file, but needs to be modified so that it points towards your Android API installation. A pre-compiled jar is provided at the usual download location.

Problems?

  • If you try to compile BoofCV in an Android you will get errors due to the swing code. The solution to this problem is to not compile it inside the Android app and instead just link to its jars.