Fill a gap on an image surface
Show older comments
Hello,
I have an image as follows:

I am using activecontour to detect the edges of the bone.
function [bw] = segmentBone(imageFile)
%Function for segmenting the bone from the background
imageFile = imageFile(:,:,1);
mask_width = 1;
border_width = 2;
imageFile = padarray(imageFile, [border_width, border_width], 0);
mask = zeros(size(imageFile));
mask(mask_width:end-mask_width,mask_width:end-mask_width) = 1;
small_image_itter = 651;
bw = activecontour(imageFile, mask, small_image_itter, 'Chan-Vese', 'SmoothFactor', 0.95);
end
This is the result I get:

The issue is that crack in the middle of the bone. I want to flatten it, so that the lower surface looks smooth. This is an example of what I want to achieve:

It is really important that the boundaries of the bone stay the same and do not get thicker!
Any ideas on how to solve this task?
Thanks in advance!
Accepted Answer
More Answers (0)
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!