Created
March 27, 2020 06:12
-
-
Save THEFASHIONGEEK/c665ea9868d399a04dcf77fd9aa3f1f1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import cv2 | |
from matplotlib import pyplot as plt | |
img = cv2.imread("imgs/chapter5/sudoku.png", 0); | |
kernel = [ | |
[1, 0, -1], | |
[1, 0, -1], | |
[1, 0, -1] | |
] | |
kernel = np.array(kernel); #Normalized mean kernel | |
prewit = cv2.filter2D(img, -1, kernel); | |
f = plt.figure(figsize=(15,15)) | |
f.add_subplot(1, 2, 1).set_title('Original Image'); | |
plt.imshow(img, cmap = "gray") | |
f.add_subplot(1, 2, 2).set_title('Prewitt in x direction Image'); | |
plt.imshow(prewit, cmap = "gray"); | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment