video=VideoReader('视频.mp4');
numberOfFrame=video.NumberOfFrame;
h=fspecial('average',[15 15]);
for i=2:numberOfFrame
back=imfilter(f,h);
back_r=size(back,1);back_c=size(back,2);
foreground_r=size(foreground,1);foreground_c=size(foreground,2);
x=(back_c-foreground_c)/2;
y=(back_r-foreground_r)/2;
result=back;
for l=1:foreground_r
for j=1:foreground_c
result(l+round(y)-1,j+round(x)-1,:)=foreground(l,j,:);
end
end
if(back_r<back_c)
result_crop=imcrop(result,[x,0,foreground_c,back_r]);
else
result_crop=imcrop(result,[0,y,back_c ,foreground_r]);
end
end