Active Contour run time warning
Show older comments
Why I get a warning while using active contour in MATLAB?
Warning: Iterations terminated prematurely because no part of the contour lies within the image domain. If the range of pixel values in the input image is small (such as 0-1)
8 Comments
Adam Danz
on 31 Dec 2020
The warning tells you why it's appearing. We cannot explain why this is happening without more info such as the image, inputs to activecontour, etc.
Tamoor Aziz
on 1 Jan 2021
Adam Danz
on 1 Jan 2021
What is "Image"? I see that there's an attachment named Image.png and I assume the variable Image stores the image data of that file but how are you reading it in?
Since you're applying logical() I assume the image data are binary.
Tamoor Aziz
on 2 Jan 2021
Image Analyst
on 2 Jan 2021
Exactly? Do you mean that there is an exact solution? Where exactly is the border of that blurry smooth shape? Can you indicate it in a red curve? It looks like a judgment call to me. What about simply thresholding and calling bwboundary()?
boundary = bwboundaries(grayImage < someGrayLevel);
Adam Danz
on 2 Jan 2021
Now I have the same question for "BoundingBox". What is it? I understand it was created using mask.png and that it's probably a binary matrix but we can't be sure without having the line of code you used to read in that file and create 'BoundingBox'.
Image Analyst
on 2 Jan 2021
The mask is some initial shape for the activecontour() function. See my attached demo.

Adam Danz
on 2 Jan 2021
I'd like the OP to share how BoundinBox was created to eliminate that step as a possible cause of the problem and to ensure that we're identically replicating the problem. That would only be 2-3 lines from your demo,
grayImage = imread(fullFileName);
mask = grayImage > thresholdValue;
And for the composite mask,
mask = bwconvhull(mask, 'Union');
Accepted Answer
More Answers (0)
Categories
Find more on Image Segmentation 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!