title: How to track or predict path of already found contours using optical flow and motion vectors?
body: <p>I am coding a project in OpenCV python. It is basically a traffic monitoring Final Year project.. Now i have coded so far that when run it identifies vehicles in a video and draws a rectangle and centroid on those vehicles. Now what i want to do is to draw motion vectors or track just the above found contours i.e the vehicles. I am unable to figure what will be the arguments in this case in opencv optical flow function.. Can anyone help me with that ? thanks .. this is the contour finding portion of code..</p>
  
  <pre><code>image, contours, hierarchy = cv2.findContours(fgmask.copy(), cv2.RETR_EXTERNAL,
                                         cv2.CHAIN_APPROX_NONE)
      try: hierarchy = hierarchy[0]
      except: hierarchy = []
  
  
      #Drawing Rectangles arround contours (Vehicles)
      for contour, hier in zip(contours, hierarchy):
          (x,y,w,h) = cv2.boundingRect(contour)
          if w &gt; 8 and h &gt; 8:
  
              cv2.rectangle(frame, (x,y), (x+w,y+h), (255, 0, 0), 2)
  </code></pre>