Ask Your Question

timis's profile - activity

2016-08-13 20:27:18 -0600 received badge  Supporter (source)
2016-08-13 20:08:32 -0600 commented question Get descriptor values in Android

thank you, it's work

2016-08-13 19:27:56 -0600 asked a question Get descriptor values in Android

I'm working on an app that uses ORB in order to detect some buildings. The values of the descriptor returned by the following code written in C++ are stored in a MySql database(my DB communicates with an Android app in order to detect the building):

Mat img2 = imread("C:\\Users\\timis\\Desktop\\test4.bmp");

    Mat img1 = img2;
    cvtColor(img2, img1, CV_BGR2GRAY);

    if (!
        printf(" --(!) Eroare la citirea imaginii \n");
        return -1;

    std::vector<KeyPoint> keypoints_1, keypoints_2;

    Mat descriptors_1, descriptors_2;

    Ptr<ORB> orb = ORB::create(500, 1.2, 8, 31, 0, 2, ORB::HARRIS_SCORE, 31, 20);

    orb->detectAndCompute(img1, Mat(), keypoints_1, descriptors_1);

    if (test == 1){
    std::cout << "Found " << keypoints_1.size() << " Keypoints " << std::endl;
    std::cout << descriptors_1 << std::endl;

    std::cout << "Numar keypoints: "<<descriptors_1.rows << std::endl;
    std::cout << "Numar caracteristici: "<<descriptors_1.cols << std::endl;
            std::ofstream output("Descriptor.txt");

    output << descriptors_1;

    test -= 1;

and this are the values returned: image description

The problem that I'm facing is that when I try to obtain the values of the image descriptor taken with the phones camera. This is the code I used:

FeatureDetector detector = FeatureDetector.create(FeatureDetector.ORB);
    Mat inputImage=new Mat();

    Mat imagineGri=new Mat();
    //convert the photo from color to gray
    Imgproc.cvtColor(inputImage, imagineGri, Imgproc.COLOR_RGB2GRAY);

    MatOfKeyPoint keyPoint= new MatOfKeyPoint();

    detector.detect(imagineGri, keyPoint);

    DescriptorExtractor dExtractor=DescriptorExtractor.create(DescriptorExtractor.ORB);

    Mat descriptor=new Mat();


but this is what I get:

Mat [ 33532CV_8UC1, isCont=true, isSubmat=false, nativeObj=0x63c8fd70, dataAddr=0x63c984e0 ]

Shouldn't I have all the values like in C++? Or is there some way that allows me to do this?

Please help me solve this problem.

2016-08-12 20:38:51 -0600 asked a question OpenCV print descriptor value

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)<float>(p, 0);

            float test =<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.