opencvfeature-extractionimagedownload

OpenCV Brisk not detecting any keypoints


I have an image that I'd like to detect in a larger image (i.e. see if a similar version is present). Template matching is not accurate enough, as the items can be rooted and scaled, so Brisk seems a hopeful approach:

However, when I try to create descriptors, I get no return:

Here is my example image:

enter image description here

BRISK = cv2.BRISK_create()
keypoints1, descriptors1 = BRISK.detectAndCompute(img, None)

returns

 ([], None)

Any suggestions how I can get better results? Why does Brisk not detect any features? Changing threshold to 0 and adding octaves doesn't seem to help.


Solution

  • Your image is way too small to find any meaningful descriptors. Unless you use a larger sized image, following is a solution that can be used:

    img = cv2.imread("/path/to/image/so_brisk.png")
    gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)  # Gray
    w, h = gray.shape
    scale_factor = 3
    gray = cv2.resize(gray, (h*scale_factor, w*scale_factor), interpolation = cv2.INTER_AREA)
    
    BRISK = cv2.BRISK_create()
    keypoints1, descriptors1 = BRISK.detectAndCompute(gray, None)