I have a binary image and I used the bwboundaries to extracted several boundaries from the image.
However, bwboundaries not only gave me hole boundaries, but also their parents.
For example, the output from this code:
B = bwboundaries(mask, 'holes');
returns multiple cells and each cell correspond to a collection of boundary points for an object.
Cell 1 may be a parent object and Cell 2 may be a hole object reside within the parent object. What I want is to combine these two cells so that the output become a new object and is equivalent to the parent object substracted by the hole.
Right now, if I output the boundary and visualize using R, the result be like:
You can see the holes will be overlapped by their parent polygons.
Of course I can do it manually but I have hundreds of images to process and it is very time consuming to manually process them all.
Is there any computational way for batch processing? Thank you.