Tracking moving object using KLT

9 ビュー (過去 30 日間)
Breezy Boo
Breezy Boo 2017 年 4 月 14 日
回答済み: Mohamed Ata 2018 年 4 月 27 日
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 Center および File ExchangeTracking and Motion Estimation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by