saving an image using 'imwrite'

1 Ansicht (letzte 30 Tage)
Harry
Harry am 5 Jul. 2013
I'm trying to save an grayscale image to a file using
imagesc(Nv)
imwrite(Nv,'C:\Users\bostock_h\Documents\Images\chargemap.jpg')
but for some reason this just creates a file which is just white with the wrong dimensions. But I know 'Nv' is fine because the 'imagesc' brings up the image in MATLAB and it is correct.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 5 Jul. 2013
imagesc() automatically scales data so that the minimum value maps to the first color and the maximum value maps to the last color. If your data does not happen to be in the range 0 to 1 for floating point values, or 0 to 255 for uint8, or 0 to 65535 for uint16, then the image that imwrite() creates is not going to be the image you want.

Weitere Antworten (0)

Kategorien

Mehr zu Images finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by