Home MATLAB - Filling in the empty region of an ellipse/skull shape?
Reply: 0

MATLAB - Filling in the empty region of an ellipse/skull shape?

user1758
1#
user1758 Published in May 21, 2018, 5:04 pm

I have been attempting to fill in a binary image in Matlab so that I am left with the entirety of this oval-like image like this.

However, I have been running into an issue in actually being able to define the red region. I have tried the following:

  1. Using the bwconvhull function to fill the shape accurately, but then I do not know how to get rid of the inner shape to isolate just the red region.
  2. I have also attempted to trace the boundary of the binary region but to no avail. I am not entirely sure what to do after tracing the boundary. I have attempted to trace just the inner boundary, but the bwtraceboundary function simply follows the entirety of the borders (on the inside and outside of the skull).

Are there any similar functions to bwconvhull where I am able to expand a region from the center outward? My major difficulties have been in isolating either (a) the inner boundary of the skull or (b) the inner "black" region where the brain should be. My coding attempts can be found below:

Issue (a) - Tracing boundaries

hole=imread('Copy CT.jpg');
BW=im2bw(hole,.9); 
dim=size(BW);
col=round(dim(2)/2);        
row=min(find(BW(:,col)));
boundary = bwtraceboundary(BW,[row,col],'S');
x=boundary(:,2);
y=boundary(:,1);

Issue (b) - Isolating only the center

hole=imread('Copy CT.jpg');
BW=im2bw(hole,.9);   
CH=bwconvhull(BW);
KH=CH-BW;
KH2=bwareaopen(KH,200);

Are there any particular functions that would be worth trying, or would there be another way to isolate the center of the circle so I can only highlight the red region? Any insight would be greatly appreciated!

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.32025 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO