Skip to content
This repository was archived by the owner on Nov 30, 2022. It is now read-only.

Commit bbb3842

Browse files
authored
Update sobel-edge-detect.py
1 parent 3dd34c0 commit bbb3842

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Image-Processing/Sobel-edge-detection/sobel-edge-detect.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
#This script can be used for edge-detection without the use of any inbuilt openCV libraries
77
#Here the sobel filter is applied after blurring the image.
88

9-
kernelblur = np.array([1/16,1/8,1/16,1/8,1/4,1/8,1/16,1/8,1/16]).reshape(3,3)
10-
kernelsobelX = np.array([-1,-2,-1,0,0,0,1,2,1]).reshape(3,3)
9+
kernelblur = np.array([1/16, 1/8, 1/16, 1/8, 1/4, 1/8, 1/16, 1/8, 1/16]).reshape(3, 3)
10+
kernelsobelX = np.array([-1, -2, -1, 0, 0, 0, 1, 2, 1]).reshape(3, 3)
1111
kernelsobelY = kernelsobelX.transpose()
1212

1313
def convolute(img, kernel, height, width):
@@ -64,8 +64,8 @@ def sobel(img):
6464
resultant = []
6565
for i in range(height-1):
6666
for j in range(width-1):
67-
in_x = pow(convoluted_X[i,j] ,2)
68-
in_y = pow(convoluted_Y[i,j] , 2)
67+
in_x = pow(convoluted_X[i, j], 2)
68+
in_y = pow(convoluted_Y[i, j], 2)
6969
gradient = sqrt(in_x + in_y)
7070
reusultant.append(grad)
7171
resultant = np.array(resultant).reshape(height-1, width-1)

0 commit comments

Comments
 (0)