Installing OpenCV from the cvs version for Ubuntu 5

Posted by Undermine on 17:33


First, there are a few dependencies to sort out. You will need to install the following packages - using Synaptic.

  • cvs - so you can get the files
    • If you don't use cvs normally, type touch ~/.cvpass to create an empty password file (or else you'll get error messages)
  • gcc - so you can compile them
  • g++ - "
  • libgtk2.0-dev
  • Various image libraries - libimlib2 and libimlib2-dev get most of them. OpenCV requires libpng, libjpeg and libtiff with the -dev versions so check they are there too...
Second, you can't install OpenCV or FFmpeg from Synaptic (well you can, but they won't deal with video files properly) so uninstall them.

Then...

  1. Obtain FFmpeg from the FFmpeg CVS repository:
    • http://ffmpeg.sourceforge.net/ is the FFmpeg homepage.
    • Note: This is no longer available, try: svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
    • The current release version of FFmpeg (0.4.9-pre1) does not work with GCC4, so the options are to either revert to an older and less strict compiler, or follow these instructions and get it working with the new shiny compiler.
    • The command to get the code out of CVS is
      cvs -z9 -d:pserver:anonymous@mplayerhq.hu:/cvsroot/ffmpeg co ffmpeg
  2. Build FFmpeg as a shared library
    • In the FFmpeg directory, do:
    • ./configure --enable-shared
      If you get any error messages here, check the dependencies (see above)
    • make
    • sudo make install
  3. Get hold of OpenCV
    • Get hold of OpenCV from CVS
      cvs -z9 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/opencvlibrary co opencv
  4. Install OpenCV
    • ./configure
      At the end of the configure process, a list of options will be displayed with either "no" or "yes" next to them. Check that FFmpeg is OK here - if it isn't, try
      • Checking that you've not installed the libraries via synaptic: do a search for ffmpeg and check that livavformat-dev hasn't been installed
      • Check that when you installed FFmpeg from source you used the --enable-shared switch
      Don't bother proceeding with the installation unless configure tells you that ffmeg is OK (unless, of course, you don't mind working with static images rather than video, in which case you might as well use the synaptic installer)
    • Run make by typing make
    • Check there are no error messages
    • sudo make install
    • Add the line /usr/local/lib to the file /etc/ld.so.conf, as these libraries have been installed there rather than in /usr/lib.
    • Finally, run ldconfig

0 comments:

แสดงความคิดเห็น