replace PIL with OpenCV