i'd use native opencv function getthreshval_otsu_8u in android application. i've noticed external opencv java wrapper functions call functions defined native, don't have same names actual native functions. example:
java function:
double threshold(mat src, mat dst, double thresh, double maxval, int type) java "native" function:
private static native double threshold_0(long src_nativeobj, long dst_nativeobj, double thresh, double maxval, int type) c++ function:
double cv::threshold( inputarray _src, outputarray _dst, double thresh, double maxval, int type ) how can make similar native java function call getthreshval_otsu_8u? there way avoid rebuilding opencv libraries , "tunnel" existing .lib files?
if not case, first need set android project in order use java native interface (this link might help).
once set up, principle quite easy:
- you need create java native prototype in java code (e.g.
public native void yourfunction();) - the corresponding function must defined in c/c++ file (e.g.
jniexport void jnicall java_your_package_javaclassname_yourfunction(jnienv * env, jobject obj);) - you should able include opencv library in c/c++ code (e.g.
#include <opencv2/core/core.hpp>)
the method want use (i.e. getthreshval_0tsu_8u) takes mat& parameter , returns double, means need adapt jni code correspondingly.
Comments
Post a Comment