Android support

From BoofCV
Revision as of 03:44, 12 June 2012 by Peter (talk | contribs) (Clarified several points about android support)
Jump to navigationJump to search

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 crash. All 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.

The one key piece of functionality missing for running on Android is a function that converts Android Bitmaps into BoofCV images. Maarten has provided unoptimized source code for converting bitmaps into BoofCV images at his thesis website [1].

Better and more complete Android support will be added in the future. Contributions of welcome.

Partial Android Port of BoofCV v0.2

For his master thesis, 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.

In this port, the following was done to get it working:

  • 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. The code is available here[2]. Note that this is an incomplete port that may not have what you need, or may not work as expected.