cv2 running optical flow on particular rectangles
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:

Create an empty matrix with same width and height of your images
Using the points from your ROI, create a shape out of it (I did mine using cv2.fillPoly()) and fill the inside of the shape with white (Your image mask should only be comprised of black and white color)
If you are planning on using corners as features, then call cv2.goodFeaturesToTrack() and pass in the mask you've made as one of its arguments. 
If you're using the Feature2D module to detect features, you can use the same mask to only extract the features in that masked area.   
By this step, you should now have a collection of features/points that are only within the bounds of the shape! Call the optical flow function and then process the results.

I hope that helps.
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!