How to track certain points in a moving object through a video ?

4 views (last 30 days)
Hi, I am trying to make a code to detect moving hose during a video taped experiment. I need to select certain points in this hose and detect them through the video. I have attached a frame of the video I have. The hose is detected through LED strip, is there a function that can allow me to select certain points of the hose in the picture from first frame and detect them through the entire video so that I can calculate the movements in pixels ? In my code I am using SURF features detection and select strongest 5 points but even then I can not find a way to track those 5 points through the video. Appreciate your advice, my code is as follows;
clear;
clc;
% Image aquisition from Video and converting into gray scale
vidIn = VideoReader('ItaS.mp4');
%%Load reference image, and compute surf features
ref_img = read(vidIn, 1);
img = rgb2gray(ref_img);
%imshow(img)
ref_pts = detectSURFFeatures(img);
[ref_features, ref_validPts] = extractFeatures(img, ref_pts);
figure; imshow(ref_img);
hold on; plot(ref_pts.selectStrongest(5));
cuba = ref_pts.selectStrongest(5);
stats1 = round(cuba.Location);
bw = double(stats1);
bw1 = bwlabel(bw, 4);
stats = regionprops(bw1, 'Centroid','BoundingBox');

Answers (1)

Dima Lisin
Dima Lisin on 25 Mar 2015
Try vision.PointTracker.

Community Treasure Hunt

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

Start Hunting!