Turn pyopencv_to and pyopencv_from into templates

This protects from unwanted implicit conversions between types at compile time.