简体   繁体   English

从Java中的(32位浮点)值创建灰度图像

[英]Create a grayscale image from (32-bit floating point) values in Java

With Java, a grayscale image from an array with (32-bit floating point) values. 使用Java,是具有(32位浮点)值的数组中的灰度图像。 Could I use BMP or PGM? 我可以使用BMP或PGM吗? What its the best image format with no compression for this array with these (32-bit floating point) values? 对于具有这些(32位浮点)值的数组,没有压缩的最佳图像格式是什么?

There's a variant of PGM called PFM (in Pf mode for grayscale) that supports IEEE 32 bit floating point samples. PGM有一个变体,称为PFM (在Pf模式下为灰度),它支持IEEE 32位浮点采样。

You could also store these images in an uncompressed TIFF file too. 您也可以将这些图像存储在未压缩的TIFF文件中。 I'm not sure what software does support floating point TIFFs though, as this is certainly outside of "Baseline" TIFF. 不过,我不确定哪种软件支持浮点TIFF,因为这肯定不在“基准” TIFF范围内。

BMP is not suitable for floating point. BMP不适合浮点。

I have a Java ImageIO plugin that reads PFM , and it's not too hard to extend it to write I guess. 我有一个Java ImageIO插件,该插件读取PFM ,我想扩展它来编写它并不难。 If your task is to implement read/write yourself, I'd certainly choose the PFM format, for simplicity. 如果您的任务是自己实现读/写,那么为了简单起见,我当然会选择PFM格式。

I also have a TIFF plugin (available on the same link), but it doesn't support floating point sample format (TIFF sample format 3 ) yet. 我也有一个TIFF插件(在同一链接上可用),但是它还不支持浮点样本格式(TIFF样本格式3 )。 Feel free to propose such a feature , and supply a few sample images for test purposes. 随时提出这样的功能 ,并提供一些示例图像以进行测试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM