how to save an image without using 'uint8'?

7 ビュー (過去 30 日間)
anika hossain
anika hossain 2015 年 9 月 17 日
コメント済み: Guillaume 2015 年 9 月 17 日
i want to save my image with its actual pixel value which is float/double. i am using 'png' format picture & _ 'imwrite(uint8(image));'_ to save it. now i want it without 'uint8'

回答 (1 件)

Guillaume
Guillaume 2015 年 9 月 17 日
The png format only supports integer pixels (up to 16 bits). There are actually very few mainstream image formats that support floating point pixels as for visualisation the decimal part makes no difference.
In theory, you could save the image as png (converting it to integer) while storing the original image in a custom png chunk, but matlab does not give that level of control over load/save of png images.
I'm sure we've told you this before: if you want to save the image for visualisation, convert it to integer, you can use uint16 instead of uint8 for more precision. If you want to save the image for further precision save it as mat file. If you want to do both, save it in both formats.
  7 件のコメント
Walter Roberson
Walter Roberson 2015 年 9 月 17 日
TIF does support floating point, and you can create floating point TIF images using the Tiff class in MATLAB.
I was mistaken about DICOM support for images (though you can insert such data under a private Bulk Data tag.)
Guillaume
Guillaume 2015 年 9 月 17 日
Yes, tif support floating point. Whether your image editor/viewer will cope with such image is not guaranteed.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDICOM Format についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by