title: How to combine background subtraction with dense optical flow tracking in openCV python
body: <p>I am using the <a href="https://docs.opencv.org/3.3.0/db/d5c/tutorial_py_bg_subtraction.html" rel="nofollow noreferrer">BackgroundSubtractorGMG</a> method and the <a href="https://docs.opencv.org/3.4.0/d7/d8b/tutorial_py_lucas_kanade.html" rel="nofollow noreferrer">Gunner Farneback</a> for dense optical flow, I wish to find a way of combining both of these methods so to improve the accuracy of detection for a moving object. Perhaps only getting the optical flow method to focus on the larger segmented images to reduce erroneous results/noise. I tried a simple feeding of the output of the background subtraction video to the optical flow method, however this did not work. I read this <a href="https://stackoverflow.com/questions/33118585/background-subtraction-and-optical-flow-for-tracking-object-in-opencv-c">stackoverflow link</a> but I am at loss on how to this using the methods above. I apologise if this is all basic or if there is a misunderstanding because I am quite new to opencv and image processing.</p>