I was wondering if anybody has a recommendation for an image format that supports integer-valued images in the range [0, 2^32] or higher, e.g. [0, 2^64]. I am interested in solutions that may already be supported by MATLAB (& OpenCV, if possible), that is, image formats with library support with read & write access in MATLAB and C/C++ (e.g. OpenCV) for such images.
I can write my own read/write library, but I would like to avoid reinventing the wheel. If no such library exists, I am interested in generic formats that would facilitate the implementation of read/write library for such images.
Note: I believe MATLAB's support for indexed images in .png
files is limited to integers in the [0, 2^16] range
Thanks
You could try TIFF.
MATLAB has a powerful interface: http://www.mathworks.com/help/techdoc/ref/tiffclass.html
For an example, look here: http://www.mathworks.com/help/techdoc/import_export/f5-123068.html#br_c_iz-1
or:
t = Tiff('uint32.tif','w');
imgdata=uint32(magic(10));
tagstruct.ImageLength = size(imgdata,1)
tagstruct.ImageWidth = size(imgdata,2)
tagstruct.Photometric = Tiff.Photometric.MinIsBlack
tagstruct.BitsPerSample = 32;
tagstruct.SampleFormat = Tiff.SampleFormat.UInt;
tagstruct.SamplesPerPixel = 1
tagstruct.RowsPerStrip = 16
tagstruct.PlanarConfiguration = Tiff.PlanarConfiguration.Chunky
tagstruct.Software = 'MATLAB'
t.setTag(tagstruct)
t.write(imgdata);
t.close();
info = imfinfo('uint32.tif');
data = imread('uint32.tif');
class(data)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With