我想用OpenCV的C ++编写一个特征脸程序 [英] I want to write a eigenface program using C++ with OpenCV

查看:78
本文介绍了我想用OpenCV的C ++编写一个特征脸程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我想用OpenCV用C ++写一个特征脸程序,但我不知道如何使用这个函数cvTermCriteria();和我希望有人帮助我理解我使用此功能的代码部分




I want to write a eigenface program using C++ with OpenCV but i don't know how to work this function cvTermCriteria();and i wish somebody help me for understand this portion of code where i use this function

void doPCA()
  {
          int i;
          CvTermCriteria calcLimit;
          CvSize faceImgSize;

          // set the number of eigenvalues to use
          nEigens = nTrainFaces-1;

          // allocate the eigenvector images
          faceImgSize.width  = faceImgArr[0]->width;
          faceImgSize.height = faceImgArr[0]->height;
          eigenVectArr = (IplImage**)cvAlloc(sizeof(IplImage*) * nEigens);
          for(i=0; i<nEigens; i++)
                  eigenVectArr[i] = cvCreateImage(faceImgSize, IPL_DEPTH_32F, 1);

          // allocate the eigenvalue array
          eigenValMat = cvCreateMat( 1, nEigens, CV_32FC1 );

          // allocate the averaged image
          pAvgTrainImg = cvCreateImage(faceImgSize, IPL_DEPTH_32F, 1);

          // set the PCA termination criterion
          calcLimit = cvTermCriteria( CV_TERMCRIT_ITER, nEigens, 1);

          // compute average image, eigenvalues, and eigenvectors
          cvCalcEigenObjects(
                  nTrainFaces,
                  (void*)faceImgArr,
                  (void*)eigenVectArr,
                  CV_EIGOBJ_NO_CALLBACK,
                  0,
                  0,
                  &calcLimit,
                  pAvgTrainImg,
                  eigenValMat->data.fl);

          cvNormalize(eigenValMat, eigenValMat, 1, 0, CV_L1, 0);
  }

推荐答案

如果你写了,你为什么要解释它呢?

如果你没有写,为什么不问那个人呢?



我们不做逐行解释。如果您有特定问题,请询问有关它的问题。但首先考虑一下 - 你想坐下45分钟然后输入逐行描述没有充分的理由吗?
If you wrote it, why would you need it explained?
If you didn't write it, why not ask the person that did?

We don't do line-by-line explanations. If you have a specific problem, then ask a question about it. But think first - would you want to sit down for 45 minutes and type up a line-by-line description for no good reason?


你读过文档 [ ^ ]?


这篇关于我想用OpenCV的C ++编写一个特征脸程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆