Difference between revisions of "Android support"

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


This page is a summary of what needs to be done to port BoofCV to Android.
'''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 required libraries (EJML, GeoRegression and libpja) can be used without modification on Android.
BoofCV itself is mostly compatible (all algorithms can just be used), but needs some modifications to be able to run:
* Since there is no java swing library, all examples have to be adapted to use the Android activity system.
* Since Android uses Bitmaps instead of BufferedImage, the code that converts BufferedImage objects to the internal representation needs to be changed to work with Bitmap objects.


== Classes that need change ==
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].
Please note that this list is based on the experience of a partial port of BoofCV v0.2.
* core.image
** ConvertBufferedImage needs to use Bitmaps
* gui
** This whole package needs to use Android Activities to show the results instead of java swing windows
* io
** io.image
*** UtilIO needs to use an activity for selectFile, so a file can be selected from the Android file system
*** ImageListManager needs to use Bitmap instead of BufferedImage
*** PlaybackImageSequance needs an activity to play back the sequence
*** ProcessImageSequence needs an activity to process and show the sequence
*** SelectInputImageToolBar is very swing specific and maybe not even needed for Android
*** SimpleImageSequence needs to use Bitmap instead of BufferedImage
*** UtilImageIO needs to use Bitmap instead of BufferedImage
** io.video
*** BoofVideoManager => ?
*** VideoInterface => ?
*** VideoListManager => ?
** io.wrapper.images
*** BufferedFileImageSequence probably just needs Bitmap instead of BufferedImage
*** JpegByteImageSequence probably just needs Bitmap instead of BufferedImage
*** LoadFileImageSequance probably just needs Bitmap instead of BufferedImage
* testing
** BoofTesting needs Bitmap instead of BufferedImage


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


== Partial Android Port of BoofCV v0.2 ==
== Partial Android Port of BoofCV v0.2 ==
For his [[Projects_Using_BoofCV|master thesis]], [[User:Maarten_Van_Lier|Maarten]] made a partial port of BoofCV v0.2 to Android.
 
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.
 
In this port, the following was done to get it working:
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.
* Just use the EJML, GeoRegression and libpja libraries that BoofCV uses, they work on Android as is.

Revision as of 03:44, 12 June 2012

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.