How to isolate object from a background of variable brightness
Show older comments
I am trying to isolate worms in these images below which have a variable background:

I binarize the image using
im = imbinarize(255-rgb2gray(image),'adaptive','Sensitivity',.62,'ForegroundPolarity','dark')
and get:

I then use
imfill(im,'holes')
to get

Now that I have a black 'halo' around my desired object, I want to isolate it from the background so that I can process it further - measure its area and the length of its skeleton.
But I am not sure how to do this.
The images always have only 1 of these worms - there are no other objects in the image. Just the background with striations and uneven lighting with 1 useful object in them.
Any help would be much appreciated :)
I've also attached the original image below.

Thanks in advance :)
Accepted Answer
More Answers (0)
Categories
Find more on Image Type Conversion 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!