Contrib module is added to java wrappers; fixed algorithm initialisation for python bindings

This commit is contained in:
Andrey Kamaev 2012-07-05 07:58:40 +00:00
parent b1eba01afb
commit 620d122fc2
5 changed files with 52 additions and 6 deletions

View File

@ -6,7 +6,7 @@ if(NOT ANDROID OR NOT PYTHON_EXECUTABLE OR ANDROID_NATIVE_API_LEVEL LESS 8)
endif()
set(the_description "The java bindings")
ocv_add_module(java BINDINGS opencv_core opencv_imgproc OPTIONAL opencv_objdetect opencv_features2d opencv_video opencv_highgui opencv_ml opencv_calib3d opencv_photo opencv_nonfree)
ocv_add_module(java BINDINGS opencv_core opencv_imgproc OPTIONAL opencv_objdetect opencv_features2d opencv_video opencv_highgui opencv_ml opencv_calib3d opencv_photo opencv_nonfree opencv_contrib)
ocv_module_include_directories("${CMAKE_CURRENT_SOURCE_DIR}/generator/src/cpp")
# get list of modules to wrap

View File

@ -18,6 +18,10 @@
# include "opencv2/ml/ml.hpp"
#endif
#ifdef HAVE_OPENCV_CONTRIB
# include "opencv2/contrib/contrib.hpp"
#endif
extern "C" {
JNIEXPORT jint JNICALL
@ -40,6 +44,9 @@ JNI_OnLoad(JavaVM* vm, void* )
#ifdef HAVE_OPENCV_ML
init &= cv::initModule_ml();
#endif
#ifdef HAVE_OPENCV_CONTRIB
init &= cv::initModule_contrib();
#endif
if(!init)
return -1;

View File

@ -22,11 +22,10 @@
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/opencv_modules.hpp"
#ifdef HAVE_OPENCV_NONFREE
#include "opencv2/nonfree/nonfree.hpp"
static bool makeUseOfNonfree = cv::initModule_nonfree();
#endif
#ifdef HAVE_OPENCV_NONFREE
# include "opencv2/nonfree/nonfree.hpp"
#endif
using cv::flann::IndexParams;
using cv::flann::SearchParams;

View File

@ -3878,11 +3878,52 @@ static PyMethodDef old_methods[] = {
/************************************************************************/
/* Module init */
#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
#ifdef HAVE_OPENCV_CONTRIB
# include "opencv2/contrib/contrib.hpp"
#endif
static PyObject* init_cv()
{
PyObject *m, *d;
cvSetErrMode(CV_ErrModeParent);
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
#ifdef HAVE_OPENCV_CONTRIB
init &= cv::initModule_contrib();
#endif
if(!init)
return 0;
#define MKTYPE(NAME) NAME##_specials(); to_ok(&NAME##_Type)
MKTYPE(cvcontourtree);

View File

@ -2,7 +2,6 @@ set(sample example-face-detection)
if(BUILD_FAT_JAVA_LIB)
set(native_deps opencv_java)
ocv_include_modules(opencv_contrib)
else()
set(native_deps opencv_contrib)
endif()