- get the size of a multi-dimensional cv::Mat
std::cout << "cvMat.dims = " << cvMat.dims << "cvMat.size = [";
for(int i = 0; i < cvMat.dims; ++i) {
if(i) std::cout << " X ";
std::cout << cvMat.size[i];
}
std::cout << "] cvMat.channels = " << cvMat.channels() << std::endl;
- save cv::Mat to bmp
std::ostringstream filename;
filename << "./save/pic-" << sequence++ << ".bmp";
std::string fileName = filename.str();
imwrite(fileName, cvMat);
std::ostringstream debug;
debug << "saved: " << filename.str() << "\n";
std::cout << debug.str();
- print uchar array as int
for (int i = 0; i < 4800; i++) {
printf("%u ", (unsigned) buffer[i]);
if (i%80 == 0) {
printf("\n");
}
}