I have been having some problem with Mat based images not looking like I believe they should in CV_16U and CV_8U. I have found that CV_32S works OK, but I have no reason to transmit such a large image. In fact, one of the images could be a boolean but there seems to be no boolean format for Mat images. Also, I'm bandwidth limited. Four 157 x 105 Mat have to be transmitted over USB2.
The images in the other two integer formats do not have the same numbers I get using cout nor are continuous blocks continuous but rather striped with 1 to 3 spaces of 0. The index also is continuous in the printout.
More bazaar, if I output the image cell immediately after the replacement statement, I get the right number and no spaces.
rowSilh[spotCol] = 255; cout << "Col = " << spotCol<< endl; cout << "Silh = " << rowSilh[spotCol]<< endl;
The two couts have the right numbers but.
The display does not match and the file from cv::FileStorage silh("imgsilh.ext", cv::FileStorage::WRITE); silh << "imgSilh"<< imgSilh; silh.release();
However, the display and the file match.
For what it's worth, I'm on Ubuntu 14.04 and OpenCV 2.48. I suspect a bug, but there should be someone else out there using the format.