- A little bit more explanation of my above comment.
calcOpticalFlowPyrLK()
can directly use vector<Point>
or vector<Point2f>
for parameter prevPts
.
prevPts
– vector of 2D points for which the flow needs to be found; point coordinates must be single-precision floating-point numbers.
That said, you only need to use contours[0]
, contours[1]
and contours[2]
for the 3 objects (they are of type vector<Point>
) and pass them to calcOpticalFlowPyrLK()
.