1 | initial version |
imwrite() can only save float images in ".exr" or ".hdr" format, and that only, if you built in suppport for that (WITH_OPENEXR).
alternatively, you can use the FileStorage, to save your img to yml (text):
FileStorage fs("my.yml", 1);
fs << "some_name" << mat;
fs.release();
2 | No.2 Revision |
imwrite() can only save float images in ".exr" or ".hdr" format, and that only, if you built in suppport for that (WITH_OPENEXR).
alternatively, you can use the FileStorage, to save your img to yml (text):
FileStorage fs("my.yml", 1);
fs << "some_name" << 3 | No.3 Revision |
imwrite() can only save float images in ".exr" or ".hdr" format, and that only, if you built in suppport for that (WITH_OPENEXR).
if you want to save it as png or jpg, you will need to convert it to uchar first:
Mat floatImg = ...
Mat ucharImg;
floatImg.convertTo(ucharImg, CV_8U, 255.0);
imwrite("my.png", ucharImg);
alternatively, you can use the FileStorage, to save your img to yml (text):
FileStorage fs("my.yml", 1);
fs << "some_name" << image;
fs.release();