2011-08-09 22:58:24 +08:00
|
|
|
#include <jni.h>
|
|
|
|
|
2012-06-08 16:11:17 +08:00
|
|
|
#include "opencv2/opencv_modules.hpp"
|
|
|
|
|
|
|
|
#ifdef HAVE_OPENCV_NONFREE
|
|
|
|
# include "opencv2/nonfree/nonfree.hpp"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_OPENCV_FEATURES2D
|
|
|
|
# include "opencv2/features2d/features2d.hpp"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_OPENCV_VIDEO
|
|
|
|
# include "opencv2/video/video.hpp"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_OPENCV_ML
|
|
|
|
# include "opencv2/ml/ml.hpp"
|
|
|
|
#endif
|
|
|
|
|
2012-07-05 15:58:40 +08:00
|
|
|
#ifdef HAVE_OPENCV_CONTRIB
|
|
|
|
# include "opencv2/contrib/contrib.hpp"
|
|
|
|
#endif
|
|
|
|
|
2011-08-09 22:58:24 +08:00
|
|
|
extern "C" {
|
|
|
|
|
|
|
|
JNIEXPORT jint JNICALL
|
2012-06-20 20:27:02 +08:00
|
|
|
JNI_OnLoad(JavaVM* vm, void* )
|
2011-08-09 22:58:24 +08:00
|
|
|
{
|
|
|
|
JNIEnv* env;
|
|
|
|
if (vm->GetEnv((void**) &env, JNI_VERSION_1_6) != JNI_OK)
|
|
|
|
return -1;
|
|
|
|
|
2012-06-08 16:11:17 +08:00
|
|
|
bool init = true;
|
|
|
|
#ifdef HAVE_OPENCV_NONFREE
|
|
|
|
init &= cv::initModule_nonfree();
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_OPENCV_FEATURES2D
|
|
|
|
init &= cv::initModule_features2d();
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_OPENCV_VIDEO
|
|
|
|
init &= cv::initModule_video();
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_OPENCV_ML
|
|
|
|
init &= cv::initModule_ml();
|
|
|
|
#endif
|
2012-07-05 15:58:40 +08:00
|
|
|
#ifdef HAVE_OPENCV_CONTRIB
|
|
|
|
init &= cv::initModule_contrib();
|
|
|
|
#endif
|
2012-06-08 16:11:17 +08:00
|
|
|
|
|
|
|
if(!init)
|
|
|
|
return -1;
|
|
|
|
|
2011-08-09 22:58:24 +08:00
|
|
|
/* get class with (*env)->FindClass */
|
|
|
|
/* register methods with (*env)->RegisterNatives */
|
|
|
|
|
|
|
|
return JNI_VERSION_1_6;
|
|
|
|
}
|
|
|
|
|
|
|
|
JNIEXPORT void JNICALL
|
2012-06-20 20:27:02 +08:00
|
|
|
JNI_OnUnload(JavaVM*, void*)
|
2011-08-09 22:58:24 +08:00
|
|
|
{
|
|
|
|
//do nothing
|
|
|
|
}
|
|
|
|
|
2012-06-08 16:11:17 +08:00
|
|
|
} // extern "C"
|