Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.50 KB | None | 0 0
  1. function [cechy, obiekt, obr_bw] = obr2cechy(obraz,tlo)
  2.  
  3. obr_r = imabsdiff(obraz,tlo);
  4. obr_bw = im2bw(obr_r,graythresh(obr_r));
  5.  
  6. [obr_ind, il_ob] = bwlabel(obr_bw);
  7. pow_max = bwarea(obr_ind==1);
  8. ind_max = 1;
  9.  
  10. for i=2:il_ob
  11.     pow = bwarea(obr_ind==i);
  12.     if pow > pow_max
  13.         pow_max = pow;
  14.         ind_max = i;
  15.     end
  16. end
  17.  
  18. obiekt = (obr_ind==ind_max);
  19.  
  20. cechy = [niezm1(obiekt), niezm2(obiekt), niezm3(obiekt), niezm4(obiekt), niezm5(obiekt), niezm6(obiekt), niezm7(obiekt)];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement