Reading a video in MATLAB and plotting the trajectory of robot in each frame

5 views (last 30 days)
Hello all,
I am working on a path planning task where I am trying to plot the trajectory of a robot arm in the SimMechanics explorer, but unfortunately this feature is not yet available.
I am now trying to find an alternative to this where I have saved the video of the SimMechanics animation as a video and read that video in MATLAB.
Is it possible to draw the trajectory on each frame of that video?
Any other suggestions to trace the trajectory will also be valuable.
Thanks and Regards

Answers (1)

Abhisek Pradhan
Abhisek Pradhan on 9 Aug 2019
A possible work around would be to get frames of the video using VideoReader Object and reading the Video.
v = VideoReader('filename');
while hasFrame(v)
video = readFrame(v);
end
whos video
Now from each frame, we can get the position of robot’s arm using Computer Vision Toolbox taking image of robot’s arms as reference image and plot the trajectory of robot in each frame.
The following link shows an example to find the position of an object from a reference object.

Categories

Find more on Simulation and Analysis in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!