Ask Your Question

what is the dimension of feature descriptor from BRISK and FREAK? How do I compute

asked 2013-07-20 10:26:51 -0600

updated 2013-07-20 15:37:39 -0600

Guanta gravatar image

How can I access the feature descriptor from FREAK and Brisk in oepncv framework....

for e.g.

#include <cv.hpp>
#include <cxcore.hpp>
#include <highgui.h>
#include <opencv2\highgui\highgui.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/nonfree/features2d.hpp>

int main()

const char * PimA="water1.jpg";   // object
const char * PimB="water2.jpg"; // image

cv::Mat GrayA =cv::imread(PimA);
cv::Mat GrayB =cv::imread(PimB);

std::vector<cv::KeyPoint> keypointsA, keypointsB;
cv::Mat descriptorsA, descriptorsB;

int Threshl=60;
int Octaves=4; 
float PatternScales=1.0f;
cv::BRISK  BRISKD(Threshl,Octaves,PatternScales);//initialize algoritm

BRISKD.detect(GrayA, keypointsA);
BRISKD.compute(GrayA, keypointsA,descriptorsA);

BRISKD.detect(GrayB, keypointsB);
BRISKD.compute(GrayB, keypointsB,descriptorsB);

Now I want to access the elements inside descriptorsA and descriptorsB

what will be the dimension of those feature descriptors as well!

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-07-20 16:02:26 -0600

berak gravatar image

afaik, bisk, brief, orb descriptors are 32 byte uchar arrays, so your desc Mat will have n rows and 32 cols ( SURF and SIFT are 128 element float arrays )

but why don't you go, and look for yourself ?

cerr << desc.rows << " " << desc.cols << " " << desc.type() << endl;

if the type() is CV_8U (0), you'd access it like:

 uchar d =<uchar>(row,col);<uchar>(row,col) = 19;

if the type() is CV_32F, that's :

float d =<float>(row,col);<float>(row,col) = 19.9f;
edit flag offensive delete link more


What is the significance of this type (uchar/float)...why they could be different !!! Under what circumstances they will be different ? and what does that 'n' denotes? Sorry for asking such trivial stuffs ...but I need to understand

noviceopencvuser gravatar imagenoviceopencvuser ( 2013-07-20 23:56:42 -0600 )edit

'n' are the number of descriptors, typically you don't know them beforehand. You should definitely read the documentation, tutorials and user guide at

Guanta gravatar imageGuanta ( 2013-07-21 07:29:17 -0600 )edit

1 descriptor row per keypoint

berak gravatar imageberak ( 2013-07-21 08:02:36 -0600 )edit

Question Tools


Asked: 2013-07-20 10:26:51 -0600

Seen: 795 times

Last updated: Jul 20 '13