Importing legacy OpenCV modules from OpenCV 2 in Python

Related: Easy install: OpenCV 3 for Python

Some legacy modules like Horn Schunck Optical Flow in OpenCV 2.4 are located in cv instead of cv2 . Note: legacy modules are no longer available in OpenCV 3.

Windows-based OpenCV 2.4 requires importing legacy functions as below, which is also Mac/Linux compatible:

import cv2
from cv2 import cv


Instead of using OpenCV 2.4, use pure Python for Horn Schunck and Lucas Kanade Optical Flow.