请告诉我在 Windows 上安装 ipp7.1 并在 OpenCV2.4.2 中使用它应该遵循哪些步骤。我下载了 Ipp7.1 评估版并使用了 CMake 2.8,然后我在 CMake 中配置了静态 OpenCV,并在 vs2008 中构建了所有项目,没有任何问题。
对于静态项目,我为 OpenCV 和 3rdparty 添加了以下列表:
opencv_calib3d241.lib opencv_contrib241.lib opencv_core241.lib opencv_features2d241.lib opencv_flann241.lib opencv_gpu241.lib opencv_highgui241.lib opencv_imgproc241.lib opencv_legacy241.lib opencv_ml241.lib opencv_nonfree241.lib opencv_objdetect241.lib opencv_photo241.lib opencv_stitching241.lib opencv_ts241.lib opencv_video241.lib opencv_videostab241.库
libjasper.lib libjasperd.lib libjpeg.lib libjpegd.lib libpng.lib libpngd.lib libtiff.lib libtiffd.lib zlib.lib zlibd.lib user32.lib
然后为 IPP 静态库附加以下列表:
ippac_l.lib ippcc_l.lib ippch_l.lib ippcore_l.lib ippcv_l.lib ippdc_l.lib ippdi_l.lib
ippi_l.lib ippj_l.lib ippm_l.lib ippr_l.lib ippsc_l.lib
ipps_l.lib ippvc_l.lib ippvm_l.lib
我的项目编译没有任何问题。
我使用以下代码来确保 IPP 已安装并正常工作。该函数有 2 个输入参数。第一个是“opencv_lib”,它将由 OpenCV 的版本填充。但我的问题在于第二个参数。“add_modules”始终为空。
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);
还有另一个问题,我相信它指的是前面的问题。cvUseOptimized(1)
在以下代码中,我使用cvUseOptimized(0)
了相同的循环代码。但奇怪的是,两者的处理时间实际上是相等的!
double t1, t2,timeCalc;
IplImage *template_image = cvLoadImage ("c:\\box.png",0);
IplImage* converted_image= cvLoadImage ("c:\\box_in_scene.png",0);
CvSize cvsrcSize = cvGetSize(converted_image);
cout << " image match template using OpenCV cvMatchTemplate() " << endl;
IplImage *image_ncc, *result_ncc;
image_ncc = cvCreateImage(cvsrcSize,8,1);
memcpy(image_ncc->imageData,converted_image->imageData,converted_image->imageSize);
result_ncc = cvCreateImage(cvSize(converted_image->width -template_image->width+1,
converted_image->height-template_image->height+1),IPL_DEPTH_32F,1);
int NumUploadedFunction = cvUseOptimized(1);
t1 = (double)cvGetTickCount();
for (int j=0;j<LOOP;j++)
cvMatchTemplate(image_ncc, template_image, result_ncc, CV_TM_CCORR_NORMED);
t2 = (double)cvGetTickCount();
timeCalc=(t2-t1)/((double)cvGetTickFrequency()*1000. * 1000.0);
cout << " OpenCV matchtemplate using cross-correlation Valid: " << timeCalc << endl;
NumUploadedFunction = cvUseOptimized(0);
t1 = (double)cvGetTickCount();
for (int j=0;j<LOOP;j++)
cvMatchTemplate(image_ncc, template_image, result_ncc, CV_TM_CCORR_NORMED);
t2 = (double)cvGetTickCount();
timeCalc=(t2-t1)/((double)cvGetTickFrequency()*1000. * 1000.0);
cout << " OpenCV matchtemplate using cross-correlation Valid: " << timeCalc << endl;