Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

What is the difference between Vec<mat> and Mat

Hi Guys,

I got confused with the usage of vector<mat> and Mat.

Example: vector<mat> images; images.push_back(imread("example.jpg")); //loop

bool CvSVM::train(const Mat& trainData, const Mat& responses, const Mat& varIdx=Mat(), const Mat& sampleIdx=Mat(), CvSVMParams params=CvSVMParams() )

For SVM, it requires the input to be Mat structure. How do you make the conversion?

Another question is with the usage of push_back.

"The methods add one or more elements to the bottom of the matrix. They emulate the corresponding method of the STL vector class. When elem is Mat , its type and the number of columns must be the same as in the container matrix."-from opencv.org

However, is push_back a concatenation operator or just grouping them into a cell structure? You can access data by images[0], images[1],...

If you define "Mat images" and then use images.push_back, the result is a concatenation of matrix.

Thanks for your clarification.

Sorry if the question seems naive.