Convert images to meshes#
from vedo import Picture, settings, printc, show
from vedo.applications import SplinePlotter
settings.default_backend = "vtk"
pic = Picture("../data/sox9_exp.jpg").bw()
pic
vedo.picture.Picture (../data/sox9_exp.jpg)
|
# Select the contour of the limb.
# Click q when done.
plt = SplinePlotter(pic)
plt.show(mode="image", zoom='tight')
outline = plt.line
plt.close()
printc("Cutting with outline... (may take a fews secs)", invert=True, c='g')
msh = pic.tomesh().cmap("viridis_r")
cut_msh = msh.clone().cut_with_point_loop(outline)
cut_msh
Cutting with outline... (may take a fews secs)
vedo.mesh.Mesh (../data/sox9_exp.jpg)
|
# interpolate the original data by looking at the 3 closest points
cut_msh.interpolate_data_from(msh, n=3)
vedo.mesh.Mesh (../data/sox9_exp.jpg)
|
show(cut_msh, outline, axes=1).close()