How to find mesh type convex hull for an image?

4 views (last 30 days)
Please give me the code to get this as output image or tell me the logic how to approach to get this type of an image.

Answers (1)

John D'Errico
John D'Errico on 7 Mar 2015
Edited: John D'Errico on 7 Mar 2015
If all you have is an image, thus a 2-dimensional view of something, you cannot compute the 3-dimensional convex hull. Sorry. That is what you asked for, the convex hull for an image.
If you ACTUALLY have a set of points that describes/samples that object in 3-dimensions, thus (x,y,z) triads for many such points, then just call convhulln on the set.
Then to plot the points, (in blue) use plot3.
And finally to plot the triangulation, you can use trimesh.
This is all trivial to do, IF you read the help. So read the help for those tools. (The point is, you will learn more by reading the help than you will by my giving you explicit code. And for something trivial, why not do so?)
The only thing that might take some digging to learn is how to plot the triangulation as it is there with red edges and no facets, something done with a call like this:
trimesh(tri,xyz(:,1),xyz(:,2),xyz(:,3),'facecolor','none','edgecolor','r')

Categories

Find more on Bounding Regions in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!