diff --git a/modules/calib3d/include/opencv2/calib3d.hpp b/modules/calib3d/include/opencv2/calib3d.hpp index 62d7ccec68..4f405afc66 100644 --- a/modules/calib3d/include/opencv2/calib3d.hpp +++ b/modules/calib3d/include/opencv2/calib3d.hpp @@ -386,17 +386,19 @@ public: CV_WRAP virtual Rect getROI2() const = 0; CV_WRAP virtual void setROI2(Rect roi2) = 0; -}; -CV_EXPORTS_W Ptr createStereoBM(int numDisparities = 0, int blockSize = 21); + CV_WRAP static Ptr create(int numDisparities = 0, int blockSize = 21); +}; class CV_EXPORTS_W StereoSGBM : public StereoMatcher { public: - enum { MODE_SGBM = 0, - MODE_HH = 1 - }; + enum + { + MODE_SGBM = 0, + MODE_HH = 1 + }; CV_WRAP virtual int getPreFilterCap() const = 0; CV_WRAP virtual void setPreFilterCap(int preFilterCap) = 0; @@ -412,14 +414,13 @@ public: CV_WRAP virtual int getMode() const = 0; CV_WRAP virtual void setMode(int mode) = 0; -}; - -CV_EXPORTS_W Ptr createStereoSGBM(int minDisparity, int numDisparities, int blockSize, - int P1 = 0, int P2 = 0, int disp12MaxDiff = 0, - int preFilterCap = 0, int uniquenessRatio = 0, - int speckleWindowSize = 0, int speckleRange = 0, - int mode = StereoSGBM::MODE_SGBM); + CV_WRAP static Ptr create(int minDisparity, int numDisparities, int blockSize, + int P1 = 0, int P2 = 0, int disp12MaxDiff = 0, + int preFilterCap = 0, int uniquenessRatio = 0, + int speckleWindowSize = 0, int speckleRange = 0, + int mode = StereoSGBM::MODE_SGBM); +}; namespace fisheye { diff --git a/modules/calib3d/perf/opencl/perf_stereobm.cpp b/modules/calib3d/perf/opencl/perf_stereobm.cpp index 1436eb9d94..d941156f12 100644 --- a/modules/calib3d/perf/opencl/perf_stereobm.cpp +++ b/modules/calib3d/perf/opencl/perf_stereobm.cpp @@ -63,7 +63,7 @@ OCL_PERF_TEST_P(StereoBMFixture, StereoBM, ::testing::Combine(OCL_PERF_ENUM(32, declare.in(left, right); - Ptr bm = createStereoBM( n_disp, winSize ); + Ptr bm = StereoBM::create( n_disp, winSize ); bm->setPreFilterType(bm->PREFILTER_XSOBEL); bm->setTextureThreshold(0); diff --git a/modules/calib3d/src/calib3d_init.cpp b/modules/calib3d/src/calib3d_init.cpp deleted file mode 100644 index 6192c7998a..0000000000 --- a/modules/calib3d/src/calib3d_init.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#include "precomp.hpp" - -using namespace cv; - -////////////////////////////////////////////////////////////////////////////////////////////////////////// - - -////////////////////////////////////////////////////////////////////////////////////////////////////////// - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////// - -#if 0 -bool cv::initModule_calib3d(void) -{ - bool all = true; - all &= !RANSACPointSetRegistrator_info_auto.name().empty(); - all &= !LMeDSPointSetRegistrator_info_auto.name().empty(); - all &= !LMSolverImpl_info_auto.name().empty(); - - return all; -} -#endif diff --git a/modules/calib3d/src/compat_stereo.cpp b/modules/calib3d/src/compat_stereo.cpp index 16eefc6847..c00adeeb87 100644 --- a/modules/calib3d/src/compat_stereo.cpp +++ b/modules/calib3d/src/compat_stereo.cpp @@ -92,18 +92,18 @@ void cvFindStereoCorrespondenceBM( const CvArr* leftarr, const CvArr* rightarr, CV_Assert( state != 0 ); - cv::Ptr sm = cv::createStereoBM(state->numberOfDisparities, + cv::Ptr sm = cv::StereoBM::create(state->numberOfDisparities, state->SADWindowSize); - sm->set("preFilterType", state->preFilterType); - sm->set("preFilterSize", state->preFilterSize); - sm->set("preFilterCap", state->preFilterCap); - sm->set("SADWindowSize", state->SADWindowSize); - sm->set("numDisparities", state->numberOfDisparities > 0 ? state->numberOfDisparities : 64); - sm->set("textureThreshold", state->textureThreshold); - sm->set("uniquenessRatio", state->uniquenessRatio); - sm->set("speckleRange", state->speckleRange); - sm->set("speckleWindowSize", state->speckleWindowSize); - sm->set("disp12MaxDiff", state->disp12MaxDiff); + sm->setPreFilterType(state->preFilterType); + sm->setPreFilterSize(state->preFilterSize); + sm->setPreFilterCap(state->preFilterCap); + sm->setBlockSize(state->SADWindowSize); + sm->setNumDisparities(state->numberOfDisparities > 0 ? state->numberOfDisparities : 64); + sm->setTextureThreshold(state->textureThreshold); + sm->setUniquenessRatio(state->uniquenessRatio); + sm->setSpeckleRange(state->speckleRange); + sm->setSpeckleWindowSize(state->speckleWindowSize); + sm->setDisp12MaxDiff(state->disp12MaxDiff); sm->compute(left, right, disp); } diff --git a/modules/calib3d/src/stereobm.cpp b/modules/calib3d/src/stereobm.cpp index 9e9341b569..d5495a7636 100644 --- a/modules/calib3d/src/stereobm.cpp +++ b/modules/calib3d/src/stereobm.cpp @@ -1098,11 +1098,11 @@ public: const char* StereoBMImpl::name_ = "StereoMatcher.BM"; -} - -cv::Ptr cv::createStereoBM(int _numDisparities, int _SADWindowSize) +Ptr StereoBM::create(int _numDisparities, int _SADWindowSize) { return makePtr(_numDisparities, _SADWindowSize); } +} + /* End of file. */ diff --git a/modules/calib3d/src/stereosgbm.cpp b/modules/calib3d/src/stereosgbm.cpp index 2b34ab5232..1793ee0945 100644 --- a/modules/calib3d/src/stereosgbm.cpp +++ b/modules/calib3d/src/stereosgbm.cpp @@ -941,7 +941,7 @@ public: const char* StereoSGBMImpl::name_ = "StereoMatcher.SGBM"; -Ptr createStereoSGBM(int minDisparity, int numDisparities, int SADWindowSize, +Ptr StereoSGBM::create(int minDisparity, int numDisparities, int SADWindowSize, int P1, int P2, int disp12MaxDiff, int preFilterCap, int uniquenessRatio, int speckleWindowSize, int speckleRange, diff --git a/modules/calib3d/test/opencl/test_stereobm.cpp b/modules/calib3d/test/opencl/test_stereobm.cpp index e64fe415e7..c7b004d8e2 100644 --- a/modules/calib3d/test/opencl/test_stereobm.cpp +++ b/modules/calib3d/test/opencl/test_stereobm.cpp @@ -79,7 +79,7 @@ PARAM_TEST_CASE(StereoBMFixture, int, int) OCL_TEST_P(StereoBMFixture, StereoBM) { - Ptr bm = createStereoBM( n_disp, winSize); + Ptr bm = StereoBM::create( n_disp, winSize); bm->setPreFilterType(bm->PREFILTER_XSOBEL); bm->setTextureThreshold(0); diff --git a/modules/calib3d/test/test_stereomatching.cpp b/modules/calib3d/test/test_stereomatching.cpp index 8c377de0c1..41290a1c3c 100644 --- a/modules/calib3d/test/test_stereomatching.cpp +++ b/modules/calib3d/test/test_stereomatching.cpp @@ -717,7 +717,7 @@ protected: Mat leftImg; cvtColor( _leftImg, leftImg, COLOR_BGR2GRAY ); Mat rightImg; cvtColor( _rightImg, rightImg, COLOR_BGR2GRAY ); - Ptr bm = createStereoBM( params.ndisp, params.winSize ); + Ptr bm = StereoBM::create( params.ndisp, params.winSize ); Mat tempDisp; bm->compute( leftImg, rightImg, tempDisp ); tempDisp.convertTo(leftDisp, CV_32F, 1./StereoMatcher::DISP_SCALE); @@ -770,7 +770,7 @@ protected: { RunParams params = caseRunParams[caseIdx]; assert( params.ndisp%16 == 0 ); - Ptr sgbm = createStereoSGBM( 0, params.ndisp, params.winSize, + Ptr sgbm = StereoSGBM::create( 0, params.ndisp, params.winSize, 10*params.winSize*params.winSize, 40*params.winSize*params.winSize, 1, 63, 10, 100, 32, params.fullDP ? diff --git a/modules/core/include/opencv2/core.hpp b/modules/core/include/opencv2/core.hpp index 2fba9fc6bb..a258e8c4d2 100644 --- a/modules/core/include/opencv2/core.hpp +++ b/modules/core/include/opencv2/core.hpp @@ -874,9 +874,6 @@ public: virtual ~Algorithm(); String name() const; - virtual void set(int, double); - virtual double get(int) const; - template typename ParamType<_Tp>::member_type get(const String& name) const; template typename ParamType<_Tp>::member_type get(const char* name) const; diff --git a/modules/core/src/algorithm.cpp b/modules/core/src/algorithm.cpp index bd28bdcdc3..9f9493e8a0 100644 --- a/modules/core/src/algorithm.cpp +++ b/modules/core/src/algorithm.cpp @@ -179,9 +179,6 @@ String Algorithm::name() const return info()->name(); } -void Algorithm::set(int, double) {} -double Algorithm::get(int) const { return 0.; } - void Algorithm::set(const String& parameter, int value) { info()->set(this, parameter.c_str(), ParamType::type, &value); diff --git a/modules/features2d/include/opencv2/features2d.hpp b/modules/features2d/include/opencv2/features2d.hpp index 193d5b93eb..a60a93bddf 100644 --- a/modules/features2d/include/opencv2/features2d.hpp +++ b/modules/features2d/include/opencv2/features2d.hpp @@ -163,17 +163,37 @@ public: class CV_EXPORTS_W ORB : public Feature2D { public: - // the size of the signature in bytes - enum - { - kBytes = 32, HARRIS_SCORE=0, FAST_SCORE=1, - NFEATURES=10000, SCALE_FACTOR=10001, NLEVELS=10002, - EDGE_THRESHOLD=10003, FIRST_LEVEL=10004, WTA_K=10005, - SCORE_TYPE=10006, PATCH_SIZE=10007, FAST_THRESHOLD=10008 - }; + enum { kBytes = 32, HARRIS_SCORE=0, FAST_SCORE=1 }; + + CV_WRAP static Ptr create(int nfeatures=500, float scaleFactor=1.2f, int nlevels=8, int edgeThreshold=31, + int firstLevel=0, int WTA_K=2, int scoreType=ORB::HARRIS_SCORE, int patchSize=31, int fastThreshold=20); + + CV_WRAP virtual void setMaxFeatures(int maxFeatures) = 0; + CV_WRAP virtual int getMaxFeatures() const = 0; + + CV_WRAP virtual void setScaleFactor(double scaleFactor) = 0; + CV_WRAP virtual double getScaleFactor() const = 0; + + CV_WRAP virtual void setNLevels(int nlevels) = 0; + CV_WRAP virtual int getNLevels() const = 0; + + CV_WRAP virtual void setEdgeThreshold(int edgeThreshold) = 0; + CV_WRAP virtual int getEdgeThreshold() const = 0; + + CV_WRAP virtual void setFirstLevel(int firstLevel) = 0; + CV_WRAP virtual int getFirstLevel() const = 0; + + CV_WRAP virtual void setWTA_K(int wta_k) = 0; + CV_WRAP virtual int getWTA_K() const = 0; + + CV_WRAP virtual void setScoreType(int scoreType) = 0; + CV_WRAP virtual int getScoreType() const = 0; - CV_WRAP static Ptr create(int nfeatures = 500, float scaleFactor = 1.2f, int nlevels = 8, int edgeThreshold = 31, - int firstLevel = 0, int WTA_K=2, int scoreType=ORB::HARRIS_SCORE, int patchSize=31, int fastThreshold = 20); + CV_WRAP virtual void setPatchSize(int patchSize) = 0; + CV_WRAP virtual int getPatchSize() const = 0; + + CV_WRAP virtual void setFastThreshold(int fastThreshold) = 0; + CV_WRAP virtual int getFastThreshold() const = 0; }; /*! @@ -188,13 +208,6 @@ public: class CV_EXPORTS_W MSER : public Feature2D { public: - enum - { - DELTA=10000, MIN_AREA=10001, MAX_AREA=10002, PASS2_ONLY=10003, - MAX_EVOLUTION=10004, AREA_THRESHOLD=10005, - MIN_MARGIN=10006, EDGE_BLUR_SIZE=10007 - }; - //! the full constructor CV_WRAP static Ptr create( int _delta=5, int _min_area=60, int _max_area=14400, double _max_variation=0.25, double _min_diversity=.2, @@ -204,6 +217,18 @@ public: CV_WRAP virtual void detectRegions( InputArray image, std::vector >& msers, std::vector& bboxes ) = 0; + + CV_WRAP virtual void setDelta(int delta) = 0; + CV_WRAP virtual int getDelta() const = 0; + + CV_WRAP virtual void setMinArea(int minArea) = 0; + CV_WRAP virtual int getMinArea() const = 0; + + CV_WRAP virtual void setMaxArea(int maxArea) = 0; + CV_WRAP virtual int getMaxArea() const = 0; + + CV_WRAP virtual void setPass2Only(bool f) = 0; + CV_WRAP virtual bool getPass2Only() const = 0; }; //! detects corners using FAST algorithm by E. Rosten @@ -225,15 +250,40 @@ public: CV_WRAP static Ptr create( int threshold=10, bool nonmaxSuppression=true, int type=FastFeatureDetector::TYPE_9_16 ); + + CV_WRAP virtual void setThreshold(int threshold) = 0; + CV_WRAP virtual int getThreshold() const = 0; + + CV_WRAP virtual void setNonmaxSuppression(bool f) = 0; + CV_WRAP virtual bool getNonmaxSuppression() const = 0; + + CV_WRAP virtual void setType(int type) = 0; + CV_WRAP virtual int getType() const = 0; }; class CV_EXPORTS_W GFTTDetector : public Feature2D { public: - enum { USE_HARRIS_DETECTOR=10000 }; CV_WRAP static Ptr create( int maxCorners=1000, double qualityLevel=0.01, double minDistance=1, int blockSize=3, bool useHarrisDetector=false, double k=0.04 ); + CV_WRAP virtual void setMaxFeatures(int maxFeatures) = 0; + CV_WRAP virtual int getMaxFeatures() const = 0; + + CV_WRAP virtual void setQualityLevel(double qlevel) = 0; + CV_WRAP virtual double getQualityLevel() const = 0; + + CV_WRAP virtual void setMinDistance(double minDistance) = 0; + CV_WRAP virtual double getMinDistance() const = 0; + + CV_WRAP virtual void setBlockSize(int blockSize) = 0; + CV_WRAP virtual int getBlockSize() const = 0; + + CV_WRAP virtual void setHarrisDetector(bool val) = 0; + CV_WRAP virtual bool getHarrisDetector() const = 0; + + CV_WRAP virtual void setK(double k) = 0; + CV_WRAP virtual double getK() const = 0; }; @@ -289,8 +339,26 @@ public: CV_WRAP static Ptr create(bool extended=false, bool upright=false, float threshold = 0.001f, - int octaves = 4, int sublevels = 4, + int nOctaves = 4, int nOctaveLayers = 4, int diffusivity = KAZE::DIFF_PM_G2); + + CV_WRAP virtual void setExtended(bool extended) = 0; + CV_WRAP virtual bool getExtended() const = 0; + + CV_WRAP virtual void setUpright(bool upright) = 0; + CV_WRAP virtual bool getUpright() const = 0; + + CV_WRAP virtual void setThreshold(double threshold) = 0; + CV_WRAP virtual double getThreshold() const = 0; + + CV_WRAP virtual void setNOctaves(int octaves) = 0; + CV_WRAP virtual int getNOctaves() const = 0; + + CV_WRAP virtual void setNOctaveLayers(int octaveLayers) = 0; + CV_WRAP virtual int getNOctaveLayers() const = 0; + + CV_WRAP virtual void setDiffusivity(int diff) = 0; + CV_WRAP virtual int getDiffusivity() const = 0; }; /*! @@ -310,8 +378,29 @@ public: CV_WRAP static Ptr create(int descriptor_type=AKAZE::DESCRIPTOR_MLDB, int descriptor_size = 0, int descriptor_channels = 3, - float threshold = 0.001f, int octaves = 4, - int sublevels = 4, int diffusivity = KAZE::DIFF_PM_G2); + float threshold = 0.001f, int nOctaves = 4, + int nOctaveLayers = 4, int diffusivity = KAZE::DIFF_PM_G2); + + CV_WRAP virtual void setDescriptorType(int dtype) = 0; + CV_WRAP virtual int getDescriptorType() const = 0; + + CV_WRAP virtual void setDescriptorSize(int dsize) = 0; + CV_WRAP virtual int getDescriptorSize() const = 0; + + CV_WRAP virtual void setDescriptorChannels(int dch) = 0; + CV_WRAP virtual int getDescriptorChannels() const = 0; + + CV_WRAP virtual void setThreshold(double threshold) = 0; + CV_WRAP virtual double getThreshold() const = 0; + + CV_WRAP virtual void setNOctaves(int octaves) = 0; + CV_WRAP virtual int getNOctaves() const = 0; + + CV_WRAP virtual void setNOctaveLayers(int octaveLayers) = 0; + CV_WRAP virtual int getNOctaveLayers() const = 0; + + CV_WRAP virtual void setDiffusivity(int diff) = 0; + CV_WRAP virtual int getDiffusivity() const = 0; }; /****************************************************************************************\ diff --git a/modules/features2d/src/akaze.cpp b/modules/features2d/src/akaze.cpp index 290031d282..4037d1c5c3 100644 --- a/modules/features2d/src/akaze.cpp +++ b/modules/features2d/src/akaze.cpp @@ -77,6 +77,27 @@ namespace cv } + void setDescriptorType(int dtype) { descriptor = dtype; } + int getDescriptorType() const { return descriptor; } + + void setDescriptorSize(int dsize) { descriptor_size = dsize; } + int getDescriptorSize() const { return descriptor_size; } + + void setDescriptorChannels(int dch) { descriptor_channels = dch; } + int getDescriptorChannels() const { return descriptor_channels; } + + void setThreshold(double threshold_) { threshold = (float)threshold_; } + double getThreshold() const { return threshold; } + + void setNOctaves(int octaves_) { octaves = octaves_; } + int getNOctaves() const { return octaves; } + + void setNOctaveLayers(int octaveLayers_) { sublevels = octaveLayers_; } + int getNOctaveLayers() const { return sublevels; } + + void setDiffusivity(int diff_) { diffusivity = diff_; } + int getDiffusivity() const { return diffusivity; } + // returns the descriptor size in bytes int descriptorSize() const { diff --git a/modules/features2d/src/brisk.cpp b/modules/features2d/src/brisk.cpp index 0a14148cf3..c24d727911 100644 --- a/modules/features2d/src/brisk.cpp +++ b/modules/features2d/src/brisk.cpp @@ -2099,7 +2099,7 @@ BriskLayer::BriskLayer(const BriskLayer& layer, int mode) void BriskLayer::getAgastPoints(int threshold, std::vector& keypoints) { - fast_9_16_->set(FastFeatureDetector::THRESHOLD, threshold); + fast_9_16_->setThreshold(threshold); fast_9_16_->detect(img_, keypoints); // also write scores diff --git a/modules/features2d/src/fast.cpp b/modules/features2d/src/fast.cpp index f3a44876af..767b74aff6 100644 --- a/modules/features2d/src/fast.cpp +++ b/modules/features2d/src/fast.cpp @@ -407,6 +407,15 @@ public: return 0; } + void setThreshold(int threshold_) { threshold = threshold_; } + int getThreshold() const { return threshold; } + + void setNonmaxSuppression(bool f) { nonmaxSuppression = f; } + bool getNonmaxSuppression() const { return nonmaxSuppression; } + + void setType(int type_) { type = type_; } + int getType() const { return type; } + int threshold; bool nonmaxSuppression; int type; diff --git a/modules/features2d/src/gftt.cpp b/modules/features2d/src/gftt.cpp index 9cfc77d83e..17e26928c0 100644 --- a/modules/features2d/src/gftt.cpp +++ b/modules/features2d/src/gftt.cpp @@ -55,23 +55,23 @@ public: { } - void set(int prop, double value) - { - if( prop == USE_HARRIS_DETECTOR ) - useHarrisDetector = value != 0; - else - CV_Error(Error::StsBadArg, ""); - } + void setMaxFeatures(int maxFeatures) { nfeatures = maxFeatures; } + int getMaxFeatures() const { return nfeatures; } - double get(int prop) const - { - double value = 0; - if( prop == USE_HARRIS_DETECTOR ) - value = useHarrisDetector; - else - CV_Error(Error::StsBadArg, ""); - return value; - } + void setQualityLevel(double qlevel) { qualityLevel = qlevel; } + double getQualityLevel() const { return qualityLevel; } + + void setMinDistance(double minDistance_) { minDistance = minDistance_; } + double getMinDistance() const { return minDistance; } + + void setBlockSize(int blockSize_) { blockSize = blockSize_; } + int getBlockSize() const { return blockSize; } + + void setHarrisDetector(bool val) { useHarrisDetector = val; } + bool getHarrisDetector() const { return useHarrisDetector; } + + void setK(double k_) { k = k_; } + double getK() const { return k; } void detect( InputArray _image, std::vector& keypoints, InputArray _mask ) { diff --git a/modules/features2d/src/kaze.cpp b/modules/features2d/src/kaze.cpp index 229bb0f08f..327b46ae26 100644 --- a/modules/features2d/src/kaze.cpp +++ b/modules/features2d/src/kaze.cpp @@ -69,6 +69,24 @@ namespace cv virtual ~KAZE_Impl() {} + void setExtended(bool extended_) { extended = extended_; } + bool getExtended() const { return extended; } + + void setUpright(bool upright_) { upright = upright_; } + bool getUpright() const { return upright; } + + void setThreshold(double threshold_) { threshold = (float)threshold_; } + double getThreshold() const { return threshold; } + + void setNOctaves(int octaves_) { octaves = octaves_; } + int getNOctaves() const { return octaves; } + + void setNOctaveLayers(int octaveLayers_) { sublevels = octaveLayers_; } + int getNOctaveLayers() const { return sublevels; } + + void setDiffusivity(int diff_) { diffusivity = diff_; } + int getDiffusivity() const { return diffusivity; } + // returns the descriptor size in bytes int descriptorSize() const { diff --git a/modules/features2d/src/mser.cpp b/modules/features2d/src/mser.cpp index d5058d9557..f5c08d1a16 100644 --- a/modules/features2d/src/mser.cpp +++ b/modules/features2d/src/mser.cpp @@ -86,35 +86,17 @@ public: virtual ~MSER_Impl() {} - void set(int propId, double value) - { - if( propId == DELTA ) - params.delta = cvRound(value); - else if( propId == MIN_AREA ) - params.minArea = cvRound(value); - else if( propId == MAX_AREA ) - params.maxArea = cvRound(value); - else if( propId == PASS2_ONLY ) - params.pass2Only = value != 0; - else - CV_Error(CV_StsBadArg, "Unknown parameter id"); - } + void setDelta(int delta) { params.delta = delta; } + int getDelta() const { return params.delta; } - double get(int propId) const - { - double value = 0; - if( propId == DELTA ) - value = params.delta; - else if( propId == MIN_AREA ) - value = params.minArea; - else if( propId == MAX_AREA ) - value = params.maxArea; - else if( propId == PASS2_ONLY ) - value = params.pass2Only; - else - CV_Error(CV_StsBadArg, "Unknown parameter id"); - return value; - } + void setMinArea(int minArea) { params.minArea = minArea; } + int getMinArea() const { return params.minArea; } + + void setMaxArea(int maxArea) { params.maxArea = maxArea; } + int getMaxArea() const { return params.maxArea; } + + void setPass2Only(bool f) { params.pass2Only = f; } + bool getPass2Only() const { return params.pass2Only; } enum { DIR_SHIFT = 29, NEXT_MASK = ((1<get_data_path()) + FEATURES2D_DIR + "/keypoints.xml.gz", FileStorage::WRITE ); if( fs.isOpened() ) { - ORB fd; - fd.detect(img, keypoints); + Ptr fd = ORB::create(); + fd->detect(img, keypoints); write( fs, "keypoints", keypoints ); } else diff --git a/modules/features2d/test/test_detectors_regression.cpp b/modules/features2d/test/test_detectors_regression.cpp index d06418cfe0..e2d9f478db 100644 --- a/modules/features2d/test/test_detectors_regression.cpp +++ b/modules/features2d/test/test_detectors_regression.cpp @@ -267,8 +267,8 @@ TEST( Features2d_Detector_GFTT, regression ) TEST( Features2d_Detector_Harris, regression ) { - Ptr gftt = GFTTDetector::create(); - gftt->set(GFTTDetector::USE_HARRIS_DETECTOR, 1); + Ptr gftt = GFTTDetector::create(); + gftt->setHarrisDetector(true); CV_FeatureDetectorTest test( "detector-harris", gftt); test.safe_run(); } diff --git a/modules/features2d/test/test_keypoints.cpp b/modules/features2d/test/test_keypoints.cpp index 7ede454038..e9dafe3474 100644 --- a/modules/features2d/test/test_keypoints.cpp +++ b/modules/features2d/test/test_keypoints.cpp @@ -140,8 +140,8 @@ TEST(Features2d_Detector_Keypoints_HARRIS, validation) TEST(Features2d_Detector_Keypoints_GFTT, validation) { - Ptr gftt = GFTTDetector::create(); - gftt->set(GFTTDetector::USE_HARRIS_DETECTOR, 1); + Ptr gftt = GFTTDetector::create(); + gftt->setHarrisDetector(true); CV_FeatureDetectorKeypointsTest test(gftt); test.safe_run(); } diff --git a/modules/java/generator/src/cpp/features2d_manual.hpp b/modules/java/generator/src/cpp/features2d_manual.hpp index 346180fe29..29e0320767 100644 --- a/modules/java/generator/src/cpp/features2d_manual.hpp +++ b/modules/java/generator/src/cpp/features2d_manual.hpp @@ -132,8 +132,11 @@ public: fd = GFTTDetector::create(); break; case HARRIS: - fd = GFTTDetector::create(); - fd->set(GFTTDetector::USE_HARRIS_DETECTOR, 1); + { + Ptr gftt = GFTTDetector::create(); + gftt->setHarrisDetector(true); + fd = gftt; + } break; case SIMPLEBLOB: fd = SimpleBlobDetector::create(); diff --git a/modules/java/generator/src/cpp/jni_part.cpp b/modules/java/generator/src/cpp/jni_part.cpp index e9776cee15..3e6f895c0e 100644 --- a/modules/java/generator/src/cpp/jni_part.cpp +++ b/modules/java/generator/src/cpp/jni_part.cpp @@ -23,14 +23,6 @@ JNI_OnLoad(JavaVM* vm, void* ) if (vm->GetEnv((void**) &env, JNI_VERSION_1_6) != JNI_OK) return -1; - bool init = true; -#ifdef HAVE_OPENCV_VIDEO - init &= cv::initModule_video(); -#endif - - if(!init) - return -1; - /* get class with (*env)->FindClass */ /* register methods with (*env)->RegisterNatives */ diff --git a/modules/ml/src/svm.cpp b/modules/ml/src/svm.cpp index 49e5c0200a..c7c32f0be5 100644 --- a/modules/ml/src/svm.cpp +++ b/modules/ml/src/svm.cpp @@ -1728,6 +1728,9 @@ public: FOR_IN_GRID(coef0, coef_grid) FOR_IN_GRID(degree, degree_grid) { + // make sure we updated the kernel and other parameters + setParams(params, Ptr() ); + double error = 0; for( k = 0; k < k_fold; k++ ) { diff --git a/modules/stitching/src/matchers.cpp b/modules/stitching/src/matchers.cpp index 94b7883959..5922f1ba19 100644 --- a/modules/stitching/src/matchers.cpp +++ b/modules/stitching/src/matchers.cpp @@ -323,27 +323,31 @@ SurfFeaturesFinder::SurfFeaturesFinder(double hess_thresh, int num_octaves, int #ifdef HAVE_OPENCV_XFEATURES2D if (num_octaves_descr == num_octaves && num_layers_descr == num_layers) { - surf = SURF::create(); - if( !surf ) + Ptr surf_ = SURF::create(); + if( !surf_ ) CV_Error( Error::StsNotImplemented, "OpenCV was built without SURF support" ); - surf->set(SURF::HESSIAN_THRESHOLD, hess_thresh); - surf->set(SURF::NOCTAVES, num_octaves); - surf->set(SURF::NOCTAVE_LAYERS, num_layers); + surf_->setHessianThreshold(hess_thresh); + surf_->setNOctaves(num_octaves); + surf_->setNOctaveLayers(num_layers); + surf = surf_; } else { - detector_ = SURF::create(); - extractor_ = SURF::create(); + Ptr sdetector_ = SURF::create(); + Ptr sextractor_ = SURF::create(); - if( !detector_ || !extractor_ ) + if( !sdetector_ || !sextractor_ ) CV_Error( Error::StsNotImplemented, "OpenCV was built without SURF support" ); - detector_->set(SURF::HESSIAN_THRESHOLD, hess_thresh); - detector_->set(SURF::NOCTAVES, num_octaves); - detector_->set(SURF::NOCTAVE_LAYERS, num_layers); + sdetector_->setHessianThreshold(hess_thresh); + sdetector_->setNOctaves(num_octaves); + sdetector_->setNOctaveLayers(num_layers); - extractor_->set(SURF::NOCTAVES, num_octaves_descr); - extractor_->set(SURF::NOCTAVE_LAYERS, num_layers_descr); + sextractor_->setNOctaves(num_octaves_descr); + sextractor_->setNOctaveLayers(num_layers_descr); + + detector_ = sdetector_; + extractor_ = sextractor_; } #else CV_Error( Error::StsNotImplemented, "OpenCV was built without SURF support" ); diff --git a/modules/video/include/opencv2/video.hpp b/modules/video/include/opencv2/video.hpp index b429ceff98..70c17e67d9 100644 --- a/modules/video/include/opencv2/video.hpp +++ b/modules/video/include/opencv2/video.hpp @@ -47,9 +47,4 @@ #include "opencv2/video/tracking.hpp" #include "opencv2/video/background_segm.hpp" -namespace cv -{ -CV_EXPORTS bool initModule_video(void); -} - #endif //__OPENCV_VIDEO_HPP__ diff --git a/modules/video/src/video_init.cpp b/modules/video/src/video_init.cpp deleted file mode 100644 index 118d28a42e..0000000000 --- a/modules/video/src/video_init.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#include "precomp.hpp" -#include "opencv2/video.hpp" - -namespace cv -{ - -bool initModule_video(void) -{ - return true; -} - -} diff --git a/modules/world/src/world_init.cpp b/modules/world/src/world_init.cpp index af2a6d9318..a20823127c 100644 --- a/modules/world/src/world_init.cpp +++ b/modules/world/src/world_init.cpp @@ -44,9 +44,5 @@ bool cv::initAll() { - return true -#ifdef HAVE_OPENCV_VIDEO - && initModule_video() -#endif - ; + return true; } diff --git a/samples/cpp/stereo_match.cpp b/samples/cpp/stereo_match.cpp index aaeea6d810..f5f77cf3dc 100644 --- a/samples/cpp/stereo_match.cpp +++ b/samples/cpp/stereo_match.cpp @@ -67,8 +67,8 @@ int main(int argc, char** argv) bool no_display = false; float scale = 1.f; - Ptr bm = createStereoBM(16,9); - Ptr sgbm = createStereoSGBM(0,16,3); + Ptr bm = StereoBM::create(16,9); + Ptr sgbm = StereoSGBM::create(0,16,3); for( int i = 1; i < argc; i++ ) { diff --git a/samples/cpp/tutorial_code/calib3d/stereoBM/SBM_Sample.cpp b/samples/cpp/tutorial_code/calib3d/stereoBM/SBM_Sample.cpp index 17560d234b..90fa2801be 100644 --- a/samples/cpp/tutorial_code/calib3d/stereoBM/SBM_Sample.cpp +++ b/samples/cpp/tutorial_code/calib3d/stereoBM/SBM_Sample.cpp @@ -40,7 +40,7 @@ int main( int argc, char** argv ) int ndisparities = 16*5; /**< Range of disparity */ int SADWindowSize = 21; /**< Size of the block window. Must be odd */ - Ptr sbm = createStereoBM( ndisparities, SADWindowSize ); + Ptr sbm = StereoBM::create( ndisparities, SADWindowSize ); //-- 3. Calculate the disparity image sbm->compute( imgLeft, imgRight, imgDisparity16S ); diff --git a/samples/cpp/tutorial_code/features2D/AKAZE_tracking/planar_tracking.cpp b/samples/cpp/tutorial_code/features2D/AKAZE_tracking/planar_tracking.cpp index 0c8cfdc3da..6ffc77cdc4 100755 --- a/samples/cpp/tutorial_code/features2D/AKAZE_tracking/planar_tracking.cpp +++ b/samples/cpp/tutorial_code/features2D/AKAZE_tracking/planar_tracking.cpp @@ -135,18 +135,19 @@ int main(int argc, char **argv) return 1; } fs["bounding_box"] >> bb; - Ptr akaze = AKAZE::create(); + + Stats stats, akaze_stats, orb_stats; + Ptr akaze = AKAZE::create(); akaze->set("threshold", akaze_thresh); - Ptr orb = ORB::create(); + Ptr orb = ORB::create(); + orb->setMaxFeatures(stats.keypoints); Ptr matcher = DescriptorMatcher::create("BruteForce-Hamming"); Tracker akaze_tracker(akaze, matcher); Tracker orb_tracker(orb, matcher); - Stats stats, akaze_stats, orb_stats; Mat frame; video_in >> frame; akaze_tracker.setFirstFrame(frame, bb, "AKAZE", stats); - orb_tracker.getDetector()->set("nFeatures", stats.keypoints); orb_tracker.setFirstFrame(frame, bb, "ORB", stats); Stats akaze_draw_stats, orb_draw_stats;