how to detect the objects from a video?
2 次查看(过去 30 天)
显示 更早的评论
I have tried to convert the video into frames. And then to a binary images where the object is identified as a white patch,but I couldn't count the the objects. Moreover our project is based on the vehicle counting system using a ip camera. I dont have computer vision toolbox in matlab. Kindly,reply me back. This is the code,I have done so far,
**clc
clear all
% Read movie
SF = 1; %Starting Frame
MV = mmreader('a.avi'); %To read Movie EF = MV.NumberofFrames ; %Ending Frame img = read(MV,1); %reading particular frame A = double(rgb2gray(img)); %motion vector works on Gray Image formate [height width] = size(A); %Movie size?
% motion estimation h1 = figure(1); for f = SF: EF %Frame from SF To EF B = A; img = read(MV,f); A = double(rgb2gray(img));
%Foreground Detection
thresh=11;
fr_diff = abs(A-B);
for j = 1:width
for k = 1:height
if (fr_diff(k,j)>thresh)
fg(k,j) = A(k,j);
else
fg(k,j) = 0;
end
end
end
subplot(2,2,1) , imagesc(img), title (['Orignal Sequence Frame#',int2str(f)]);
subplot(2,2,2) , imshow(mat2gray(A)), title ('Previous Frame');
subplot(2,2,3) , imshow(mat2gray(B)), title ('Next Frame');
sd=imadjust(fg);
level=graythresh(sd);
m=imnoise(sd,'gaussian',0,0.025);
k=wiener2(m,[5,5]);
bw=im2bw(k,level);
subplot(2,2,4) , imagesc(bw), title ('Foreground');
hold off;
pause (.1);
% saveas(h1,strcat('Result-Paris-',num2str(f)),'jpg');
end**
0 个评论
采纳的回答
jasche
2013-1-24
can you post a clearly intended code. Have you decided on an algorithm to binarize you input frames ?
One way to count targets can be to identify the maximum intensity point in the frame and find the connected region.
2 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Tracking and Motion Estimation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!