Skip to content

Commit d278c22

Browse files
Edge_Detection
1 parent da26fe9 commit d278c22

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Edge Detection/Edge_Detection.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
'''
2+
For using this Script you need to install OpenCV in your machine
3+
'''
4+
#Importing openCV library
5+
import cv2 as cv
6+
7+
#Taking path of input from the user
8+
path=input("Enter the path of uploaded image")
9+
img=cv.imread(path)
10+
img=cv.resize(img,(640,640)) #resizing the image
11+
12+
#Printing the original image
13+
cv.imshow('Original',img)
14+
#Reducing the noise from the image
15+
gray=cv.cvtColor(img,cv.COLOR_RGB2GRAY)
16+
17+
#Using Canny algorithm to detect the edges of the image
18+
final=cv.Canny(gray,100,200)
19+
print('Number of edges'+ '=' +str(len(final))) #printing Number of edges
20+
cv.imshow('Final',final)
21+
cv.waitKey(0)

0 commit comments

Comments
 (0)