我目前正在开发一个android应用程序。在java端,我将一个List<KeyPoint> objectKeypoints传递给原生代码。但是如何将本机的这个jobject转换成Vector<Keypoint> objectKeypoints进行进一步的处理呢?
例如: Java Side my calling:
List<KeyPoint> objKeypoints;
Mat mGrayMat = ;// is not empty;
FeatureDetector featureDetector = FeatureDetector.create(FeatureDetector.SURF);
featureDetector.detect(obj_keypoints, mGrayMat);
FindObject(objKeypoints,mGrayMat );原生端C++代码;
JNIEXPORT void JNICALL Java_my_app_AndroidAppView_FindObject(JNIEnv* env, jobject obj, jobject obj_keypoints, jlong matAddrObjGray){
// How to convert obj_keypoints to Vector<KeyPoint>?
Vector<KeyPoint> objectKeypoints = ....;
Next Step is calculating the descriptors for the Keypoints.
}发布于 2012-05-09 06:57:58
你不能,除非它真的是一个Vector。如果接口只指定List,那么您应该将其作为List来处理。如果需要Vector,请将接口更改为require。
您也可以从列表中构建一个新的Vector,但这似乎是毫无意义的昂贵。
https://stackoverflow.com/questions/10507647
复制相似问题