OpenCV
#as you can see the above image is not presented as the original
# OpenCV
#for exact representaition
import cv2
from matplotlib import pyplot as plt
import numpy as np
img = cv2.imread(r'C:\Users\shrey\code\puppy.jpg') #loads the puppy image to img variable
plt.imshow(cv2.cvtColor(img,cv2.COLOR_BGR2RGB))
plt.title("Cute Puppies")
plt.axis("off")
plt.show()
#as you can see the above image is not presented as the original
# OpenCV
#for exact representaition
import cv2
from matplotlib import pyplot as plt
import numpy as np
img = cv2.imread(r'C:\Users\shrey\code\puppy.jpg') #loads the puppy image to img variable
plt.imshow(cv2.cvtColor(img,cv2.COLOR_BGR2RGB))
plt.title("Cute Puppies")
plt.axis("off")
plt.show()
# OpenCV
#for Gray image
import cv2
from matplotlib import pyplot as plt
import numpy as np
img = cv2.imread(r'C:\Users\shrey\code\puppy.jpg',0) #loads the puppy image to img variable
plt.imshow(img,cmap='gray')
plt.title("Cute Puppies")
plt.axis("off")
plt.show()