PyImageSearch/imutils

let opencv2matplotlib work with float images as well

johnnewto opened this issue · 0 comments

def opencv2matplotlib(image):
# OpenCV represents images in BGR order; however, Matplotlib
# expects the image in RGB order, so simply convert from BGR
# to RGB and return
# return cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
return image[...,::-1] # to also work with float images