How to prevent imwrite from rounding my data?

So, I am working with temperature data in a range of 0 to 500 degrees. This data is taken from a FLIR camera, so the data is saved in a multi frame tiff file. I run this data through my first script to single out my area of interest. I then save the data to another multi frame tiff file with the imwrite function. In my data, each value has at least 4 decimal points. imwrite can write data to a tiff in int8-64 format, and in double format. in the int formats it rounds to the nearest whole number. In double format it assumes a dynamic range of [0,1] and scales the data. So my question is: how do i write this data to a tiff file without loosing my decimals or limiting the data to a maximum of 255?
EDIT: The data goes through another script to pull temperatures at specific pixels, and those selected points are plotted on a 18-19 scaled plot and a 18-500 scaled plot

1 件のコメント

Adam
Adam 2017 年 8 月 11 日
What are you going to do with the tiff afterwards? You can scale the data to a 0-1 range and then just scale it back up again when you use the tiff.

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

回答 (1 件)

Jan
Jan 2017 年 8 月 11 日

0 投票

TIFF images are not the best idea to store data in a high precision. You can use a 16-bit TIFF image, but a binary file might be much easier.

2 件のコメント

Harrison Biggs
Harrison Biggs 2017 年 8 月 11 日
Can I use a binary file for multiple frames? I've never used a binary file
Jan
Jan 2017 年 8 月 11 日
編集済み: Jan 2017 年 8 月 11 日
If you want to store the values without any limitations in the precision, you can store the data as MAT file or by:
fid = fopen(FileName, 'w');
fwrite(fid, ndims(data), 'uint64');
fwrite(fid, size(data), 'uint64');
fwrite(fid, data, 'double');
fclose(fid);
You have to decide how to store the meta-data like array size and so on.
TIFFs are image files. I did not exactly understand, which demands you have for the precision, but perhaps the limitations are not sufficient. But if you want to store the data as image files, the binary format is not optimal. As far as I can see, Matlab's TIFF export allows 8 bits per channel only.

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

カテゴリ

ヘルプ センター および File ExchangeConvert Image Type についてさらに検索

質問済み:

2017 年 8 月 11 日

編集済み:

Jan
2017 年 8 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by