Can I use cvUseOptimized with normal OpenCV or do I have to have IPP loaded

asked 2013-10-18 16:09:26 -0500

joeish80829 gravatar image

This is just a quick question i'm playing with the code at this link and below How to use IPP7.1 & OpenCV 2.4.1

And when I cout the NumUploadedFunction after each for next loop the value of the cvUse Optimized return is 1 both times...I was hoping some one can tell me why this is and maybe direct me to a link of where i can understand cvUseOptimized better...like how i can tell if a function is an optimized function i can use cvUseOtimized on....from the code at the link i assume cvMatchTemplate is an optimized function but i dont understand why in this code the NumUploadedFunction output is 1 after cvUseOptimized is set to 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="" &lt;&lt;="" "="" opencv="" matchtemplate="" using="" cross-correlation="" valid:="" "="" &lt;&lt;="" timecalc="" &lt;&lt;="" endl;="" <="" p="">

edit retag flag offensive close merge delete