How to acquire [X,Y] coordinates with vision tool box?

2 views (last 30 days)
Hello Everyone,
I am using Vision Tool Box to track points in a video. I have the code used in the face feature detection example, which shows me the moving points frame by frame. How could I access and save the coordinates of the points at each frame? I am interested in seeing how much each point move per frame. Thanks for the help.
videoFileReader = vision.VideoFileReader('visionface.avi'); %import file
videoPlayer = vision.VideoPlayer('Position',[100,100,680,520]); %???
objectFrame = videoFileReader(); %reads the first frame
objectRegion = [264,122,93,93]; %selects the area of interest
objectImage = insertShape(objectFrame,'Rectangle',objectRegion,'Color','red'); %selects feature of boundary
figure;
imshow(objectImage); %display bounded region of first frame
title('Red box shows object region');
points = detectMinEigenFeatures(rgb2gray(objectFrame),'ROI',objectRegion); %algorithm of detection
pointImage = insertMarker(objectFrame,points.Location,'+','Color','white'); %decide types of markers
figure;
imshow(pointImage);
title('Detected interest points');
tracker = vision.PointTracker('MaxBidirectionalError',1); %creates a tracker object
initialize(tracker,points.Location,objectFrame); %starts the object
while ~isDone(videoFileReader)
frame = videoFileReader();
[points,validity] = tracker(frame);
out = insertMarker(frame,points(validity, :),'+');
videoPlayer(out);
end
release(videoPlayer);
release(videoFileReader);

Answers (0)

Community Treasure Hunt

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

Start Hunting!