Oriented FAST and rotated BRIEF
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
- Features from accelerated segment test (FAST)를 사용하여 키포인트를 찾는다.
- Harris corner detection 상위 N개 포인트를 검출한다.
- SIFT (Scale-Invariant Feature Transform)에서 사용되는 스케일 피라미드(Scale-Pyrimid)를 사용하여 여러 스케일에 대한 특징점을 찾는다.
- steer BRIEF 설명자를 사용하여 특징점을 표현하는 벡터를 만든다.
- 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 ↩