open-mmlab / denseflow

Extracting optical flow and frames
https://open-mmlab.github.io/
MIT License
307 stars 61 forks source link

how to compute backward optical flow? #41

Open Pixie8888 opened 3 years ago

Pixie8888 commented 3 years ago

Hi, thanks for this wonderful work! I am wondering how can I compute backward optical flow using denseflow? e.g. optical flow from t+1 to t.

innerlee commented 3 years ago

Set step to -1

Pixie8888 commented 3 years ago

Thanks for the quick reply! Does that mean: In opencv function, to compute backward optical flow, just simply change prvs to img_t+1, next to img_t?

prvs = img_t+1 next = img_t flow = cv2.calcOpticalFlowFarneback(prvs,next, None, 0.5, 3, 8, 3, 5, 1.2, 0)

innerlee commented 3 years ago

If you are using denseflow,, then simply set the step argument to -1. e.g.,

denseflow test.avi -b=20 -a=tvl1 -s=-1 -v