Skip to content

Instantly share code, notes, and snippets.

@THEFASHIONGEEK
Created March 26, 2020 06:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save THEFASHIONGEEK/d4f35acb4fb4139127aa39f900e8bcf8 to your computer and use it in GitHub Desktop.
Save THEFASHIONGEEK/d4f35acb4fb4139127aa39f900e8bcf8 to your computer and use it in GitHub Desktop.
import numpy as np
import cv2
from matplotlib import pyplot as plt
img = cv2.imread("imgs/chapter5/sudoku.png", 0);
dx = cv2.Scharr(img,cv2.CV_8UC1,1,0) # first order derivative around x
dy = cv2.Scharr(img,cv2.CV_8UC1,0,1) # first order derivative around y
f = plt.figure(figsize=(15,15))
f.add_subplot(2, 2, 1).set_title('Original Image');
plt.imshow(img, cmap="gray")
f.add_subplot(2, 2, 2).set_title('dx');
plt.imshow(dx, cmap="gray");
f.add_subplot(2, 2, 3).set_title('dy');
plt.imshow(dy, cmap="gray");
plt.show();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment