Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit dc12e6a

Browse files
Merge pull request avinashkranjan#891 from ShubhamGupta577/Fast-Algorithm
Fast algorithm
2 parents b7662b9 + 7f479f5 commit dc12e6a

File tree

4 files changed

+60
-0
lines changed

4 files changed

+60
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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 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+
15+
# Initiate FAST object with default values
16+
fast = cv.FastFeatureDetector_create()
17+
18+
# find and draw the keypoints
19+
kp = fast.detect(img,None)
20+
img2 = cv.drawKeypoints(img, kp, None, color=(255,0,0))
21+
22+
# Print all default parameters
23+
print( "Threshold: {}".format(fast.getThreshold()) )
24+
print( "nonmaxSuppression:{}".format(fast.getNonmaxSuppression()) )
25+
print( "neighborhood: {}".format(fast.getType()) )
26+
print( "Total Keypoints with nonmaxSuppression: {}".format(len(kp)) )
27+
28+
# Disable nonmaxSuppression
29+
fast.setNonmaxSuppression(0)
30+
kp = fast.detect(img,None)
31+
32+
print( "Total Keypoints without nonmaxSuppression: {}".format(len(kp)) )
33+
final = cv.drawKeypoints(img, kp, None, color=(255,0,0))
34+
35+
#Naming the output image
36+
image_name = path.split(r'/')
37+
image = image_name[-1].split('.')
38+
output = r".\\"+ image[0] + "(_detected).jpg"
39+
40+
#Saving the image
41+
cv.imwrite(output,final)
42+
43+
#Printing the final output image
44+
cv.imshow('Final',final)
45+
cv.waitKey(0)
46+
cv.destroyAllWindows()
317 KB
Loading[フレーム]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Fast Algorithm
2+
3+
- In this script, we implement the `Fast (Features from Accelerated Segment Test)` algorithm of `OpenCV` to detect the corners from any image.
4+
5+
## Setup instructions
6+
7+
- For using this script, you have to install `Open CV` in your machine and after that you easily run the **Fast_Algorithm.py** file
8+
9+
## Output
10+
11+
<img src="./input.jpg" width=500/> <img src="./Output.png" width=500/>
12+
## Author
13+
14+
[Shubham Gupta](https://github.com/ShubhamGupta577)
26.3 KB
Loading[フレーム]

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /