background retrieving from video

hi I want to retrieve background of a street from a video So i wrote this code
if true
close all;
clc;
obj= mmreader('12.avi');
Frames = obj.NumberOfFrames;
Height = obj.Height;
Width = obj.Width;
size(obj);
a=read(obj);
sum = double(zeros(Height,Width,3));
imframe = double(zeros(Height,Width,3));
for f=1:Frames
sum(:,:,:,:) = sum(:,:,:,:) + double(a(:,:,:,f));
end
imframe = (sum(:,:,:,:)/Frames);
imframe1 = uint8(imframe);
figure;
imshow(imframe1);
end
the result as shown in below not very good
I want to delete the cars that are in specified area how I can do that please help me if any one know. best regards

回答(0 个)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by