开发者

Image processing library for Android and Java

I am currently working on a small project, which shall load an image from an URL, resize and change it's colour depth to only 16 colours using a specified colour palette. The main problem for me is, that I want a program, which I can use on an Android device and on a desktop computer. Do you know a good image processing library which works on both systems?

Thanks in advance.开发者_StackOverflow中文版


There are several tools:

  • ImageJ, http://rsbweb.nih.gov/ij/
  • Fiji, http://fiji.sc/wiki/index.php/Fiji
  • IMMI, http://www.burgsys.com/image-processing-software-free.php
  • BoofCV: http://boofcv.org


The answers on this page are quite dated as of February 2014. I was searching to find a free Android image processing library and I came across the Stanford lecture notes here: http://www.stanford.edu/class/ee368/Android/index.html

Investigating a bit further, I found out that they are using OpenCV in their course material. It has a Java interface (along with many other languages), but the library is written natively in C++. They state that:

Along with well-established companies like Google, Yahoo, Microsoft, Intel, IBM, Sony, Honda, Toyota that employ the library, there are many startups such as Applied Minds, VideoSurf, and Zeitera, that make extensive use of OpenCV.

I am excited(!) to have found this, looking forward to going home and giving it a go.


The Android NDK allows you to use an existing C/C++ library that does not require java.awt or any of the Android classes. For example, you could easily compile libpng as a shared library for Android and then write a JNI interface to pass images from the Java layer to the png library. Similarly, you will also be able to compile libpng as a shared library for your desktop computer and use it from there.

I recently wrote a tutorial on how to compile open-source libraries for Android. If you browse the Android source, you will find some classes that use the skia graphics library via jni. I have not used skia before, but since Android has skia in its base framework, it should not be too difficult to get it to work in your app/desktop program.

Writing cross-platform programs has been an area of active interest amongst the mobile developers community, and some engines such as libgdx have gotten really good at it. So what you are attempting is definitely possible.


Octoate,

I don't think there is a library that exists that does what you want, the reason for that is on non-mobile platform every graphical operation you are going to use in Java is going to use the Java2D rendering pipeline to some degree. On Android, this doesn't exist.

Android provides its own graphical pipeline for image manipulation and actually simplifies a lot of things that are more complicated in standard Java.

All that being said, it looks like you found a library (JJIL) that acts as an abstraction layer on top of these differences, in that case I would be a bit worried about performance and do some testing in your own code to see how it performs compared to the platform methods. For example, I saw this quote from JJIL:

allows images to be converted from Android bitmaps into JJIL RgbImages

When I look at the source for RgbImages, it looks like the image data gets converted and stored in an internal array; all of those layers of abstraction are going to cost you CPU time and memory, especially as images on mobile devices get bigger due to higher resolution cameras and high-bandwidth connections.

This may not be that big of an issue, but again, you'll probably want to do some profiling/testing/performance comparisons.


Any pure Java library should work on both platforms. A Google search of "Java image processing library" produced several results. Try to find the lightest weight lib that serves your purposes since memory and CPU are limited on mobile devices.

Barry

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜