I\'m using OpenCV 3.0.0 on Python 2.7.9. I\'m trying to track an object in a video with a still background, and estimate some of its properties. Since there can be multiple movi
Answer from @rayryeng is excellent!
One small thing from my implementation is:
The np.where()
returns a tuple, which contains an array of row indices and an array of column indices. So, pts[0]
includes a list of row indices
, which correspond to height of the image, pts[1]
includes a list of column indices
, which correspond to the width of the image. The img.shape
returns (rows, cols, channels)
. So I think it should be img[pts[0], pts[1]]
to slice the ndarray
behind the img.