【发布时间】:2013-08-04 06:47:54
【问题描述】:
我想了解如何保存float 类型的图像:
float * image;
以这种方式分配:
int size = width * height;
image = (float *)malloc(size * sizeof(float));
我尝试使用 CImg 库,但不直接接受浮点数。事实上,我只用它来捕捉图像浮动,因为我只需要浮动图像。
CImg<float> image("image.jpg");
int width = image.width();
int height = image.height();
int size = width*height
float * image = image.data();
如何将这张图片从.jpg 或.bmp 保存到float 可读。我想打开一个写缓冲区,但没有保存任何东西,我无法从文件中读取!
【问题讨论】:
-
这些图片来自哪里?什么是浮点范围?我几乎可以肯定您需要先将格式标准化为整数值。
标签: c++ serialization floating-point cimg