MATLAB Answers


Detection of 3D blobs with flat surfaces

Asked by Roohollah Milimonfared on 25 Aug 2019 at 4:01
Latest activity Answered by darova
on 26 Aug 2019 at 9:07
I have a 3D gray-scale array that represents a bag with several objects inside. I need to find (segment) any object with flat surface/s in the bag. Knowing the approximate intensity range of these objects, I binarized the volume, and removed objects with volumes below a threshold.
The result was getting some of those objects as individual blobs and some attached to nearby objects.
Now, I would like to detect blobs with flat surfaces. Any suggestion?


on 25 Aug 2019 at 17:52
What do you mean by 'flat blob'?
That's right. Only expand it to 3D. An example of a 3D blob with flat surfaces is a cylinder (flat surfaces at its two ends).
In my problem, the blobs have more complicated shapes, but some have flat surfaces that I would like to use as a characteristic to detect them.

Sign in to comment.

2 Answers

Answer by Image Analyst
on 26 Aug 2019 at 1:13
Edited by Image Analyst
on 26 Aug 2019 at 2:57
 Accepted Answer

Try convhulln() and extract any blob that has points on the convex hull.


Show 1 older comment
Image Analyst
on 26 Aug 2019 at 2:58
I meant convhulln() or whatever the multi-dimensional convex hull function is called.
stats = regionprops3(blob,'ConvexImage','ConvexHull','VoxelList');
The binary blob (right) and its ConvexImage (left):
C = intersect(stats.ConvexHull{1,1},stats.VoxelList{1,1},'rows');
C is empty which means the blob has no point on its convex hull.
Below is the plot of voxels (red) and convex hull points (blue). On the top surface, the convex hull points are located at the edges. Can we use this fact to say it is a (nearly) flat surface?
I have come up with this trivial solution.
In this problem, the direction of the flat surface is fixed (y-axis is always the axis normal to the flat surface). Sort the y-coordinates (the first column in ConvexHull) in descending order:
ConvexHull = stats.ConvexHull{1,1};
ConvexHull = sortrows(ConvexHull,1,'descend');
Find the Standard Deviation of the first 10% of the ConvexHull coordinates.
threshold = size(ConvexHull,1) * 0.1;
y_coor = ConvexHull(1:threshold,1);
x_coor = ConvexHull(1:threshold,2);
z_coor = ConvexHull(1:threshold,3);
y_std = std(y_coor) % 0.948
x_std = std(x_coor) % 23.676
z_std = std(z_coor) % 49.474
The value of y-std found to be significantly lower than its counterparts (x_std & z_std).
The positions of the 10% of the ConvexHull points in the blob indicates there should be a lower STD for y-coordinates:
Still, need to verify this for my other random-shaped blobs with flat surfaces.
Thoughts and opinions on this is much appreciated.

Sign in to comment.

Answer by darova
on 26 Aug 2019 at 9:07

What about boundary()?
Once you have boundary faces: find all neighbour faces for each node
If angles between surfaces is about zero then we have a flat face


Sign in to comment.