0

How do i process several frames (say 30) of a video during real-time acquisition to get a certain value, and then shift 1 frame in the video to calculate it again, thus using the 2nd-31st frames? In other words, how do i make a sliding temporal window in Matlab?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62

1 Answers1

0

I guess you would need a function that tells you which start and end frames to use for each sliding window. Check this out:

function [starts, ends] = calculateSlidingWindowIndices(slidWinSize, startFr, endFr)
   lastStart = endFr - slidWinSize + 1;
   starts = startFr:lastStart;
   ends = starts + slidWinSize - 1;
end

The first sliding window should now go from starts(1) to ends(1), the second from starts(2) to ends(2) and so on. Is this what you need?

user1809923
  • 1,235
  • 3
  • 12
  • 27