Hello, I'm having trouble running the CalcOpticalFlowPyrLK in Python. When I try doing the calculations for the Lucas Kanade code it will not compute the error I get is the following:
File "****", line 63, in callback
(currFeatures, status, track_error) = cv.CalcOpticalFlowPyrLK(old_image, new_image, old_pyramid, new_pyramid, old_features, (3,3), 1, (cv.CV_TERMCRIT_ITER, 10, 0) , 0)
error: pyramid A has insufficient size
Here's the following code:
new_pyramid = self.pyrdownsize(new_image)
old_pyramid = self.pyrdownsize(old_image)
(currFeatures, status, track_error) = cv.CalcOpticalFlowPyrLK(old_image, new_image, old_pyramid, new_pyramid, old_features, (3,3), 1, (cv.CV_TERMCRIT_ITER, 10, 0) , 0)
def pyrdownsize(self, cv_image):
(rows,cols) = cv.GetSize(cv_image)
pyr = cv.CreateMat(int(cols/2), int(rows/2), cv.GetElemType(cv_image))
cv.PyrDown(cv_image, pyr)
return pyr
Is there something I'm not seeing?
Thanks for the help once again.