filtering - Applying even-sized median filter in Python -


my assignment apply median filter of size 50x50 pixels image. know how apply filter, how can specify size of filter when even? code far below.

import matplotlib.pyplot plt astropy.io import fits import scipy.signal sg  #   open data files hdulist = fits.open('xbulge-w1.fits') w1data = hdulist[0].data  hdulist2 = fits.open('xbulge-w2.fits') w2data = hdulist2[0].data  #   apply median filter each image w1_med = sg.medfilt(w1data) w2_med = sg.medfilt(w2data)  #   set maximum sampled galactic lat (b) , long (l) l_max = 15 b_max = 15  #   plot median filtered images, rescaled galactic coordinates plt.subplot2grid((2,1), (0,0)) plt.imshow(w1_med, origin='lower',            extent=[l_max, -l_max, -b_max, b_max],            cmap = 'gray') plt.title('w1 median filter')  plt.subplot2grid((2, 1), (1,0)) plt.imshow(w2_med, origin='lower',            extent=[l_max, -l_max, -b_max, b_max],            cmap = 'gray') plt.title('w2 median filter')  plt.tight_layout() plt.show() 

i see definition medfilt:

signature: sg.medfilt(volume, kernel_size=none) docstring: perform median filter on n-dimensional array.  apply median filter input array using local window-size given `kernel_size`.  parameters ---------- volume : array_like     n-dimensional input array. kernel_size : array_like, optional     scalar or n-length list giving size of median filter     window in each dimension.  elements of `kernel_size` should odd.     if `kernel_size` scalar, scalar used size in     each dimension. default size 3 each dimension.     .... 

have tried this?

sg.medfilt(w1data,kernel_size=50) 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -