Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PIL import Image
- from scipy.ndimage import filters
- from scipy.signal import medfilt2d
- import numpy as np
- import matplotlib.pyplot as plt
- import math as math
- import glob
- import os
- import sys
- import visualPercepUtils as vpu
- def testSobel(im, params=None):
- gx = filters.sobel(im, 1)
- return [gx]
- im = Image.open('imgs-P4/cuadros.png').convert('L')
- cuadros = np.array(im)
- plt.imshow(cuadros, cmap="gray")
- plt.imshow(filters.sobel(cuadros,-1)+filters.sobel(cuadros,0), cmap="gray")
- sobely = np.array([1,2,1]*np.array([1,0,-1]).reshape(-1, 1))
- sobelx = np.array([1,0,-1]*np.array([1,2,1]).reshape(-1, 1))
- plt.imshow(filters.convolve(im, sobelx)+filters.convolve(im, sobely), cmap="gray")
Add Comment
Please, Sign In to add comment