1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-26 22:03:04 +04:00

Merge pull request #26405 from kaingwade:rename_features2d

Rename features2d #26405

This PR renames the module _features2d_ to _features_ as one of the Big OpenCV Cleanup #25007. 
Related PR: opencv/opencv_contrib: [#3820](https://github.com/opencv/opencv_contrib/pull/3820) opencv/ci-gha-workflow: [#192](https://github.com/opencv/ci-gha-workflow/pull/192)
This commit is contained in:
WU Jia
2024-11-12 16:04:48 +08:00
committed by GitHub
parent c7a21dc5bf
commit 614e250fd3
260 changed files with 273 additions and 268 deletions
@@ -0,0 +1,27 @@
from __future__ import print_function
import cv2 as cv
import numpy as np
import argparse
parser = argparse.ArgumentParser(description='Code for Feature Detection tutorial.')
parser.add_argument('--input', help='Path to input image.', default='box.png')
args = parser.parse_args()
src = cv.imread(cv.samples.findFile(args.input), cv.IMREAD_GRAYSCALE)
if src is None:
print('Could not open or find the image:', args.input)
exit(0)
#-- Step 1: Detect the keypoints using SURF Detector
minHessian = 400
detector = cv.xfeatures2d_SURF.create(hessianThreshold=minHessian)
keypoints = detector.detect(src)
#-- Draw keypoints
img_keypoints = np.empty((src.shape[0], src.shape[1], 3), dtype=np.uint8)
cv.drawKeypoints(src, keypoints, img_keypoints)
#-- Show detected (drawn) keypoints
cv.imshow('SURF Keypoints', img_keypoints)
cv.waitKey()