python
from google.colab import files
from google.colab import drive
drive.mount('/content/drive')
img = cv2.imread("/content/drive/My Drive/Colab Notebooks/img/Lenna.bmp")
img2 = cv2.imread("/content/drive/My Drive/Colab Notebooks/img/Mandrill.bmp")
python
import cv2 #opencv
import matplotlib.pyplot as plt
%matplotlib inline
python
#Create new window
fig = plt.figure()
#X the whole flg*Divide into Y and place the image at the plot position.
X = 2
Y = 2
#Display of img
imgplot = 1
ax1 = fig.add_subplot(X, Y, imgplot)
#Title setting
ax1.set_title("img",fontsize=20)
plt.imshow(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
#Display of img2
img2plot = 4
ax2 = fig.add_subplot(X, Y, img2plot)
#Title setting
ax2.set_title("img2",fontsize=20)
plt.imshow(cv2.cvtColor(img2, cv2.COLOR_BGR2RGB))
plt.show() #It was displayed without it.
With this, it seems easy to write a comparison article of future operation results!
Recommended Posts