Even though we have FAST to quickly detect the keypoints, we still have to use SIFT or SURF to compute the descriptors. We need a way to quickly compute the descriptors as well. This is where BRIEF comes into the picture. BRIEF is a method for extracting feature descriptors. It cannot detect the keypoints by itself, so we need to use it in conjunction with a keypoint detector. The good thing about BRIEF is that it's compact and fast.
Consider the following image:
BRIEF takes the list of input keypoints and outputs an updated list. So if you run BRIEF on this image, you will see something like this:
Following is the code:
import cv2 import numpy as np gray_image = cv2.imread('input.jpg', 0) # Initiate FAST detector fast = cv2.FastFeatureDetector() # Initiate BRIEF extractor brief = cv2.DescriptorExtractor_create("BRIEF") # find the keypoints with STAR keypoints = fast.detect(gray_image, None) # compute the descriptors with BRIEF keypoints, descriptors = brief.compute(gray_image, keypoints) gray_keypoints = cv2.drawKeypoints(gray_image, keypoints, color=(0,255,0)) cv2.imshow('BRIEF keypoints', gray_keypoints) cv2.waitKey()