如何将Qt QByteArray转换为cv::InputArray?
我需要传入一个自定义特征向量:
// Constructor
HoGDetector::HoGDetector(QObject *parent) :
QObject(parent)
{
qDebug() << "Creating HoG Detector";
// Set the SVM Detector ( Default OpenCV One )
m_HoG.setSVMDetector(HOGDescriptor::getDefaultPeopleDetector());
// Read
QFile svmVectorFile(":/descriptorvector.dat");
QByteArray svmVector = svmVectorFile.readAll();
// Set the SVM Detector - custom trained HoG Detector
m_HoG.setSVMDetector(svmVector);
}
谢谢!
OpenCV知道如何将std:vector转换为InputArray,所以这应该可以做到:
m_HoG.setSVMDetector(std::vector<uchar>(svmVector.begin(), svmVector.end()));