Loading images in google colab

后端 未结 11 1736
梦如初夏
梦如初夏 2021-01-30 15:01

My Jupyter Notebook has the following code to upload an image to Colab:

from google.colab import files
uploaded = files.upload()

I get prompted

11条回答
  •  臣服心动
    2021-01-30 15:51

    You can an image on colab directly from internet using the command

    !wget "copy paste the image address here"
    

    check with!ls

    Display the image using the code below:

    import cv2
    import numpy as np
    from matplotlib import pyplot as plt
    
    img = cv2.imread("Sample-image.jpg")
    img_cvt=cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
    plt.imshow(img_cvt)
    plt.show()
    

提交回复
热议问题