Question

What's this about?

We have a C++ application dealing with image processing and computer vision on videos using OpenCV, we're going to rewrite it from scratch and need some help deciding what technologies to use. More specifically, I need help on how to choose the technology I'd use.

About the app

The app's functionality is divided in modules that are called in an order defined by a configuration XML file and can also be changed in runtime, but not in realtime (i.e. the application doesn't need to close, but the processing will start from scratch). These modules share data in a central datapool.

Why are we starting from scratch?

This application wasn't planned to be as dynamic as it currently strives to be, so it's grown to be a collection of buggy patches, macros and workarounds; it's now full of memory leaks, unnecessary QT dependencies, slow conversions between QT and OpenCV image formats and compilation and testing times have grown too much.


Language choice

The original code used C++, just because the guy who originally started the project only knew C++. This may be a good choice, because we need it to be as fast as possible, but there may be better choices to account for the dynamic nature of the application.

We're limited by the languages supported by OpenCV (C++, Java and Python mainly; although I've read there is also support for Ruby, Ch, C# and any JVM language)

What is needed

  • Speed: We're aiming for realtime tracking. This may rule out Python and Ruby.
  • Class Instantiation by name: Although our C++ macros and class registration system work, a language designed to be dynamic that has it's own runtime would be nice. Maybe Objective-C++, or Java.

What would be ideal

  • Module/Plugin/Extension/Component Framework: Why reinvent the wheel, using a good framework for this would let us focus on what's special about our app. There are many options here. Objective-C has it's NSBundles; C++ has libraries like Boost.Extension, Pluma, DynObj, FxEngine, etc; C has C-Pluff; I'd even say there are too many options.
  • Runtime class loading and reloading: From a developing point of view, it would be interesting to be able to compile and reload just one module. I've seen this done in via code injection in Objective-C and using Java's reflection.

What am I missing?

I have too many interesting options!

Here's where I need help, based on your experiences in modular app development, with this constraints, what kind of language/framework feature should I be looking for?

What question should I make myself about this project that would let me narrow my search?


Edit

I hadn't noticed that OpenCV had GPU bindings only for C++, so I'm stuck with it.

Now that the language is fixed, the search has narrowed a lot. I could use Objective-C++ to get the dynamism needed (Obj-C runtime + NSBundle from Cocoa/GnuStep/Cocotron), which sounds complicated; or C++ with a framework.

So I'll now narrow my question to:

  • Is using NSBundle in a crossplatform way with Objective-C++ easier than it sounds?
  • What C++ framework will provide me with hot-swappable modules?
  • The main reason for swapping modules in runtime is to be able to change code in a fast way, would Runtime-Compiled C++ be a better solution?

Meta: I did my research on how to ask a question like this, I hope it's acceptable.

Was it helpful?

Solution

"What question should I make myself about this project that would let me narrow my search?"

if you need gpu support(cuda/ocl), your only choice is c++.

you can safely discard C, as it won't be supported in the near future

have no fear of python, even if you need direct pixel access, that's all numpy arrays (running c-code again)

i'd be a bit sceptical of ruby, c# ch and the like, since those bindings are community based, and might not be up to date / maintained properly, while the java & python bindings are machine - generated from the c++ api, and are part of the official distribution.

OTHER TIPS

If you're looking for portability and have large memory for disposal then you can go with Java. The performance hit between C++ and Java is not that bad. For conversion between Mat and other image format I'm still not sure, coz it needs deep copy to perform that, so if your code can display the image in openCV native format then you can fasten the application

pro :

  • You can stop worrying about memory leak
  • The project is much more portable compared to C/C++(this can be wrong if you can avoid using primitive datatypes which size is non consistent and for example always use int*_t in C)

cons:

  • slower than C/C++
  • more memory and CPU clock needed

http://www.ibm.com/developerworks/java/library/j-jtp09275/index.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top