errors on running FAST algorithm on corner detection
Could any one provide a example python script to test FAST algorithm on corner detection?
When I run below example python script from opencv-python tutorial, I get a error "TypeError: Required argument 'outImage' (pos 3) not found"
import numpy as np
import cv2
from matplotlib import pyplot as plt
img = cv2.imread('Penguins.jpg',0)
# Initiate FAST object with default values
fast = cv2.FastFeatureDetector_create()
# find and draw the keypoints
kp = fast.detect(img,None)
img2 = cv2.drawKeypoints(img, kp, color=(255,0,0))
# Print all default params
print "Threshold: ", fast.getInt('threshold')
print "nonmaxSuppression: ", fast.getBool('nonmaxSuppression')
print "neighborhood: ", fast.getInt('type')
print "Total Keypoints with nonmaxSuppression: ", len(kp)
cv2.imwrite('fast_true.png',img2)
# Disable nonmaxSuppression
fast.setBool('nonmaxSuppression',0)
kp = fast.detect(img,None)
print "Total Keypoints without nonmaxSuppression: ", len(kp)
img3 = cv2.drawKeypoints(img, kp, color=(255,0,0))
cv2.imwrite('fast_false.png',img3)
I would suggest you for this and other posts in the future, that you use the function to highlight code in your question. It is not easy to read a post without it.
where did you find that example ? i'm pretty sure, i fixed it lately, see here
Thanks Berak,
I run the example from the link you provided. There is a issue on print out threshold. Below is the error: AttributeError: 'cv2.FastFeatureDetector' object has no attribute 'getInt'
Could you kindly let me know the solution?
oh, right. thanks for the notice.
(you probably need to comment out the whole "print ..." block for now)
but again, your issue was about drawKeypoints, right ?
well yea, no idea, how that slipped, but it's fast.getThreshold(), fast.getNonmaxSuppression(), etc, now.
try a :
help(fast)
, and see yourself !I do comment out all print. The original issue is about drawKeypoints. After fixing the issue about drawKeypoints. It is observed that several function from FastFeatureDetector_create, such as getInt() and setBool() does not work.
Let me know if you have some ideas about it.
Thanks
It works after changing it as below:
print "Threshold: ", fast.getThreshold()
Thanks
remember me to fix the docs sample !
Hi When I run this example on Python 2.7.14-x64. The following error is shown.
Traceback (most recent call last): File "fast.py", line 9, in <module> kp = fast.detect(img,None)
TypeError: Incorrect type of self (must be 'Feature2D' or its derivative)
Could anyone help me to fix it? Other PC with Same python version tun OK without this.
@JackCha please do not post answers here, if you have a question or comment, thank you.