Matlab:用imcontour填充等高线图 [英] Matlab: Filled contour plot with imcontour

查看:1544
本文介绍了Matlab:用imcontour填充等高线图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从MATLAB中的图像创建一个填充的等高线图。但是,命令 imcontour 似乎没有填充轮廓的选项。如果我使用 contourf ,它会绘制所有黑色轮廓线。由于图像具有很多轮廓水平,因此几乎完全以黑色显示。



是否有人知道如何填充 imcontour 或如何在图像上有意义地应用 contourf

解决方案

imcontour 没有填充版本,因为从理论上讲,图像本身填充版本。

  data = load('clown'); 
img = ind2rgb(data.X,data.map);

imshow(img);
持有
imcontour(img(:,:,1),3);



你可以使用 contourf ,然后


I am trying to create a filled contour plot from an image in MATLAB. However, the command imcontour does not seem to have an option for filled contours. If I use contourf, it draws all the contour lines in black. Since the image has a lot of contour levels, it is shown almost completely in black.

Does anybody know how to make a filled imcontour or how to meaningfully apply contourf on an image?

解决方案

There is no filled version of imcontour because in theory, the image itself is the filled version.

data = load('clown');
img = ind2rgb(data.X, data.map);

imshow(img);
hold on
imcontour(img(:,:,1), 3);

You could use contourf though, and specify the line color. By specifying a value of 'none' no lines will be shown.

c = contourf(data, 2, 'LineColor', 'none')

这篇关于Matlab:用imcontour填充等高线图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆