Created
June 18, 2015 19:35
-
-
Save drhirsch/62543e43769f73d11dfb to your computer and use it in GitHub Desktop.
Loading ISR and video data at same time using GeoDataMatlab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading ISR data and AVI video at the same times from disk | |
Michael Hirsch | |
My first thought on finding the nearest neighbor in time between instruments | |
is to use interp1(). | |
Let's say I have a radar that samples once every three seconds, and a camera that samples | |
once per second. The code below is done in Matlab/Octave. | |
``` | |
t_isr = [0,3,6,9,12]; | |
t_vid = 0:12; | |
tnew_isr = interp1(t_isr,t_isr,t_vid,'nearest'); | |
``` | |
tnew_isr is the time of the ISR to playback for each video frame. Again there is | |
probably a better way to do this, but for now it's sufficient to do: | |
``` | |
vid = VideoReader('myvid.avi'); | |
for i=1:length(t_vid) | |
img = readFrame(vid); | |
%ind_isr = find(tnew_isr(i)==t_isr,1,'first'); % get index of isr for this time | |
%load ISR data for this time via GeoDataMatlab | |
end | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment