从MATLAB Isosurface中提取轮廓

时间:2014-10-27 00:30:24

标签: matlab

我有一个我在MATLAB中绘制的等值面,例如:

MATLAB Isosurface

对于我目前拥有的给定视图设置,我想从中提取大纲。我期望的输出是这样的(由GIMP制作):

Isosurface Outline

有没有办法以编程方式执行此操作,因此我不必在GIMP中手动执行此操作?

1 个答案:

答案 0 :(得分:0)

这够好吗?边缘检测取自bwboundaries文档。

clear, close all
[x y z v] = flow;
figure(1)
p = patch(isosurface(x, y, z, v, -3));
set(p, 'FaceColor', 'red', 'EdgeColor', 'none');
daspect([1 1 1])
view(3)
grid off
axis off
print -dbmp test

I=imread('test.bmp');
G = im2bw(I, graythresh(I));
[B,L] = bwboundaries(~G,'noholes');

for k = 1:length(B)
    boundary = B{k};
    plot(boundary(:,2), -boundary(:,1), 'k', 'LineWidth', 2)
    hold on
end
hold off

结果是:

enter image description here

相关问题