Details on how to use this code can be found in the link below. How to Convert your OpenCV C++ code Into a Python Module