Is there is a way to export mesh in figure to stl or obj???

28 views (last 30 days)
Hello I have a matlab code as i below that result 3d mesh, I wonder is there is any simple way that give me an option to export it to 3D object as stl or obj or any else 3d extension
if true
% Img = imread('MK2.jpg');
Img=double(Img(:,:,1));
sigma=1.5;
G=fspecial('gaussian',15,sigma);
Img_smooth=conv2(Img,G,'same');
[Ix,Iy]=gradient(Img_smooth);
f=Ix.^2+Iy.^2;
g=1./(1+f);
c0=2;
initialfunc=c0*ones(size(Img));
initialfunc(10:95, 8:100)=-c0;
phi=initialLSF;
figure(1);
mesh(-phi);
hold on; contour(phi, [0,0], 'r','LineWidth',2);
title('M1');
view([-80 35]);
imagesc(Img,[0, 255]); axis off; axis equal; colormap(gray); hold on; contour(phi, [0,0], 'r');
end
end
alfa=0;
iter_refine = 10;
.
.
.
figure;
mesh(-finalLSF);
hold on; contour(phi, [0,0], 'r','LineWidth',2);
str=['Final level set function, ', num2str(iter_outer*iter_inner+iter_refine), ' iterations'];
title(str);
axis off;
end
end

Answers (2)

Young Dae
Young Dae on 14 Sep 2018

Walter Roberson
Walter Roberson on 27 Dec 2017
Note: mesh are surf that have face color turned off.

Community Treasure Hunt

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

Start Hunting!