4
$\begingroup$

I have this image:

enter image description here

I wish to know if there is a way to detect a very smooth contour of this blob without including any surface irregularities (objects close or attached to the surface that tend to increase the curvature dramatically).

The approach that I have been using includes the use of MorphologicalBinarize. However, I do not know how to get rid of any irregularities close to the surface of the blob

enter image description here

Note: Since i have a stack of images, drawing by hand is tedious

$\endgroup$
8
$\begingroup$
img00=Import["https://i.stack.imgur.com/unvja.png"]

enter image description here

img01=Erosion[img00,DiskMatrix[60]]  

enter image description here

here is the result :

img02=Dilation[img01,DiskMatrix[60]]    

![enter image description here

The value 60 used for Erosion/Dilation has been easily found by experimental trials (4 iterations : 3 -> 10 -> 30 -> 60) .

comparaison result/initial image :

img03=ImageMultiply @@ (ColorNegate /@ (GradientFilter[#,2]& /@  {img00,img02}))  

enter image description here

$\endgroup$
  • 1
    $\begingroup$ Erosion followed by Dilation is known as Opening. If one wants to fill holes as well as remove protrusions, one can perform Closing as well. $\endgroup$ – Rahul Jul 12 '17 at 9:37
  • $\begingroup$ @Rahul Thanks. In fact my approach was "chimical" rather than "image processing". $\endgroup$ – andre314 Jul 12 '17 at 9:41
5
$\begingroup$
img = Import["https://i.stack.imgur.com/fBF7C.png"];

curveImg = ColorNegate@CurvatureFlowFilter[img, 80];

circleImg = ColorNegate@EdgeDetect[FillingTransform[DeleteSmallComponents[Binarize[curveImg]]]];

circleImgCol = Colorize[circleImg, ColorRules -> {0 -> Red, 1 -> White}];

ImageMultiply[img, circleImgCol]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.