How to plot a video along with a figure in the same frame.

7 ビュー (過去 30 日間)
Phong Pham
Phong Pham 2014 年 1 月 10 日
回答済み: Walter Roberson 2014 年 1 月 11 日
I have a video and the data to obtain the plot. I want to have the video and the plot in the same frame so I can see both (movie and plot ) at same time while the video is playing.
So far I could not do it, the plot only shows after the movie is done playing.
Please helps me. I am greatly appreciated all your helps.
Here is my code:
close all;
clear all;
pdir=strcat('/Users/PH/Desktop/');
nameopen='data_traking_1';
SS=strcat(pdir,nameopen);
load(SS);
name2='3particles.avi';
SSS=strcat(pdir,name2);
obj=VideoReader(SSS);
nFrames = obj.NumberOfFrames;
vidHeight = obj.Height;
vidWidth = obj.Width;
% Preallocate movie structure.
mov(1:nFrames) = ...
struct('cdata', zeros(vidHeight, vidWidth, 3, 'uint8'),...
'colormap', []);
% Read one frame at a time.
for k = 1 : nFrames
mov(k).cdata = read(obj, k);
end
% Size a figure based on the video's width and height.
hf = figure;
set(hf, 'position', [150 150 vidWidth vidHeight])
% Play back the movie once at the video's frame rate.
movie(hf, mov, 1, obj.FrameRate); hold on
plot(X,Y,'o'); hold off

採用された回答

Walter Roberson
Walter Roberson 2014 年 1 月 11 日

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by