Intel® IPP - Open Source Computer Vision Library (OpenCV) FAQ

  • How is Intel® IPP different from OpenCV?
  • How do I use OpenCV with Intel® IPP functions?
  • How do I use OpenCV 2.4 with Intel® IPP 9.0?
  • How do I use OpenCV 2.4 with Intel® IPP 8.x?
  • How do I use OpenCV version 1.x with Intel® IPP?
  • How do I use both Intel® IPP and OpenCV functions in my application?
  • How do I get support for the OpenCV library?
  • How do I submit requests for computer vision functions to be supported in the Intel IPP?

How is Intel IPP different from OpenCV?
OpenCV (Open Source Computer Vision) is a library of programming functions for real time computer vision. 
In addition to computer vision, Intel IPP provides high performance low-level routines for imaging, cryptography, signal processing and data compression. These functions are designed maximize application performance on Intel® processor-based workstations and servers. 

How do I use OpenCV with Intel IPP functions?
OpenCV 3.0 supports optimization on x86 and x64 platforms with Intel® Integrated Performance Primitives, Intel® IPP offers a special subset of Intel® IPP functions for image processing and computer vision, the IPP-ICV libraries.  The IPP-ICV package support the optimization on AVX2, SSE4.x, SSE2 instructions sets.

The IPP-ICV package is provided with the OpenCV library, and the optimization with IPP-ICV is enabled by default on the supported platforms, and users do not need install additional standalone Intel® IPP package.  Check this page on Intel IPP-ICV package for opencv 3.0: http://code.opencv.org/projects/opencv/wiki/Opencv3

To use the Intel® IPP with the old versions of OpenCV, check the content bellow.

How do I use OpenCV 2.4 with Intel IPP 9.0?

Intel IPP 9.0 introduced a few APIs change. To use the OpenCV 2.4 with the Intel(R) IPP 9.0, users need to get the Intel IPP legacy libraries first,  then make the following change to build the library:

 1.  Download Intel(R) 9.0 legacy libraries. Please visit the Intel® IPP Legacy Libraries article, and check "Download and Installation" part to install Intel® IPP legacy libraries. 

2. Set an IPPROOT_LEGACY environment variable to the IPP legacy library folder. For example: 
     At Windows:       > set  IPPROOT_LEGACY=C:\Work\IPP_legacy   
     Or at Linux                $ export IPPROOT_LEGACY=~/IPP_legacy       
     The $IPPROOT_LEGACY/include should point to IPP legacy header files.

3. Modify the following CMake files (line numbers are provided for original file):

   a. <OpenCV dir>/opencv/sources/cmake/OpenCVFindIPP.cmake
           Change line #166:
         
  Before:     ${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPCORE}${IPP_SUFFIX}${IPP_LIB_SUFFIX})
         
  After:        ${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPCV}90lgc${IPP_SIFFIX}${IPP_LIB_SUFFIX}
                              ${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPI}90lgc${IPP_SIFFIX}${IPP_LIB_SUFFIX} )

           Add a line after line #194:
          
Before:   set(IPP_LIBRARY_DIRS ${IPP_ROOT_DIR}/lib     PARENT_SCOPE)
           
After:      set(IPP_LIBRARY_DIRS ${IPP_ROOT_DIR}/lib     PARENT_SCOPE) 
                               set(IPP_LEGACY_LIBRARY_DIRS $ENV{IPPROOT_LEGACY}/lib PARENT_SCOPE)

           Change line #199:
       
    Before:    if(NOT EXISTS ${IPP_ROOT_DIR}/../em64t)
       
    After:        f(NOT EXISTS ${IPP_ROOT_DIR}/../intel64_lin)

           Change line #203:
      
     Before:       if(NOT EXISTS ${IPP_ROOT_DIR}/../ia32)
       
     After:         if(NOT EXISTS ${IPP_ROOT_DIR}/../ia32_lin)

            Add a line after line #218:  
        
   Before:   if (APPLE)
                          set(IPP_LIBRARY_DIRS ${IPP_ROOT_DIR}/lib)
       
     After:     if (APPLE)
       
                  set(IPP_LIBRARY_DIRS ${IPP_ROOT_DIR}/lib)
            
             set(IPP_LEGACY_LIBRARY_DIRS $ENV{IPPROOT_LEGACY}

            Change line #223:
            Before:   endif()
                               set(IPP_LIBRARY_DIRS ${IPP_ROOT_DIR}/lib/intel64)
           
  After:    endif()
                    set(IPP_LEGACY_LIBRARY_DIRS $ENV{IPPROOT_LEGACY}/lib/intel64)
                   
set(IPP_LIBRARY_DIRS ${IPP_ROOT_DIR}/lib/intel64 ${IPP_LEGACY_LIBRARY_DIRS})                                 

         Change line #228:
     
    Before:
        
 get_filename_component(INTEL_COMPILER_LIBRARY_DIR ${IPP_ROOT_DIR}/../compiler/lib REALPATH) 
       
  After:
        get_filename_component(INTEL_COMPILER_LIBRARY_DIR ${IPP_ROOT_DIR}/../lib REALPATH)

           Change line #237:
             Before:    ${INTEL_COMPILER_LIBRARY_DIR}/intel64)
             After:       ${INTEL_COMPILER_LIBRARY_DIR}/intel64
                                 
${IPP_LEGACY_LIBRARY_DIRS})

            Change line #239:

             Before:     ${INTEL_COMPILER_LIBRARY_DIR}/intel64)
             After:          ${INTEL_COMPILER_LIBRARY_DIR}/intel64
                                  ${IPP_LEGACY_LIBRARY_DIRS})                                                           

            Change line #246:
                 Before:      ${INTEL_COMPILER_LIBRARY_DIR}/ia32)
                 After:        ${INTEL_COMPILER_LIBRARY_DIR}/ia32
                                  ${IPP_LEGACY_LIBRARY_DIRS})                                                            

            Add a line after line #253:
             
   Before:   set(IPP_LIBRARIES ${IPP_LIBRARIES} PARENT_SCOPE)
                After:         set(IPP_LIBRARIES ${IPP_LIBRARIES} PARENT_SCOPE) 
                                  s
et(IPP_LEGACY_LIBRARIES ${IPP_LEGACY_LIBRARY_DIRS} PARENT_SCOPE)

    b.  <OpenCV dir>/opencv/sources/cmake/OpenCVFindLibsPerf.cmake
        Add a line after line #16:
        Before:  ocv_include_directories(${IPP_INCLUDE_DIRS})
         After:    ocv_include_directories(${IPP_INCLUDE_DIRS}) 
                      
ocv_include_directories($ENV{IPPROOT_LEGACY}/include)

4.    Create small “ipp_legacy.h” file in <OpenCV dir>/opencv/sources/modules/core/include/opencv2/core directory

#include "ippcv90legacy.h"
#include "ippi90legacy.h"

#if defined(_WIN32)
#pragma warning( disable : 4505 4996 )
#else
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#pragma GCC diagnostic ignored "-Wunused-function"
#endif

static void ippStaticInit()
{
    legacy90ippiInit();
    legacy90ippcvInit();
}

static void ippiHaarClassifierFree_32f(void* p)
{
    free(p);
}

5.  Modify <OpenCV dir>/opencv/sources/modules/core/include/opencv2/core/internal.hpp file,  add one line to include ""ipp_legacy.h" 

#ifdef HAVE_IPP
#  include "ipp.h"
#  include "ipp_legacy.h" // Add this line


CV_INLINE IppiSize ippiSize(int width, int height)

6.    Make sure IPPROOT environment variable is set to IPP library folder, and build OpenCV using standard CMake procedure with Intel® IPP support.

How do I use OpenCV 2.4 with Intel IPP 8.x? 

OpenCV 2.4 use Cmake configuration to add Intel® IPP libraries, which is different from the OpenCV 1.x release. The building scrip supports Intel® IPP 7.0 and previous IPP release. To use OpenCV 2.4 with the newer Intel® IPP 8.x release, it needs to manually change the OpenCVFindIPP.cmake file in OpenCV source and make sure it can find the correct version of Intel IPP 8.x at your system:

Here is an example to build the OpenCV 2.4 with Intel IPP 8.1. For other version, you needs to slightly change the Intel® IPP names and Intel(® IPP folders for that version:

  1. Open opencv-2.4.5/cmake/OpenCVFindIPP.cmake file

          Line 182:
     
            Change:    if(NOT EXISTS ${IPP_ROOT_DIR}/../em64t)
             To:           If(NOT EXISTS ${IPP_ROOT_DIR}/lib/intel64)
          Line 186:
              C
    hange:    if(NOT EXISTS ${IPP_ROOT_DIR}/../ia32)
              To:            if(NOT EXISTS ${IPP_ROOT_DIR}/lib/ia32)

        Note, if you are using IPP 7.x, or IPP 6.1, the building scrip supports that version, and it does not need to change this file.

    2.  To switch ‘ON’ IPP support, define “WITH_IPP=ON” in build command line:  
            > cmake-D WITH_IPP=ON /usr/opencv-2.4.x

      If will report the third party libraries support information as below:

                 --found IPP: 8.1.1[8.1.1]
                 --IPP libs : libippvm_l.a; libippcc_l.a;libippcv_l.a;libipps_l.a;libippcore_l.a
                   ......
                  .....
                  Other Third party libraries
                   Use IPP 8.1.1.
                    at : /opt/intel/ipp….

How do I use OpenCV version 1.x with Intel IPP?
OpenCV version 1.0 provides a transparent user interface to the Intel® IPP by automatically loading the Intel IPP libraries at runtime if they are available. It supports IPP version 5.1 to version IPP 6.1.

To use OpenCV 1.x with Intel IPP, users need to download Intel IPP 6.1 release. If you have a valid Intel IPP licenses,   please login into the Intel Registration Center to get the package.

The following is test code small test code to detect if Intel IPP dlls are loaded by OpenCV after you install Intel 6.1 package.

#include <stdio.h>
#pragma comment( lib, "highgui.lib" )
#pragma comment( lib, "cxcore.lib" )
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;
}//_end_of_file_

if IPP dll are loaded automatically, the output of detect code is like 
    NumUploadedFunction = 144
    opencv_lib = cxcore: 1.0.0,
    add_modules = ippcv-6.1.dll, ippi-6.1.dll, ipps-6.1.dll, ippvm-6.1.dll, ippcc-6.1.dll


How do I use both Intel IPP and OpenCV functions in my application?
The OpenCV source code contains examples of how Intel IPP functions are used. Intel IPP performs operations directly on image buffers so you would need to pass pointers to those buffers to the Intel IPP along with corresponding information about the buffers such as image width and height. The Intel IPP and OpenCV function calls can be easily mixed in the same application. Here is an example:

// Let A, B and C be single-channel 8-bit images. 
IplImage *A, *B, *C; 
// Compute C = (A+B)/2 using an Intel IPP function call 
IppiSize size = { A->width, A->height }; 
ippiAdd_8u_C1RSfs( (Ipp8u*)A->imageData, A->widthStep, (Ipp8u*)B->imageData, B->widthStep, (Ipp8u*)C >imageData, C->widthStep, size, 1 );

For more information, please check the OpenCV project page.


How do I get support for the OpenCV library?
Please check the OpenCV FAQ for answers to common questions as well as information on where to submit bug reports. Please search for answers at and submit questions/bugs to the OpenCV newsgroup


How do I submit requests for computer vision functions to be supported in the Intel IPP?
Please submit your Intel IPP feature requests and problem reports to Intel® Premier Support. You can also participate in the Intel IPP discussion forum.  

For more complete information about compiler optimizations, see our Optimization Notice.