yes, blob analysis is the best way for your purpose
Tracking moving object using KLT
9 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
另请参阅
类别
在 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!