Shouldn't bwconvhull() be idempotent?
Show older comments
Shouldn't the following two calculations give the same results?
load BWimage
A=bwconvhull(BW);
B=bwconvhull(bwconvhull(BW));
They don't.
isequal(A,B)
Accepted Answer
More Answers (2)
ideally it should. already the shape you provide in the original is convex, but the result of the first call of bwconvhull and the original differ at 130 positions. the result of the first bwconvhull result and second show differences at 114 positions.
i think the general issue is that shapes/lines can not be represented good in pixel format except for horizontal, vertical and diagonal lines. in the other cases the algorithm just rounds some pixel to be inside the hull or not
using bwconvhull on easier shapes like a block or something like
[0 0 0 0;
0 1 1 0;
0 1 1 1;
0 0 1 0];
is idempotent
2 Comments
Jonas
on 20 Jun 2021
another example where built in matlab functions work worse than user developed functions.
Categories
Find more on Object Analysis 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!







