1 | initial version |
But the output hist matrix is invalid with values (rows, cols) as (-1, -1).
a multi (more than 2d) mat can't express it's dimensions using rows & cols only, thus they're left empty(at -1) and you have to query the Mat::size member
(note: Not the function !):
cv::Mat hist; // MatND is an alias for Mat, since a very long time already ..
cv::calcHist(&matImageHSV, nImages, channels, cv::Mat(), // do not use mask
hist, dims, histSize, ranges,
true, // the histogram is uniform
false );
cout << hist.dims << endl;
cout << hist.size << endl;
3
36 x 25 x 25 // hbins, sbins, vbins, again !
2 | No.2 Revision |
But the output hist matrix is invalid with values (rows, cols) as (-1, -1).
a multi (more than 2d) mat can't express it's dimensions using rows & cols only, thus they're left empty(at -1) and you have to query the Mat::size member
(note: Not the function !):
cv::Mat hist; // MatND is an alias for Mat, since a very long time already ..
cv::calcHist(&matImageHSV, nImages, channels, cv::Mat(), // do not use mask
hist, dims, histSize, ranges,
true, // the histogram is uniform
false );
cout << hist.dims << endl;
cout << hist.size << endl;
3
36 x 25 x 25 // hbins, sbins, vbins, again !
3 | No.3 Revision |
But the output hist matrix is invalid with values (rows, cols) as (-1, -1).
a multi (more than 2d) dimensional mat can't express it's dimensions using rows & cols only, thus they're left empty(at -1) and you have to query the Mat::size member
(note: Not the function !):
cv::Mat hist; // MatND is an alias for Mat, since a very long time already ..
cv::calcHist(&matImageHSV, nImages, channels, cv::Mat(), // do not use mask
hist, dims, histSize, ranges,
true, // the histogram is uniform
false );
cout << hist.dims << endl;
cout << hist.size << endl;
3
36 x 25 x 25 // hbins, sbins, vbins, again !