フィルターのクリア

How can I write a raw double precision image to disk?

2 ビュー (過去 30 日間)
Michael
Michael 2011 年 6 月 28 日
I have a double precision image with small values and a very small dynamic range. I want to write this image to disk "as is": if I change it to the interval [0 255] the image is quantized and all the information is lost.
How can I write the image just the way it is stored in memory? By the way, using MATLAB's save is not a real option, I want to write a raw image.

採用された回答

Bjorn Gustavsson
Bjorn Gustavsson 2011 年 6 月 28 日
If you want to have true double precision image I think that the fits (Flexible Image Transport System) file format is the way to go. Then you can use the specialized ds9 image viewer, and some other image viewers know how to read fits images. There is a matlab interface to the C-fitsio tools:
that is supposedly good. Matlab unfortunately does not support writing fits-files. But it is not too difficult to roll your own, if you stick to a minimal/simple version of images to write. I made one wfits.m that you can find:
HTH,

その他の回答 (2 件)

Ali Can ARIK
Ali Can ARIK 2011 年 6 月 28 日
You can write the image on the disk as if writing a double precision array. However the image cannot be viewed by any image display tool, it can only be read again in Matlab.
filename = 'image.dat';
x = magic(5);
fid = fopen(filename,'w');
fwrite(fid,x);
fclose(fid);
% Following reads the file back into Matlab.
fid = fopen(filename,'r');
x_read = fread(fid);
fclose(fid);
Hope this is what you're looking for.
  2 件のコメント
David Young
David Young 2011 年 6 月 28 日
If the intention is to read it again in MATLAB, why not just use save and load?
Ali Can ARIK
Ali Can ARIK 2011 年 6 月 28 日
Good point. It makes it possible to read it using another programming language though and this is why I thought it would be useful.
Bjorn's solution above is actually what Michael needs imo.

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


Peter Manley-Cooke
Peter Manley-Cooke 2011 年 6 月 28 日
Could you not expand the dynamic range before quantization and shrink it again when the image is re-loaded?

カテゴリ

Help Center および File ExchangeLarge Files and Big Data についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by