mirror of
https://github.com/opencv/opencv.git
synced 2024-12-01 23:30:06 +08:00
Merge pull request #3348 from vpisarev:refactor_algorithms2
This commit is contained in:
commit
55f490485b
@ -386,15 +386,17 @@ public:
|
|||||||
|
|
||||||
CV_WRAP virtual Rect getROI2() const = 0;
|
CV_WRAP virtual Rect getROI2() const = 0;
|
||||||
CV_WRAP virtual void setROI2(Rect roi2) = 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
|
class CV_EXPORTS_W StereoSGBM : public StereoMatcher
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum { MODE_SGBM = 0,
|
enum
|
||||||
|
{
|
||||||
|
MODE_SGBM = 0,
|
||||||
MODE_HH = 1
|
MODE_HH = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -412,14 +414,13 @@ public:
|
|||||||
|
|
||||||
CV_WRAP virtual int getMode() const = 0;
|
CV_WRAP virtual int getMode() const = 0;
|
||||||
CV_WRAP virtual void setMode(int mode) = 0;
|
CV_WRAP virtual void setMode(int mode) = 0;
|
||||||
};
|
|
||||||
|
|
||||||
|
CV_WRAP static Ptr<StereoSGBM> create(int minDisparity, int numDisparities, int blockSize,
|
||||||
CV_EXPORTS_W Ptr<StereoSGBM> createStereoSGBM(int minDisparity, int numDisparities, int blockSize,
|
|
||||||
int P1 = 0, int P2 = 0, int disp12MaxDiff = 0,
|
int P1 = 0, int P2 = 0, int disp12MaxDiff = 0,
|
||||||
int preFilterCap = 0, int uniquenessRatio = 0,
|
int preFilterCap = 0, int uniquenessRatio = 0,
|
||||||
int speckleWindowSize = 0, int speckleRange = 0,
|
int speckleWindowSize = 0, int speckleRange = 0,
|
||||||
int mode = StereoSGBM::MODE_SGBM);
|
int mode = StereoSGBM::MODE_SGBM);
|
||||||
|
};
|
||||||
|
|
||||||
namespace fisheye
|
namespace fisheye
|
||||||
{
|
{
|
||||||
|
@ -63,7 +63,7 @@ OCL_PERF_TEST_P(StereoBMFixture, StereoBM, ::testing::Combine(OCL_PERF_ENUM(32,
|
|||||||
|
|
||||||
declare.in(left, right);
|
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->setPreFilterType(bm->PREFILTER_XSOBEL);
|
||||||
bm->setTextureThreshold(0);
|
bm->setTextureThreshold(0);
|
||||||
|
|
||||||
|
@ -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
|
|
@ -92,18 +92,18 @@ void cvFindStereoCorrespondenceBM( const CvArr* leftarr, const CvArr* rightarr,
|
|||||||
|
|
||||||
CV_Assert( state != 0 );
|
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);
|
state->SADWindowSize);
|
||||||
sm->set("preFilterType", state->preFilterType);
|
sm->setPreFilterType(state->preFilterType);
|
||||||
sm->set("preFilterSize", state->preFilterSize);
|
sm->setPreFilterSize(state->preFilterSize);
|
||||||
sm->set("preFilterCap", state->preFilterCap);
|
sm->setPreFilterCap(state->preFilterCap);
|
||||||
sm->set("SADWindowSize", state->SADWindowSize);
|
sm->setBlockSize(state->SADWindowSize);
|
||||||
sm->set("numDisparities", state->numberOfDisparities > 0 ? state->numberOfDisparities : 64);
|
sm->setNumDisparities(state->numberOfDisparities > 0 ? state->numberOfDisparities : 64);
|
||||||
sm->set("textureThreshold", state->textureThreshold);
|
sm->setTextureThreshold(state->textureThreshold);
|
||||||
sm->set("uniquenessRatio", state->uniquenessRatio);
|
sm->setUniquenessRatio(state->uniquenessRatio);
|
||||||
sm->set("speckleRange", state->speckleRange);
|
sm->setSpeckleRange(state->speckleRange);
|
||||||
sm->set("speckleWindowSize", state->speckleWindowSize);
|
sm->setSpeckleWindowSize(state->speckleWindowSize);
|
||||||
sm->set("disp12MaxDiff", state->disp12MaxDiff);
|
sm->setDisp12MaxDiff(state->disp12MaxDiff);
|
||||||
|
|
||||||
sm->compute(left, right, disp);
|
sm->compute(left, right, disp);
|
||||||
}
|
}
|
||||||
|
@ -1098,11 +1098,11 @@ public:
|
|||||||
|
|
||||||
const char* StereoBMImpl::name_ = "StereoMatcher.BM";
|
const char* StereoBMImpl::name_ = "StereoMatcher.BM";
|
||||||
|
|
||||||
}
|
Ptr<StereoBM> StereoBM::create(int _numDisparities, int _SADWindowSize)
|
||||||
|
|
||||||
cv::Ptr<cv::StereoBM> cv::createStereoBM(int _numDisparities, int _SADWindowSize)
|
|
||||||
{
|
{
|
||||||
return makePtr<StereoBMImpl>(_numDisparities, _SADWindowSize);
|
return makePtr<StereoBMImpl>(_numDisparities, _SADWindowSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/* End of file. */
|
/* End of file. */
|
||||||
|
@ -941,7 +941,7 @@ public:
|
|||||||
const char* StereoSGBMImpl::name_ = "StereoMatcher.SGBM";
|
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 P1, int P2, int disp12MaxDiff,
|
||||||
int preFilterCap, int uniquenessRatio,
|
int preFilterCap, int uniquenessRatio,
|
||||||
int speckleWindowSize, int speckleRange,
|
int speckleWindowSize, int speckleRange,
|
||||||
|
@ -79,7 +79,7 @@ PARAM_TEST_CASE(StereoBMFixture, int, int)
|
|||||||
|
|
||||||
OCL_TEST_P(StereoBMFixture, StereoBM)
|
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->setPreFilterType(bm->PREFILTER_XSOBEL);
|
||||||
bm->setTextureThreshold(0);
|
bm->setTextureThreshold(0);
|
||||||
|
|
||||||
|
@ -717,7 +717,7 @@ protected:
|
|||||||
Mat leftImg; cvtColor( _leftImg, leftImg, COLOR_BGR2GRAY );
|
Mat leftImg; cvtColor( _leftImg, leftImg, COLOR_BGR2GRAY );
|
||||||
Mat rightImg; cvtColor( _rightImg, rightImg, 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;
|
Mat tempDisp;
|
||||||
bm->compute( leftImg, rightImg, tempDisp );
|
bm->compute( leftImg, rightImg, tempDisp );
|
||||||
tempDisp.convertTo(leftDisp, CV_32F, 1./StereoMatcher::DISP_SCALE);
|
tempDisp.convertTo(leftDisp, CV_32F, 1./StereoMatcher::DISP_SCALE);
|
||||||
@ -770,7 +770,7 @@ protected:
|
|||||||
{
|
{
|
||||||
RunParams params = caseRunParams[caseIdx];
|
RunParams params = caseRunParams[caseIdx];
|
||||||
assert( params.ndisp%16 == 0 );
|
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,
|
10*params.winSize*params.winSize,
|
||||||
40*params.winSize*params.winSize,
|
40*params.winSize*params.winSize,
|
||||||
1, 63, 10, 100, 32, params.fullDP ?
|
1, 63, 10, 100, 32, params.fullDP ?
|
||||||
|
@ -874,9 +874,6 @@ public:
|
|||||||
virtual ~Algorithm();
|
virtual ~Algorithm();
|
||||||
String name() const;
|
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 String& name) const;
|
||||||
template<typename _Tp> typename ParamType<_Tp>::member_type get(const char* 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();
|
return info()->name();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Algorithm::set(int, double) {}
|
|
||||||
double Algorithm::get(int) const { return 0.; }
|
|
||||||
|
|
||||||
void Algorithm::set(const String& parameter, int value)
|
void Algorithm::set(const String& parameter, int value)
|
||||||
{
|
{
|
||||||
info()->set(this, parameter.c_str(), ParamType<int>::type, &value);
|
info()->set(this, parameter.c_str(), ParamType<int>::type, &value);
|
||||||
|
@ -163,17 +163,37 @@ public:
|
|||||||
class CV_EXPORTS_W ORB : public Feature2D
|
class CV_EXPORTS_W ORB : public Feature2D
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// the size of the signature in bytes
|
enum { kBytes = 32, HARRIS_SCORE=0, FAST_SCORE=1 };
|
||||||
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
|
|
||||||
};
|
|
||||||
|
|
||||||
CV_WRAP static Ptr<ORB> create(int nfeatures=500, float scaleFactor=1.2f, int nlevels=8, int edgeThreshold=31,
|
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);
|
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 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
|
class CV_EXPORTS_W MSER : public Feature2D
|
||||||
{
|
{
|
||||||
public:
|
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
|
//! the full constructor
|
||||||
CV_WRAP static Ptr<MSER> create( int _delta=5, int _min_area=60, int _max_area=14400,
|
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,
|
double _max_variation=0.25, double _min_diversity=.2,
|
||||||
@ -204,6 +217,18 @@ public:
|
|||||||
CV_WRAP virtual void detectRegions( InputArray image,
|
CV_WRAP virtual void detectRegions( InputArray image,
|
||||||
std::vector<std::vector<Point> >& msers,
|
std::vector<std::vector<Point> >& msers,
|
||||||
std::vector<Rect>& bboxes ) = 0;
|
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
|
//! detects corners using FAST algorithm by E. Rosten
|
||||||
@ -225,15 +250,40 @@ public:
|
|||||||
CV_WRAP static Ptr<FastFeatureDetector> create( int threshold=10,
|
CV_WRAP static Ptr<FastFeatureDetector> create( int threshold=10,
|
||||||
bool nonmaxSuppression=true,
|
bool nonmaxSuppression=true,
|
||||||
int type=FastFeatureDetector::TYPE_9_16 );
|
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
|
class CV_EXPORTS_W GFTTDetector : public Feature2D
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum { USE_HARRIS_DETECTOR=10000 };
|
|
||||||
CV_WRAP static Ptr<GFTTDetector> create( int maxCorners=1000, double qualityLevel=0.01, double minDistance=1,
|
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 );
|
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,
|
CV_WRAP static Ptr<KAZE> create(bool extended=false, bool upright=false,
|
||||||
float threshold = 0.001f,
|
float threshold = 0.001f,
|
||||||
int octaves = 4, int sublevels = 4,
|
int nOctaves = 4, int nOctaveLayers = 4,
|
||||||
int diffusivity = KAZE::DIFF_PM_G2);
|
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,
|
CV_WRAP static Ptr<AKAZE> create(int descriptor_type=AKAZE::DESCRIPTOR_MLDB,
|
||||||
int descriptor_size = 0, int descriptor_channels = 3,
|
int descriptor_size = 0, int descriptor_channels = 3,
|
||||||
float threshold = 0.001f, int octaves = 4,
|
float threshold = 0.001f, int nOctaves = 4,
|
||||||
int sublevels = 4, int diffusivity = KAZE::DIFF_PM_G2);
|
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 = (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
|
// returns the descriptor size in bytes
|
||||||
int descriptorSize() const
|
int descriptorSize() const
|
||||||
{
|
{
|
||||||
|
@ -2099,7 +2099,7 @@ BriskLayer::BriskLayer(const BriskLayer& layer, int mode)
|
|||||||
void
|
void
|
||||||
BriskLayer::getAgastPoints(int threshold, std::vector<KeyPoint>& keypoints)
|
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);
|
fast_9_16_->detect(img_, keypoints);
|
||||||
|
|
||||||
// also write scores
|
// also write scores
|
||||||
|
@ -407,6 +407,15 @@ public:
|
|||||||
return 0;
|
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;
|
int threshold;
|
||||||
bool nonmaxSuppression;
|
bool nonmaxSuppression;
|
||||||
int type;
|
int type;
|
||||||
|
@ -55,23 +55,23 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void set(int prop, double value)
|
void setMaxFeatures(int maxFeatures) { nfeatures = maxFeatures; }
|
||||||
{
|
int getMaxFeatures() const { return nfeatures; }
|
||||||
if( prop == USE_HARRIS_DETECTOR )
|
|
||||||
useHarrisDetector = value != 0;
|
|
||||||
else
|
|
||||||
CV_Error(Error::StsBadArg, "");
|
|
||||||
}
|
|
||||||
|
|
||||||
double get(int prop) const
|
void setQualityLevel(double qlevel) { qualityLevel = qlevel; }
|
||||||
{
|
double getQualityLevel() const { return qualityLevel; }
|
||||||
double value = 0;
|
|
||||||
if( prop == USE_HARRIS_DETECTOR )
|
void setMinDistance(double minDistance_) { minDistance = minDistance_; }
|
||||||
value = useHarrisDetector;
|
double getMinDistance() const { return minDistance; }
|
||||||
else
|
|
||||||
CV_Error(Error::StsBadArg, "");
|
void setBlockSize(int blockSize_) { blockSize = blockSize_; }
|
||||||
return value;
|
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 )
|
void detect( InputArray _image, std::vector<KeyPoint>& keypoints, InputArray _mask )
|
||||||
{
|
{
|
||||||
|
@ -69,6 +69,24 @@ namespace cv
|
|||||||
|
|
||||||
virtual ~KAZE_Impl() {}
|
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
|
// returns the descriptor size in bytes
|
||||||
int descriptorSize() const
|
int descriptorSize() const
|
||||||
{
|
{
|
||||||
|
@ -86,35 +86,17 @@ public:
|
|||||||
|
|
||||||
virtual ~MSER_Impl() {}
|
virtual ~MSER_Impl() {}
|
||||||
|
|
||||||
void set(int propId, double value)
|
void setDelta(int delta) { params.delta = delta; }
|
||||||
{
|
int getDelta() const { return params.delta; }
|
||||||
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");
|
|
||||||
}
|
|
||||||
|
|
||||||
double get(int propId) const
|
void setMinArea(int minArea) { params.minArea = minArea; }
|
||||||
{
|
int getMinArea() const { return params.minArea; }
|
||||||
double value = 0;
|
|
||||||
if( propId == DELTA )
|
void setMaxArea(int maxArea) { params.maxArea = maxArea; }
|
||||||
value = params.delta;
|
int getMaxArea() const { return params.maxArea; }
|
||||||
else if( propId == MIN_AREA )
|
|
||||||
value = params.minArea;
|
void setPass2Only(bool f) { params.pass2Only = f; }
|
||||||
else if( propId == MAX_AREA )
|
bool getPass2Only() const { return params.pass2Only; }
|
||||||
value = params.maxArea;
|
|
||||||
else if( propId == PASS2_ONLY )
|
|
||||||
value = params.pass2Only;
|
|
||||||
else
|
|
||||||
CV_Error(CV_StsBadArg, "Unknown parameter id");
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum { DIR_SHIFT = 29, NEXT_MASK = ((1<<DIR_SHIFT)-1) };
|
enum { DIR_SHIFT = 29, NEXT_MASK = ((1<<DIR_SHIFT)-1) };
|
||||||
|
|
||||||
|
@ -660,55 +660,32 @@ public:
|
|||||||
scoreType(_scoreType), patchSize(_patchSize), fastThreshold(_fastThreshold)
|
scoreType(_scoreType), patchSize(_patchSize), fastThreshold(_fastThreshold)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void set(int prop, double value)
|
void setMaxFeatures(int maxFeatures) { nfeatures = maxFeatures; }
|
||||||
{
|
int getMaxFeatures() const { return nfeatures; }
|
||||||
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, "");
|
|
||||||
}
|
|
||||||
|
|
||||||
double get(int prop) const
|
void setScaleFactor(double scaleFactor_) { scaleFactor = scaleFactor_; }
|
||||||
{
|
double getScaleFactor() const { return scaleFactor; }
|
||||||
double value = 0;
|
|
||||||
if( prop == NFEATURES )
|
void setNLevels(int nlevels_) { nlevels = nlevels_; }
|
||||||
value = nfeatures;
|
int getNLevels() const { return nlevels; }
|
||||||
else if( prop == SCALE_FACTOR )
|
|
||||||
value = scaleFactor;
|
void setEdgeThreshold(int edgeThreshold_) { edgeThreshold = edgeThreshold_; }
|
||||||
else if( prop == NLEVELS )
|
int getEdgeThreshold() const { return edgeThreshold; }
|
||||||
value = nlevels;
|
|
||||||
else if( prop == EDGE_THRESHOLD )
|
void setFirstLevel(int firstLevel_) { firstLevel = firstLevel_; }
|
||||||
value = edgeThreshold;
|
int getFirstLevel() const { return firstLevel; }
|
||||||
else if( prop == FIRST_LEVEL )
|
|
||||||
value = firstLevel;
|
void setWTA_K(int wta_k_) { wta_k = wta_k_; }
|
||||||
else if( prop == WTA_K )
|
int getWTA_K() const { return wta_k; }
|
||||||
value = wta_k;
|
|
||||||
else if( prop == SCORE_TYPE )
|
void setScoreType(int scoreType_) { scoreType = scoreType_; }
|
||||||
value = scoreType;
|
int getScoreType() const { return scoreType; }
|
||||||
else if( prop == PATCH_SIZE )
|
|
||||||
value = patchSize;
|
void setPatchSize(int patchSize_) { patchSize = patchSize_; }
|
||||||
else if( prop == FAST_THRESHOLD )
|
int getPatchSize() const { return patchSize; }
|
||||||
value = fastThreshold;
|
|
||||||
else
|
void setFastThreshold(int fastThreshold_) { fastThreshold = fastThreshold_; }
|
||||||
CV_Error(Error::StsBadArg, "");
|
int getFastThreshold() const { return fastThreshold; }
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
// returns the descriptor size in bytes
|
// returns the descriptor size in bytes
|
||||||
int descriptorSize() const;
|
int descriptorSize() const;
|
||||||
|
@ -255,8 +255,8 @@ protected:
|
|||||||
fs.open( string(ts->get_data_path()) + FEATURES2D_DIR + "/keypoints.xml.gz", FileStorage::WRITE );
|
fs.open( string(ts->get_data_path()) + FEATURES2D_DIR + "/keypoints.xml.gz", FileStorage::WRITE );
|
||||||
if( fs.isOpened() )
|
if( fs.isOpened() )
|
||||||
{
|
{
|
||||||
ORB fd;
|
Ptr<ORB> fd = ORB::create();
|
||||||
fd.detect(img, keypoints);
|
fd->detect(img, keypoints);
|
||||||
write( fs, "keypoints", keypoints );
|
write( fs, "keypoints", keypoints );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -267,8 +267,8 @@ TEST( Features2d_Detector_GFTT, regression )
|
|||||||
|
|
||||||
TEST( Features2d_Detector_Harris, regression )
|
TEST( Features2d_Detector_Harris, regression )
|
||||||
{
|
{
|
||||||
Ptr<FeatureDetector> gftt = GFTTDetector::create();
|
Ptr<GFTTDetector> gftt = GFTTDetector::create();
|
||||||
gftt->set(GFTTDetector::USE_HARRIS_DETECTOR, 1);
|
gftt->setHarrisDetector(true);
|
||||||
CV_FeatureDetectorTest test( "detector-harris", gftt);
|
CV_FeatureDetectorTest test( "detector-harris", gftt);
|
||||||
test.safe_run();
|
test.safe_run();
|
||||||
}
|
}
|
||||||
|
@ -140,8 +140,8 @@ TEST(Features2d_Detector_Keypoints_HARRIS, validation)
|
|||||||
|
|
||||||
TEST(Features2d_Detector_Keypoints_GFTT, validation)
|
TEST(Features2d_Detector_Keypoints_GFTT, validation)
|
||||||
{
|
{
|
||||||
Ptr<FeatureDetector> gftt = GFTTDetector::create();
|
Ptr<GFTTDetector> gftt = GFTTDetector::create();
|
||||||
gftt->set(GFTTDetector::USE_HARRIS_DETECTOR, 1);
|
gftt->setHarrisDetector(true);
|
||||||
CV_FeatureDetectorKeypointsTest test(gftt);
|
CV_FeatureDetectorKeypointsTest test(gftt);
|
||||||
test.safe_run();
|
test.safe_run();
|
||||||
}
|
}
|
||||||
|
@ -132,8 +132,11 @@ public:
|
|||||||
fd = GFTTDetector::create();
|
fd = GFTTDetector::create();
|
||||||
break;
|
break;
|
||||||
case HARRIS:
|
case HARRIS:
|
||||||
fd = GFTTDetector::create();
|
{
|
||||||
fd->set(GFTTDetector::USE_HARRIS_DETECTOR, 1);
|
Ptr<GFTTDetector> gftt = GFTTDetector::create();
|
||||||
|
gftt->setHarrisDetector(true);
|
||||||
|
fd = gftt;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case SIMPLEBLOB:
|
case SIMPLEBLOB:
|
||||||
fd = SimpleBlobDetector::create();
|
fd = SimpleBlobDetector::create();
|
||||||
|
@ -23,14 +23,6 @@ JNI_OnLoad(JavaVM* vm, void* )
|
|||||||
if (vm->GetEnv((void**) &env, JNI_VERSION_1_6) != JNI_OK)
|
if (vm->GetEnv((void**) &env, JNI_VERSION_1_6) != JNI_OK)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
bool init = true;
|
|
||||||
#ifdef HAVE_OPENCV_VIDEO
|
|
||||||
init &= cv::initModule_video();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if(!init)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
/* get class with (*env)->FindClass */
|
/* get class with (*env)->FindClass */
|
||||||
/* register methods with (*env)->RegisterNatives */
|
/* register methods with (*env)->RegisterNatives */
|
||||||
|
|
||||||
|
@ -1728,6 +1728,9 @@ public:
|
|||||||
FOR_IN_GRID(coef0, coef_grid)
|
FOR_IN_GRID(coef0, coef_grid)
|
||||||
FOR_IN_GRID(degree, degree_grid)
|
FOR_IN_GRID(degree, degree_grid)
|
||||||
{
|
{
|
||||||
|
// make sure we updated the kernel and other parameters
|
||||||
|
setParams(params, Ptr<Kernel>() );
|
||||||
|
|
||||||
double error = 0;
|
double error = 0;
|
||||||
for( k = 0; k < k_fold; k++ )
|
for( k = 0; k < k_fold; k++ )
|
||||||
{
|
{
|
||||||
|
@ -323,27 +323,31 @@ SurfFeaturesFinder::SurfFeaturesFinder(double hess_thresh, int num_octaves, int
|
|||||||
#ifdef HAVE_OPENCV_XFEATURES2D
|
#ifdef HAVE_OPENCV_XFEATURES2D
|
||||||
if (num_octaves_descr == num_octaves && num_layers_descr == num_layers)
|
if (num_octaves_descr == num_octaves && num_layers_descr == num_layers)
|
||||||
{
|
{
|
||||||
surf = SURF::create();
|
Ptr<SURF> surf_ = SURF::create();
|
||||||
if( !surf )
|
if( !surf_ )
|
||||||
CV_Error( Error::StsNotImplemented, "OpenCV was built without SURF support" );
|
CV_Error( Error::StsNotImplemented, "OpenCV was built without SURF support" );
|
||||||
surf->set(SURF::HESSIAN_THRESHOLD, hess_thresh);
|
surf_->setHessianThreshold(hess_thresh);
|
||||||
surf->set(SURF::NOCTAVES, num_octaves);
|
surf_->setNOctaves(num_octaves);
|
||||||
surf->set(SURF::NOCTAVE_LAYERS, num_layers);
|
surf_->setNOctaveLayers(num_layers);
|
||||||
|
surf = surf_;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
detector_ = SURF::create();
|
Ptr<SURF> sdetector_ = SURF::create();
|
||||||
extractor_ = SURF::create();
|
Ptr<SURF> sextractor_ = SURF::create();
|
||||||
|
|
||||||
if( !detector_ || !extractor_ )
|
if( !sdetector_ || !sextractor_ )
|
||||||
CV_Error( Error::StsNotImplemented, "OpenCV was built without SURF support" );
|
CV_Error( Error::StsNotImplemented, "OpenCV was built without SURF support" );
|
||||||
|
|
||||||
detector_->set(SURF::HESSIAN_THRESHOLD, hess_thresh);
|
sdetector_->setHessianThreshold(hess_thresh);
|
||||||
detector_->set(SURF::NOCTAVES, num_octaves);
|
sdetector_->setNOctaves(num_octaves);
|
||||||
detector_->set(SURF::NOCTAVE_LAYERS, num_layers);
|
sdetector_->setNOctaveLayers(num_layers);
|
||||||
|
|
||||||
extractor_->set(SURF::NOCTAVES, num_octaves_descr);
|
sextractor_->setNOctaves(num_octaves_descr);
|
||||||
extractor_->set(SURF::NOCTAVE_LAYERS, num_layers_descr);
|
sextractor_->setNOctaveLayers(num_layers_descr);
|
||||||
|
|
||||||
|
detector_ = sdetector_;
|
||||||
|
extractor_ = sextractor_;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
CV_Error( Error::StsNotImplemented, "OpenCV was built without SURF support" );
|
CV_Error( Error::StsNotImplemented, "OpenCV was built without SURF support" );
|
||||||
|
@ -47,9 +47,4 @@
|
|||||||
#include "opencv2/video/tracking.hpp"
|
#include "opencv2/video/tracking.hpp"
|
||||||
#include "opencv2/video/background_segm.hpp"
|
#include "opencv2/video/background_segm.hpp"
|
||||||
|
|
||||||
namespace cv
|
|
||||||
{
|
|
||||||
CV_EXPORTS bool initModule_video(void);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif //__OPENCV_VIDEO_HPP__
|
#endif //__OPENCV_VIDEO_HPP__
|
||||||
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -44,9 +44,5 @@
|
|||||||
|
|
||||||
bool cv::initAll()
|
bool cv::initAll()
|
||||||
{
|
{
|
||||||
return true
|
return true;
|
||||||
#ifdef HAVE_OPENCV_VIDEO
|
|
||||||
&& initModule_video()
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
@ -67,8 +67,8 @@ int main(int argc, char** argv)
|
|||||||
bool no_display = false;
|
bool no_display = false;
|
||||||
float scale = 1.f;
|
float scale = 1.f;
|
||||||
|
|
||||||
Ptr<StereoBM> bm = createStereoBM(16,9);
|
Ptr<StereoBM> bm = StereoBM::create(16,9);
|
||||||
Ptr<StereoSGBM> sgbm = createStereoSGBM(0,16,3);
|
Ptr<StereoSGBM> sgbm = StereoSGBM::create(0,16,3);
|
||||||
|
|
||||||
for( int i = 1; i < argc; i++ )
|
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 ndisparities = 16*5; /**< Range of disparity */
|
||||||
int SADWindowSize = 21; /**< Size of the block window. Must be odd */
|
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
|
//-- 3. Calculate the disparity image
|
||||||
sbm->compute( imgLeft, imgRight, imgDisparity16S );
|
sbm->compute( imgLeft, imgRight, imgDisparity16S );
|
||||||
|
@ -135,18 +135,19 @@ int main(int argc, char **argv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
fs["bounding_box"] >> bb;
|
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);
|
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");
|
Ptr<DescriptorMatcher> matcher = DescriptorMatcher::create("BruteForce-Hamming");
|
||||||
Tracker akaze_tracker(akaze, matcher);
|
Tracker akaze_tracker(akaze, matcher);
|
||||||
Tracker orb_tracker(orb, matcher);
|
Tracker orb_tracker(orb, matcher);
|
||||||
|
|
||||||
Stats stats, akaze_stats, orb_stats;
|
|
||||||
Mat frame;
|
Mat frame;
|
||||||
video_in >> frame;
|
video_in >> frame;
|
||||||
akaze_tracker.setFirstFrame(frame, bb, "AKAZE", stats);
|
akaze_tracker.setFirstFrame(frame, bb, "AKAZE", stats);
|
||||||
orb_tracker.getDetector()->set("nFeatures", stats.keypoints);
|
|
||||||
orb_tracker.setFirstFrame(frame, bb, "ORB", stats);
|
orb_tracker.setFirstFrame(frame, bb, "ORB", stats);
|
||||||
|
|
||||||
Stats akaze_draw_stats, orb_draw_stats;
|
Stats akaze_draw_stats, orb_draw_stats;
|
||||||
|
Loading…
Reference in New Issue
Block a user