Creating an image from values in the range [-1,1] and applying a colormap

1 回表示 (過去 30 日間)
Coby Allred
Coby Allred 2017 年 3 月 24 日
コメント済み: Walter Roberson 2017 年 3 月 27 日
Hello,
I have a matrix of data which I am trying to show as an image with values that range from -1 to 1. Ideally, I would like to keep these values within this range and not have to compress them to [0,1] but I am not sure if this is possible or how to best approach it.
Second, I would like to apply a colormap to this image that covers the entire -1 to 1 range but this would require the -1 to 1 image unless there is another way to do it. Any help with this would be appreciated!

回答 (1 件)

Walter Roberson
Walter Roberson 2017 年 3 月 24 日
data = rand(30,50) * 2 - 1;
imagesc( data, [-1 1]);
colormap( prisim(256) )
  3 件のコメント
Image Analyst
Image Analyst 2017 年 3 月 27 日
You can use save() to save it to a .mat file.
Walter Roberson
Walter Roberson 2017 年 3 月 27 日
Note: floating point TIFF images are not common, and your viewer might not know how to deal with them.

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

カテゴリ

Help Center および File ExchangeColor and Styling についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by