Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

asked 2016-03-22 07:26:09 -0600

Nbb gravatar image

Convert Mat.type and convert Mat to vector

Hello

1) Given a Mat M and vector<double> v, how do I extract the 1st column and store it in a vector ? I have tried M.col(0).copyTo(v) but I am getting an error "Heap Corruption Detected". I am however, able to do so if v is a Mat itself. I just want to know why I cant convert it to a vector.

2) Do i have to take note of anything when using convertTo(OutputArray m, int rtype, double alpha=1, double beta=0 ) ? Like if i were to convert 64F to 8U for display purposes, do I have to perform the scaling operation or does the function takes care of it i.e. I do not have to worry about anything.

Thanks !

Convert Mat.type and convert Mat to vector

Hello

1) Given a Mat M and vector<double> vector< double > v, how do I extract the 1st column and store it in a vector ? I have tried M.col(0).copyTo(v) but I am getting an error "Heap Corruption Detected". I am however, able to do so if v is a Mat itself. I just want to know why I cant convert it to a vector.

2) Do i have to take note of anything when using convertTo(OutputArray m, int rtype, double alpha=1, double beta=0 ) ? Like if i were to convert 64F to 8U for display purposes, do I have to perform the scaling operation or does the function takes care of it i.e. I do not have to worry about anything.

3) Is it more efficient to process vectors or Matrices ? Eg a vector< vector< int >> vs a 2D Mat and a vector< int > vs a 1D Mat (row or column Mat). I know http://docs.opencv.org/2.4/doc/tutorials/core/how_to_scan_images/how_to_scan_images.html#howtoscanimagesopencv covers how to process matrices efficiently but I also want to know if it is faster to process a vector or a matrix.

Thanks !