This article describes how to install OpenCV2 on Ubuntu 9.10 Karmic Koala with IPP Support enabled.

The IPP(Integrated Performance Primitives) library is developed by Intel, which accelerates some processes using appropriate processors. You can get a free version for non-commercial purposes.
I presume you have the libraries already installed, but this not necessary if you don't want to use them.
This manual should work with other Linux distributions, too. But I didn't checked it yet.

First you have to get OpenCv 2.0 and extract it in any directory you want.

Now you should get these packages to fulfill some of the depencies.
{c}sudo apt-get install build-essential libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg62-dev libtiff4-dev
sudo apt-get install libswscale-dev libswscale-unstripped-0{/c}

The structure of ffmpeg changed, but OpenCV searches for these libraries at wrong place. That's why you have to link the files to their old place.
In order to achieve this you have to be SuperUser:
{c}sudo -s
mkdir /usr/include/ffmpeg
ln -s /usr/include/libavcodec/avcodec.h /usr/include/ffmpeg/avcodec.h
ln -s /usr/include/libavformat/avformat.h /usr/include/ffmpeg/avformat.h
ln -s /usr/include/libavformat/avio.h /usr/include/ffmpeg/avio.h
ln -s /usr/include/libavutil/avutil.h /usr/include/ffmpeg/avutil.h
ln -s /usr/include/libswscale/swscale.h /usr/include/ffmpeg/swscale.h{/c}

Configuring cmake its necessary to enable IPP support manually USE_IPP=ON -D IPP_PATH=/opt/intel/ipp/6.1.2.051/lp32/sharedlib.
Maybe you're using another architecture, in this case you have to change the IPP_PATH.
If there shall be no IPP support, just don't use these variables.
{c}cd OpenCV-2.0.0
mkdir release
cd release
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON OPENCV_BUILD_3RDPARTY_LIBS=ON -D USE_SSE=ON -D USE_SSE2=ON -D USE_SSE3=ON -D USE_IPP=ON -D IPP_PATH=/opt/intel/ipp/6.1.2.051/lp32/sharedlib ..
{/c}

cmake output should look like this:
{c}
-- General configuration for opencv 2.0.0 =====================================
--
--     Compiler:                  
--     C++ flags (Release):         -Wall -pthread -ffunction-sections  -O3 -DNDEBUG  -fomit-frame-pointer -O3 -ffast-math -mmmx -msse -msse2 -msse3 -DNDEBUG
--     C++ flags (Debug):           -Wall -pthread -ffunction-sections  -g  -O0 -DDEBUG -D_DEBUG
--     Linker flags (Release):     
--     Linker flags (Debug):       
--
--   GUI:
--     GTK+ 2.x:                  1
--     GThread:                   1
--
--   Image I/O:
--     JPEG:                    TRUE
--     PNG:                     TRUE
--     TIFF:                    TRUE
--     JASPER:                  FALSE
--
--   Video I/O:
--     DC1394 1.x:              
--     DC1394 2.x:              1
--     FFMPEG:                 1
--       codec:                 1
--       format:                1
--       util:                  1
--       swscale:               1
--       gentoo-style:          1
--     GStreamer:               1
--     UniCap:                    
--     V4L/V4L2:                1/1
--     Xine:                    1
--
--   Interfaces:
--     Old Python:                0
--     Python:                    ON
--     Use IPP:                   /opt/intel/ipp/6.1.2.051/lp32/sharedlib
--     Build Documentation        0
--
--     Install path:              /usr/local
--
--     cvconfig.h is in:          /home/asctec/Downloads/OpenCV-2.0.0/release
-- -----------------------------------------------------------------
--

-- Configuring done
-- Generating done
-- Build files have been written to: /home/USER/Downloads/OpenCV-2.0.0/release{/c}

If these are these are the right settings you can start compiling the library using make.
{c}make -j4{/c}

Assuming everything went well, you can start the installation.
{c}[100%] Built target cvtest
sudo make install{/c}

To check everything is working well, you can compile the following code.
{c}
#include
#pragma comment( lib, "highgui.lib" )
#pragma comment( lib, "cxcore.lib" )
#include "cv.h"
#include "highgui.h"
int main(){

      int NumUploadedFunction = 0;
      NumUploadedFunction = cvUseOptimized(1);
      printf("\t NumUploadedFunction = %d \n\n", NumUploadedFunction);

      const char* opencv_lib = 0;
      const char* add_modules = 0;
      cvGetModuleInfo(0, &opencv_lib,&add_modules);
      printf("\t opencv_lib = %s,\n\t add_modules = %s\n\n", opencv_lib,add_modules);

      return 0;
}{/c}

The output should look like:
{c}NumUploadedFunction = 1

opencv_lib = cxcore: 2.0.0,
add_modules ={/c}

Maybe you get something like this instead:
{c}error while loading shared libraries: libcv.so.2.0: cannot open shared object file: No such file or directory{/c}

Then you have to export path of the new library:
{c}export LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH{/c}

Looking at the output of the example code you'll notice there is something wrong.
Instead of linking the IPP libraries dynamically like in OpenCV Version 1 they are now static linked.
And many things are already optimized in Version 2, that's why IPP isn't really used although it's recognised.

Add comment

Security code
Refresh