Ask Your Question

Revision history [back]

Getting keypoint vector from native code

I am writting an application in which I want that my native code should return keypoint vector.After searching through various site I found that Vector<keypoint> is not a standard JNI type. Is there any alternative to get it.Right now my code look like this(making my app to crash.i)

Vector<KeyPoint> keypoint = FindFeatures(Gray1.getNativeObjAddr(),descriptor.getNativeObjAddr());

and

public native Vector<KeyPoint> FindFeatures(long matAddrGr1, long matAddrGr2);

Native code:

extern "C" {
JNIEXPORT Vector<KeyPoint> JNICALL Java_com_example_xyz_MainActivity_FindFeatures(JNIEnv*, jobject, jlong addrGray1, jlong addrdescrptor);

JNIEXPORT Vector<KeyPoint> JNICALL Java_com_example_xyz_MainActivity_FindFeatures(JNIEnv*, jobject, jlong addrGray1, jlong addrdescrptor)
{
    Mat* mGr1  = (Mat*)addrGray1;
    Mat* descriptors_1 = (Mat*)addrdescrptor;
    vector<KeyPoint> keypoint_1;

    //some processing here

    return keypoint_1;
  }
}