Python - Filtro paso alto

 
Vista:

Filtro paso alto

Publicado por Geomata (21 intervenciones) el 12/01/2021 10:10:08
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import cv2
import numpy as np
from matplotlib import pyplot as plt
import skimage.transform as tf
import math
 
lenaToday = cv2.imread('LenaToday.png',0)
 
f= np.fft.fft2(lenaToday)
fshift = np.fft.fftshift (f)
print (fshift.shape, fshift.dtype)
Espectro = (np. log (np.abs(fshift)))
 
plt.title('Espectro')
plt.imshow(Espectro,cmap ='gray')
 
rows,cols =lenaToday.shape
crow,ccol = rows//2, cols//2
mask = np.ones((rows,cols),np.uint8)
mask[crow-30:crow+30, ccol-30:ccol+30]=0
print (fshift.shape)
fshift =fshift*mask
f_ishift = np.fft.ifftshift(fshift)
lenaToday_filtro = np.fft.ifft2(f_ishift)
lenaToday_filtro = np.abs(lenaToday_filtro)
 
plt.title('LenaToday HPF')
plt.imshow(lenaToday_filtro,cmap='gray')
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder