27
$\begingroup$

I am trying to implement a content based image retrieval system but before I do so I would like to get an overview of some programming languages suitable for this task (having good libs and such).

Does anyone know some good languages and libs for that kind of task? What about Python or Java?

Best

$\endgroup$
  • $\begingroup$ The scope is an academic project ;-) sorry for not telling that! $\endgroup$ – jstr Feb 15 '12 at 14:12
  • 1
    $\begingroup$ I worked for ~3 years in a computer vision group for a software start-up. We used python + scipy/numpy for rapidly prototyping stuff, and C++ for production code. boost::python wrappers for heavy C++ helped with the porting. BLAS and LAPACK used for heavy numerical stuff. $\endgroup$ – wim Feb 15 '12 at 23:26
  • 2
    $\begingroup$ @wim - your comment would have made a great answer, with a little more detail about why you used those languages for the different phases of development. $\endgroup$ – Mark Booth Feb 16 '12 at 15:29
  • 1
    $\begingroup$ You can use Matlab or Octave for rapid prototyping, and then convert into C++ with the help of toolkits such as Armadillo (for linear algebra) and MLPACK (for machine learning & pattern recognition). Armadillo uses BLAS and LAPACK internally (same as Matlab). You can also mix'n'match Matlab/Octave code with C++ code via Armadillo's mex interface. $\endgroup$ – mtall Jan 15 '14 at 3:22
35
$\begingroup$

Maybe you can be more specific about the scope and scale of your work (academic project? Desktop or Mobile commercial product? Web-based commercial project?).

Some recommendations and comments:

  • Matlab is common in the academic world, and quite good for sketching/validating ideas. You will have access to a large body of code from other researchers (in CV and machine learning); prototyping and debugging will be very fast and easy, but whatever you will have developed in this environment will be hard to put in production. Depending on what your code is doing, you might have memory/performance problems (there are situations where you can't describe what you want to do in terms of Matlab's primitives and have to start looping on pixels and Matlab's being an interpreted language is not helping in this context). Interaction with databases, web servers etc is not easy, sometimes impossible (you won't get a Matlab program to become a Thrift server called by a web front-end). Costs $$$.

  • C++ is what is used for many production-grade CV systems (think of something at the scale of Google's image search or Streetview, or many commercial robotics applications). Good libraries like OpenCV, excellent performance, easy to put into a production environment. If you need to do machine learning, there are many libraries out there (LibSVM / SVMlight, Torch). If you have to resort to "loop on all pixels" code it will perform well. Easy to use for coding the systems/storage layers needed in a large scale retrieval system (eg: a very large on-disk hash map for storing an inverted index mapping feature hashes to images). Things like Thrift / Message Pack can turn your retrieval program into a RPC server which can be called by a web front-end. However: not very agile for prototyping, quite terrible for trying out new ideas, slower development time; and put in the hands of inexperienced coders might have hard to track performances and/or instability problems.

  • Python is somehow a middle ground between both. You can use it for Matlab style numerical computing (with numpy and scipy) + have bindings to libraries like OpenCV. You can do systems / data structure stuff with it and get acceptable performances. There are quite a few machine learning packages out there though less than in Matlab or C++. Unless you have to resort to "loop on all pixels" code, you will be able to code pretty much everything you could have done with C++ with a 1:1.5 to 1:3 ratio of performance and 2:1 to 10:1 ratio of source code size (debatable). But depending on the success of your project there will be a point where performance will be an issue and when rewriting to C++ won't be an option.

$\endgroup$
  • 4
    $\begingroup$ Also, Matlab is very strong in documentation, unlike Python. $\endgroup$ – Andrey Rubshtein Feb 15 '12 at 16:45
  • 1
    $\begingroup$ What about C? That's my go-to language when in doubt. $\endgroup$ – Zetta Suro Aug 18 '12 at 2:47
10
$\begingroup$

Especially since your project is academic, Mathematica is a very good and appropriate software system. Mathematica 8 comes with a comprehensive set of features for image processing, linear algebra, numerics, GPU, etc. It is also a symbolic system so many times I can derive closed form solutions for equations---quite handy for computer vision tasks. Mathematica can also communicate with Python, C, C++, Java, .NET, ..., code.

$\endgroup$
5
$\begingroup$

If this is an academic project, then you should definitely use Matlab, and more specifically the Image Processing Toolbox and the Computer Vision System Toolbox. It will take you orders of magnitude less time to prototype and evaluate algorithms in Matlab than in C++.

Even with the Python interface OpenCV is much harder to use than Matlab, and if you really have to you can call C or C++ code from Matlab through mex.

$\endgroup$
4
$\begingroup$

For an image retrieval system. You would have client side and server side code. The server side can be either in Python or C/C++. OpenCV is your best choice here. It has both python & C++ interfaces. For the client side, I think you're better off using java.

$\endgroup$
3
$\begingroup$

The best language for computer vision is C++. Although its major drawback is that it is more difficult to achieve what you want. OpenCV is the best library for computer vision out there but you can do the same things using matlab or python.

Take a look here.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.