Advertisement
Guest User

filter_tests_in_python

a guest
Aug 18th, 2011
575
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 13.09 KB | None | 0 0
  1. # parabolas: skipped
  2.  
  3.  
  4. s = numpy.ndarray((801), numpy.dtype("float32"))
  5. for y in range(401):
  6.     p = (y/90.0)**2
  7.     s[400 - y] = p
  8.     s[400 + y] = p
  9.  
  10. # s[0] == s[800] == 19.7531
  11.  
  12. # for some reason grey_dilation() does not work in 1D, so I use grey_erosion with an inverted structure element
  13. grey_dilate = scipy.ndimage.grey_erosion(inputarray, structure = -1.0*s)
  14.  
  15.  
  16. median_filtered = scipy.ndimage.median_filter(inputarray, size = 300)
  17. (median_filtered - inputarray).max()
  18.  
  19. >>> 4.0
  20.  
  21. median_filtered2 = median_filtered - 4.0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement