Image is not displaying in Google Colab while using imshow()

Alankrit Mishra picture Alankrit Mishra · Mar 21, 2019 · Viewed 38.1k times · Source

I am working on a project which requires functions from OpenCV to plot images. I am trying to display image using the below code in Google Colab. But nothing shows up in the output. Can anybody help me with this?

%pylab notebook
import cv2

testim = imread('butterfly.jpg')
figure()
imshow(testim)
plt.show()

Screenshot:

enter image description here

Link to my Colab Notebook

Answer

Mohammed Waseem picture Mohammed Waseem · Aug 26, 2019

Google colab crashes if you try to display image using cv2.imshow() instead import from google.colab.patches import cv2_imshow and display using cv2_imshow(<image>)