Ask Your Question

how to implement BRISK in python, I tried it but it showed that there is no such attribute in cv2 library pls help me!!

asked 2017-09-26 12:18:25 -0500

shrijay gravatar image

brisk = cv2.xfeatures2d.BRISK_create() AttributeError: module 'cv2.xfeatures2d' has no attribute 'BRISK_create'

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2017-09-26 12:22:39 -0500

berak gravatar image

it is simply: cv2.BRISK_create()

>>> help(cv2.BRISK_create)
Help on built-in function BRISK_create:

    BRISK_create([, thresh[, octaves[, patternScale]]]) -> retval
    .   @brief The BRISK constructor
    .   @Param thresh AGAST detection threshold score.
    .   @Param octaves detection octaves. Use 0 to do single scale.
    .   @Param patternScale apply this scale to the pattern used for sampling the neighbourhood of a
    .   keypoint.

    BRISK_create(radiusList, numberList[, dMax[, dMin[, indexChange]]]) -> retval
    .   @brief The BRISK constructor for a custom pattern
    .   @Param radiusList defines the radii (in pixels) where the samples around a keypoint are taken (for
    .   keypoint scale 1).
    .   @Param numberList defines the number of sampling points on the sampling circle. Must be the same
    .   size as radiusList..
    .   @Param dMax threshold for the short pairings used for descriptor formation (in pixels for keypoint
    .   scale 1).
    .   @Param dMin threshold for the long pairings used for orientation determination (in pixels for
    .   keypoint scale 1).
    .   @Param indexChange index remapping of the bits.
edit flag offensive delete link more



thanks brother !! i am very new to both python and CV

shrijay gravatar imageshrijay ( 2017-09-26 12:26:03 -0500 )edit

sure, welcome ;)

berak gravatar imageberak ( 2017-09-26 12:56:57 -0500 )edit

import numpy as np import cv2 import matplotlib.pyplot as plt

img1 = cv2.imread('book.jpg', 0) # Original image - ensure grayscale img2 = cv2.imread('book2.jpg', 0) # Rotated image - ensure grayscale

brisk = cv2.BRISK_create(1000, 2)

(kp1,des1) = brisk.detectAndCompute(img1,None) print(len(kp1)) (kp2,des2) = brisk.detectAndCompute(img2, None) print(len(kp2))

bf = cv2.BFMatcher(cv2.NORM_HAMMING, crossCheck=True)

matches = bf.match(des1,des2) print(len(matches))

matches = sorted(matches, key=lambda val: val.distance) print(len(matches))

img3 = cv2.drawMatches(img1,kp1,img2,kp2,matches ,None, flags=2)


i am trying this code but im not getting any keypoints will you help me

shrijay gravatar imageshrijay ( 2017-09-26 13:05:05 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-09-26 12:18:25 -0500

Seen: 3,510 times

Last updated: Sep 26 '17