Ask Your Question
0

How to extract BRIEF descriptor for the keypoint on given location.

asked 2015-03-18 06:58:44 -0600

Kashif gravatar image

updated 2015-03-18 10:29:31 -0600

berak gravatar image

Hello,

I recently started working with opencv. I want to extract BRIEF descriptors for some keypoints. For this I am using this code.

    detector = cv.FeatureDetector('STAR');
    keypoints = detector.detect(im);
    extractor = cv.DescriptorExtractor('BRIEF');
    descriptors = extractor.compute(im, keypoints);

This code is working fine. But what I actually want is, I want to provide location of keypoints by myself. For Example, I want to extract BRIEF descriptor for the keypoints on location (16,16). Apparently, I can write the code in this way

    detector = cv.FeatureDetector('STAR');
    keypoints = detector.detect(im, [16,16]);
    extractor = cv.DescriptorExtractor('BRIEF');
    descriptors = extractor.compute(im, keypoints);

Of course, This is not working. How can I extract BRIEF descriptor for my defined location??? I have already done it with SURF, BRISK and FREAK in matlab. But I want to do it with BRIEF descriptor.

Thank you, Best Regards.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
3

answered 2015-03-18 07:15:17 -0600

Guanta gravatar image

updated 2015-03-18 07:15:38 -0600

Keypoints are not just points! They can carry a size, angle, etc., see also:

In [6]: ? cv2.KeyPoint()
Type:        builtin_function_or_method
String form: <built-in function KeyPoint>
Docstring:   KeyPoint([x, y, _size[, _angle[, _response[, _octave[, _class_id]]]]]) -> <KeyPoint object>

Thus, you need to convert your point into a KeyPoint, e.g.:

descriptors = extractor.compute(im, [cv2.KeyPoint(16,16,1)]);
edit flag offensive delete link more

Comments

Thank you Guanta for your response. Yes, I want to convert points into keypoints. But I am not able to do this.

cv.Keypoint() is not working. it seems this function is not avaialable???

I am using opencv in MATLAB that i connected through mexopencv ( By follwing the guidlines given here http://vision.is.tohoku.ac.jp/~kyamag... )

Best Regards,

Kashif gravatar imageKashif ( 2015-03-18 07:41:11 -0600 )edit

@Kashif, please use the cv2 api, not the old cv one(which will be removed in a couple of days)

berak gravatar imageberak ( 2015-03-18 07:43:27 -0600 )edit

Ok, Can you please share the link from where I can download and use it?

Kashif gravatar imageKashif ( 2015-03-18 08:02:46 -0600 )edit
1

import cv2

(that's all)

berak gravatar imageberak ( 2015-03-18 08:11:15 -0600 )edit

Thank you berak. I am sorry to be too naive. I am working in matlab file. I connected opencv with matlab through mexopencv. I did not import cv either. how can I import cv2 ? should I import it in .m file?

Kashif gravatar imageKashif ( 2015-03-18 08:25:57 -0600 )edit

sorry, ignore me then, mistook it for python.

berak gravatar imageberak ( 2015-03-18 08:30:37 -0600 )edit

@berak, No Problem :) Thanks btw. @Guanta, can you guide please

Kashif gravatar imageKashif ( 2015-03-18 08:41:35 -0600 )edit
1

@kashi: sorry, never used OpenCV from Matlab (I use Python / C++). I already wondered about your cv-commands, since in Python you would always write cv2.. I don't hope it for you, but it might be that KeyPoints are not properly exported to Matlab. Maybe you can write another question answering explicitly for Matlab a la "Using keypoints in matlab", maybe somebody who uses Matlab gets attracted by such a title. Good luck!

Guanta gravatar imageGuanta ( 2015-03-18 10:24:42 -0600 )edit

Ok, Thank you :)

Kashif gravatar imageKashif ( 2015-03-18 10:52:11 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2015-03-18 06:58:44 -0600

Seen: 1,552 times

Last updated: Mar 18 '15