Install OpenCV 2.4 in Ubuntu 12.04

Installing OpenCV 2.4 from source code as I did with OpenCV 2.3.1a in Ubuntu 10.10 went flawlessly, didn’t need changing any of the preexisting ffmpeg libraries as I had to in Ubuntu 11.10.

You can download the source code for it from here.

But be aware of the changes in new version. If you are updating from a previous version of OpenCV be careful because they have introduced multiple changes and your code might not work. This are some of the biggest changes:

  • OpenCV now provides pretty complete build information via (surprise) cv::getBuildInformation().
  • reading/writing video via ffmpeg finally works and it’s now available on MacOSX too.
  • MOG2 background subtraction by Zoran Zivkovic was optimized using TBB.
  • >20 more bugs in our bug tracker have been closed (
  • Asus Xtion is now properly supported for HighGUI. For now, you have to manually specify this device by using VideoCapture(CV_CAP_OPENNI_ASUS) instead of VideoCapture(CV_CAP_OPENNI).
  • Some of the old functionality from the modules imgproc, video, calib3d, features2d, objdetect has been moved to legacy.
  • CMake scripts have been substantially modified. Now it’s very easy to add new modules – just put the directory with include, src, doc and test sub-directories to the modules directory, create a very simple CMakeLists.txt and your module will be built as a part of OpenCV. Also, it’s possible to exclude certain modules from build (the CMake variables “BUILD_opencv_” control that).
  • The new very base cv::Algorithm class has been introduced. It’s planned to be the base of all the “non-trivial” OpenCV functionality.
  • features2d API has been cleaned up. There are no more numerous classes with duplicated functionality. The base classes FeatureDetector and DescriptorExtractor are now derivatives of cv::Algorithm. There is also the base Feature2D, using which you can detect keypoints and compute the descriptors in a single call. This is also more efficient.
  • SIFT and SURF have been moved to a separate module named nonfree to indicate possible legal issues of using those algorithms in user applications. Also, SIFT performance has been substantially improved (by factor of 3-4x).
  • The current state-of-art textureless detection algorithm, Line-Mod by S. Hinterstoisser, has been contributed by Patrick Mihelich. See objdetect/objdetect.hpp, class Detector.
  • 3 face recognition algorithms have been contributed by Philipp Wagner. Please, check opencv/contrib/contrib.hpp, FaceRecognizer class, and opencv/samples/cpp/facerec_demo.cpp.
  • 2 algorithms for solving PnP problem have been added. Please, check flags parameter in solvePnP and solvePnPRansac functions.
  • Enhanced LogPolar implementation (that uses Blind-Spot model) has been contributed by Fabio Solari and Manuela Chessa, see opencv/contrib/contrib.hpp, LogPolar_* classes and opencv/samples/cpp/logpolar_bsm.cpp sample.
  • A stub module photo has been created to support a quickly growing “computational photography” area. Currently, it only contains inpainting algorithm, moved from imgproc, but it’s planned to add much more functionality.
  • Another module videostab (beta version) has been added that solves a specific yet very important task of video stabilization. The module is under active development. Please, check opencv/samples/cpp/videostab.cpp sample.
  • findContours can now find contours on a 32-bit integer image of labels (not only on a black-and-white 8-bit image). This is a step towards more convenient connected component analysis.
  • Canny edge detector can now be run on color images, which results in better edge maps.

Source of changelog: Computer vision talks.

Leave a comment ?


  1. Use OpenCV on Eclipse CDT | Programming and Technology - pingback on Friday May 18th, 2012 at 05:39 PM

Leave a Comment

Trackbacks and Pingbacks:

  • Use OpenCV on Eclipse CDT | Programming and Technology - Pingback on 2012/05/18/ 17:39