opencv shim and image decoding/encoding from a buffer