OpenCV cv.CalcOpticalFlowHS Horn-Schunck smoothness lambda parameter

less than 1 minute read

The default lambda=1.0 smoothness parameter for OpenCV 2.4 cv.CalcOpticalFlowHS does not work well for some cases. Also, OpenCV’s lambda is different from Matlab Computer Vision Toolbox Horn Schunck opticalFlowHS('Smoothness',1.0) parameter, which also defaults to 1.0.

Horn Schunck Optical Flow comparison between Matlab and Python shows that OpenCV cv.CalcOpticalFlowHS setting lambda=0.001 gives results that are much more like Matlab–I can see the fine details.


Note: OpenCV 3 no longer has the original Horn Schunck optical flow.


Linearized Horn Schunck has problems with large displacements in the image, which can be resolved by a pyramidal algorithm, or by using the more modern optical flow algorithms in OpenCV 3.x.




Leave a Comment