%TYP5 rozdiely voči dynamickému pozadiu, ktoré ja aktualizované % keď sa v ňom nič nehýbe clear all close all videoObjekt = VideoReader('test.mpg'); nFrames = videoObjekt.NumberOfFrames subplot(2,3,1);colormap(gray(256)) subplot(2,3,2);colormap(gray(256)) subplot(2,3,3);colormap(gray(256)) subplot(2,3,4);colormap(gray(256)) subplot(2,3,5);colormap(gray(256)) bkgframe=double(rgb2gray(read(videoObjekt, 1))); h = fspecial('gaussian', [33 33], 10); for k = 2 : nFrames actframe=double(rgb2gray(read(videoObjekt, k))); dframe=abs(actframe-bkgframe); mframe = imfilter(dframe, h); bwframe = 255*im2bw(uint8(mframe), 10/255); subplot(2,3,1);image(actframe); subplot(2,3,2);image(bkgframe); subplot(2,3,3);image(dframe); subplot(2,3,4);image(mframe); subplot(2,3,5);image(bwframe); k if max(max(bwframe))<128 bkgframe=double(rgb2gray(read(videoObjekt, k))); disp('aktualizované pozadie') end pause end