Reputation: 660
I am using OpenCV's Optical Flow module. I understand the examples in the documentation but those take the entire image and then get the optical flow over the image.
I only want to pass it over some parts of an image. Is it possible to do that? If yes, how do I go about it?
Thanks!
Upvotes: 0
Views: 596
Reputation: 495
Yes, it's possible. cv2.calcOpticalFlowPyrLK()
will be the optical flow function you need. Before you make that function call, you will have to create an image mask. I did a similar project, but in C++, though I can outline the steps for you:
cv2.fillPoly()
) and fill the inside of the shape with white (Your image mask should only be comprised of black and white color)cv2.goodFeaturesToTrack()
and pass in the mask you've made as one of its arguments. I hope that helps.
Upvotes: 1