且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在OpenCV 2.4.13中导入训练有素的SVM检测器

更新时间:2023-12-02 12:15:34

您可以读取文件并将每个值都推回float数组,因此首先声明它:

You can read the file and push every value back to an array of float, so first declare it:

vector<float> myDescriptorVector;

然后推送每个值:

ifstream infile ("yourFile.dat".c_str());

float number;

while (infile >> number)
    myDescriptorVector.push_back(number);


return myDescriptorVector;

最后,对HOG使用标准初始化,然后将向量传递到SVM检测器,就像您已经猜到的那样:

Finally use the standard initialization for the HOG and pass the vector to the SVM detector as you already guessed:

hog.setSVMDetector(myDescriptorVector);