I can replace pixels in CV_32S but not CV_16U or CV_8U

asked 2014-04-29 16:29:16 -0500

Ralph058 gravatar image

updated 2014-04-30 10:57:36 -0500

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.

If I process in 32S then convert to 16U or 8U as needed. Everything works OK. It appears the issue is to the method of writing to pixels.

For what it's worth, I'm on Ubuntu 14.04 and OpenCV 2.48.

I suspect a bug, but, if so, there should be someone else out there using the format.

edit retag flag offensive close merge delete