What does "sig[i] = cv::Mat(sigv).clone().reshape(1);" do?

asked 2018-06-17 03:53:17 -0600

rezaee gravatar image

updated 2018-06-17 17:06:31 -0600

i KNOW reshape() get a vector and make a matrix from it. But why in this line of code:

sig[i] = cv::Mat(sigv).clone().reshape(1);

It came after the clone() ? What does this line of code do exactly?

EDIT: More information:

//Do EMD and report
//
vector<cv::Mat> sig(5);
cout << "\nEMD: " << endl;
// Oi Vey, parse histograms to earth movers signatures
//
for( i=0; i<5; ++i) {
vector<cv::Vec3f> sigv;
// (re)normalize histogram to make the bin weights sum to 1.
//
cv::normalize(hist[i], hist[i], 1, 0, cv::NORM_L1);
for( int h = 0; h < h_bins; h++ )
for( int s = 0; s < s_bins; s++ ) {
float bin_val = hist[i].at<float>(h, s);
if( bin_val != 0 )
sigv.push_back( cv::Vec3f(bin_val, (float)h, (float)s));
}
// make Nx3 32fC1 matrix, where N is the number of nonzero histogram bins
//
sig[i] = cv::Mat(sigv).clone().reshape(1);
edit retag flag offensive close merge delete

Comments

Without context (what is sigv) it's difficult to say. sigv is may be a vector Mat(sigv) convert a vector to a mat

LBerger gravatar imageLBerger ( 2018-06-17 07:48:08 -0600 )edit

@LBerger I put more information.

rezaee gravatar imagerezaee ( 2018-06-17 17:07:42 -0600 )edit

you can remove clone it is useless.

LBerger gravatar imageLBerger ( 2018-06-18 01:04:58 -0600 )edit