AttributeError: module 'cv2' has no attribute 'xfeatures2d'

System: Jetson Nano, JetPack 4.6.1.
I tried running a code using SIFT for feature extraction, and i got the following error.
sift = cv2.xfeatures2d.SIFT_create(contrastThreshold=peak_thresh, edgeThreshold=edge_threshold)
AttributeError: module ‘cv2’ has no attribute ‘xfeatures2d’

Can anyone solve? Or tell me a work around. Thank you!

A user has shared a script to manually build OpenCV package:
GitHub - mdegans/nano_build_opencv: Build OpenCV on Nvidia Jetson Nano

Please check the script and see if additional configs have to be enabled for xfeatures2d. And modify the script to enable it and build the package.

Thank you @DaneLLL for your response, I believe the reason why I get the error is because I am using the pre-installed OpenCV that comes with the jetpack. I will upgrade to 4.5.1 and get back to you if it works.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.