Advertisement
Guest User

Untitled

a guest
Oct 24th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. vid = videoinput('winvideo')
  2. get(vid)
  3. get(getselectedsource(vid))
  4. set(vid, 'TriggerRepeat', Inf)
  5. figure;
  6. set(gcf, 'doublebuffer', 'on')
  7. start(vid)
  8. flushdata(vid);
  9.  
  10. while (vid.FramesAcquired <= 100)
  11. data = getdata(vid, 1);
  12. image = rgb2gray(data);
  13.  
  14. subplot(3,2,1)
  15. imshow(image)
  16.  
  17. subplot(3,2,2) %histogram szarego
  18. imhist(image)
  19.  
  20. leveledImage = histeq(image)
  21.  
  22. subplot(3,2,3)
  23. imshow(leveledImage)
  24.  
  25. threshold = graythresh(image) % binaryacja adaptacyjne
  26. binaryImage = im2bw(image, threshold)
  27. subplot(3,2,4)
  28. imshow(binaryImage)
  29.  
  30. end
  31.  
  32. stop(vid)
  33. delete(vid)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement