我在Matlab中收集了大约30秒的数据以及相关的时间戳。
与此同时,我录制了30秒的网络摄像头数据。
我想将数据叠加到视频上,以便每个视频帧显示当前和之前五秒钟的数据。
有什么想法吗?
答案 0 :(得分:0)
未经测试,但类似的东西应该有效:
fps_video = 30; % in Hz
fps_data = 8000; % in Hz
duration_video = 30; % in s
number_of_video_frames = fps_video * duration_video;
window_duration = 5; % in s
number_of_datapoints = window_duration * fps_data; % data samples in window_duration seconds
for n = 1:number_of_video_frames
subplot(1,2,1);
imshow(video(n,:,:));
subplot(1,2,2);
data_1 = zeros(number_of_datapoints);
if (n >= (window_duration * fps_video))
fps_data_1 = (1, (n * fps_data/fps_video) - number_of_datapoints: n * fps_data/fps_video)
fps_data_2 = ...
end
plot(data_1, data_2) % don't know what data_with_timestamps looks like (what is x and y, set data_1 and data_2 accordingly...)
pause(1/fps_video);
end