【问题标题】:Generate Gray Scale Heat Map in Matlab在 Matlab 中生成灰度热图
【发布时间】:2013-09-19 09:03:44
【问题描述】:

我有一个包含十进制值的大矩阵。 我想在 Matlab 中绘制一个灰度热图。

我该怎么做?

我尝试使用 rgb2gray 函数,但为此我需要先创建一个图像。这在matlab中怎么做?

【问题讨论】:

  • 你好 Deadman,有后续吗?你可以考虑看看我的回答,我认为它解决了你的问题。

标签: image matlab grayscale


【解决方案1】:

imagesc 将完成这项工作。

imagesc(img)
axis equal off
colormap gray
colorbar

【讨论】:

  • 是的,如果你有图像处理工具箱,imshow 也可以。
【解决方案2】:

您可以使用surf-plot

你的矩阵:

A = rand(50,50);

俯视图:

surf(A);
view(0,90)

想要的灰度:

colormap(gray)

和颜色条作为图例:

colorbar

导致:

【讨论】:

    【解决方案3】:

    示例代码:

    myImage = mat2gray(myMatrix); % Converts your data to an image.
    figure; hold on; % Creates a figure
    imshow(myImage); % Show image
    colormap(jet); % Sets the color map you want
    colorbar; % Show a color bar on the right
    

    您可能感兴趣的一些彩色地图:

    喷气式飞机

    我认为jet 代表heatmap

    更多信息请访问Mathworks colormap page

    【讨论】:

      猜你喜欢
      • 2013-07-08
      • 1970-01-01
      • 2013-06-10
      • 2020-06-27
      • 2016-12-03
      • 1970-01-01
      • 1970-01-01
      • 2016-09-07
      • 2011-02-26
      相关资源
      最近更新 更多