def sobel_threshold(im, dx=1, dy=1, blur=3, threshold=10): return (sobel(im, dx=dx, dy=dy, blur=blur) > threshold).astype(np.uint8) * 255