Guest User

Untitled

a guest
Oct 20th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. function [binarisasiImage, binarisasiImageLabel] = BinarisasiSegProcess(I)
  2.  
  3. img_bin = I;
  4. % pic_grey = rgb2gray(pic);
  5. % imshow(pic_grey);
  6. img_bin1 = adaptivethreshold(img_bin,150,0.04,0);
  7. figure, imshow(img_bin1);
  8.  
  9. img_bin2 = ~img_bin1;
  10. figure, imshow(img_bin2);
  11.  
  12. img_bin3 = bwareaopen(img_bin2,50);
  13. figure, imshow(img_bin3);
  14.  
  15. se_bin = strel('disk',5);
  16. img_bin4 = imclose(img_bin3, se_bin);
  17. figure, imshow(img_bin4);
  18.  
  19. img_bin5 = imfill(img_bin4,'holes');
  20. figure, imshow(img_bin5);
  21.  
  22. binarisasiImage = bwareaopen(img_bin5,200);
  23. figure, imshow(binarisasiImage);
  24.  
  25. binarisasiImageLabel = bwlabel(binarisasiImage);
Add Comment
Please, Sign In to add comment