Advertisement
Guest User

Untitled

a guest
Jan 16th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. files = dir('images/*.bmp');
  2. for file = files'
  3. i = imread(strcat('images/',file.name));
  4. file.name
  5. [r, c] = size(i);
  6. a = zeros(r/2, c/2);
  7. for x=2:2:r,
  8. for y=2:2:c,
  9. if i(x,y) > 100,
  10. a(x/2,y/2) = 255;
  11. else
  12. a(x/2,y/2) = 0;
  13. end;
  14. end;
  15. end;
  16. imwrite(logical(a), strcat('images/Converted/',file.name));
  17. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement