Ask Your Question
0

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.create("Feature2D.BRISK");

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
1

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 = desc.at<uchar>(row,col);
 desc.at<uchar>(row,col) = 19;

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

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

Comments

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
1

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

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

1 descriptor row per keypoint

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

Question Tools

Stats

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

Seen: 862 times

Last updated: Jul 20 '13