这个功能意味着什么; cvTermCriteria()? [英] what means this fonction ;cvTermCriteria()?

查看:192
本文介绍了这个功能意味着什么; cvTermCriteria()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想用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 anybody help me for understand this function and this is 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);
    }

推荐答案

请阅读Open CV文档:

http://docs.opencv.org/modules/core/doc/old_basic_structures.html [ ^ ],

http://docs.opencv.org [ ^ ]。



这个问题效率不高。很明显,你在问自己没有写的代码。如果您不了解函数或库的文档,为什么要尝试深入研究?您需要尝试从文档中理解它,然后编写自己的代码。即使你不能使它工作,它也会给你更多的理解;然后你可以问问题显示你的代码。至少你可以解释你尝试了什么以及为什么,这可以提供回答的线索或给你一个如何正确做的建议。



-SA
Please read Open CV documentation:
http://docs.opencv.org/modules/core/doc/old_basic_structures.html[^],
http://docs.opencv.org[^].

The question is not very productive. It's pretty apparent that you are asking on the code which you did not write by yourself. Why trying to dig in it if you did not understand the documentation of the function or the library? You need try to understand it from documentation and then write your own code. Even if you fail to make it working, it will give you a lot more understanding; and then you can ask the question showing your code. At least you will be able to explain what did you try and why, and that could provide a clue for the answering or giving you an advice on how to do it correctly.

—SA


这篇关于这个功能意味着什么; cvTermCriteria()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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