Merged the trunk r8589:8653 - all changes related to build warnings
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC diagnostic ignored "-Wmissing-declarations"
|
||||
#endif
|
||||
|
||||
#ifndef __OPENCV_PERF_PRECOMP_HPP__
|
||||
#define __OPENCV_PERF_PRECOMP_HPP__
|
||||
|
||||
@@ -5,7 +9,7 @@
|
||||
#include "opencv2/highgui/highgui.hpp"
|
||||
#include "opencv2/features2d/features2d.hpp"
|
||||
|
||||
#if GTEST_CREATE_SHARED_LIBRARY
|
||||
#ifdef GTEST_CREATE_SHARED_LIBRARY
|
||||
#error no modules except ts should have GTEST_CREATE_SHARED_LIBRARY defined
|
||||
#endif
|
||||
|
||||
|
@@ -110,10 +110,10 @@ Mat BOWKMeansTrainer::cluster() const
|
||||
BOWKMeansTrainer::~BOWKMeansTrainer()
|
||||
{}
|
||||
|
||||
Mat BOWKMeansTrainer::cluster( const Mat& descriptors ) const
|
||||
Mat BOWKMeansTrainer::cluster( const Mat& _descriptors ) const
|
||||
{
|
||||
Mat labels, vocabulary;
|
||||
kmeans( descriptors, clusterCount, labels, termcrit, attempts, flags, vocabulary );
|
||||
kmeans( _descriptors, clusterCount, labels, termcrit, attempts, flags, vocabulary );
|
||||
return vocabulary;
|
||||
}
|
||||
|
||||
|
@@ -61,7 +61,7 @@ inline int smoothedSum(const Mat& sum, const KeyPoint& pt, int y, int x)
|
||||
+ sum.at<int>(img_y - HALF_KERNEL, img_x - HALF_KERNEL);
|
||||
}
|
||||
|
||||
void pixelTests16(const Mat& sum, const std::vector<KeyPoint>& keypoints, Mat& descriptors)
|
||||
static void pixelTests16(const Mat& sum, const std::vector<KeyPoint>& keypoints, Mat& descriptors)
|
||||
{
|
||||
for (int i = 0; i < (int)keypoints.size(); ++i)
|
||||
{
|
||||
@@ -71,7 +71,7 @@ void pixelTests16(const Mat& sum, const std::vector<KeyPoint>& keypoints, Mat& d
|
||||
}
|
||||
}
|
||||
|
||||
void pixelTests32(const Mat& sum, const std::vector<KeyPoint>& keypoints, Mat& descriptors)
|
||||
static void pixelTests32(const Mat& sum, const std::vector<KeyPoint>& keypoints, Mat& descriptors)
|
||||
{
|
||||
for (int i = 0; i < (int)keypoints.size(); ++i)
|
||||
{
|
||||
@@ -82,7 +82,7 @@ void pixelTests32(const Mat& sum, const std::vector<KeyPoint>& keypoints, Mat& d
|
||||
}
|
||||
}
|
||||
|
||||
void pixelTests64(const Mat& sum, const std::vector<KeyPoint>& keypoints, Mat& descriptors)
|
||||
static void pixelTests64(const Mat& sum, const std::vector<KeyPoint>& keypoints, Mat& descriptors)
|
||||
{
|
||||
for (int i = 0; i < (int)keypoints.size(); ++i)
|
||||
{
|
||||
@@ -127,8 +127,8 @@ int BriefDescriptorExtractor::descriptorType() const
|
||||
|
||||
void BriefDescriptorExtractor::read( const FileNode& fn)
|
||||
{
|
||||
int descriptorSize = fn["descriptorSize"];
|
||||
switch (descriptorSize)
|
||||
int dSize = fn["descriptorSize"];
|
||||
switch (dSize)
|
||||
{
|
||||
case 16:
|
||||
test_fn_ = pixelTests16;
|
||||
@@ -142,7 +142,7 @@ void BriefDescriptorExtractor::read( const FileNode& fn)
|
||||
default:
|
||||
CV_Error(CV_StsBadArg, "descriptorSize must be 16, 32, or 64");
|
||||
}
|
||||
bytes_ = descriptorSize;
|
||||
bytes_ = dSize;
|
||||
}
|
||||
|
||||
void BriefDescriptorExtractor::write( FileStorage& fs) const
|
||||
|
@@ -56,7 +56,7 @@ DescriptorExtractor::~DescriptorExtractor()
|
||||
{}
|
||||
|
||||
void DescriptorExtractor::compute( const Mat& image, vector<KeyPoint>& keypoints, Mat& descriptors ) const
|
||||
{
|
||||
{
|
||||
if( image.empty() || keypoints.empty() )
|
||||
{
|
||||
descriptors.release();
|
||||
@@ -102,7 +102,7 @@ Ptr<DescriptorExtractor> DescriptorExtractor::create(const string& descriptorExt
|
||||
string type = descriptorExtractorType.substr(pos);
|
||||
return new OpponentColorDescriptorExtractor(DescriptorExtractor::create(type));
|
||||
}
|
||||
|
||||
|
||||
return Algorithm::create<DescriptorExtractor>("Feature2D." + descriptorExtractorType);
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ OpponentColorDescriptorExtractor::OpponentColorDescriptorExtractor( const Ptr<De
|
||||
CV_Assert( !descriptorExtractor.empty() );
|
||||
}
|
||||
|
||||
void convertBGRImageToOpponentColorSpace( const Mat& bgrImage, vector<Mat>& opponentChannels )
|
||||
static void convertBGRImageToOpponentColorSpace( const Mat& bgrImage, vector<Mat>& opponentChannels )
|
||||
{
|
||||
if( bgrImage.type() != CV_8UC3 )
|
||||
CV_Error( CV_StsBadArg, "input image must be an BGR image of type CV_8UC3" );
|
||||
@@ -223,11 +223,11 @@ void OpponentColorDescriptorExtractor::computeImpl( const Mat& bgrImage, vector<
|
||||
vector<KeyPoint> outKeypoints;
|
||||
outKeypoints.reserve( keypoints.size() );
|
||||
|
||||
int descriptorSize = descriptorExtractor->descriptorSize();
|
||||
Mat mergedDescriptors( maxKeypointsCount, 3*descriptorSize, descriptorExtractor->descriptorType() );
|
||||
int dSize = descriptorExtractor->descriptorSize();
|
||||
Mat mergedDescriptors( maxKeypointsCount, 3*dSize, descriptorExtractor->descriptorType() );
|
||||
int mergedCount = 0;
|
||||
// cp - current channel position
|
||||
size_t cp[] = {0, 0, 0};
|
||||
size_t cp[] = {0, 0, 0};
|
||||
while( cp[0] < channelKeypoints[0].size() &&
|
||||
cp[1] < channelKeypoints[1].size() &&
|
||||
cp[2] < channelKeypoints[2].size() )
|
||||
@@ -250,7 +250,7 @@ void OpponentColorDescriptorExtractor::computeImpl( const Mat& bgrImage, vector<
|
||||
// merge descriptors
|
||||
for( int ci = 0; ci < N; ci++ )
|
||||
{
|
||||
Mat dst = mergedDescriptors(Range(mergedCount, mergedCount+1), Range(ci*descriptorSize, (ci+1)*descriptorSize));
|
||||
Mat dst = mergedDescriptors(Range(mergedCount, mergedCount+1), Range(ci*dSize, (ci+1)*dSize));
|
||||
channelDescriptors[ci].row( idxs[ci][cp[ci]] ).copyTo( dst );
|
||||
cp[ci]++;
|
||||
}
|
||||
|
@@ -45,7 +45,7 @@ using namespace std;
|
||||
|
||||
namespace cv
|
||||
{
|
||||
|
||||
|
||||
/*
|
||||
* FeatureDetector
|
||||
*/
|
||||
@@ -95,19 +95,19 @@ Ptr<FeatureDetector> FeatureDetector::create( const string& detectorType )
|
||||
return new GridAdaptedFeatureDetector(FeatureDetector::create(
|
||||
detectorType.substr(strlen("Grid"))));
|
||||
}
|
||||
|
||||
|
||||
if( detectorType.find("Pyramid") == 0 )
|
||||
{
|
||||
return new PyramidAdaptedFeatureDetector(FeatureDetector::create(
|
||||
detectorType.substr(strlen("Pyramid"))));
|
||||
}
|
||||
|
||||
|
||||
if( detectorType.find("Dynamic") == 0 )
|
||||
{
|
||||
return new DynamicAdaptedFeatureDetector(AdjusterAdapter::create(
|
||||
detectorType.substr(strlen("Dynamic"))));
|
||||
}
|
||||
|
||||
|
||||
if( detectorType.compare( "HARRIS" ) == 0 )
|
||||
{
|
||||
Ptr<FeatureDetector> fd = FeatureDetector::create("GFTT");
|
||||
@@ -149,13 +149,13 @@ void GFTTDetector::detectImpl( const Mat& image, vector<KeyPoint>& keypoints, co
|
||||
/*
|
||||
* DenseFeatureDetector
|
||||
*/
|
||||
DenseFeatureDetector::DenseFeatureDetector( float _initFeatureScale, int _featureScaleLevels,
|
||||
float _featureScaleMul, int _initXyStep,
|
||||
int _initImgBound, bool _varyXyStepWithScale,
|
||||
bool _varyImgBoundWithScale ) :
|
||||
initFeatureScale(_initFeatureScale), featureScaleLevels(_featureScaleLevels),
|
||||
featureScaleMul(_featureScaleMul), initXyStep(_initXyStep), initImgBound(_initImgBound),
|
||||
varyXyStepWithScale(_varyXyStepWithScale), varyImgBoundWithScale(_varyImgBoundWithScale)
|
||||
DenseFeatureDetector::DenseFeatureDetector( float _initFeatureScale, int _featureScaleLevels,
|
||||
float _featureScaleMul, int _initXyStep,
|
||||
int _initImgBound, bool _varyXyStepWithScale,
|
||||
bool _varyImgBoundWithScale ) :
|
||||
initFeatureScale(_initFeatureScale), featureScaleLevels(_featureScaleLevels),
|
||||
featureScaleMul(_featureScaleMul), initXyStep(_initXyStep), initImgBound(_initImgBound),
|
||||
varyXyStepWithScale(_varyXyStepWithScale), varyImgBoundWithScale(_varyImgBoundWithScale)
|
||||
{}
|
||||
|
||||
|
||||
@@ -203,7 +203,7 @@ struct ResponseComparator
|
||||
}
|
||||
};
|
||||
|
||||
void keepStrongest( int N, vector<KeyPoint>& keypoints )
|
||||
static void keepStrongest( int N, vector<KeyPoint>& keypoints )
|
||||
{
|
||||
if( (int)keypoints.size() > N )
|
||||
{
|
||||
|
@@ -156,11 +156,11 @@ static void _prepareImgAndDrawKeypoints( const Mat& img1, const vector<KeyPoint>
|
||||
// draw keypoints
|
||||
if( !(flags & DrawMatchesFlags::NOT_DRAW_SINGLE_POINTS) )
|
||||
{
|
||||
Mat outImg1 = outImg( Rect(0, 0, img1.cols, img1.rows) );
|
||||
drawKeypoints( outImg1, keypoints1, outImg1, singlePointColor, flags + DrawMatchesFlags::DRAW_OVER_OUTIMG );
|
||||
Mat _outImg1 = outImg( Rect(0, 0, img1.cols, img1.rows) );
|
||||
drawKeypoints( _outImg1, keypoints1, _outImg1, singlePointColor, flags + DrawMatchesFlags::DRAW_OVER_OUTIMG );
|
||||
|
||||
Mat outImg2 = outImg( Rect(img1.cols, 0, img2.cols, img2.rows) );
|
||||
drawKeypoints( outImg2, keypoints2, outImg2, singlePointColor, flags + DrawMatchesFlags::DRAW_OVER_OUTIMG );
|
||||
Mat _outImg2 = outImg( Rect(img1.cols, 0, img2.cols, img2.rows) );
|
||||
drawKeypoints( _outImg2, keypoints2, _outImg2, singlePointColor, flags + DrawMatchesFlags::DRAW_OVER_OUTIMG );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,9 +178,9 @@ static inline void _drawMatch( Mat& outImg, Mat& outImg1, Mat& outImg2 ,
|
||||
pt2 = kp2.pt,
|
||||
dpt2 = Point2f( std::min(pt2.x+outImg1.cols, float(outImg.cols-1)), pt2.y );
|
||||
|
||||
line( outImg,
|
||||
Point(cvRound(pt1.x*draw_multiplier), cvRound(pt1.y*draw_multiplier)),
|
||||
Point(cvRound(dpt2.x*draw_multiplier), cvRound(dpt2.y*draw_multiplier)),
|
||||
line( outImg,
|
||||
Point(cvRound(pt1.x*draw_multiplier), cvRound(pt1.y*draw_multiplier)),
|
||||
Point(cvRound(dpt2.x*draw_multiplier), cvRound(dpt2.y*draw_multiplier)),
|
||||
color, 1, CV_AA, draw_shift_bits );
|
||||
}
|
||||
|
||||
|
@@ -42,8 +42,7 @@
|
||||
|
||||
#include "precomp.hpp"
|
||||
|
||||
namespace cv
|
||||
{
|
||||
using namespace cv;
|
||||
|
||||
/////////////////////// AlgorithmInfo for various detector & descriptors ////////////////////////////
|
||||
|
||||
@@ -54,7 +53,7 @@ namespace cv
|
||||
|
||||
CV_INIT_ALGORITHM(BriefDescriptorExtractor, "Feature2D.BRIEF",
|
||||
obj.info()->addParam(obj, "bytes", obj.bytes_));
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CV_INIT_ALGORITHM(FastFeatureDetector, "Feature2D.FAST",
|
||||
@@ -69,7 +68,7 @@ CV_INIT_ALGORITHM(StarDetector, "Feature2D.STAR",
|
||||
obj.info()->addParam(obj, "lineThresholdProjected", obj.lineThresholdProjected);
|
||||
obj.info()->addParam(obj, "lineThresholdBinarized", obj.lineThresholdBinarized);
|
||||
obj.info()->addParam(obj, "suppressNonmaxSize", obj.suppressNonmaxSize));
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CV_INIT_ALGORITHM(MSER, "Feature2D.MSER",
|
||||
@@ -81,8 +80,8 @@ CV_INIT_ALGORITHM(MSER, "Feature2D.MSER",
|
||||
obj.info()->addParam(obj, "maxEvolution", obj.maxEvolution);
|
||||
obj.info()->addParam(obj, "areaThreshold", obj.areaThreshold);
|
||||
obj.info()->addParam(obj, "minMargin", obj.minMargin);
|
||||
obj.info()->addParam(obj, "edgeBlurSize", obj.edgeBlurSize));
|
||||
|
||||
obj.info()->addParam(obj, "edgeBlurSize", obj.edgeBlurSize));
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CV_INIT_ALGORITHM(ORB, "Feature2D.ORB",
|
||||
@@ -96,7 +95,7 @@ CV_INIT_ALGORITHM(ORB, "Feature2D.ORB",
|
||||
obj.info()->addParam(obj, "scoreType", obj.scoreType));
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
CV_INIT_ALGORITHM(GFTTDetector, "Feature2D.GFTT",
|
||||
obj.info()->addParam(obj, "nfeatures", obj.nfeatures);
|
||||
obj.info()->addParam(obj, "qualityLevel", obj.qualityLevel);
|
||||
@@ -105,15 +104,18 @@ CV_INIT_ALGORITHM(GFTTDetector, "Feature2D.GFTT",
|
||||
obj.info()->addParam(obj, "k", obj.k));
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
class CV_EXPORTS HarrisDetector : public GFTTDetector
|
||||
{
|
||||
public:
|
||||
HarrisDetector( int maxCorners=1000, double qualityLevel=0.01, double minDistance=1,
|
||||
int blockSize=3, bool useHarrisDetector=true, double k=0.04 )
|
||||
: GFTTDetector( maxCorners, qualityLevel, minDistance, blockSize, useHarrisDetector, k ) {}
|
||||
int blockSize=3, bool useHarrisDetector=true, double k=0.04 );
|
||||
AlgorithmInfo* info() const;
|
||||
};
|
||||
};
|
||||
|
||||
inline HarrisDetector::HarrisDetector( int _maxCorners, double _qualityLevel, double _minDistance,
|
||||
int _blockSize, bool _useHarrisDetector, double _k )
|
||||
: GFTTDetector( _maxCorners, _qualityLevel, _minDistance, _blockSize, _useHarrisDetector, _k ) {}
|
||||
|
||||
CV_INIT_ALGORITHM(HarrisDetector, "Feature2D.HARRIS",
|
||||
obj.info()->addParam(obj, "nfeatures", obj.nfeatures);
|
||||
@@ -122,7 +124,7 @@ CV_INIT_ALGORITHM(HarrisDetector, "Feature2D.HARRIS",
|
||||
obj.info()->addParam(obj, "useHarrisDetector", obj.useHarrisDetector);
|
||||
obj.info()->addParam(obj, "k", obj.k));
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CV_INIT_ALGORITHM(DenseFeatureDetector, "Feature2D.Dense",
|
||||
obj.info()->addParam(obj, "initFeatureScale", obj.initFeatureScale);
|
||||
@@ -139,17 +141,18 @@ CV_INIT_ALGORITHM(GridAdaptedFeatureDetector, "Feature2D.Grid",
|
||||
obj.info()->addParam(obj, "gridRows", obj.gridRows);
|
||||
obj.info()->addParam(obj, "gridCols", obj.gridCols));
|
||||
|
||||
bool initModule_features2d(void)
|
||||
bool cv::initModule_features2d(void)
|
||||
{
|
||||
Ptr<Algorithm> brief = createBriefDescriptorExtractor(), orb = createORB(),
|
||||
star = createStarDetector(), fastd = createFastFeatureDetector(), mser = createMSER(),
|
||||
dense = createDenseFeatureDetector(), gftt = createGFTTDetector(),
|
||||
harris = createHarrisDetector(), grid = createGridAdaptedFeatureDetector();
|
||||
|
||||
return brief->info() != 0 && orb->info() != 0 && star->info() != 0 &&
|
||||
fastd->info() != 0 && mser->info() != 0 && dense->info() != 0 &&
|
||||
gftt->info() != 0 && harris->info() != 0 && grid->info() != 0;
|
||||
}
|
||||
bool all = true;
|
||||
all &= !BriefDescriptorExtractor_info_auto.name().empty();
|
||||
all &= !FastFeatureDetector_info_auto.name().empty();
|
||||
all &= !StarDetector_info_auto.name().empty();
|
||||
all &= !MSER_info_auto.name().empty();
|
||||
all &= !ORB_info_auto.name().empty();
|
||||
all &= !GFTTDetector_info_auto.name().empty();
|
||||
all &= !HarrisDetector_info_auto.name().empty();
|
||||
all &= !DenseFeatureDetector_info_auto.name().empty();
|
||||
all &= !GridAdaptedFeatureDetector_info_auto.name().empty();
|
||||
|
||||
return all;
|
||||
}
|
||||
|
||||
|
@@ -274,6 +274,7 @@ public:
|
||||
|
||||
private:
|
||||
const Mat mask;
|
||||
MaskPredicate& operator=(const MaskPredicate&);
|
||||
};
|
||||
|
||||
void KeyPointsFilter::runByPixelsMask( vector<KeyPoint>& keypoints, const Mat& mask )
|
||||
|
@@ -174,7 +174,7 @@ int DescriptorMatcher::DescriptorCollection::size() const
|
||||
/*
|
||||
* DescriptorMatcher
|
||||
*/
|
||||
void convertMatches( const vector<vector<DMatch> >& knnMatches, vector<DMatch>& matches )
|
||||
static void convertMatches( const vector<vector<DMatch> >& knnMatches, vector<DMatch>& matches )
|
||||
{
|
||||
matches.clear();
|
||||
matches.reserve( knnMatches.size() );
|
||||
@@ -539,7 +539,7 @@ void FlannBasedMatcher::read( const FileNode& fn)
|
||||
for(int i = 0; i < (int)ip.size(); ++i)
|
||||
{
|
||||
CV_Assert(ip[i].type() == FileNode::MAP);
|
||||
std::string name = (std::string)ip[i]["name"];
|
||||
std::string _name = (std::string)ip[i]["name"];
|
||||
int type = (int)ip[i]["type"];
|
||||
|
||||
switch(type)
|
||||
@@ -549,19 +549,19 @@ void FlannBasedMatcher::read( const FileNode& fn)
|
||||
case CV_16U:
|
||||
case CV_16S:
|
||||
case CV_32S:
|
||||
indexParams->setInt(name, (int) ip[i]["value"]);
|
||||
indexParams->setInt(_name, (int) ip[i]["value"]);
|
||||
break;
|
||||
case CV_32F:
|
||||
indexParams->setFloat(name, (float) ip[i]["value"]);
|
||||
indexParams->setFloat(_name, (float) ip[i]["value"]);
|
||||
break;
|
||||
case CV_64F:
|
||||
indexParams->setDouble(name, (double) ip[i]["value"]);
|
||||
indexParams->setDouble(_name, (double) ip[i]["value"]);
|
||||
break;
|
||||
case CV_USRTYPE1:
|
||||
indexParams->setString(name, (std::string) ip[i]["value"]);
|
||||
indexParams->setString(_name, (std::string) ip[i]["value"]);
|
||||
break;
|
||||
case CV_MAKETYPE(CV_USRTYPE1,2):
|
||||
indexParams->setBool(name, (int) ip[i]["value"] != 0);
|
||||
indexParams->setBool(_name, (int) ip[i]["value"] != 0);
|
||||
break;
|
||||
case CV_MAKETYPE(CV_USRTYPE1,3):
|
||||
indexParams->setAlgorithm((int) ip[i]["value"]);
|
||||
@@ -578,7 +578,7 @@ void FlannBasedMatcher::read( const FileNode& fn)
|
||||
for(int i = 0; i < (int)sp.size(); ++i)
|
||||
{
|
||||
CV_Assert(sp[i].type() == FileNode::MAP);
|
||||
std::string name = (std::string)sp[i]["name"];
|
||||
std::string _name = (std::string)sp[i]["name"];
|
||||
int type = (int)sp[i]["type"];
|
||||
|
||||
switch(type)
|
||||
@@ -588,19 +588,19 @@ void FlannBasedMatcher::read( const FileNode& fn)
|
||||
case CV_16U:
|
||||
case CV_16S:
|
||||
case CV_32S:
|
||||
searchParams->setInt(name, (int) sp[i]["value"]);
|
||||
searchParams->setInt(_name, (int) sp[i]["value"]);
|
||||
break;
|
||||
case CV_32F:
|
||||
searchParams->setFloat(name, (float) ip[i]["value"]);
|
||||
searchParams->setFloat(_name, (float) ip[i]["value"]);
|
||||
break;
|
||||
case CV_64F:
|
||||
searchParams->setDouble(name, (double) ip[i]["value"]);
|
||||
searchParams->setDouble(_name, (double) ip[i]["value"]);
|
||||
break;
|
||||
case CV_USRTYPE1:
|
||||
searchParams->setString(name, (std::string) ip[i]["value"]);
|
||||
searchParams->setString(_name, (std::string) ip[i]["value"]);
|
||||
break;
|
||||
case CV_MAKETYPE(CV_USRTYPE1,2):
|
||||
searchParams->setBool(name, (int) ip[i]["value"] != 0);
|
||||
searchParams->setBool(_name, (int) ip[i]["value"] != 0);
|
||||
break;
|
||||
case CV_MAKETYPE(CV_USRTYPE1,3):
|
||||
searchParams->setAlgorithm((int) ip[i]["value"]);
|
||||
|
@@ -539,8 +539,8 @@ static void extractMSER_8UC1_Pass( int* ioptr,
|
||||
}
|
||||
*imgptr += 0x10000;
|
||||
}
|
||||
int i = (int)(imgptr-ioptr);
|
||||
ptsptr->pt = cvPoint( i&stepmask, i>>stepgap );
|
||||
int imsk = (int)(imgptr-ioptr);
|
||||
ptsptr->pt = cvPoint( imsk&stepmask, imsk>>stepgap );
|
||||
// get the current location
|
||||
accumulateMSERComp( comptr, ptsptr );
|
||||
ptsptr++;
|
||||
|
@@ -555,9 +555,9 @@ static inline float getScale(int level, int firstLevel, double scaleFactor)
|
||||
* @param detector_params parameters to use
|
||||
*/
|
||||
ORB::ORB(int _nfeatures, float _scaleFactor, int _nlevels, int _edgeThreshold,
|
||||
int _firstLevel, int WTA_K, int _scoreType, int _patchSize) :
|
||||
int _firstLevel, int _WTA_K, int _scoreType, int _patchSize) :
|
||||
nfeatures(_nfeatures), scaleFactor(_scaleFactor), nlevels(_nlevels),
|
||||
edgeThreshold(_edgeThreshold), firstLevel(_firstLevel), WTA_K(WTA_K),
|
||||
edgeThreshold(_edgeThreshold), firstLevel(_firstLevel), WTA_K(_WTA_K),
|
||||
scoreType(_scoreType), patchSize(_patchSize)
|
||||
{}
|
||||
|
||||
@@ -653,8 +653,8 @@ static void computeKeyPoints(const vector<Mat>& imagePyramid,
|
||||
|
||||
for (int level = 0; level < nlevels; ++level)
|
||||
{
|
||||
int nfeatures = nfeaturesPerLevel[level];
|
||||
allKeypoints[level].reserve(nfeatures*2);
|
||||
int featuresNum = nfeaturesPerLevel[level];
|
||||
allKeypoints[level].reserve(featuresNum*2);
|
||||
|
||||
vector<KeyPoint> & keypoints = allKeypoints[level];
|
||||
|
||||
@@ -668,14 +668,14 @@ static void computeKeyPoints(const vector<Mat>& imagePyramid,
|
||||
if( scoreType == ORB::HARRIS_SCORE )
|
||||
{
|
||||
// Keep more points than necessary as FAST does not give amazing corners
|
||||
KeyPointsFilter::retainBest(keypoints, 2 * nfeatures);
|
||||
KeyPointsFilter::retainBest(keypoints, 2 * featuresNum);
|
||||
|
||||
// Compute the Harris cornerness (better scoring than FAST)
|
||||
HarrisResponses(imagePyramid[level], keypoints, 7, HARRIS_K);
|
||||
}
|
||||
|
||||
//cull to the final desired level, using the new Harris scores or the original FAST scores.
|
||||
KeyPointsFilter::retainBest(keypoints, nfeatures);
|
||||
KeyPointsFilter::retainBest(keypoints, featuresNum);
|
||||
|
||||
float sf = getScale(level, firstLevel, scaleFactor);
|
||||
|
||||
@@ -738,7 +738,7 @@ void ORB::operator()( InputArray _image, InputArray _mask, vector<KeyPoint>& _ke
|
||||
if( image.type() != CV_8UC1 )
|
||||
cvtColor(_image, image, CV_BGR2GRAY);
|
||||
|
||||
int nlevels = this->nlevels;
|
||||
int levelsNum = this->nlevels;
|
||||
|
||||
if( !do_keypoints )
|
||||
{
|
||||
@@ -751,15 +751,15 @@ void ORB::operator()( InputArray _image, InputArray _mask, vector<KeyPoint>& _ke
|
||||
//
|
||||
// In short, ultimately the descriptor should
|
||||
// ignore octave parameter and deal only with the keypoint size.
|
||||
nlevels = 0;
|
||||
levelsNum = 0;
|
||||
for( size_t i = 0; i < _keypoints.size(); i++ )
|
||||
nlevels = std::max(nlevels, std::max(_keypoints[i].octave, 0));
|
||||
nlevels++;
|
||||
levelsNum = std::max(levelsNum, std::max(_keypoints[i].octave, 0));
|
||||
levelsNum++;
|
||||
}
|
||||
|
||||
// Pre-compute the scale pyramids
|
||||
vector<Mat> imagePyramid(nlevels), maskPyramid(nlevels);
|
||||
for (int level = 0; level < nlevels; ++level)
|
||||
vector<Mat> imagePyramid(levelsNum), maskPyramid(levelsNum);
|
||||
for (int level = 0; level < levelsNum; ++level)
|
||||
{
|
||||
float scale = 1/getScale(level, firstLevel, scaleFactor);
|
||||
Size sz(cvRound(image.cols*scale), cvRound(image.rows*scale));
|
||||
@@ -839,13 +839,13 @@ void ORB::operator()( InputArray _image, InputArray _mask, vector<KeyPoint>& _ke
|
||||
KeyPointsFilter::runByImageBorder(_keypoints, image.size(), edgeThreshold);
|
||||
|
||||
// Cluster the input keypoints depending on the level they were computed at
|
||||
allKeypoints.resize(nlevels);
|
||||
allKeypoints.resize(levelsNum);
|
||||
for (vector<KeyPoint>::iterator keypoint = _keypoints.begin(),
|
||||
keypointEnd = _keypoints.end(); keypoint != keypointEnd; ++keypoint)
|
||||
allKeypoints[keypoint->octave].push_back(*keypoint);
|
||||
|
||||
// Make sure we rescale the coordinates
|
||||
for (int level = 0; level < nlevels; ++level)
|
||||
for (int level = 0; level < levelsNum; ++level)
|
||||
{
|
||||
if (level == firstLevel)
|
||||
continue;
|
||||
@@ -864,7 +864,7 @@ void ORB::operator()( InputArray _image, InputArray _mask, vector<KeyPoint>& _ke
|
||||
if( do_descriptors )
|
||||
{
|
||||
int nkeypoints = 0;
|
||||
for (int level = 0; level < nlevels; ++level)
|
||||
for (int level = 0; level < levelsNum; ++level)
|
||||
nkeypoints += (int)allKeypoints[level].size();
|
||||
if( nkeypoints == 0 )
|
||||
_descriptors.release();
|
||||
@@ -897,7 +897,7 @@ void ORB::operator()( InputArray _image, InputArray _mask, vector<KeyPoint>& _ke
|
||||
|
||||
_keypoints.clear();
|
||||
int offset = 0;
|
||||
for (int level = 0; level < nlevels; ++level)
|
||||
for (int level = 0; level < levelsNum; ++level)
|
||||
{
|
||||
// Get the features and compute their orientation
|
||||
vector<KeyPoint>& keypoints = allKeypoints[level];
|
||||
|
@@ -43,10 +43,6 @@
|
||||
#ifndef __OPENCV_PRECOMP_H__
|
||||
#define __OPENCV_PRECOMP_H__
|
||||
|
||||
#if _MSC_VER >= 1200
|
||||
#pragma warning( disable: 4251 4512 4710 4711 4514 4996 )
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CVCONFIG_H
|
||||
#include "cvconfig.h"
|
||||
#endif
|
||||
|
@@ -48,13 +48,13 @@ static void
|
||||
computeIntegralImages( const Mat& matI, Mat& matS, Mat& matT, Mat& _FT )
|
||||
{
|
||||
CV_Assert( matI.type() == CV_8U );
|
||||
|
||||
|
||||
int x, y, rows = matI.rows, cols = matI.cols;
|
||||
|
||||
|
||||
matS.create(rows + 1, cols + 1, CV_32S);
|
||||
matT.create(rows + 1, cols + 1, CV_32S);
|
||||
_FT.create(rows + 1, cols + 1, CV_32S);
|
||||
|
||||
|
||||
const uchar* I = matI.ptr<uchar>();
|
||||
int *S = matS.ptr<int>(), *T = matT.ptr<int>(), *FT = _FT.ptr<int>();
|
||||
int istep = (int)matI.step, step = (int)(matS.step/sizeof(S[0]));
|
||||
@@ -121,29 +121,28 @@ StarDetectorComputeResponses( const Mat& img, Mat& responses, Mat& sizes, int ma
|
||||
StarFeature f[MAX_PATTERN];
|
||||
|
||||
Mat sum, tilted, flatTilted;
|
||||
int y, i=0, rows = img.rows, cols = img.cols;
|
||||
int y, rows = img.rows, cols = img.cols;
|
||||
int border, npatterns=0, maxIdx=0;
|
||||
|
||||
CV_Assert( img.type() == CV_8UC1 );
|
||||
|
||||
|
||||
responses.create( img.size(), CV_32F );
|
||||
sizes.create( img.size(), CV_16S );
|
||||
|
||||
while( pairs[i][0] >= 0 && !
|
||||
( sizes0[pairs[i][0]] >= maxSize
|
||||
|| sizes0[pairs[i+1][0]] + sizes0[pairs[i+1][0]]/2 >= std::min(rows, cols) ) )
|
||||
while( pairs[npatterns][0] >= 0 && !
|
||||
( sizes0[pairs[npatterns][0]] >= maxSize
|
||||
|| sizes0[pairs[npatterns+1][0]] + sizes0[pairs[npatterns+1][0]]/2 >= std::min(rows, cols) ) )
|
||||
{
|
||||
++i;
|
||||
++npatterns;
|
||||
}
|
||||
|
||||
npatterns = i;
|
||||
|
||||
npatterns += (pairs[npatterns-1][0] >= 0);
|
||||
maxIdx = pairs[npatterns-1][0];
|
||||
|
||||
|
||||
computeIntegralImages( img, sum, tilted, flatTilted );
|
||||
int step = (int)(sum.step/sum.elemSize());
|
||||
|
||||
for( i = 0; i <= maxIdx; i++ )
|
||||
for(int i = 0; i <= maxIdx; i++ )
|
||||
{
|
||||
int ur_size = sizes0[i], t_size = sizes0[i] + sizes0[i]/2;
|
||||
int ur_area = (2*ur_size + 1)*(2*ur_size + 1);
|
||||
@@ -169,24 +168,24 @@ StarDetectorComputeResponses( const Mat& img, Mat& responses, Mat& sizes, int ma
|
||||
sizes1[maxIdx] = -sizes1[maxIdx];
|
||||
border = sizes0[maxIdx] + sizes0[maxIdx]/2;
|
||||
|
||||
for( i = 0; i < npatterns; i++ )
|
||||
for(int i = 0; i < npatterns; i++ )
|
||||
{
|
||||
int innerArea = f[pairs[i][1]].area;
|
||||
int outerArea = f[pairs[i][0]].area - innerArea;
|
||||
invSizes[i][0] = 1.f/outerArea;
|
||||
invSizes[i][1] = 1.f/innerArea;
|
||||
}
|
||||
|
||||
|
||||
#if CV_SSE2
|
||||
if( useSIMD )
|
||||
{
|
||||
for( i = 0; i < npatterns; i++ )
|
||||
for(int i = 0; i < npatterns; i++ )
|
||||
{
|
||||
_mm_store_ps((float*)&invSizes4[i][0], _mm_set1_ps(invSizes[i][0]));
|
||||
_mm_store_ps((float*)&invSizes4[i][1], _mm_set1_ps(invSizes[i][1]));
|
||||
}
|
||||
|
||||
for( i = 0; i <= maxIdx; i++ )
|
||||
for(int i = 0; i <= maxIdx; i++ )
|
||||
_mm_store_ps((float*)&sizes1_4[i], _mm_set1_ps((float)sizes1[i]));
|
||||
}
|
||||
#endif
|
||||
@@ -197,7 +196,7 @@ StarDetectorComputeResponses( const Mat& img, Mat& responses, Mat& sizes, int ma
|
||||
float* r_ptr2 = responses.ptr<float>(rows - 1 - y);
|
||||
short* s_ptr = sizes.ptr<short>(y);
|
||||
short* s_ptr2 = sizes.ptr<short>(rows - 1 - y);
|
||||
|
||||
|
||||
memset( r_ptr, 0, cols*sizeof(r_ptr[0]));
|
||||
memset( r_ptr2, 0, cols*sizeof(r_ptr2[0]));
|
||||
memset( s_ptr, 0, cols*sizeof(s_ptr[0]));
|
||||
@@ -206,10 +205,10 @@ StarDetectorComputeResponses( const Mat& img, Mat& responses, Mat& sizes, int ma
|
||||
|
||||
for( y = border; y < rows - border; y++ )
|
||||
{
|
||||
int x = border, i;
|
||||
int x = border;
|
||||
float* r_ptr = responses.ptr<float>(y);
|
||||
short* s_ptr = sizes.ptr<short>(y);
|
||||
|
||||
|
||||
memset( r_ptr, 0, border*sizeof(r_ptr[0]));
|
||||
memset( s_ptr, 0, border*sizeof(s_ptr[0]));
|
||||
memset( r_ptr + cols - border, 0, border*sizeof(r_ptr[0]));
|
||||
@@ -226,7 +225,7 @@ StarDetectorComputeResponses( const Mat& img, Mat& responses, Mat& sizes, int ma
|
||||
__m128 bestResponse = _mm_setzero_ps();
|
||||
__m128 bestSize = _mm_setzero_ps();
|
||||
|
||||
for( i = 0; i <= maxIdx; i++ )
|
||||
for(int i = 0; i <= maxIdx; i++ )
|
||||
{
|
||||
const int** p = (const int**)&f[i].p[0];
|
||||
__m128i r0 = _mm_sub_epi32(_mm_loadu_si128((const __m128i*)(p[0]+ofs)),
|
||||
@@ -241,7 +240,7 @@ StarDetectorComputeResponses( const Mat& img, Mat& responses, Mat& sizes, int ma
|
||||
_mm_store_ps((float*)&vals[i], _mm_cvtepi32_ps(r0));
|
||||
}
|
||||
|
||||
for( i = 0; i < npatterns; i++ )
|
||||
for(int i = 0; i < npatterns; i++ )
|
||||
{
|
||||
__m128 inner_sum = vals[pairs[i][1]];
|
||||
__m128 outer_sum = _mm_sub_ps(vals[pairs[i][0]], inner_sum);
|
||||
@@ -260,7 +259,7 @@ StarDetectorComputeResponses( const Mat& img, Mat& responses, Mat& sizes, int ma
|
||||
_mm_packs_epi32(_mm_cvtps_epi32(bestSize),_mm_setzero_si128()));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
for( ; x < cols - border; x++ )
|
||||
{
|
||||
int ofs = y*step + x;
|
||||
@@ -268,13 +267,13 @@ StarDetectorComputeResponses( const Mat& img, Mat& responses, Mat& sizes, int ma
|
||||
float bestResponse = 0;
|
||||
int bestSize = 0;
|
||||
|
||||
for( i = 0; i <= maxIdx; i++ )
|
||||
for(int i = 0; i <= maxIdx; i++ )
|
||||
{
|
||||
const int** p = (const int**)&f[i].p[0];
|
||||
vals[i] = p[0][ofs] - p[1][ofs] - p[2][ofs] + p[3][ofs] +
|
||||
p[4][ofs] - p[5][ofs] - p[6][ofs] + p[7][ofs];
|
||||
}
|
||||
for( i = 0; i < npatterns; i++ )
|
||||
for(int i = 0; i < npatterns; i++ )
|
||||
{
|
||||
int inner_sum = vals[pairs[i][1]];
|
||||
int outer_sum = vals[pairs[i][0]] - inner_sum;
|
||||
@@ -306,7 +305,7 @@ static bool StarDetectorSuppressLines( const Mat& responses, const Mat& sizes, P
|
||||
int x, y, delta = sz/4, radius = delta*4;
|
||||
float Lxx = 0, Lyy = 0, Lxy = 0;
|
||||
int Lxxb = 0, Lyyb = 0, Lxyb = 0;
|
||||
|
||||
|
||||
for( y = pt.y - radius; y <= pt.y + radius; y += delta )
|
||||
for( x = pt.x - radius; x <= pt.x + radius; x += delta )
|
||||
{
|
||||
@@ -314,7 +313,7 @@ static bool StarDetectorSuppressLines( const Mat& responses, const Mat& sizes, P
|
||||
float Ly = r_ptr[(y+1)*rstep + x] - r_ptr[(y-1)*rstep + x];
|
||||
Lxx += Lx*Lx; Lyy += Ly*Ly; Lxy += Lx*Ly;
|
||||
}
|
||||
|
||||
|
||||
if( (Lxx + Lyy)*(Lxx + Lyy) >= lineThresholdProjected*(Lxx*Lyy - Lxy*Lxy) )
|
||||
return true;
|
||||
|
||||
@@ -415,7 +414,7 @@ StarDetectorSuppressNonmax( const Mat& responses, const Mat& sizes,
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
StarDetector::StarDetector(int _maxSize, int _responseThreshold,
|
||||
int _lineThresholdProjected,
|
||||
int _lineThresholdBinarized,
|
||||
@@ -431,10 +430,10 @@ void StarDetector::detectImpl( const Mat& image, vector<KeyPoint>& keypoints, co
|
||||
{
|
||||
Mat grayImage = image;
|
||||
if( image.type() != CV_8U ) cvtColor( image, grayImage, CV_BGR2GRAY );
|
||||
|
||||
|
||||
(*this)(grayImage, keypoints);
|
||||
KeyPointsFilter::runByPixelsMask( keypoints, mask );
|
||||
}
|
||||
}
|
||||
|
||||
void StarDetector::operator()(const Mat& img, vector<KeyPoint>& keypoints) const
|
||||
{
|
||||
@@ -446,5 +445,5 @@ void StarDetector::operator()(const Mat& img, vector<KeyPoint>& keypoints) const
|
||||
responseThreshold, lineThresholdProjected,
|
||||
lineThresholdBinarized, suppressNonmaxSize );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -493,23 +493,6 @@ private:
|
||||
CV_DescriptorExtractorTest& operator=(const CV_DescriptorExtractorTest&) { return *this; }
|
||||
};
|
||||
|
||||
/*template<typename T, typename Distance>
|
||||
class CV_CalonderDescriptorExtractorTest : public CV_DescriptorExtractorTest<Distance>
|
||||
{
|
||||
public:
|
||||
CV_CalonderDescriptorExtractorTest( const char* testName, float _normDif, float _prevTime ) :
|
||||
CV_DescriptorExtractorTest<Distance>( testName, _normDif, Ptr<DescriptorExtractor>(), _prevTime )
|
||||
{}
|
||||
|
||||
protected:
|
||||
virtual void createDescriptorExtractor()
|
||||
{
|
||||
CV_DescriptorExtractorTest<Distance>::dextractor =
|
||||
new CalonderDescriptorExtractor<T>( string(CV_DescriptorExtractorTest<Distance>::ts->get_data_path()) +
|
||||
FEATURES2D_DIR + "/calonder_classifier.rtc");
|
||||
}
|
||||
};*/
|
||||
|
||||
/****************************************************************************************\
|
||||
* Algorithmic tests for descriptor matchers *
|
||||
\****************************************************************************************/
|
||||
@@ -928,7 +911,7 @@ void CV_DescriptorMatcherTest::radiusMatchTest( const Mat& query, const Mat& tra
|
||||
|
||||
dmatcher->radiusMatch( query, matches, radius, masks );
|
||||
|
||||
int curRes = cvtest::TS::OK;
|
||||
//int curRes = cvtest::TS::OK;
|
||||
if( (int)matches.size() != queryDescCount )
|
||||
{
|
||||
ts->printf(cvtest::TS::LOG, "Incorrect matches count while test radiusMatch() function (1).\n");
|
||||
@@ -968,7 +951,7 @@ void CV_DescriptorMatcherTest::radiusMatchTest( const Mat& query, const Mat& tra
|
||||
}
|
||||
if( (float)badCount > (float)queryDescCount*badPart )
|
||||
{
|
||||
curRes = cvtest::TS::FAIL_INVALID_OUTPUT;
|
||||
//curRes = cvtest::TS::FAIL_INVALID_OUTPUT;
|
||||
ts->printf( cvtest::TS::LOG, "%f - too large bad matches part while test radiusMatch() function (2).\n",
|
||||
(float)badCount/(float)queryDescCount );
|
||||
ts->set_failed_test_info( cvtest::TS::FAIL_BAD_ACCURACY );
|
||||
@@ -1059,24 +1042,6 @@ TEST( Features2d_DescriptorExtractor_BRIEF, regression )
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
#if CV_SSE2
|
||||
TEST( Features2d_DescriptorExtractor_Calonder_uchar, regression )
|
||||
{
|
||||
CV_CalonderDescriptorExtractorTest<uchar, L2<uchar> > test( "descriptor-calonder-uchar",
|
||||
std::numeric_limits<float>::epsilon() + 1,
|
||||
0.0132175f );
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
TEST( Features2d_DescriptorExtractor_Calonder_float, regression )
|
||||
{
|
||||
CV_CalonderDescriptorExtractorTest<float, L2<float> > test( "descriptor-calonder-float",
|
||||
std::numeric_limits<float>::epsilon(),
|
||||
0.0221308f );
|
||||
test.safe_run();
|
||||
}
|
||||
#endif // CV_SSE2
|
||||
|
||||
/*
|
||||
* Matchers
|
||||
*/
|
||||
|
@@ -1,3 +1,7 @@
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC diagnostic ignored "-Wmissing-declarations"
|
||||
#endif
|
||||
|
||||
#ifndef __OPENCV_TEST_PRECOMP_HPP__
|
||||
#define __OPENCV_TEST_PRECOMP_HPP__
|
||||
|
||||
|
Reference in New Issue
Block a user