This post is a review of my personal past experience with computer vision in C++ and Java. I did my masters thesis in computer vision in the early 90ies, but I ended up working in other fields: video games, Internet and finance, which only left a little time to do vision in my free time. While both C++ and Java were good choices for professional vision programmers, several of the approaches I chose caused me to run out of steam. I also tried to do computer vision with functional, declarative and hybrid languages e.g. Oz, Scheme and Scala but will not cover that here.
Borland C++ early 90iesC++ did not have STL or any other standard library so I used Borland's OWL library for images and for the application. I used C++ templates, classes with multiple inheritance, RTTI just to set up basic container functionality. There were a few books that has some free C or C++ source code for image processing and vision, but they did not spawn a user community. I did not really get to do anything interesting.
JAI, Java Advanced Imaging late 90iesI was very excited when Java came around, this was the language to cure all programming ailments. Now they had added a library that could be used for vision and a lot of big companies were sponsoring JAI. It turned out to be a very complex framework with a deep class hierarchy, I spent a lot of time reading the manual trying to find out how to get access to image pixels. I gave up using it and the framework never gained much popularity.
VXL, C++, STL, Boost, Python, GCC, Linux around 2000 Open source software, OSS had started to become prominent. There were 2 OSS libraries:
- OpenCV (Open Computer Vision), wich was still in alpha.
- VXL (Vision X Library) wich was a merge of 2 big non OSS libs TargetJR and IUE.
Tools needed for build and GUI
- VXL does builds using CMake to create Make files
- Boost uses BJam to do builds
- Python bindings using Pyste from Boost
- VXL used FLTK and OpenGL as a GUI
- It was hard to get the different build systems, CMake, Bjam and Make, to work together
- GCC 3.1 and 3.2 core dumped when compiling certain Boost classes
- Python bindings worked for simple C++ classes, but not for the nested template classes in VXL
- It was hard to debug the template programs
- Emacs was not really as easy to use as Visual Studio
- Bad drivers for OpenGL on Linux
ImageJ in Java around 2004 A colleague showed me a visualization tool he had worked on and said that he did it in around 1 month. I barely believed him, but tried the underlying framework, ImageJ. To my big surprise I was up and running and doing real work in a few hours. ImageJ just got things right. It was built using pure Java by one man, Wayne Rasband. It is very easy to work with and very modular, so a lot of people have made plugins and there is a vibrant development community. When I started working on ShapeLogic that was the best choice.
OpenCV, GIL Generic Image Library, Boost and Eclipse in C++ 2008In the light of advance in the C++ language and tools, I have decided to try it again.
C++ image libraries choices
C++ IDE tried
- Eclipse 3.4
- NetBeans 6.1
C++ cross platform GUIs
I tried Boost, OpenCV and GIL and got them up and running under both Linux and Windows in a few hours. Eclipse CDT C++ IDE works great.
Porting ShapeLogic algorithms to C++ version My plan is to port some algorithms from ShapeLogic from Java to C++. ShapeLogic is a toolkit for declarative programming, specialized for vision. In principle you should be able to make a list of rules for categorizing say the shape of a particle in a particle analyzer. You put them in a database or a flat file and the same rules should work for C++ and Java version of ShapeLogic. In practice this might not work out.
Advantages of C++ and Java This is a loose first assessment.
Constructs used in ShapeLogic that are missing or less convenient in C++
- Uniform cross platform GUI
- Dynamic cross platform libraries
- Garbage collection
- Antlr for parsing logic language
- Substantially higher speed
- Better handling of video
- Used more frequently for computer vision programming
- Good tracking and face recognition algorithms in OpenCV