如何使用IPP7.1& OpenCV 2.4.1

时间:2012-10-22 10:55:33

标签: opencv

请告诉我在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.lib

     

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;

0 个答案:

没有答案