-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDIP_018.py
19 lines (16 loc) · 866 Bytes
/
DIP_018.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Agregar Ruido a la imagen con OpenCV
from matplotlib import pyplot as plt
from skimage.util import random_noise
from skimage.io import imread
I = imread('DataSet/House.jpeg', as_gray = True)
gauss = random_noise(I, mode='gaussian', seed=None, clip=True)
gauss_lv = random_noise(I, mode='localvar', seed=None, clip=True)
poisson = random_noise(I, mode='poisson', seed=None, clip=True)
sp = random_noise(I, mode='s&p', seed=None, clip=True)
plt.figure(figsize=(12, 8))
plt.subplot(231), plt.imshow(I), plt.title('Original'), plt.gray()
plt.subplot(232), plt.imshow(gauss), plt.title('Gaussian'), plt.gray()
plt.subplot(233), plt.imshow(gauss_lv), plt.title('Gaussian localvar'), plt.gray()
plt.subplot(234), plt.imshow(poisson), plt.title('Poisson'), plt.gray()
plt.subplot(235), plt.imshow(sp), plt.title('Salt & Pepper'), plt.gray()
plt.show()