问题描述
我正在尝试从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填充等高线图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!