Tracking moving object using KLT

9 次查看(过去 30 天)
Breezy Boo
Breezy Boo 2017-4-14
Following is code to track corner points using klt algorithm.
I detect corner points using harris corner detector which also include some background points but i want to track only moving objects in the video and place box around them. Can i use blob and gaussian mixture model?
videoFileReader = vision.VideoFileReader('CrowdVideo.avi'));
videoPlayer = vision.VideoPlayer('Position',[100,100,680,520]);
release(videoFileReader);
release(videoPlayer);
objectFrame = step(videoFileReader);
%Detect interest points in the object region
%for rgb image
points = detectHarrisFeatures(rgb2gray(objectFrame));
%Display the detected points
pointImage = insertMarker(objectFrame, points.Location, '+', 'Color', 'white');
figure;
imshow(pointImage);
title('Detected Interest points');
%Creater tracker object
tracker = vision.PointTracker('MaxBidirectionalError',1);
%Initialize tracker
initialize(tracker, points.Location, objectFrame);
%read, track, display point and results in each frame
while ~isDone(videoFileReader)
frame = step(videoFileReader);
[points, validity] = step(tracker, frame);
out = insertMarker(frame, points(validity,:),'+');
step(videoPlayer, out);
end
release(videoPlayer);
release(videoFileReader);
end

回答(1 个)

Mohamed Ata
Mohamed Ata 2018-4-27
yes, blob analysis is the best way for your purpose

类别

Help CenterFile Exchange 中查找有关 Tracking and Motion Estimation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by