Created
January 4, 2020 14:38
-
-
Save lucifermorningstar1305/7ab3d3d8e24ba1a4dbe4bee30fe57094 to your computer and use it in GitHub Desktop.
Sobel Edge Filter Algorithm
This file contains hidden or 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
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) | |
Hx = np.array([[1,0,-1], [2,0,-2],[1,0,-1]], dtype=np.float32) | |
Hy = np.array([[-1,-2,-1],[0,0,0],[1,2,1]], dtype=np.float32) | |
Gx = scipy.signal.convolve2d(Gm, Hx, mode ='same') | |
Gy = scipy.signal.convolve2d(Gm,Hy,mode = 'same') | |
G = (Gx*Gx + Gy*Gy) ** 0.5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment