Commit 1eacb485 authored by Roman Donchenko's avatar Roman Donchenko

Boring changes - features2d.

parent bd70a033
...@@ -646,7 +646,7 @@ public: ...@@ -646,7 +646,7 @@ public:
* gridRows Grid rows count. * gridRows Grid rows count.
* gridCols Grid column count. * gridCols Grid column count.
*/ */
CV_WRAP GridAdaptedFeatureDetector( const Ptr<FeatureDetector>& detector=0, CV_WRAP GridAdaptedFeatureDetector( const Ptr<FeatureDetector>& detector=Ptr<FeatureDetector>(),
int maxTotalKeypoints=1000, int maxTotalKeypoints=1000,
int gridRows=4, int gridCols=4 ); int gridRows=4, int gridCols=4 );
...@@ -1143,8 +1143,8 @@ protected: ...@@ -1143,8 +1143,8 @@ protected:
class CV_EXPORTS_W FlannBasedMatcher : public DescriptorMatcher class CV_EXPORTS_W FlannBasedMatcher : public DescriptorMatcher
{ {
public: public:
CV_WRAP FlannBasedMatcher( const Ptr<flann::IndexParams>& indexParams=new flann::KDTreeIndexParams(), CV_WRAP FlannBasedMatcher( const Ptr<flann::IndexParams>& indexParams=makePtr<flann::KDTreeIndexParams>(),
const Ptr<flann::SearchParams>& searchParams=new flann::SearchParams() ); const Ptr<flann::SearchParams>& searchParams=makePtr<flann::SearchParams>() );
virtual void add( const std::vector<Mat>& descriptors ); virtual void add( const std::vector<Mat>& descriptors );
virtual void clear(); virtual void clear();
......
...@@ -2003,7 +2003,7 @@ BriskLayer::BriskLayer(const cv::Mat& img_in, float scale_in, float offset_in) ...@@ -2003,7 +2003,7 @@ BriskLayer::BriskLayer(const cv::Mat& img_in, float scale_in, float offset_in)
scale_ = scale_in; scale_ = scale_in;
offset_ = offset_in; offset_ = offset_in;
// create an agast detector // create an agast detector
fast_9_16_ = new FastFeatureDetector(1, true, FastFeatureDetector::TYPE_9_16); fast_9_16_ = makePtr<FastFeatureDetector>(1, true, FastFeatureDetector::TYPE_9_16);
makeOffsets(pixel_5_8_, (int)img_.step, 8); makeOffsets(pixel_5_8_, (int)img_.step, 8);
makeOffsets(pixel_9_16_, (int)img_.step, 16); makeOffsets(pixel_9_16_, (int)img_.step, 16);
} }
...@@ -2025,7 +2025,7 @@ BriskLayer::BriskLayer(const BriskLayer& layer, int mode) ...@@ -2025,7 +2025,7 @@ BriskLayer::BriskLayer(const BriskLayer& layer, int mode)
offset_ = 0.5f * scale_ - 0.5f; offset_ = 0.5f * scale_ - 0.5f;
} }
scores_ = cv::Mat::zeros(img_.rows, img_.cols, CV_8U); scores_ = cv::Mat::zeros(img_.rows, img_.cols, CV_8U);
fast_9_16_ = new FastFeatureDetector(1, false, FastFeatureDetector::TYPE_9_16); fast_9_16_ = makePtr<FastFeatureDetector>(1, false, FastFeatureDetector::TYPE_9_16);
makeOffsets(pixel_5_8_, (int)img_.step, 8); makeOffsets(pixel_5_8_, (int)img_.step, 8);
makeOffsets(pixel_9_16_, (int)img_.step, 16); makeOffsets(pixel_9_16_, (int)img_.step, 16);
} }
......
...@@ -99,7 +99,7 @@ Ptr<DescriptorExtractor> DescriptorExtractor::create(const String& descriptorExt ...@@ -99,7 +99,7 @@ Ptr<DescriptorExtractor> DescriptorExtractor::create(const String& descriptorExt
{ {
size_t pos = String("Opponent").size(); size_t pos = String("Opponent").size();
String type = descriptorExtractorType.substr(pos); String type = descriptorExtractorType.substr(pos);
return new OpponentColorDescriptorExtractor(DescriptorExtractor::create(type)); return makePtr<OpponentColorDescriptorExtractor>(DescriptorExtractor::create(type));
} }
return Algorithm::create<DescriptorExtractor>("Feature2D." + descriptorExtractorType); return Algorithm::create<DescriptorExtractor>("Feature2D." + descriptorExtractorType);
...@@ -119,7 +119,7 @@ CV_WRAP void Feature2D::compute( const Mat& image, CV_OUT CV_IN_OUT std::vector< ...@@ -119,7 +119,7 @@ CV_WRAP void Feature2D::compute( const Mat& image, CV_OUT CV_IN_OUT std::vector<
OpponentColorDescriptorExtractor::OpponentColorDescriptorExtractor( const Ptr<DescriptorExtractor>& _descriptorExtractor ) : OpponentColorDescriptorExtractor::OpponentColorDescriptorExtractor( const Ptr<DescriptorExtractor>& _descriptorExtractor ) :
descriptorExtractor(_descriptorExtractor) descriptorExtractor(_descriptorExtractor)
{ {
CV_Assert( !descriptorExtractor.empty() ); CV_Assert( descriptorExtractor );
} }
static void convertBGRImageToOpponentColorSpace( const Mat& bgrImage, std::vector<Mat>& opponentChannels ) static void convertBGRImageToOpponentColorSpace( const Mat& bgrImage, std::vector<Mat>& opponentChannels )
...@@ -249,7 +249,7 @@ int OpponentColorDescriptorExtractor::descriptorType() const ...@@ -249,7 +249,7 @@ int OpponentColorDescriptorExtractor::descriptorType() const
bool OpponentColorDescriptorExtractor::empty() const bool OpponentColorDescriptorExtractor::empty() const
{ {
return descriptorExtractor.empty() || (DescriptorExtractor*)(descriptorExtractor)->empty(); return !descriptorExtractor || descriptorExtractor->empty();
} }
} }
...@@ -90,19 +90,19 @@ Ptr<FeatureDetector> FeatureDetector::create( const String& detectorType ) ...@@ -90,19 +90,19 @@ Ptr<FeatureDetector> FeatureDetector::create( const String& detectorType )
{ {
if( detectorType.find("Grid") == 0 ) if( detectorType.find("Grid") == 0 )
{ {
return new GridAdaptedFeatureDetector(FeatureDetector::create( return makePtr<GridAdaptedFeatureDetector>(FeatureDetector::create(
detectorType.substr(strlen("Grid")))); detectorType.substr(strlen("Grid"))));
} }
if( detectorType.find("Pyramid") == 0 ) if( detectorType.find("Pyramid") == 0 )
{ {
return new PyramidAdaptedFeatureDetector(FeatureDetector::create( return makePtr<PyramidAdaptedFeatureDetector>(FeatureDetector::create(
detectorType.substr(strlen("Pyramid")))); detectorType.substr(strlen("Pyramid"))));
} }
if( detectorType.find("Dynamic") == 0 ) if( detectorType.find("Dynamic") == 0 )
{ {
return new DynamicAdaptedFeatureDetector(AdjusterAdapter::create( return makePtr<DynamicAdaptedFeatureDetector>(AdjusterAdapter::create(
detectorType.substr(strlen("Dynamic")))); detectorType.substr(strlen("Dynamic"))));
} }
...@@ -190,7 +190,7 @@ GridAdaptedFeatureDetector::GridAdaptedFeatureDetector( const Ptr<FeatureDetecto ...@@ -190,7 +190,7 @@ GridAdaptedFeatureDetector::GridAdaptedFeatureDetector( const Ptr<FeatureDetecto
bool GridAdaptedFeatureDetector::empty() const bool GridAdaptedFeatureDetector::empty() const
{ {
return detector.empty() || (FeatureDetector*)detector->empty(); return !detector || detector->empty();
} }
struct ResponseComparator struct ResponseComparator
...@@ -295,7 +295,7 @@ PyramidAdaptedFeatureDetector::PyramidAdaptedFeatureDetector( const Ptr<FeatureD ...@@ -295,7 +295,7 @@ PyramidAdaptedFeatureDetector::PyramidAdaptedFeatureDetector( const Ptr<FeatureD
bool PyramidAdaptedFeatureDetector::empty() const bool PyramidAdaptedFeatureDetector::empty() const
{ {
return detector.empty() || (FeatureDetector*)detector->empty(); return !detector || detector->empty();
} }
void PyramidAdaptedFeatureDetector::detectImpl( const Mat& image, std::vector<KeyPoint>& keypoints, const Mat& mask ) const void PyramidAdaptedFeatureDetector::detectImpl( const Mat& image, std::vector<KeyPoint>& keypoints, const Mat& mask ) const
......
...@@ -51,7 +51,7 @@ DynamicAdaptedFeatureDetector::DynamicAdaptedFeatureDetector(const Ptr<AdjusterA ...@@ -51,7 +51,7 @@ DynamicAdaptedFeatureDetector::DynamicAdaptedFeatureDetector(const Ptr<AdjusterA
bool DynamicAdaptedFeatureDetector::empty() const bool DynamicAdaptedFeatureDetector::empty() const
{ {
return adjuster_.empty() || adjuster_->empty(); return !adjuster_ || adjuster_->empty();
} }
void DynamicAdaptedFeatureDetector::detectImpl(const Mat& image, std::vector<KeyPoint>& keypoints, const Mat& mask) const void DynamicAdaptedFeatureDetector::detectImpl(const Mat& image, std::vector<KeyPoint>& keypoints, const Mat& mask) const
...@@ -124,7 +124,7 @@ bool FastAdjuster::good() const ...@@ -124,7 +124,7 @@ bool FastAdjuster::good() const
Ptr<AdjusterAdapter> FastAdjuster::clone() const Ptr<AdjusterAdapter> FastAdjuster::clone() const
{ {
Ptr<AdjusterAdapter> cloned_obj = new FastAdjuster( init_thresh_, nonmax_, min_thresh_, max_thresh_ ); Ptr<AdjusterAdapter> cloned_obj(new FastAdjuster( init_thresh_, nonmax_, min_thresh_, max_thresh_ ));
return cloned_obj; return cloned_obj;
} }
...@@ -158,7 +158,7 @@ bool StarAdjuster::good() const ...@@ -158,7 +158,7 @@ bool StarAdjuster::good() const
Ptr<AdjusterAdapter> StarAdjuster::clone() const Ptr<AdjusterAdapter> StarAdjuster::clone() const
{ {
Ptr<AdjusterAdapter> cloned_obj = new StarAdjuster( init_thresh_, min_thresh_, max_thresh_ ); Ptr<AdjusterAdapter> cloned_obj(new StarAdjuster( init_thresh_, min_thresh_, max_thresh_ ));
return cloned_obj; return cloned_obj;
} }
...@@ -195,7 +195,7 @@ bool SurfAdjuster::good() const ...@@ -195,7 +195,7 @@ bool SurfAdjuster::good() const
Ptr<AdjusterAdapter> SurfAdjuster::clone() const Ptr<AdjusterAdapter> SurfAdjuster::clone() const
{ {
Ptr<AdjusterAdapter> cloned_obj = new SurfAdjuster( init_thresh_, min_thresh_, max_thresh_ ); Ptr<AdjusterAdapter> cloned_obj(new SurfAdjuster( init_thresh_, min_thresh_, max_thresh_ ));
return cloned_obj; return cloned_obj;
} }
...@@ -205,15 +205,15 @@ Ptr<AdjusterAdapter> AdjusterAdapter::create( const String& detectorType ) ...@@ -205,15 +205,15 @@ Ptr<AdjusterAdapter> AdjusterAdapter::create( const String& detectorType )
if( !detectorType.compare( "FAST" ) ) if( !detectorType.compare( "FAST" ) )
{ {
adapter = new FastAdjuster(); adapter = makePtr<FastAdjuster>();
} }
else if( !detectorType.compare( "STAR" ) ) else if( !detectorType.compare( "STAR" ) )
{ {
adapter = new StarAdjuster(); adapter = makePtr<StarAdjuster>();
} }
else if( !detectorType.compare( "SURF" ) ) else if( !detectorType.compare( "SURF" ) )
{ {
adapter = new SurfAdjuster(); adapter = makePtr<SurfAdjuster>();
} }
return adapter; return adapter;
......
...@@ -461,7 +461,7 @@ void cv::evaluateFeatureDetector( const Mat& img1, const Mat& img2, const Mat& H ...@@ -461,7 +461,7 @@ void cv::evaluateFeatureDetector( const Mat& img1, const Mat& img2, const Mat& H
keypoints1 = _keypoints1 != 0 ? _keypoints1 : &buf1; keypoints1 = _keypoints1 != 0 ? _keypoints1 : &buf1;
keypoints2 = _keypoints2 != 0 ? _keypoints2 : &buf2; keypoints2 = _keypoints2 != 0 ? _keypoints2 : &buf2;
if( (keypoints1->empty() || keypoints2->empty()) && fdetector.empty() ) if( (keypoints1->empty() || keypoints2->empty()) && !fdetector )
CV_Error( Error::StsBadArg, "fdetector must not be empty when keypoints1 or keypoints2 is empty" ); CV_Error( Error::StsBadArg, "fdetector must not be empty when keypoints1 or keypoints2 is empty" );
if( keypoints1->empty() ) if( keypoints1->empty() )
...@@ -575,7 +575,7 @@ void cv::evaluateGenericDescriptorMatcher( const Mat& img1, const Mat& img2, con ...@@ -575,7 +575,7 @@ void cv::evaluateGenericDescriptorMatcher( const Mat& img1, const Mat& img2, con
if( keypoints1.empty() ) if( keypoints1.empty() )
CV_Error( Error::StsBadArg, "keypoints1 must not be empty" ); CV_Error( Error::StsBadArg, "keypoints1 must not be empty" );
if( matches1to2->empty() && dmatcher.empty() ) if( matches1to2->empty() && !dmatcher )
CV_Error( Error::StsBadArg, "dmatch must not be empty when matches1to2 is empty" ); CV_Error( Error::StsBadArg, "dmatch must not be empty when matches1to2 is empty" );
bool computeKeypoints2ByPrj = keypoints2.empty(); bool computeKeypoints2ByPrj = keypoints2.empty();
......
...@@ -326,7 +326,7 @@ BFMatcher::BFMatcher( int _normType, bool _crossCheck ) ...@@ -326,7 +326,7 @@ BFMatcher::BFMatcher( int _normType, bool _crossCheck )
Ptr<DescriptorMatcher> BFMatcher::clone( bool emptyTrainData ) const Ptr<DescriptorMatcher> BFMatcher::clone( bool emptyTrainData ) const
{ {
BFMatcher* matcher = new BFMatcher(normType, crossCheck); Ptr<BFMatcher> matcher = makePtr<BFMatcher>(normType, crossCheck);
if( !emptyTrainData ) if( !emptyTrainData )
{ {
matcher->trainDescCollection.resize(trainDescCollection.size()); matcher->trainDescCollection.resize(trainDescCollection.size());
...@@ -458,31 +458,31 @@ void BFMatcher::radiusMatchImpl( const Mat& queryDescriptors, std::vector<std::v ...@@ -458,31 +458,31 @@ void BFMatcher::radiusMatchImpl( const Mat& queryDescriptors, std::vector<std::v
*/ */
Ptr<DescriptorMatcher> DescriptorMatcher::create( const String& descriptorMatcherType ) Ptr<DescriptorMatcher> DescriptorMatcher::create( const String& descriptorMatcherType )
{ {
DescriptorMatcher* dm = 0; Ptr<DescriptorMatcher> dm;
if( !descriptorMatcherType.compare( "FlannBased" ) ) if( !descriptorMatcherType.compare( "FlannBased" ) )
{ {
dm = new FlannBasedMatcher(); dm = makePtr<FlannBasedMatcher>();
} }
else if( !descriptorMatcherType.compare( "BruteForce" ) ) // L2 else if( !descriptorMatcherType.compare( "BruteForce" ) ) // L2
{ {
dm = new BFMatcher(NORM_L2); dm = makePtr<BFMatcher>(int(NORM_L2)); // anonymous enums can't be template parameters
} }
else if( !descriptorMatcherType.compare( "BruteForce-SL2" ) ) // Squared L2 else if( !descriptorMatcherType.compare( "BruteForce-SL2" ) ) // Squared L2
{ {
dm = new BFMatcher(NORM_L2SQR); dm = makePtr<BFMatcher>(int(NORM_L2SQR));
} }
else if( !descriptorMatcherType.compare( "BruteForce-L1" ) ) else if( !descriptorMatcherType.compare( "BruteForce-L1" ) )
{ {
dm = new BFMatcher(NORM_L1); dm = makePtr<BFMatcher>(int(NORM_L1));
} }
else if( !descriptorMatcherType.compare("BruteForce-Hamming") || else if( !descriptorMatcherType.compare("BruteForce-Hamming") ||
!descriptorMatcherType.compare("BruteForce-HammingLUT") ) !descriptorMatcherType.compare("BruteForce-HammingLUT") )
{ {
dm = new BFMatcher(NORM_HAMMING); dm = makePtr<BFMatcher>(int(NORM_HAMMING));
} }
else if( !descriptorMatcherType.compare("BruteForce-Hamming(2)") ) else if( !descriptorMatcherType.compare("BruteForce-Hamming(2)") )
{ {
dm = new BFMatcher(NORM_HAMMING2); dm = makePtr<BFMatcher>(int(NORM_HAMMING2));
} }
else else
CV_Error( Error::StsBadArg, "Unknown matcher name" ); CV_Error( Error::StsBadArg, "Unknown matcher name" );
...@@ -497,8 +497,8 @@ Ptr<DescriptorMatcher> DescriptorMatcher::create( const String& descriptorMatche ...@@ -497,8 +497,8 @@ Ptr<DescriptorMatcher> DescriptorMatcher::create( const String& descriptorMatche
FlannBasedMatcher::FlannBasedMatcher( const Ptr<flann::IndexParams>& _indexParams, const Ptr<flann::SearchParams>& _searchParams ) FlannBasedMatcher::FlannBasedMatcher( const Ptr<flann::IndexParams>& _indexParams, const Ptr<flann::SearchParams>& _searchParams )
: indexParams(_indexParams), searchParams(_searchParams), addedDescCount(0) : indexParams(_indexParams), searchParams(_searchParams), addedDescCount(0)
{ {
CV_Assert( !_indexParams.empty() ); CV_Assert( _indexParams );
CV_Assert( !_searchParams.empty() ); CV_Assert( _searchParams );
} }
void FlannBasedMatcher::add( const std::vector<Mat>& descriptors ) void FlannBasedMatcher::add( const std::vector<Mat>& descriptors )
...@@ -522,17 +522,17 @@ void FlannBasedMatcher::clear() ...@@ -522,17 +522,17 @@ void FlannBasedMatcher::clear()
void FlannBasedMatcher::train() void FlannBasedMatcher::train()
{ {
if( flannIndex.empty() || mergedDescriptors.size() < addedDescCount ) if( !flannIndex || mergedDescriptors.size() < addedDescCount )
{ {
mergedDescriptors.set( trainDescCollection ); mergedDescriptors.set( trainDescCollection );
flannIndex = new flann::Index( mergedDescriptors.getDescriptors(), *indexParams ); flannIndex = makePtr<flann::Index>( mergedDescriptors.getDescriptors(), *indexParams );
} }
} }
void FlannBasedMatcher::read( const FileNode& fn) void FlannBasedMatcher::read( const FileNode& fn)
{ {
if (indexParams.empty()) if (!indexParams)
indexParams = new flann::IndexParams(); indexParams = makePtr<flann::IndexParams>();
FileNode ip = fn["indexParams"]; FileNode ip = fn["indexParams"];
CV_Assert(ip.type() == FileNode::SEQ); CV_Assert(ip.type() == FileNode::SEQ);
...@@ -570,8 +570,8 @@ void FlannBasedMatcher::read( const FileNode& fn) ...@@ -570,8 +570,8 @@ void FlannBasedMatcher::read( const FileNode& fn)
}; };
} }
if (searchParams.empty()) if (!searchParams)
searchParams = new flann::SearchParams(); searchParams = makePtr<flann::SearchParams>();
FileNode sp = fn["searchParams"]; FileNode sp = fn["searchParams"];
CV_Assert(sp.type() == FileNode::SEQ); CV_Assert(sp.type() == FileNode::SEQ);
...@@ -725,7 +725,7 @@ bool FlannBasedMatcher::isMaskSupported() const ...@@ -725,7 +725,7 @@ bool FlannBasedMatcher::isMaskSupported() const
Ptr<DescriptorMatcher> FlannBasedMatcher::clone( bool emptyTrainData ) const Ptr<DescriptorMatcher> FlannBasedMatcher::clone( bool emptyTrainData ) const
{ {
FlannBasedMatcher* matcher = new FlannBasedMatcher(indexParams, searchParams); Ptr<FlannBasedMatcher> matcher = makePtr<FlannBasedMatcher>(indexParams, searchParams);
if( !emptyTrainData ) if( !emptyTrainData )
{ {
CV_Error( Error::StsNotImplemented, "deep clone functionality is not implemented, because " CV_Error( Error::StsNotImplemented, "deep clone functionality is not implemented, because "
...@@ -1066,7 +1066,7 @@ Ptr<GenericDescriptorMatcher> GenericDescriptorMatcher::create( const String& ge ...@@ -1066,7 +1066,7 @@ Ptr<GenericDescriptorMatcher> GenericDescriptorMatcher::create( const String& ge
Ptr<GenericDescriptorMatcher> descriptorMatcher = Ptr<GenericDescriptorMatcher> descriptorMatcher =
Algorithm::create<GenericDescriptorMatcher>("DescriptorMatcher." + genericDescritptorMatcherType); Algorithm::create<GenericDescriptorMatcher>("DescriptorMatcher." + genericDescritptorMatcherType);
if( !paramsFilename.empty() && !descriptorMatcher.empty() ) if( !paramsFilename.empty() && descriptorMatcher )
{ {
FileStorage fs = FileStorage( paramsFilename, FileStorage::READ ); FileStorage fs = FileStorage( paramsFilename, FileStorage::READ );
if( fs.isOpened() ) if( fs.isOpened() )
...@@ -1086,7 +1086,7 @@ VectorDescriptorMatcher::VectorDescriptorMatcher( const Ptr<DescriptorExtractor> ...@@ -1086,7 +1086,7 @@ VectorDescriptorMatcher::VectorDescriptorMatcher( const Ptr<DescriptorExtractor>
const Ptr<DescriptorMatcher>& _matcher ) const Ptr<DescriptorMatcher>& _matcher )
: extractor( _extractor ), matcher( _matcher ) : extractor( _extractor ), matcher( _matcher )
{ {
CV_Assert( !extractor.empty() && !matcher.empty() ); CV_Assert( extractor && matcher );
} }
VectorDescriptorMatcher::~VectorDescriptorMatcher() VectorDescriptorMatcher::~VectorDescriptorMatcher()
...@@ -1152,14 +1152,14 @@ void VectorDescriptorMatcher::write (FileStorage& fs) const ...@@ -1152,14 +1152,14 @@ void VectorDescriptorMatcher::write (FileStorage& fs) const
bool VectorDescriptorMatcher::empty() const bool VectorDescriptorMatcher::empty() const
{ {
return extractor.empty() || extractor->empty() || return !extractor || extractor->empty() ||
matcher.empty() || matcher->empty(); !matcher || matcher->empty();
} }
Ptr<GenericDescriptorMatcher> VectorDescriptorMatcher::clone( bool emptyTrainData ) const Ptr<GenericDescriptorMatcher> VectorDescriptorMatcher::clone( bool emptyTrainData ) const
{ {
// TODO clone extractor // TODO clone extractor
return new VectorDescriptorMatcher( extractor, matcher->clone(emptyTrainData) ); return makePtr<VectorDescriptorMatcher>( extractor, matcher->clone(emptyTrainData) );
} }
} }
...@@ -141,7 +141,7 @@ protected: ...@@ -141,7 +141,7 @@ protected:
void emptyDataTest() void emptyDataTest()
{ {
assert( !dextractor.empty() ); assert( dextractor );
// One image. // One image.
Mat image; Mat image;
...@@ -186,7 +186,7 @@ protected: ...@@ -186,7 +186,7 @@ protected:
void regressionTest() void regressionTest()
{ {
assert( !dextractor.empty() ); assert( dextractor );
// Read the test image. // Read the test image.
string imgFilename = string(ts->get_data_path()) + FEATURES2D_DIR + "/" + IMAGE_FILENAME; string imgFilename = string(ts->get_data_path()) + FEATURES2D_DIR + "/" + IMAGE_FILENAME;
...@@ -267,7 +267,7 @@ protected: ...@@ -267,7 +267,7 @@ protected:
void run(int) void run(int)
{ {
createDescriptorExtractor(); createDescriptorExtractor();
if( dextractor.empty() ) if( !dextractor )
{ {
ts->printf(cvtest::TS::LOG, "Descriptor extractor is empty.\n"); ts->printf(cvtest::TS::LOG, "Descriptor extractor is empty.\n");
ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_TEST_DATA ); ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_TEST_DATA );
......
...@@ -230,7 +230,7 @@ void CV_FeatureDetectorTest::regressionTest() ...@@ -230,7 +230,7 @@ void CV_FeatureDetectorTest::regressionTest()
void CV_FeatureDetectorTest::run( int /*start_from*/ ) void CV_FeatureDetectorTest::run( int /*start_from*/ )
{ {
if( fdetector.empty() ) if( !fdetector )
{ {
ts->printf( cvtest::TS::LOG, "Feature detector is empty.\n" ); ts->printf( cvtest::TS::LOG, "Feature detector is empty.\n" );
ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_TEST_DATA ); ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_TEST_DATA );
......
...@@ -62,7 +62,7 @@ protected: ...@@ -62,7 +62,7 @@ protected:
virtual void run(int) virtual void run(int)
{ {
cv::initModule_features2d(); cv::initModule_features2d();
CV_Assert(!detector.empty()); CV_Assert(detector);
string imgFilename = string(ts->get_data_path()) + FEATURES2D_DIR + "/" + IMAGE_FILENAME; string imgFilename = string(ts->get_data_path()) + FEATURES2D_DIR + "/" + IMAGE_FILENAME;
// Read the test image. // Read the test image.
......
...@@ -196,7 +196,7 @@ public: ...@@ -196,7 +196,7 @@ public:
minKeyPointMatchesRatio(_minKeyPointMatchesRatio), minKeyPointMatchesRatio(_minKeyPointMatchesRatio),
minAngleInliersRatio(_minAngleInliersRatio) minAngleInliersRatio(_minAngleInliersRatio)
{ {
CV_Assert(!featureDetector.empty()); CV_Assert(featureDetector);
} }
protected: protected:
...@@ -307,8 +307,8 @@ public: ...@@ -307,8 +307,8 @@ public:
normType(_normType), normType(_normType),
minDescInliersRatio(_minDescInliersRatio) minDescInliersRatio(_minDescInliersRatio)
{ {
CV_Assert(!featureDetector.empty()); CV_Assert(featureDetector);
CV_Assert(!descriptorExtractor.empty()); CV_Assert(descriptorExtractor);
} }
protected: protected:
...@@ -392,7 +392,7 @@ public: ...@@ -392,7 +392,7 @@ public:
minKeyPointMatchesRatio(_minKeyPointMatchesRatio), minKeyPointMatchesRatio(_minKeyPointMatchesRatio),
minScaleInliersRatio(_minScaleInliersRatio) minScaleInliersRatio(_minScaleInliersRatio)
{ {
CV_Assert(!featureDetector.empty()); CV_Assert(featureDetector);
} }
protected: protected:
...@@ -510,8 +510,8 @@ public: ...@@ -510,8 +510,8 @@ public:
normType(_normType), normType(_normType),
minDescInliersRatio(_minDescInliersRatio) minDescInliersRatio(_minDescInliersRatio)
{ {
CV_Assert(!featureDetector.empty()); CV_Assert(featureDetector);
CV_Assert(!descriptorExtractor.empty()); CV_Assert(descriptorExtractor);
} }
protected: protected:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment