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


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 audio, video, imaging, cryptography, signal processing and codecs. These functions are designed maximize application performance on Intel® processor-based workstations and servers.

Which Intel IPP functions are used in OpenCV?
The OpenCV library is an open source library of computer vision functions. OpenCV functions are implemented in two ways: with or without Intel IPP function calls. In the first case, customers need to have the Intel IPP binaries installed in order to take advantage of the Intel IPP optimizations. In the second case, all the functionality is implemented in the OpenCV open source code.

How can I make OpenCV automatically call Intel IPP functions at run-time? How to detect it?
OpenCV provides a transparent user interface to the Intel IPP by automatically loading the Intel IPP libraries at runtime if they are available. For Intel IPP versions 5.1 through 6.1, developers do not need to explicitly link with the Intel IPP libraries.

If you are using Intel IPP version later than 6.1, depending on which OpenCV package you have installed, you may need to check the source code to understand which version of the Intel IPP optimized libraries are automatically loaded. Follow these instructions:

    1. Open the file OpenCV\cxcore\src\cxswitcher.cpp.
    2. Go to function cvUseOptimized.
    3. Depending on your target system, you will need to modify lines numbers 551, 552, and 553. The numbers in quotes below indicate the Intel IPP versions that OpenCV will check for:
551  static const char* ipp_sfx_ia32[] = {"-6.1", "-6.0", "-5.3", "-5.2", "-5.1", "", 0 };
552  static const char* ipp_sfx_ia64[] = { "64-6.1", "64-6.0", "64-5.3", "64-5.2", "64-5.1", "64", 0 };
553  static const char* ipp_sfx_em64t[] = { "em64t-6.1", "em64t-6.0", "em64t-5.3", "em64t-5.2", "em64t-5.1", "em64t", 0 };
  1. Make sure that the latest Intel IPP DLLs are on your system PATH so that they are dispatched at application runtime.
  2. Here is small test code to detect if Intel IPP dlls are loaded by OpenCV automatically.

#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

Note: The above check method were validated in OpenCV 1.0 and before version.

The latest release OpenCV 2.0 and OpenCV 2.1 change the way to load IPP library. See the instructions at: http://opencv.willowgarage.com/wiki/InstallGuide and the thread discussion in Problems about IPP6.1 and Opencv2.0/2.1.
cvGetModuleInfo provides information about external DLLs if OpenCV load ones. It work in previous OpenCV versions for IPP because that time IPP was linked dynamically. Now it is linked statically in OpenCV2.0/2.1, so you can not get info through this function.
To check _cvipp.h file or search for HAVE_IPP macro through sources may help you to find where IPP is used and where still be an opportunity to insert call for IPP.

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.

Known IPP and OpenCV issue
There is a lot of discussion in IPP forum about IPP and OpenCV, for example IPP doesn't work with OpenCV 2.0.  and OpenCV 2.1 was just recently released. It support build with IPP static libraries.
Problems about IPP6.1 and Opencv2.0/2.1

We summarize several known issues here:
1. Multiple IPP versions are loaded in opencv project, which cause OMP Abort: Initializing libguide40.dll but found libiomp5md.dll already initialized
Suggested solution: keep only one IPP version in system search path.

2. Load IPP library in Opencv project, where ipp library were loaded simultaneously by using the LoadLibrary() function.  It cause a deadlock or a crash. See detail discussion in thread.  ( ippcore-6.0.dll is assumed to be loaded when trying to load ipps-6.0.dll. But initialization code (DllMain) from ippcore-6.0.dll had not been called yet)
In common project, it is not problem to use IPP library and opencv library together. For example,

 

#include <stdio.h>
#include <cv.h>
#include <cxcore.h>
#include <ipp.h>
#pragma comment (lib, "cxcore.lib")
#pragma comment(lib, "ippi.lib")

int main( int argc, char** argv )  
{  
const IppLibraryVersion* ippVersion = ippiGetLibVersion();   
printf("%s\n", ippVersion->Name);

int nFuncs=cvUseOptimized(1);
printf( "number of function optimized is\t");
printf("%d\n" ,  nFuncs );
const char* opencv_libraries = 0;
const char* addon_modules = 0;
cvGetModuleInfo(0, &opencv_libraries,&addon_modules );
printf( "OpenCV: %s\nAdd-on Modules: %s\n", opencv_libraries, addon_modules );
return 0;
}

3. Enable OpenMP in OpenCV project build with Intel compiler, which cause same the problem (deadlock or crash) as above.  The OpenMP Run time library libiomp5md.dll was used before initialization.
Suggested solution, disable the OpenMP option.  See the thread

What new functions have been added to the Intel IPP computer vision domain (ippCV)?
In addition to performance improvements, more than 100 functions have been added to the Intel IPP computer vision domain:

  • 16u data support for existing functions (arithmetic, statistical, Canny and Distance Transform)
  • Camera distortion correction (undistortion, generate matrices for ippi Remap function)
  • General pyramids (arbitrary rate and kernel are supported)
  • Optical Flow (pyramidal Lucas-Kanade algorithm, copy with subpixel precision)
  • Haar Classifier support (apply classifier, integral image, stddev for rectangle)

In addition, a computer vision sample for Face Detection (as part of image-processing sample in Intel IPP 6.1) is available for Windows*.  A face detection demo is also included in UIC sample demo.

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

How do I migrate from OpenCV to Intel IPP?
A substantial part of OpenCV functionality contains Intel IPP support. Almost all OpenCV functions that have Intel IPP support can be easily changed to direct Intel IPP function calls. You can check this by looking at the OpenCV source code. However, some OpenCV functions have no Intel IPP support; these mainly consist of functions that use complicated structures. There are two ways to get help in migrating these more complicated functions:

  1. Submit an issue to Intel Premier Support where support engineers can help you with Intel IPP function usage.
  2. Start a discussion thread in the Intel IPP User Forum and get help from Intel IPP engineers and the developer community.

You can also refer to the Intel IPP Face Detection sample code, which illustrates how to use Intel IPP to apply a classifier using Haar-like features in face detection algorithm in a Windows* application.


How do I configure OpenCV to include IPP?
Please see OpenCV installation Guide or refer to the Article IPP Support Model Changed in OpenCV 2.1
Or read  this forum thread for more information.

Can I get performance acceleration automatically if I have build IPP into OpenCV?

No, it is not always true. In fact, the IPP-build-in OpenCV only accelerate several domains and the functions based on them as below. The integration may have no effect on most of image processing functions. so if you want to get acceleration on image processing, please call IPP directly.

For example, in OpenCV 2.1, the mainly IPP function call in OpenCV are in 

  • Color Conversion in cv =>cvcolor.cpp
  • Harr classifier training functions in cv => cvharr.cpp
  • ippsDFT function in cxcore=>cxdxt.c

And there are some changes in different OpenCV version,  User can do search HAVE_IPP in OpenCV source to check.  For example,  in OpenCV 2.4.6,  more ipp functions are added:

  • Arithmetic and logical operations  in cv => opencv\modules\core\src\arithm.cpp,  ippiAdd_8u_C1RSfs, ippiSub_16u_C1RSfs, ippiOr_8u_C1R
  • Scharr &Sobel Filter in cv => opencv\modules\imgproc\src\deriv.cpp ippiFilterScharrVertBorder_32f_C1R
  • Mathfunction   => opencv\modules\core\src\mathfuncs.cpp(1148):#define Exp_64f ippsExp_64f_A50
  • HOG (Histogram-of-Oriented Gradients)     descriptor and object detection =>opencv\modules\objdetect\src\hog.cpp(344):        ippsNormalize_32f

Note: the article apply to standaone IPP 5.x and higher version, also to the IPP component in Intel Parallel Studio and Intel Compiler Professional Edition. See more in Getting Intel® IPP from stand-alone version or bundled products?

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