Skip to content

Commit 4fe629a

Browse files
authored
Create img_grad.py
1 parent 4dc90b1 commit 4fe629a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

img_grad.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import numpy as np
2+
from skimage.color import rgb2gray
3+
from skimage.data import imread
4+
import matplotlib.pyplot as plt
5+
import sys
6+
7+
def imshow(img):
8+
plt.imshow(img, cmap=plt.cm.gray)
9+
plt.show()
10+
11+
img = imread(sys.argv[1])
12+
img_gray = rgb2gray(img)
13+
img_grad = np.gradient(img_gray)
14+
15+
imshow(img_grad[0]+img_grad[1])

0 commit comments

Comments
 (0)