Image converter using OpenCV in Python