Ask Your Question
0

Get descriptor values in Android

asked 2016-08-13 19:27:56 -0600

timis gravatar image

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 (!img1.data)
    {
        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();
    Utils.bitmapToMat(mOpenCvCameraView.bitmap,inputImage);

    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();

    dExtractor.compute(imagineGri,keyPoint,descriptor);

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.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2016-08-13 19:32:03 -0600

berak gravatar image

updated 2016-08-13 20:24:23 -0600

there's Mat.dump(), if you want to look at the values

edit flag offensive delete link more

Comments

thank you, it's work

timis gravatar imagetimis ( 2016-08-13 20:08:32 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-08-13 19:27:56 -0600

Seen: 421 times

Last updated: Aug 13 '16