Regarding imwrite()

12 Ansichten (letzte 30 Tage)
Samay Kumar
Samay Kumar am 2 Sep. 2011
Friends,
I want to store 3D Cartesian Co-ordinates (acquired from range-map of 376x200 size) in the image format. Let say, color image has three channels and I want to store x-coordinates of given points in red channel, y-coordinates in green channel and so on.
I tried using..
>>imwrite(cartPoints, 'cartPoints.tif')
where, size of cartPoints is (376, 200, 3).
Problem is when I read the 'cartPoints.tif', values are normalized between [0, 255] and hence the real information is lost. Can somebody help me to save the value to the image without getting normalized?
Any help would be really appreciated.

Akzeptierte Antwort

David Young
David Young am 2 Sep. 2011
If you want to read the data back into MATLAB without any loss of accuracy, then use load and save rather than imwrite and imread.
If you really must use an image file format, copy the data to a uint16 array, and use an uncompressed file format that supports 16-bit data, such as .tif. To avoid loss of data you still need to ensure that the values you start with are integers that can be expressed in 16 bits.

Weitere Antworten (1)

Samay Kumar
Samay Kumar am 3 Sep. 2011
Thanks David, was informative.
With I can save data without loss or normalization in TIFF format.
Thanks anyhow.

Kategorien

Mehr zu Read, Write, and Modify Image finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by