diff --git a/modules/contrib/include/opencv2/contrib/contrib.hpp b/modules/contrib/include/opencv2/contrib/contrib.hpp index 75b4065e01..2f7a119082 100644 --- a/modules/contrib/include/opencv2/contrib/contrib.hpp +++ b/modules/contrib/include/opencv2/contrib/contrib.hpp @@ -557,15 +557,15 @@ namespace cv void* user_data; }; - CV_EXPORTS int chamerMatching( Mat& img, Mat& templ, - vector >& results, vector& cost, + CV_EXPORTS_W int chamerMatching( Mat& img, Mat& templ, + CV_OUT vector >& results, CV_OUT vector& cost, double templScale=1, int maxMatches = 20, double minMatchDistance = 1.0, int padX = 3, int padY = 3, int scales = 5, double minScale = 0.6, double maxScale = 1.6, double orientationWeight = 0.5, double truncate = 20); - class CV_EXPORTS StereoVar + class CV_EXPORTS_W StereoVar { public: // Flags @@ -918,26 +918,26 @@ namespace cv void lda(InputArray src, InputArray labels); }; - class CV_EXPORTS FaceRecognizer : public Algorithm + class CV_EXPORTS_W FaceRecognizer : public Algorithm { public: //! virtual destructor virtual ~FaceRecognizer() {} // Trains a FaceRecognizer. - virtual void train(InputArray src, InputArray labels) = 0; + CV_WRAP virtual void train(InputArray src, InputArray labels) = 0; // Gets a prediction from a FaceRecognizer. virtual int predict(InputArray src) const = 0; // Predicts the label and confidence for a given sample. - virtual void predict(InputArray src, int &label, double &dist) const = 0; + CV_WRAP virtual void predict(InputArray src, CV_OUT int &label, CV_OUT double &dist) const = 0; // Serializes this object to a given filename. - virtual void save(const string& filename) const; + CV_WRAP virtual void save(const string& filename) const; // Deserializes this object from a given filename. - virtual void load(const string& filename); + CV_WRAP virtual void load(const string& filename); // Serializes this object to a given cv::FileStorage. virtual void save(FileStorage& fs) const = 0; @@ -947,9 +947,9 @@ namespace cv }; - CV_EXPORTS Ptr createEigenFaceRecognizer(int num_components = 0, double threshold = DBL_MAX); - CV_EXPORTS Ptr createFisherFaceRecognizer(int num_components = 0, double threshold = DBL_MAX); - CV_EXPORTS Ptr createLBPHFaceRecognizer(int radius=1, int neighbors=8, + CV_EXPORTS_W Ptr createEigenFaceRecognizer(int num_components = 0, double threshold = DBL_MAX); + CV_EXPORTS_W Ptr createFisherFaceRecognizer(int num_components = 0, double threshold = DBL_MAX); + CV_EXPORTS_W Ptr createLBPHFaceRecognizer(int radius=1, int neighbors=8, int grid_x=8, int grid_y=8, double threshold = DBL_MAX); enum @@ -968,12 +968,11 @@ namespace cv COLORMAP_HOT = 11 }; - CV_EXPORTS void applyColorMap(InputArray src, OutputArray dst, int colormap); + CV_EXPORTS_W void applyColorMap(InputArray src, OutputArray dst, int colormap); - CV_EXPORTS bool initModule_contrib(); + CV_EXPORTS_W bool initModule_contrib(); } - #include "opencv2/contrib/retina.hpp" #endif diff --git a/modules/python/CMakeLists.txt b/modules/python/CMakeLists.txt index 81cf81df85..4636dfa95a 100644 --- a/modules/python/CMakeLists.txt +++ b/modules/python/CMakeLists.txt @@ -10,7 +10,7 @@ if(ANDROID OR IOS OR NOT PYTHONLIBS_FOUND OR NOT PYTHON_USE_NUMPY) endif() set(the_description "The python bindings") -ocv_add_module(python BINDINGS opencv_core opencv_flann opencv_imgproc opencv_video opencv_ml opencv_features2d opencv_highgui opencv_calib3d opencv_photo opencv_objdetect opencv_legacy OPTIONAL opencv_nonfree) +ocv_add_module(python BINDINGS opencv_core opencv_flann opencv_imgproc opencv_video opencv_ml opencv_features2d opencv_highgui opencv_calib3d opencv_photo opencv_objdetect opencv_contrib opencv_legacy OPTIONAL opencv_nonfree) add_definitions(-DPYTHON_USE_NUMPY=1) @@ -20,6 +20,8 @@ ocv_module_include_directories( "${CMAKE_CURRENT_SOURCE_DIR}/src2" ) + + set(opencv_hdrs "${OPENCV_MODULE_opencv_core_LOCATION}/include/opencv2/core/core.hpp" "${OPENCV_MODULE_opencv_flann_LOCATION}/include/opencv2/flann/miniflann.hpp" @@ -31,7 +33,8 @@ set(opencv_hdrs "${OPENCV_MODULE_opencv_ml_LOCATION}/include/opencv2/ml/ml.hpp" "${OPENCV_MODULE_opencv_features2d_LOCATION}/include/opencv2/features2d/features2d.hpp" "${OPENCV_MODULE_opencv_calib3d_LOCATION}/include/opencv2/calib3d/calib3d.hpp" - "${OPENCV_MODULE_opencv_objdetect_LOCATION}/include/opencv2/objdetect/objdetect.hpp") + "${OPENCV_MODULE_opencv_objdetect_LOCATION}/include/opencv2/objdetect/objdetect.hpp" + "${OPENCV_MODULE_opencv_contrib_LOCATION}/include/opencv2/contrib/contrib.hpp") if(HAVE_opencv_nonfree) list(APPEND opencv_hdrs "${OPENCV_MODULE_opencv_nonfree_LOCATION}/include/opencv2/nonfree/features2d.hpp" diff --git a/modules/python/src2/cv2.cpp b/modules/python/src2/cv2.cpp index 4924e9b982..204380a658 100644 --- a/modules/python/src2/cv2.cpp +++ b/modules/python/src2/cv2.cpp @@ -9,6 +9,7 @@ #include "numpy/ndarrayobject.h" #include "opencv2/core/core.hpp" +#include "opencv2/contrib/contrib.hpp" #include "opencv2/flann/miniflann.hpp" #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/calib3d/calib3d.hpp" @@ -116,6 +117,9 @@ typedef cvflann::flann_algorithm_t cvflann_flann_algorithm_t; typedef Ptr Ptr_flann_IndexParams; typedef Ptr Ptr_flann_SearchParams; +typedef Ptr Ptr_FaceRecognizer; +typedef vector vector_Scalar; + static PyObject* failmsgp(const char *fmt, ...) { char str[1000]; diff --git a/modules/python/src2/hdr_parser.py b/modules/python/src2/hdr_parser.py index 8bee6b5f64..a765612f53 100755 --- a/modules/python/src2/hdr_parser.py +++ b/modules/python/src2/hdr_parser.py @@ -11,6 +11,7 @@ opencv_hdr_list = [ "../../video/include/opencv2/video/tracking.hpp", "../../video/include/opencv2/video/background_segm.hpp", "../../objdetect/include/opencv2/objdetect/objdetect.hpp", +"../../contrib/include/opencv2/contrib/contrib.hpp", "../../highgui/include/opencv2/highgui/highgui.hpp" ]