opencv > pil
import cv2
from PIL import Image
img = cv2.imread("test.png")
image = Image.fromarray(cv2.cvtColor(img,cv2.COLOR_BGR2RGB))
pil > opencv
import cv2
from PIL import Image
image = Image.open("test.png")
img = cv2.cvtColor(numpy.asarray(image),cv2.COLOR_RGB2BGR)