c++ - Is there any checklist to avoid crashes when using OpenCV SVM? -


i' stepping through svm in opencv 2.4 slowly. 1 crash there list of suggestions, how check data befode feeding train , predict functions?

currently have crashes when calling predict , can't figure out why.

this section of code should relevant:

            row = cv::mat::zeros(1, 256, cv_32fc1);              ( std::map<int, int>::iterator fit = tmp.begin(); fit != tmp.end(); fit ++ )             {                 row.at<float>(0, fit->first) = fit->second;               }                            float result = svm.predict(row); 

seems not documented stumbling block. when create cvsvm - instance on heap, doesn't crash more.

i used create global instance ov cvsvm in test code, , assign actual data later:

cvsvm _svm; //... code , scopes //training _svm = cvsvm (trainingdata, trainingclasses, cv::mat(), cv::mat(), param); //... code , scopes //testing float l = _svm.predict(testdata) 

it crashed in predict, because labels mat vas not initialized


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -