Jupyter Notebook3
Jupyter Notebook3
OpenCV represents the images in BGR as opposed to the RGB we expect. Since it
is inthe reverse order, you tend to see the blue color in images. We will use
the following codefor converting from BGR to RGB
In [9]: img1=cv2.imread('Mahesh.jpg')
plt.imshow(cv2.cvtColor(img1, cv2.COLOR_BGR2RGB))
plt.title("Mahesh Yadav")
img3 = cv2.imread('Mahesh.jpg')
gray = cv2.cvtColor(img3, cv2.COLOR_BGR2GRAY)
plt.imshow(gray, cmap='gray')
plt.show()
In [13]: f=plt.figure(figsize=(15,15))
f.add_subplot(1,2,1)
plt.imshow(gray,cmap='gray')
plt.title('Gray Scale Image')
(1600, 1200, 3)
In [21]: # Resizing an Image
resized=cv2.resize(img, (360,640))
plt.imshow(cv2.cvtColor(resized, cv2.COLOR_BGR2RGB))
print(resized.shape)
(640, 360, 3)
Out[41]: True