Conversion between any/all of BGR, RGB, and GBR may be necessary when working with
Matplotlib pyplot.imshow(): M x N x 3 image, where last dimension is RGB.
OpenCV cv2.imshow(): M x N x 3 image, where last dimension is BGR
Scientific Cameras: some output M X N x 3 image, where last dimension is GBR
BGR to RGB
OpenCV image to Matplotlib
rgb = bgr[...,::-1]
RGB to BGR
Matplotlib image to OpenCV
bgr = rgb[...,::-1]