Reputation: 2148
I am calculating the optical flow for a video using
flow = cv2.calcOpticalFlowFarneback(prvs,next, None, 0.5, 3, 15, 3, 5, 1.2, 0)
The input resolution is 320x240. I computed some basic stats for the flow data received from the function with this code
arr1 = np.load(file_path)
y = arr1[:,:,0]
x = arr1[:,:,1]
if (y_min > y.min()):
y_min = y.min()
if (y_max < y.max()):
y_max = y.max()
and I got the following values:
y:
min max mean std_dev
-838.59191895 850.21942139 0.01124349 4.41635523
x:
min max mean std_dev
-58.26990128 73.48989105 0.00110086 2.47226620
I noticed that for y
coordinates the min and max values far exceed the input dimensions, i.e., 320x240
. Can anybody point out the reason for this observation? I'm unable to figure out the valid range of values expected from the cv2.calcOpticalFlowFarneback
function.
Upvotes: 0
Views: 682
Reputation: 2830
Theoretically there is no minimum and maximum bound in the optical flow estimates, since there is no search range as by block matching methods. The motion vector is derived from the image gradients and the optical flow equation and can point outside the image or video bounds. The high errors might be gross-outliers of flow estimation which is totaly normal and may be caused if the content in the images change dramatically due to illumination changes, shadows, motion blur, coding artifacts etc.
Upvotes: 2