ORB Feature Detection in Python OpenCV
Hello Everyone!
In this tutorial, we will see what is ORB feature detector and how can we implement it in Python.
ORB stands for Oriented FAST and rotated BRIEF. In 2011, Opencv labs developed ORB which was an amazing alternative to SIFT and SURF. It’s faster and has less computation cost. Unlike SIFT and SURF, it is not patented.
ORB makes use of a modified version of the FAST keypoint detector and BRIEF descriptor. FAST features are not scale-invariant and rotation invariant.
Therefore, to make it scale-invariant ORB uses a multiscale pyramid. A multiscale pyramid consists of multiple layers where each successive layer contains a downsampled version of the previous layer image. ORB detects features at each level/ different scales.
An orientation is assigned to each keypoint (left or right) depending upon the change in intensities around that key point. Hence, ORB is also a rotation invariant.
To read more about ORB Feature detection, visit Opencv’s official documentation on ORB.
CODE
#Feature detection using ORB #import cv2 library import cv2 orb=cv2.ORB_create() #read image img=cv2.imread("tt.jpg",1) #if image dimensions are very large, uncomment it to resize image #img=cv2.resize(img,(400,400)) #detect key points and descriptors kp, des = orb.detectAndCompute(img, None) #draw key points on the image imgg=cv2.drawKeypoints(img, kp, None) cv2.imshow("ORIGIONAL IMAGE",img) cv2.imshow("FEATURES DETECTED",imgg) cv2.waitKey(0) cv2.destroyAllWindows()
OUTPUT
We can see in comparison to all the pixels of the image there are very fewer pixels that represent features. So instead of working with all the pixels, we can always extract the features and save time and reduce computation cost.
Hope you liked this tutorial!
Also read:
Leave a Reply