Skip to content

Instantly share code, notes, and snippets.

@mstrYoda
Created December 21, 2016 08:54
Show Gist options
  • Save mstrYoda/b9c72eb181aa2d4591840d8654023958 to your computer and use it in GitHub Desktop.
Save mstrYoda/b9c72eb181aa2d4591840d8654023958 to your computer and use it in GitHub Desktop.
matlab regionprops example
I = imread('coins.png');
bw = im2bw(I, graythresh(I));
bw2 = imfill(bw,'holes');
s = regionprops(bw2, 'BoundingBox');
for k=1:length(s),
boundary = s(k).BoundingBox;
I2 = imcrop(I,boundary);
subplot(1,length(s),k),imshow(I2);
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment