%TYP1 diferencia voci predchadzajucej snimke clear all close all videoObjekt = VideoReader('test.mpg'); %pozor na frame 27, 61, 73 nFrames = videoObjekt.NumberOfFrames subplot(2,2,1);colormap(gray(256)) subplot(2,2,2);colormap(gray(256)) subplot(2,2,3);colormap(gray(256)) subplot(2,2,4);colormap(gray(256)) lastFrame=double(rgb2gray(read(videoObjekt, 1))); h = fspecial('gaussian', [33 33], 10); for k = 2 : nFrames actframe=double(rgb2gray(read(videoObjekt, k))); dframe=abs(actframe-lastFrame); %mframe = medfilt2(dframe); mframe = imfilter(dframe, h); bwframe = 255*im2bw(uint8(mframe), 10/255); subplot(2,2,1);image(actframe); subplot(2,2,2);image(dframe); subplot(2,2,3);image(mframe); subplot(2,2,4);image(bwframe); pause lastFrame=actframe; k end