Guest User

Untitled

a guest
Dec 10th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. from PIL import Image
  2. from scipy.ndimage import filters
  3. from scipy.signal import medfilt2d
  4. import numpy as np
  5. import matplotlib.pyplot as plt
  6. import math as math
  7. import glob
  8. import os
  9. import sys
  10.  
  11. import visualPercepUtils as vpu
  12.  
  13. def testSobel(im, params=None):
  14. gx = filters.sobel(im, 1)
  15. return [gx]
  16.  
  17. im = Image.open('imgs-P4/cuadros.png').convert('L')
  18. cuadros = np.array(im)
  19. plt.imshow(cuadros, cmap="gray")
  20.  
  21. plt.imshow(filters.sobel(cuadros,-1)+filters.sobel(cuadros,0), cmap="gray")
  22.  
  23. sobely = np.array([1,2,1]*np.array([1,0,-1]).reshape(-1, 1))
  24. sobelx = np.array([1,0,-1]*np.array([1,2,1]).reshape(-1, 1))
  25. plt.imshow(filters.convolve(im, sobelx)+filters.convolve(im, sobely), cmap="gray")
Add Comment
Please, Sign In to add comment