I have an image and I want to extract a region from it. I have coordinates of left upper corner and right lower corner of this region. In gray scale I do it like this:
Best way to do this is to use :- img2 = cv2.cvtColor(img , cv2.COLOR_BGR2RGB) This will convert the BGR 'img' array to RGB 'img2' array. Now you can use img2 array for imshow() function of matplotlib.
img2 = cv2.cvtColor(img , cv2.COLOR_BGR2RGB)
Refer Link:- cvtColor