If you come across this error when calling the python method, use:
a = np.ascontiguousarray(a, dtype=np.float32)
Explanation:
Most issues I have come across when using OpenCV with Python, were to do with either using a wrong data type, or the python arrays were no contiguous. The above seems to solve both.