Ask Your Question
0

OpenCV print descriptor value

asked 2016-08-12 17:00:16 -0600

timis gravatar image

I'm writing a C++ program that should store in a MySQL DB the image descriptors value. I'm using ORB and as far as I know, I should have an 128 bit long value. When I run the following code

for (int p = 0; p < 500; p++){

        if (p == 499){

            cerr << "linia i coloana 0" << descriptors_2.row(p).col(0) << endl;
            cerr << "linia i coloana 0" << descriptors_2.col(0).row(p) << endl;
            cerr << (float)descriptors_2.at<float>(p, 0);

            float test = descriptors_2.at<float>(p, 0);
            cerr << "p,0" << test << endl;

        }

    }

I get the result shown in the picture.

image description

I'm wondering if the hexa value is the one that I should store or is there something that I am doing wrong. Please help me find the problem.

edit retag flag offensive close merge delete

Comments

ORB gives 256 bit value which is of 32 Bytes but not 128 bits

WhoAmI gravatar imageWhoAmI ( 2016-08-16 08:36:43 -0600 )edit

yes, that's correct. why did you expect 128 bits ?

berak gravatar imageberak ( 2016-08-16 08:41:53 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2016-08-12 20:43:51 -0600

berak gravatar image

updated 2016-08-13 01:31:00 -0600

ORB descriptors are uchar , not float, so you have to use:

 uchar value = descriptors_2.at<uchar>(y,x);
 cerr << (int) value << endl;

(if you omit casting to int, cerr will assume it's a letter, not a number)

also note, that can simply print out whole Mat's like:

cerr << descriptors_2.row(3) << endl; // e.g. print 4th row
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-08-12 17:00:16 -0600

Seen: 389 times

Last updated: Aug 13 '16