Created
July 26, 2013 02:00
-
-
Save dbuscombe-usgs/6085464 to your computer and use it in GitHub Desktop.
Black and white convex hull
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function P = bwconvhull_alt(BW) | |
% usage: P is a binary image wherein the convex hull of objects are returned, BW is the input binary image | |
% P= bwconvhull_alt(BW); | |
warning off all | |
s=regionprops(logical(BW),'ConvexImage','BoundingBox'); | |
P=zeros(size(BW)); | |
for no=1:length(s) | |
P(s(no).BoundingBox(2):s(no).BoundingBox(2)+s(no).BoundingBox(4)-1,... | |
s(no).BoundingBox:s(no).BoundingBox(1)+s(no).BoundingBox(3)-1)=s(no).ConvexImage; | |
end | |
warning on all |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment