Opencv Resize Rgb Image. We will display both images so we can compare the converted image with the original one. Opencv is bgr pillow is rgb.
The transformation happens in line 7. Reading and saving image files with python opencv imread imwrite the opencv function imwrite that saves an image assumes that the order of colors is bgr so it is saved as a. The main trick is in that simple code.
The main trick is in that simple code.
Cvtcolor image flag allows us to take an image and set a flag in this case cv2 rgb2gray and perform the rgb image to grayscale transformation. Convert from bgr to rgb so we can plot using matplotlib img cv2 cvtcolor img cv2 color bgr2rgb disable x y. Img cv2 resize oriimg 360 480 option 2 factor with float value. The transformation happens in line 7.