ipynb
# 画像をアップロード
from google.colab import files
uploaded_file = files.upload()
uploaded_file_name = next(iter(uploaded_file))
# 画像にノイズを加える
import cv2
import numpy as np
from skimage.util import random_noise
img = cv2.imread(uploaded_file_name)
noise_img = random_noise(img, mode='s&p',amount=0.5)
noise_img = np.array(255*noise_img, dtype = 'uint8')
# 画像を描画
%matplotlib inline
from matplotlib import pyplot as plt
plt.imshow(noise_img)
plt.show()
# 画像をダウンロード
from PIL import Image
Image.fromarray(noise_img).save('edited_image.jpg')
files.download('edited_image.jpg')


参考
https://theailearner.com/tag/skimage-util-random_noise/
かわいい猫ちゃんはunsplashからとってきてます
https://unsplash.com/photos/IuJc2qh2TcA