Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

no, won't work this way. your trainData needs each hog vector stacked as one horizontal row , and you need a seperate labels mat with 1 entry per hog feature. so:

Mat trainData, trainLabels; // initially empty.
for (...) {
    // obtain feature vector:
    vector<float> featureVector;
    hog.compute(img, featureVector, Size(32, 32), Size(0, 0));
    Mat feature = Mat(featureVector).reshape(1,1); // from col to row
    trainLabels.push_back(1); // or -1 for the negs.