2012-09-03 37 views

回答

1

很好,因爲OpenCV的是開源的,你可以只查看源代碼

,但它往往快於它只是谷歌,像https://www.google.no/search?q=struct+CvSVMParams

然後右擊三分命中,在OpenCV的結束文檔http://docs.opencv.org/modules/ml/doc/support_vector_machines.html

然後使用瀏覽器的網頁搜索功能(通常[Ctrl鍵F]爲「找到」),以查找該頁面中的文本「CvSVMParams」,導致你失望的頁面http://docs.opencv.org/modules/ml/doc/support_vector_machines.html#cvsvmparams-cvsvmparams

在這一點上它是閱讀文檔

它是一種技能,是必不可少的事情,所以我不打算重複這裏就是我在0.5秒左右–發現有破壞它只要看看。我也建議您嘗試從頭開始尋找自己。因爲這也是你需要的一項基本技能,並且必須經過培訓達到

+0

+1強調搜索的技巧。 –

+0

對不起,我沒有提到我使用2.3。我總是被帶到舊的文檔(http://opencv.willowgarage.com/documentation/cpp/ml_support_vector_machines.html?highlight=svm#cvsvmparams),它沒有說明默認的構造函數是如何初始化結構的,但我想它是安全地假設它是一樣的。在任何情況下,我都會嘗試查看源代碼。謝謝 –

0

這裏是構造:

https://github.com/Itseez/opencv/blob/ddf82d0b154873510802ef75c53e628cd7b2cb13/modules/ml/src/svm.cpp

// SVM training parameters 
struct SvmParams 
{ 
    int   svmType; 
    int   kernelType; 
    double  gamma; 
    double  coef0; 
    double  degree; 
    double  C; 
    double  nu; 
    double  p; 
    Mat   classWeights; 
    TermCriteria termCrit; 

    SvmParams() 
    { 
     svmType = SVM::C_SVC; 
     kernelType = SVM::RBF; 
     degree = 0; 
     gamma = 1; 
     coef0 = 0; 
     C = 1; 
     nu = 0; 
     p = 0; 
     termCrit = TermCriteria(CV_TERMCRIT_ITER+CV_TERMCRIT_EPS, 1000, FLT_EPSILON); 
    } 

    SvmParams(int _svmType, int _kernelType, 
      double _degree, double _gamma, double _coef0, 
      double _Con, double _nu, double _p, 
      const Mat& _classWeights, TermCriteria _termCrit) 
    { 
     svmType = _svmType; 
     kernelType = _kernelType; 
     degree = _degree; 
     gamma = _gamma; 
     coef0 = _coef0; 
     C = _Con; 
     nu = _nu; 
     p = _p; 
     classWeights = _classWeights; 
     termCrit = _termCrit; 
    } 

};