2013-04-03 122 views
0

我在尋求幫助。 因爲EM課我無法建立我的項目。我用opencv 2.4.2在opencv 2.4.2中使用EM

我找不到問題所在。有人可以建議嗎?

cv::TermCriteria Termination; 
Termination.type=CV_TERMCRIT_ITER; 
Termination.maxCount=num_numIter; 
cv::EM model=cv::EM(NClusters,cv::EM::COV_MAT_SPHERICAL,Termination); 
model.train(groupped_one_person_features); 

最後一行得到LINK ERR,我不知道如何創建EM類的對象。 NClusters是int,還有什麼可以錯的?

我用:#include "opencv2/ml/ml.hpp"

該代碼產生這些錯誤:

2錯誤LNK2019:無法解析的外部符號「市民:虛擬BOOL __cdecl CV :: EM ::列車(CV類:: _ InputArray常量&,類品種:: _ OutputArray常量&,類品種:: _ OutputArray常量&,類 CV :: _ OutputArray常量&)」 (?火車@ EM @ CV @@ UEAA_NAEBV_InputArray @ 2 @ AEBV_OutputArray @ 2 @ 11 @?) 在函數「void __cdecl compute_LBPH_patterns_EM(struct ArrayData *,struct Pattern *,int,int)」中引用D:\ Work \ EBIS2012CPlusPlus \ Imet_v1(?compute_LBPH_patterns_EM @@ YAXPEAUArrayData @@ PEAUPattern @@ HH @ Z) .0_x64 \ Imet_v1.0_x64 \ compute_patterns.obj AND錯誤1錯誤LNK2019:無法解析的外部符號「public: virtual __cdecl cv :: EM ::〜EM(void)」(?? 1EM @ cv @@ UEAA @ XZ)參考 函數「void __cdecl compute_LBPH_patterns_EM(struct ArrayData *,struct Pattern *,int,int)」(?compute_LBPH_patterns_EM @@ YAXPEAUArrayData @@ PEAUPattern @@ HH @ Z)D:\ Work \ EBIS2012CPlusPlus \ Imet_v1.0_x64 \ Imet_v1 .0_x64 \ compute_patterns.obj AND錯誤3錯誤LNK2019:無法解析的外部符號「public: __cdecl cv :: EM :: EM(int,int,cl (struct ArrayData *,struct Pattern *,int,int)「(?C++ :: TermCriteria const &)」(?0EM @ cv @@ QEAA @ HHAEBVTermCriteria @ 1 @@ Z) compute_LBPH_patterns_EM @@ YAXPEAUArrayData @@ PEAUPattern @@ HH @ Z)d:\工作\ EBIS2012CPlusPlus \ Imet_v1.0_x64 \ Imet_v1.0_x64 \ compute_patterns.obj

非常感謝

回答

1

嘗試使用這個 -

using namespace cv; 
EM em_model; 
const TermCriteria term_crit = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 
                  100, FLT_EPSILON); 
em_model = EM(clustercount, EM::COV_MAT_DIAGONAL, term_crit); 
em_model.train(samples, loghood, labels, probs); 
0

這裏你去

#include <opencv2\opencv.hpp> 

using namespace cv;    //use the opencv namespace 

EM em_model;     //EM model 

int main() 
{ 
    //get samples 
    Mat samples; 

    //define and crate ternmination critaria 
    int type  = TermCriteria::COUNT + TermCriteria::EPS;  
    int maxCount = EM::DEFAULT_MAX_ITERS; 
    TermCriteria termCritaria = TermCriteria(type, maxCount, FLT_EPSILON); 

    //define EM parameters and instantiate model 
    int nclusters  = EM::DEFAULT_NCLUSTERS; 
    int covMatrix_type = EM::COV_MAT_DEFAULT; 
    em_model = EM(nclusters, covMatrix_type, termCritaria); 

    //train EM model 
    em_model.train(samples); 


    return 0; 
} 
相關問題