提交 d2b9dc55 编写于 作者: V Vadim Pisarevsky

quickly corrected the previous refactoring of features2d: moved from...

quickly corrected the previous refactoring of features2d: moved from set(SOME_PROP, val) to setSomeProp(val)
上级 22ff1e88
......@@ -386,17 +386,19 @@ public:
CV_WRAP virtual Rect getROI2() const = 0;
CV_WRAP virtual void setROI2(Rect roi2) = 0;
};
CV_EXPORTS_W Ptr<StereoBM> createStereoBM(int numDisparities = 0, int blockSize = 21);
CV_WRAP static Ptr<StereoBM> 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<StereoSGBM> 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<StereoSGBM> 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
{
......
......@@ -63,7 +63,7 @@ OCL_PERF_TEST_P(StereoBMFixture, StereoBM, ::testing::Combine(OCL_PERF_ENUM(32,
declare.in(left, right);
Ptr<StereoBM> bm = createStereoBM( n_disp, winSize );
Ptr<StereoBM> bm = StereoBM::create( n_disp, winSize );
bm->setPreFilterType(bm->PREFILTER_XSOBEL);
bm->setTextureThreshold(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
......@@ -92,18 +92,18 @@ void cvFindStereoCorrespondenceBM( const CvArr* leftarr, const CvArr* rightarr,
CV_Assert( state != 0 );
cv::Ptr<cv::StereoMatcher> sm = cv::createStereoBM(state->numberOfDisparities,
cv::Ptr<cv::StereoBM> 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);
}
......
......@@ -1098,11 +1098,11 @@ public:
const char* StereoBMImpl::name_ = "StereoMatcher.BM";
}
cv::Ptr<cv::StereoBM> cv::createStereoBM(int _numDisparities, int _SADWindowSize)
Ptr<StereoBM> StereoBM::create(int _numDisparities, int _SADWindowSize)
{
return makePtr<StereoBMImpl>(_numDisparities, _SADWindowSize);
}
}
/* End of file. */
......@@ -941,7 +941,7 @@ public:
const char* StereoSGBMImpl::name_ = "StereoMatcher.SGBM";
Ptr<StereoSGBM> createStereoSGBM(int minDisparity, int numDisparities, int SADWindowSize,
Ptr<StereoSGBM> StereoSGBM::create(int minDisparity, int numDisparities, int SADWindowSize,
int P1, int P2, int disp12MaxDiff,
int preFilterCap, int uniquenessRatio,
int speckleWindowSize, int speckleRange,
......
......@@ -79,7 +79,7 @@ PARAM_TEST_CASE(StereoBMFixture, int, int)
OCL_TEST_P(StereoBMFixture, StereoBM)
{
Ptr<StereoBM> bm = createStereoBM( n_disp, winSize);
Ptr<StereoBM> bm = StereoBM::create( n_disp, winSize);
bm->setPreFilterType(bm->PREFILTER_XSOBEL);
bm->setTextureThreshold(0);
......
......@@ -717,7 +717,7 @@ protected:
Mat leftImg; cvtColor( _leftImg, leftImg, COLOR_BGR2GRAY );
Mat rightImg; cvtColor( _rightImg, rightImg, COLOR_BGR2GRAY );
Ptr<StereoBM> bm = createStereoBM( params.ndisp, params.winSize );
Ptr<StereoBM> 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<StereoSGBM> sgbm = createStereoSGBM( 0, params.ndisp, params.winSize,
Ptr<StereoSGBM> 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 ?
......
......@@ -874,9 +874,6 @@ public:
virtual ~Algorithm();
String name() const;
virtual void set(int, double);
virtual double get(int) const;
template<typename _Tp> typename ParamType<_Tp>::member_type get(const String& name) const;
template<typename _Tp> typename ParamType<_Tp>::member_type get(const char* name) const;
......
......@@ -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<int>::type, &value);
......
......@@ -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<ORB> 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<ORB> 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<MSER> 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<std::vector<Point> >& msers,
std::vector<Rect>& 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<FastFeatureDetector> 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<GFTTDetector> 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<KAZE> 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<AKAZE> 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;
};
/****************************************************************************************\
......
......@@ -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 = 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
{
......
......@@ -2099,7 +2099,7 @@ BriskLayer::BriskLayer(const BriskLayer& layer, int mode)
void
BriskLayer::getAgastPoints(int threshold, std::vector<KeyPoint>& keypoints)
{
fast_9_16_->set(FastFeatureDetector::THRESHOLD, threshold);
fast_9_16_->setThreshold(threshold);
fast_9_16_->detect(img_, keypoints);
// also write scores
......
......@@ -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;
......
......@@ -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<KeyPoint>& keypoints, InputArray _mask )
{
......
......@@ -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 = 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
{
......
......@@ -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<<DIR_SHIFT)-1) };
......
......@@ -660,55 +660,32 @@ public:
scoreType(_scoreType), patchSize(_patchSize), fastThreshold(_fastThreshold)
{}
void set(int prop, double value)
{
if( prop == NFEATURES )
nfeatures = cvRound(value);
else if( prop == SCALE_FACTOR )
scaleFactor = value;
else if( prop == NLEVELS )
nlevels = cvRound(value);
else if( prop == EDGE_THRESHOLD )
edgeThreshold = cvRound(value);
else if( prop == FIRST_LEVEL )
firstLevel = cvRound(value);
else if( prop == WTA_K )
wta_k = cvRound(value);
else if( prop == SCORE_TYPE )
scoreType = cvRound(value);
else if( prop == PATCH_SIZE )
patchSize = cvRound(value);
else if( prop == FAST_THRESHOLD )
fastThreshold = cvRound(value);
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 == NFEATURES )
value = nfeatures;
else if( prop == SCALE_FACTOR )
value = scaleFactor;
else if( prop == NLEVELS )
value = nlevels;
else if( prop == EDGE_THRESHOLD )
value = edgeThreshold;
else if( prop == FIRST_LEVEL )
value = firstLevel;
else if( prop == WTA_K )
value = wta_k;
else if( prop == SCORE_TYPE )
value = scoreType;
else if( prop == PATCH_SIZE )
value = patchSize;
else if( prop == FAST_THRESHOLD )
value = fastThreshold;
else
CV_Error(Error::StsBadArg, "");
return value;
}
void setScaleFactor(double scaleFactor_) { scaleFactor = scaleFactor_; }
double getScaleFactor() const { return scaleFactor; }
void setNLevels(int nlevels_) { nlevels = nlevels_; }
int getNLevels() const { return nlevels; }
void setEdgeThreshold(int edgeThreshold_) { edgeThreshold = edgeThreshold_; }
int getEdgeThreshold() const { return edgeThreshold; }
void setFirstLevel(int firstLevel_) { firstLevel = firstLevel_; }
int getFirstLevel() const { return firstLevel; }
void setWTA_K(int wta_k_) { wta_k = wta_k_; }
int getWTA_K() const { return wta_k; }
void setScoreType(int scoreType_) { scoreType = scoreType_; }
int getScoreType() const { return scoreType; }
void setPatchSize(int patchSize_) { patchSize = patchSize_; }
int getPatchSize() const { return patchSize; }
void setFastThreshold(int fastThreshold_) { fastThreshold = fastThreshold_; }
int getFastThreshold() const { return fastThreshold; }
// returns the descriptor size in bytes
int descriptorSize() const;
......
......@@ -255,8 +255,8 @@ protected:
fs.open( string(ts->get_data_path()) + FEATURES2D_DIR + "/keypoints.xml.gz", FileStorage::WRITE );
if( fs.isOpened() )
{
ORB fd;
fd.detect(img, keypoints);
Ptr<ORB> fd = ORB::create();
fd->detect(img, keypoints);
write( fs, "keypoints", keypoints );
}
else
......
......@@ -267,8 +267,8 @@ TEST( Features2d_Detector_GFTT, regression )
TEST( Features2d_Detector_Harris, regression )
{
Ptr<FeatureDetector> gftt = GFTTDetector::create();
gftt->set(GFTTDetector::USE_HARRIS_DETECTOR, 1);
Ptr<GFTTDetector> gftt = GFTTDetector::create();
gftt->setHarrisDetector(true);
CV_FeatureDetectorTest test( "detector-harris", gftt);
test.safe_run();
}
......
......@@ -140,8 +140,8 @@ TEST(Features2d_Detector_Keypoints_HARRIS, validation)
TEST(Features2d_Detector_Keypoints_GFTT, validation)
{
Ptr<FeatureDetector> gftt = GFTTDetector::create();
gftt->set(GFTTDetector::USE_HARRIS_DETECTOR, 1);
Ptr<GFTTDetector> gftt = GFTTDetector::create();
gftt->setHarrisDetector(true);
CV_FeatureDetectorKeypointsTest test(gftt);
test.safe_run();
}
......
......@@ -132,8 +132,11 @@ public:
fd = GFTTDetector::create();
break;
case HARRIS:
fd = GFTTDetector::create();
fd->set(GFTTDetector::USE_HARRIS_DETECTOR, 1);
{
Ptr<GFTTDetector> gftt = GFTTDetector::create();
gftt->setHarrisDetector(true);
fd = gftt;
}
break;
case SIMPLEBLOB:
fd = SimpleBlobDetector::create();
......
......@@ -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 */
......
......@@ -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_ = 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<SURF> sdetector_ = SURF::create();
Ptr<SURF> 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" );
......
......@@ -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__
/*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;
}
}
......@@ -67,8 +67,8 @@ int main(int argc, char** argv)
bool no_display = false;
float scale = 1.f;
Ptr<StereoBM> bm = createStereoBM(16,9);
Ptr<StereoSGBM> sgbm = createStereoSGBM(0,16,3);
Ptr<StereoBM> bm = StereoBM::create(16,9);
Ptr<StereoSGBM> sgbm = StereoSGBM::create(0,16,3);
for( int i = 1; i < argc; i++ )
{
......
......@@ -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<StereoBM> sbm = createStereoBM( ndisparities, SADWindowSize );
Ptr<StereoBM> sbm = StereoBM::create( ndisparities, SADWindowSize );
//-- 3. Calculate the disparity image
sbm->compute( imgLeft, imgRight, imgDisparity16S );
......
......@@ -135,18 +135,19 @@ int main(int argc, char **argv)
return 1;
}
fs["bounding_box"] >> bb;
Ptr<Feature2D> akaze = AKAZE::create();
Stats stats, akaze_stats, orb_stats;
Ptr<AKAZE> akaze = AKAZE::create();
akaze->set("threshold", akaze_thresh);
Ptr<Feature2D> orb = ORB::create();
Ptr<ORB> orb = ORB::create();
orb->setMaxFeatures(stats.keypoints);
Ptr<DescriptorMatcher> 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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册