Search code examples
iphoneimage-processingsmartphonecodenameone

Suitability of CodeNameOne for image processing application


We need to build an image processing application for smartphones (mainly for iPhone). The operations consist of:

  • image filtering
  • composite geometrical transformation
  • region growing

Also, the user is required to specify (touch) some parts of the image. Those parts would serve as inputs for the app. Example: eyes and lip in a face. We have built a desktop version of this app. The processing part is quite heavy and we extensively used BufferedImage class.

Should we use CodeNameOne for building this app? If not then what alternatives do you suggest?

Please consider the following factors:

  • Performance
  • Ease of writing the code (for image processing)

Solution

  • I gave an answer for this in our discussion forum but I think its a worthwhile question for a duplicate post:

    Generally for most platforms you should be fine in terms of performance except for iOS & arguably Windows Phone.

    Codename One is optimized for common use cases, since iOS doesn't allow for JIT's it can never be as fast as Java on the desktop since its really hard to do some optimizations e.g. array bound check elimination. So every access to an array will contain a branch check which can be pretty expensive for image processing.

    Add to that the fact that we don't have any image processing API's other than basic ARGB and you can get the "picture", it just won't be efficient or easy.

    The problem is that this is a very specific field, I highly doubt you will find any solution that will help you with this sort of code. So your only approach AFAIK is to build native code to do the actual image processing heavy lifting.

    You can do this with Codename One by using the NativeInterface API which allows you to invoke critical code in native code and use cn1lib's to wrap them as libraries. You would then be able to get native performance for that portion of the code but this would only make sense for critical sections in the code. If you write a lot of native code the benefits of Codename One start to dissipate and you might as well go to native.