from gen_flow import gen_flow_circle
case = 1 # 1 or 2
height = 101
width = 101
if case == 1:
flow = gen_flow_circle([height//2, width//2], height, width)
flow = flow / 3
else:
flow = gen_flow_circle([0,0], height, width)
flow = flow / 5
print(flow[:,:,0])
print(flow[:,:,1])
from flow_display import dense_flow
dense_flow(flow)
![flow](https://raw.githubusercontent.com/Chen8023/optical-flow/master/./image/dense_flow_center.png)
![flow](https://raw.githubusercontent.com/Chen8023/optical-flow/master/./image/dense_flow_topleft.png)
from flow_display import sparse_flow
sparse_flow(flow, stride=10)
![flow](https://raw.githubusercontent.com/Chen8023/optical-flow/master/./image/sparse_flow_center.png)
![flow](https://raw.githubusercontent.com/Chen8023/optical-flow/master/./image/sparse_flow_topleft.png)
from image_warp import image_warp
# nearest or bilinear
deformed_nearest = image_warp(img.copy(), flow, mode='nearest')
deformed_bilinear = image_warp(img.copy(), flow, mode='bilinear')
![flow](https://raw.githubusercontent.com/Chen8023/optical-flow/master/./image/deformed_center.png)
![flow](https://raw.githubusercontent.com/Chen8023/optical-flow/master/./image/deformed_topleft.png)