Overlaying Dynamic Data Plots on a Video
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Dear fellow MATLAB Users,
I have created a dynamic plotting system to be used with a .mov video on my computer. I am attempting to overlay the video on a predetermined image range, and then plot dynamic (x,y) data points on top of the movie as it plays. I have been able to play the movie independently, and plot data independently over a static image, however I have not been able to run the video and plot simultaneously, nor have I figured out how to plot the video on the predetermined viewing window as I can with a static image. Here is my current code:
_________ START CODE _________
Data_File='Experiment_B_Data.txt';
Eye_Data=csvread(Data_File); % Eye_Data=Imported CSV Eye Tracking Data
% Experiment Definitions
TO=(Eye_Data(:,1)); % TO=Time Output Column Vector (Micro Seconds)
XY_Position=Eye_Data(:,3:4); % XY_Data=(X,Y) Gaze Location (Pixels)
X_Position=Eye_Data(:,3); % X_Data=X Gaze Location (Pixels)
Y_Position=Eye_Data(:,4); % Y_Data=Y Gaze Location (Pixels)
% Plot Dimensions
min_x = 487;
max_x = 2074;
min_y = 213;
max_y = 1106;
% &&&&&&&&&&&&& Video Experiment &&&&&&&&&&&&&&&&&
% % Frame 1
img07c = imread('z01_F_46.jpg'); % Load Video Experiment
% img07c = implay('Test_B_Video.mov'); % Load Video Experiment
figure;
% Stretch experiment image proportionally to X and Y axes
imagesc([min_x max_x],[min_y max_y],img07c);
axis image
title('Video Experiment:');
xlabel('X-Position (pixel)');
ylabel('Y-Position (pixel)');
hold on
x=X_Position;y=Y_Position;
t=numel(x);
r=x(t);
nnn=y(t);
s1=subplot(1,1,1);
set(s1,'xlim',[1 numel(x)],'ylim',sort([0 r]),'nextplot','add')
p1=plot(NaN,NaN,'r-');
p2=plot(r,nnn,'g*');
axis([487 2074 213 1106])
set(gca,'ydir','rev')
for t=1:numel(x)
r=x(t);
nnn=y(t);
set(p2,'xdata',r,'ydata',nnn)
pause(.01)
end
hold on
_______ END CODE _______
My goal is to replace the static image plotted on the predetermined x and y range with a .mov video, and to overlay my dynamic plot. Any help that could be given would be greatly appreciated. Thank you.
~ Chris
1 commentaire
andrey oppenheimer
le 12 Mai 2023
did you have any luck with this code?
we are trying to do somthing similar. do you have your original code ?
Réponses (0)
Voir également
Catégories
En savoir plus sur Convert Image Type dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!