Hi,
You should take a look to Calib3d JNI interface. For example the findFundamentalMat() function :
public static Mat findFundamentalMat(MatOfPoint2f points1, MatOfPoint2f points2)
{
Mat points1_mat = points1;
Mat points2_mat = points2;
Mat retVal = new Mat(findFundamentalMat_2(points1_mat.nativeObj, points2_mat.nativeObj));
return retVal;
}
[...]
private static native long findFundamentalMat_2(long points1_mat_nativeObj, long points2_mat_nativeObj);
And it's native part :
JNIEXPORT jlong JNICALL Java_org_opencv_calib3d_Calib3d_findFundamentalMat_12 (JNIEnv*, jclass, jlong, jlong);
JNIEXPORT jlong JNICALL Java_org_opencv_calib3d_Calib3d_findFundamentalMat_12
(JNIEnv* env, jclass , jlong points1_mat_nativeObj, jlong points2_mat_nativeObj)
{
static const char method_name[] = "calib3d::findFundamentalMat_12()";
try {
LOGD("%s", method_name);
std::vector<Point2f> points1;
Mat& points1_mat = *((Mat*)points1_mat_nativeObj);
Mat_to_vector_Point2f( points1_mat, points1 );
std::vector<Point2f> points2;
Mat& points2_mat = *((Mat*)points2_mat_nativeObj);
Mat_to_vector_Point2f( points2_mat, points2 );
::Mat _retval_ = cv::findFundamentalMat( points1, points2 );
return (jlong) new ::Mat(_retval_);
} catch(const std::exception &e) {
throwJavaException(env, &e, method_name);
} catch (...) {
throwJavaException(env, 0, method_name);
}
return 0;
}
So, this should do the trick :
JNIEXPORT void JNICALL Java_ImageProcessingActivity_rectfy (JNIEnv * jobject, jlong corners, inputMatAddress jlong){
std::vector<Point2f> corners_vector;
Mat& corners_mat = *((Mat*)corners);
Mat_to_vector_Point2f( corners_mat_mat, corners_vector );
[...]
}