In 2007 I created an open source computer vision project, ShapeLogic, built in Java to work with ImageJ. This setup has been very easy to work with and very productive. Bjarne Stroustrup the creator of C++ gave an interview about the new features in the C++0x standard and TR1. C++ now has a lot of innovating programming constructs e.g. template meta programming, lambda functions, concepts and traits. When I found out that "axiom" is going to be a keyword in C++ my inner mathematician demanded that I take a second look at C++ in connection with computer vision.
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.
JAI, Java Advanced Imaging late 90ies
I 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:
Tools needed for build and GUI
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++ 2008
In the light of advance in the C++ language and tools, I have decided to try it again.
C++ image libraries choices
C++ IDE tried
C++ cross platform GUIs
First attempt
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++
-Sami Badawi
http://www.shapelogic.org
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 90ies
C++ 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 90ies
I 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++ 2008
In the light of advance in the C++ language and tools, I have decided to try it again.C++ image libraries choices
- OpenCV, Open Computer Vision
- Openframeworks built on top of OpenCV
- GIL Generic Image Library
- VXL
C++ IDE tried
- Eclipse 3.4
- NetBeans 6.1
C++ cross platform GUIs
- FLTK Fast Light Toolkit
- wxWidgets
- HighGui from OpenCV
First attempt
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
- HashTable
- Reflection
- 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
- Computer vision C++ libraries review
- Declarative framework and Particle Analyzer Java to C++ port
-Sami Badawi
http://www.shapelogic.org