Oriented FAST and rotated BRIEF
lastmod 2025-02-02created 2017-11-0616 edits
Oriented FAST and rotated BRIEF (ORB) is a fast robust local feature detector, first presented by Ethan Rublee et al. in 2011, that can be used in computer vision tasks like object recognition or 3D reconstruction. It is based on the FAST keypoint detector and the visual descriptor BRIEF (Binary Robust Independent Elementary Features). Its aim is to provide a fast and efficient alternative to SIFT.
Step
- Find keypoints using Features from accelerated segment test (FAST).
- Detect the top N points with Harris corner detection.
- Find keypoints at multiple scales using the scale pyramid (Scale-Pyrimid) used in SIFT (Scale-Invariant Feature Transform).
- Build vectors that represent the keypoints using the steer BRIEF descriptor.
- Match images using multi-probe LSH (Locality Sensetive Hashing).
Implementation Code
ORB example
def draw_diff(img1, img2, ratio=0.8):
# Initiate SIFT detector
orb = cv2.ORB_create()
# find the keypoints and descriptors with SIFT
kp1, des1 = orb.detectAndCompute(img1, None)
kp2, des2 = orb.detectAndCompute(img2, None)
# create BFMatcher object
bf = cv2.BFMatcher(cv2.NORM_HAMMING, crossCheck=True)
# Match descriptors.
matches = bf.match(des1, des2)
# Sort them in the order of their distance.
matches = sorted(matches, key=lambda x: x.distance)
# BFMatcher with default params
bf = cv2.BFMatcher()
matches = bf.knnMatch(des1, des2, k=2)
# Apply ratio test
good = []
for m, n in matches:
if m.distance < ratio * n.distance:
good.append([m])
# Draw first 10 matches.
knn_image = cv2.drawMatchesKnn(img1, kp1, img2, kp2, good, None, flags=2)
plt.imshow(knn_image)
plt.show()
See also
- Feature detection
- OpenCV
- k-nearest neighbors algorithm (KNN)
- Features from accelerated segment test (FAST)
- Binary Robust Independent Elementary Features (BRIEF)
Favorite site
- Wikipedia (en) Oriented FAST and rotated BRIEF
- Stackoverflow - C++ - OpenCV feature detection with ORB
- Result: ORB are binary feature vectors which don't work with Flann. Use Brute Force (BFMatcher) instead.
Official
- OpenCV: cv::ORB Class Reference
- OpenCV-Python Tutorials - ORB (Oriented FAST and Rotated BRIEF)
- ORB (Oriented FAST and Rotated BRIEF) - OpenCV 3.0.0-dev documentation
References
-
Datascienceschool.net_-_7eb4b2a440824bb0a8c2c7ce3da7a4e2.ipynb.zip ↩
Pages that link here