Professional Documents
Culture Documents
Edge Detection Using Python
Edge Detection Using Python
Ans:
Vehicle Detection
Face Detection and recognition
Fingerprint recognition
Medical Imaging
Gesture Recognition
Ball Tracking in Sports
Geological bodies detection
Optical Character Recognition
Self-Driving
Tracking Objects
Identity Verification Using Iris Code
Counting Objects
Separating Specific Entity from Entire Image.
Q2: Implement the Edge detection code in python/MATLAB; decryption is attached with PDF.
Code:
import numpy as np
import cv2
import cv2 as cv
from math import pow
from google.colab.patches import cv2_imshow
img1=cv2.imread('/content/drive/MyDrive/image to grayscale/
building.PNG',0)
kernel=np.ones((5,5),np.float32)/25
gblur=cv2.GaussianBlur(img1,(5,5),0)
#####smoothning apply using 2 Gaussian levels############
img = cv.hconcat((img1,gblur))
print(" ORIGNAL GAUSSIA
N")
cv2_imshow(img)
print("\n")
######sobelx apply###################
sobelx=cv2.Sobel(img,cv2.CV_64F,1,0)
print(" ORIGNAL SOBELX"
)
cv2_imshow(sobelx)
print("\n")
######sobely apply###################
sobely=cv2.Sobel(img,cv2.CV_64F,0,1)
print(" ORIGNAL SOBELY"
)
cv2_imshow(sobely)
print("\n")
######gradient apply###################
print(" ORIGNAL SOBELX+
Y")
cv2_imshow(sobelx+sobely)
imgsmooth=(sobelx*sobelx)+(sobely*sobely)
imgsmooth=pow(imgsmooth,0.5)
print("\n ORIGNAL GRAD
IENT")
cv2_imshow(imgsmooth)
print("\n ORIGNAL GRAD
IENT(Thinner Edges)")
cv2_imshow(imgsmooth/2)
Output:
ORIGNAL GAUSSIAN
ORIGNAL SOBELX
ORIGNAL SOBELY
ORIGNAL SOBELX+Y
ORIGNAL GRADIENT
ORIGNAL GRADIENT (Thinner Edges)