Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- info=imaqhwinfo
- vid=videoinput('winvideo')
- %preview(vid)
- get(vid)
- get(getselectedsource(vid))
- set(vid, 'TriggerRepeat', Inf)
- set(gcf, 'doublebuffer', 'on')
- start(vid)
- figure(1)
- while(vid.FramesAcquired <=10)
- data=getsnapshot(vid);
- obraz=rgb2gray(data);
- subplot(2,2,1);
- imshow(obraz);
- end
- %figure(2);
- subplot(2,2,2);
- imhist(obraz);
- %figure(3);
- subplot(2,2,3);
- histeq(obraz);
- %level = graythresh(obraz);
- %bin = im2bw(obraz,level);
- %figure(4);
- %subplot(2,2,4);
- %imshow(bin);
- % figure(2);
- % %zakolcenia gausa
- % obr_g = imnoise(obraz,'gaussian');
- % subplot(3,1,1);
- % imshow(obr_g);
- %
- % hg=fspecial('gaussian',[3 3]);
- % obr_h=imfilter(obr_g,hg);
- % subplot(3,1,2)
- % imshow(obr_h);
- % hg1=fspecial('gaussian',[7 7]);
- % obr_h1=imfilter(obr_g,hg1);
- % subplot(3,1,3);
- % imshow(obr_h1);
- %
- % figure(3);
- % subplot(3,1,1);
- % imshow(obr_g);
- % h_usr=fspecial('average',[3 3])
- % obr_f=imfilter(obr_g,h_usr);
- % subplot(3,1,2);
- % imshow(obr_f);
- % h_usr1=fspecial('average',[7 7])
- % obr_f1=imfilter(obr_g,h_usr1);
- % subplot(3,1,3);
- % imshow(obr_f1);
- %
- % figure(4);
- % subplot(3,1,1);
- % imshow(obr_g);
- % obr_fm=medfilt2(obr_g, [3 3]);
- % subplot(3,1,2);
- % imshow(obr_fm);
- % obr_fm1=medfilt2(obr_g, [7 7]);
- % subplot(3,1,3);
- % % imshow(obr_fm1);
- %
- % figure(5);
- % %zaklocenia sol i pieprz
- % obr_sp=imnoise(obraz,'salt & pepper');
- % subplot(3,1,1);
- % imshow(obr_sp);
- %
- % hg=fspecial('gaussian',[3 3]);
- % obr_h=imfilter(obr_sp,hg);
- % subplot(3,1,2)
- % imshow(obr_h);
- % hg1=fspecial('gaussian',[7 7]);
- % obr_h1=imfilter(obr_sp,hg1);
- % subplot(3,1,3);
- % imshow(obr_h1);
- %
- % figure(6);
- % subplot(3,1,1);
- % imshow(obr_sp);
- % h_usr=fspecial('average',[3 3])
- % obr_f=imfilter(obr_sp,h_usr);
- % subplot(3,1,2);
- % imshow(obr_f);
- % h_usr1=fspecial('average',[7 7])
- % obr_f1=imfilter(obr_sp,h_usr1);
- % subplot(3,1,3);
- % imshow(obr_f1);
- %
- % figure(7);
- % subplot(3,1,1);
- % imshow(obr_sp);
- % obr_fm=medfilt2(obr_sp, [3 3]);
- % subplot(3,1,2);
- % imshow(obr_fm);
- % obr_fm1=medfilt2(obr_sp, [7 7]);
- % subplot(3,1,3);
- % imshow(obr_fm1);
- figure(8);
- %zakloenia pasami
- obr_p=pasy(obraz,1,50,'poziome');
- subplot(3,1,1);
- imshow(obr_p);
- hg=fspecial('gaussian',[3 3]);
- obr_h=imfilter(obr_p,hg);
- subplot(3,1,2)
- imshow(obr_p);
- hg1=fspecial('gaussian',[7 7]);
- obr_h1=imfilter(obr_p,hg1);
- subplot(3,1,3);
- imshow(obr_h1);
- figure(9);
- subplot(3,1,1);
- imshow(obr_p);
- h_usr=fspecial('average',[3 3])
- obr_f=imfilter(obr_p,h_usr);
- subplot(3,1,2);
- imshow(obr_f);
- h_usr1=fspecial('average',[7 7])
- obr_f1=imfilter(obr_p,h_usr1);
- subplot(3,1,3);
- imshow(obr_f1);
- figure(10);
- subplot(3,1,1);
- imshow(obr_p);
- obr_fm=medfilt2(obr_p, [3 3]);
- subplot(3,1,2);
- imshow(obr_fm);
- obr_fm1=medfilt2(obr_p, [7 7]);
- subplot(3,1,3);
- imshow(obr_fm1);
- stop(vid)
- delete(vid)
- clear
- close(gfc)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement