Inconsistent crashes with bwboundaries

I am using version 2019a. I am using bwboundaries to find the contour of an object, but it has recently been causing crashes. However, the crashes only occur with certain images and I am not sure what the differences are. Attached are img1.m and img2.m which contain the images. Running the following leads to a crash with an error message reading "Illegal instruction detected at [Time]"
B=bwboundaries(img1);
However running everything the same on img2 gives me the proper readout
B=bwboundaries(img2);
The only obvious difference I can see is that img1 only has one object and img2 has five objects (confirmed by running regionprops on both images). Adding in objects into img1 did not solve the issue.

 Accepted Answer

I don't have that particular version but it works fine with r2021a:
s1 = load('img1.mat')
bw1 = s1.img1;
subplot(1, 2, 1);
imshow(bw1);
s2 = load('img2.mat')
bw2 = s2.img2;
subplot(1, 2, 2);
imshow(bw2);
axis on image
b1 = bwboundaries(bw1)
b2 = bwboundaries(bw2)
s1 =
struct with fields:
img1: [490×490 logical]
s2 =
struct with fields:
img2: [529×529 logical]
b1 =
1×1 cell array
{59×2 double}
b2 =
5×1 cell array
{ 3×2 double}
{22×2 double}
{ 3×2 double}
{72×2 double}
{ 3×2 double}

More Answers (0)

Products

Release

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!