Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Integer-valued images in the [0, 2^32] range or higher. Support in MATLAB or/and OpenCV?

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

like image 324
Amelio Vazquez-Reina Avatar asked Feb 23 '23 21:02

Amelio Vazquez-Reina


1 Answers

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)
like image 112
Ashish Uthama Avatar answered May 13 '23 05:05

Ashish Uthama