Introduction
ORB features help computers find and describe important points in pictures so they can recognize objects or match images quickly.
Jump into concepts and practice - no test required
import cv2 orb = cv2.ORB_create(nfeatures=500) keypoints, descriptors = orb.detectAndCompute(image, None)
orb = cv2.ORB_create()
keypoints, descriptors = orb.detectAndCompute(image, None)orb = cv2.ORB_create(nfeatures=1000) keypoints, descriptors = orb.detectAndCompute(image, None)
keypoints = orb.detect(image, None) descriptors = orb.compute(image, keypoints)[1]
import cv2 import numpy as np # Load a sample image in grayscale image = cv2.imread(cv2.samples.findFile('box.png'), cv2.IMREAD_GRAYSCALE) # Create ORB detector orb = cv2.ORB_create(nfeatures=500) # Detect keypoints and compute descriptors keypoints, descriptors = orb.detectAndCompute(image, None) # Print number of keypoints found print(f'Number of keypoints detected: {len(keypoints)}') # Show first 5 keypoints coordinates for i, kp in enumerate(keypoints[:5]): print(f'Keypoint {i+1}: x={kp.pt[0]:.2f}, y={kp.pt[1]:.2f}')
kp after running kp, des = orb.detectAndCompute(img, None)?
import cv2
img = cv2.imread('image.jpg', 0)
orb = cv2.ORB_create(nfeatures=1000)
kp, des = orb.detectAndCompute(img, None)import cv2
img = cv2.imread('image.jpg')
orb = cv2.ORB_create(nfeatures=300)
kp, des = orb.detectAndCompute(img, None)
print(len(kp))