1 | initial version |
vector<mat> images; images.push_back(imread("example.jpg"))
This creates an array (vector is a C++ STL wrapper around arrays) of matrices and puts the image "example.jpg" into a matrix and pushes that matrix onto the first position of the array.
Is your confusion attributable to the fact that both a vector and an OpenCV matrix have a push_back() member function? They pretty much do the same thing, but to different data types.
To "convert" from a vector of matrices to a single matrix with concatenation, i think you could do something like this to use OpenCV push_back to build a "compound" matrix (by popping matrices off the front of the vector and concatenating):
Mat imageConcat; while(images.size() != 0) {imageConcat.push_back(images.front()); images.erase(0);}
However, in my (admittedly limited) experience with SVMs I don't think you want to dump a whole image in there. All you'd be doing is training on each horizontal row of pixel data - I don't think that's what you want (unless you've got some cool algorithm going that does exactly that). Training on raw image data is probably too many SVM dimensions anyways.