- https://in.mathworks.com/help/matlab/ref/xcorr.html
- https://in.mathworks.com/help/matlab/ref/max.html
Estimating Optical flow for one dimensional signals
7 views (last 30 days)
Show older comments
I want to estimate the optical flow between two one dimensional signals. The standard method to estimate it as of my knowledge is to use the
opticFlow = opticalFlowHS
flow = estimateFlow(opticFlow,frameGray);
But, it is defined for 2D images. Is it possible to compute this for 1D signals?
0 Comments
Accepted Answer
Paras Gupta
on 22 Aug 2023
Hi Anisia,
I understand that you want to estimate the optical flow between one dimensional (1D) signals. Since 1D signals do not contain spatial structure in contrast to 2D signals, the same traditional optical flow techniques like Horn-Schunck (HS) method cannot directly be applied for estimation.
However, if the one-dimensional signals are treated as time series, analysis techniques like cross-correlation, dynamic time warping (DTW), or other Fourier-based techniques can be used to measure some estimate of the optical motion between the two signals. It is to be noted that these methods may not provide the same robustness or accuracy as the methods designed for 2D signals.
The following code uses cross-correlation to estimate optical flow between two 1D signals.
signal1 = [1, 2, 3, 4, 5];
signal2 = [2, 3, 4, 5, 6];
crossCorr = xcorr(signal1, signal2);
% Find the index of the maximum correlation value
[~, maxIndex] = max(crossCorr);
% Estimate the motion as the time lag corresponding to the maximum correlation
motion = maxIndex - length(signal1) + 1
Please refer to the documentation below for more details on the above code.
Hope this helps.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!