Ask Your Question

Revision history [back]

OpenCV 2.4.2 docs

http://docs.opencv.org/modules/video/doc/motion_analysis_and_object_tracking.html?highlight=calcopticalflow#cv.CalcOpticalFlowPyrLK

In OpenCV 2.4.1 docs too, they had not mentioned about pyramids.

I had used cv2.OpticalFlowPyrLK a month ago. I too was trying to make pyramids. But in OpenCV >= 2.3.1, pyramids are not required. Here's how I use it.

template_pt = np.asarray(template_pt,dtype="float32")
target_pt = np.asarray(target_pt,dtype="float32")

target_pt, status, track_error = calcOpticalFlowPyrLK(img1, img2, template_pt, target_pt, 
                                                      winSize=(win_size_lk, win_size_lk),
                                                      flags = OPTFLOW_USE_INITIAL_FLOW,
                                                      criteria = (TERM_CRITERIA_EPS | TERM_CRITERIA_COUNT, 10, 0.03))