1 | initial version |
img8bit and CV_32FC3 ? 8 bit image is CV_8UC1 or CV_8UC3 (afair imwrite writes 8 bit 3 channel or 8 bit 1 channel images only). You have CV_32F (one channel) so try CV_8UC1:
wshed.convertTo(img8bit, CV_8UC1, 255.0);
Sure you will lose some information, but if you want to have just visualization it is ok. If you want store and then read all information use FileStorage
class.