dx = cv2.Sobel(imgY, cv2.CV_64F, 1, 0, ksize=3) dy = cv2.Sobel(imgY, cv2.CV_64F, 0, 1, ksize=3) grad = np.sqrt(dx ** 2 + dy ** 2) fig, axes = plt.subplots(ncols=4, figsize=(20,5)) axes[0].imshow(imgY, cmap=cm.Greys_r, vmin=0, vmax=255) axes[0].set_title('Y') axes[0].get_xaxis().set_visible(False) axes[0].get_yaxis().set_visible(False) axes[1].imshow(dx, cmap=cm.Greys_r, vmin=-128, vmax=128) axes[1