Commit e5592567 authored by Ilya Lavrenov's avatar Ilya Lavrenov

added cv::GFTTDetector

parent ac3f06bc
...@@ -276,7 +276,7 @@ void SimpleBlobDetector::findBlobs(const cv::Mat &image, const cv::Mat &binaryIm ...@@ -276,7 +276,7 @@ void SimpleBlobDetector::findBlobs(const cv::Mat &image, const cv::Mat &binaryIm
#endif #endif
} }
void SimpleBlobDetector::detectImpl(const cv::Mat& image, std::vector<cv::KeyPoint>& keypoints, const cv::Mat&) const void SimpleBlobDetector::detectImpl(InputArray image, std::vector<cv::KeyPoint>& keypoints, InputArray) const
{ {
//TODO: support mask //TODO: support mask
keypoints.clear(); keypoints.clear();
...@@ -284,7 +284,7 @@ void SimpleBlobDetector::detectImpl(const cv::Mat& image, std::vector<cv::KeyPoi ...@@ -284,7 +284,7 @@ void SimpleBlobDetector::detectImpl(const cv::Mat& image, std::vector<cv::KeyPoi
if (image.channels() == 3) if (image.channels() == 3)
cvtColor(image, grayscaleImage, COLOR_BGR2GRAY); cvtColor(image, grayscaleImage, COLOR_BGR2GRAY);
else else
grayscaleImage = image; grayscaleImage = image.getMat();
std::vector < std::vector<Center> > centers; std::vector < std::vector<Center> > centers;
for (double thresh = params.minThreshold; thresh < params.maxThreshold; thresh += params.thresholdStep) for (double thresh = params.minThreshold; thresh < params.maxThreshold; thresh += params.thresholdStep)
...@@ -292,20 +292,11 @@ void SimpleBlobDetector::detectImpl(const cv::Mat& image, std::vector<cv::KeyPoi ...@@ -292,20 +292,11 @@ void SimpleBlobDetector::detectImpl(const cv::Mat& image, std::vector<cv::KeyPoi
Mat binarizedImage; Mat binarizedImage;
threshold(grayscaleImage, binarizedImage, thresh, 255, THRESH_BINARY); threshold(grayscaleImage, binarizedImage, thresh, 255, THRESH_BINARY);
#ifdef DEBUG_BLOB_DETECTOR
// Mat keypointsImage;
// cvtColor( binarizedImage, keypointsImage, CV_GRAY2RGB );
#endif
std::vector < Center > curCenters; std::vector < Center > curCenters;
findBlobs(grayscaleImage, binarizedImage, curCenters); findBlobs(grayscaleImage, binarizedImage, curCenters);
std::vector < std::vector<Center> > newCenters; std::vector < std::vector<Center> > newCenters;
for (size_t i = 0; i < curCenters.size(); i++) for (size_t i = 0; i < curCenters.size(); i++)
{ {
#ifdef DEBUG_BLOB_DETECTOR
// circle(keypointsImage, curCenters[i].location, curCenters[i].radius, Scalar(0,0,255),-1);
#endif
bool isNew = true; bool isNew = true;
for (size_t j = 0; j < centers.size(); j++) for (size_t j = 0; j < centers.size(); j++)
{ {
...@@ -327,17 +318,9 @@ void SimpleBlobDetector::detectImpl(const cv::Mat& image, std::vector<cv::KeyPoi ...@@ -327,17 +318,9 @@ void SimpleBlobDetector::detectImpl(const cv::Mat& image, std::vector<cv::KeyPoi
} }
} }
if (isNew) if (isNew)
{
newCenters.push_back(std::vector<Center> (1, curCenters[i])); newCenters.push_back(std::vector<Center> (1, curCenters[i]));
//centers.push_back(std::vector<Center> (1, curCenters[i]));
}
} }
std::copy(newCenters.begin(), newCenters.end(), std::back_inserter(centers)); std::copy(newCenters.begin(), newCenters.end(), std::back_inserter(centers));
#ifdef DEBUG_BLOB_DETECTOR
// imshow("binarized", keypointsImage );
//waitKey();
#endif
} }
for (size_t i = 0; i < centers.size(); i++) for (size_t i = 0; i < centers.size(); i++)
...@@ -355,16 +338,4 @@ void SimpleBlobDetector::detectImpl(const cv::Mat& image, std::vector<cv::KeyPoi ...@@ -355,16 +338,4 @@ void SimpleBlobDetector::detectImpl(const cv::Mat& image, std::vector<cv::KeyPoi
KeyPoint kpt(sumPoint, (float)(centers[i][centers[i].size() / 2].radius)); KeyPoint kpt(sumPoint, (float)(centers[i][centers[i].size() / 2].radius));
keypoints.push_back(kpt); keypoints.push_back(kpt);
} }
#ifdef DEBUG_BLOB_DETECTOR
namedWindow("keypoints", CV_WINDOW_NORMAL);
Mat outImg = image.clone();
for(size_t i=0; i<keypoints.size(); i++)
{
circle(outImg, keypoints[i].pt, keypoints[i].size, Scalar(255, 0, 255), -1);
}
//drawKeypoints(image, keypoints, outImg);
imshow("keypoints", outImg);
waitKey();
#endif
} }
...@@ -751,9 +751,9 @@ BRISK::computeKeypointsNoOrientation(InputArray _image, InputArray _mask, std::v ...@@ -751,9 +751,9 @@ BRISK::computeKeypointsNoOrientation(InputArray _image, InputArray _mask, std::v
void void
BRISK::detectImpl( const Mat& image, std::vector<KeyPoint>& keypoints, const Mat& mask) const BRISK::detectImpl( InputArray image, std::vector<KeyPoint>& keypoints, InputArray mask) const
{ {
(*this)(image, mask, keypoints); (*this)(image.getMat(), mask.getMat(), keypoints);
} }
void void
...@@ -2229,7 +2229,7 @@ BriskLayer::halfsample(const cv::Mat& srcimg, cv::Mat& dstimg) ...@@ -2229,7 +2229,7 @@ BriskLayer::halfsample(const cv::Mat& srcimg, cv::Mat& dstimg)
CV_Assert(srcimg.cols / 2 == dstimg.cols); CV_Assert(srcimg.cols / 2 == dstimg.cols);
CV_Assert(srcimg.rows / 2 == dstimg.rows); CV_Assert(srcimg.rows / 2 == dstimg.rows);
// handle non-SSE case // handle non-SSE case
resize(srcimg, dstimg, dstimg.size(), 0, 0, INTER_AREA); resize(srcimg, dstimg, dstimg.size(), 0, 0, INTER_AREA);
} }
......
...@@ -51,7 +51,7 @@ namespace cv ...@@ -51,7 +51,7 @@ namespace cv
FeatureDetector::~FeatureDetector() FeatureDetector::~FeatureDetector()
{} {}
void FeatureDetector::detect( const Mat& image, std::vector<KeyPoint>& keypoints, const Mat& mask ) const void FeatureDetector::detect( InputArray image, std::vector<KeyPoint>& keypoints, InputArray mask ) const
{ {
keypoints.clear(); keypoints.clear();
...@@ -63,11 +63,29 @@ void FeatureDetector::detect( const Mat& image, std::vector<KeyPoint>& keypoints ...@@ -63,11 +63,29 @@ void FeatureDetector::detect( const Mat& image, std::vector<KeyPoint>& keypoints
detectImpl( image, keypoints, mask ); detectImpl( image, keypoints, mask );
} }
void FeatureDetector::detect(const std::vector<Mat>& imageCollection, std::vector<std::vector<KeyPoint> >& pointCollection, const std::vector<Mat>& masks ) const void FeatureDetector::detect(InputArrayOfArrays _imageCollection, std::vector<std::vector<KeyPoint> >& pointCollection,
InputArrayOfArrays _masks ) const
{ {
if (_imageCollection.isUMatVector())
{
std::vector<UMat> uimageCollection, umasks;
_imageCollection.getUMatVector(uimageCollection);
_masks.getUMatVector(umasks);
pointCollection.resize( uimageCollection.size() );
for( size_t i = 0; i < uimageCollection.size(); i++ )
detect( uimageCollection[i], pointCollection[i], umasks.empty() ? noArray() : umasks[i] );
return;
}
std::vector<Mat> imageCollection, masks;
_imageCollection.getMatVector(imageCollection);
_masks.getMatVector(masks);
pointCollection.resize( imageCollection.size() ); pointCollection.resize( imageCollection.size() );
for( size_t i = 0; i < imageCollection.size(); i++ ) for( size_t i = 0; i < imageCollection.size(); i++ )
detect( imageCollection[i], pointCollection[i], masks.empty() ? Mat() : masks[i] ); detect( imageCollection[i], pointCollection[i], masks.empty() ? noArray() : masks[i] );
} }
/*void FeatureDetector::read( const FileNode& ) /*void FeatureDetector::read( const FileNode& )
...@@ -125,21 +143,37 @@ GFTTDetector::GFTTDetector( int _nfeatures, double _qualityLevel, ...@@ -125,21 +143,37 @@ GFTTDetector::GFTTDetector( int _nfeatures, double _qualityLevel,
{ {
} }
void GFTTDetector::detectImpl( const Mat& image, std::vector<KeyPoint>& keypoints, const Mat& mask) const void GFTTDetector::detectImpl( InputArray _image, std::vector<KeyPoint>& keypoints, InputArray _mask) const
{ {
Mat grayImage = image;
if( image.type() != CV_8U ) cvtColor( image, grayImage, COLOR_BGR2GRAY );
std::vector<Point2f> corners; std::vector<Point2f> corners;
goodFeaturesToTrack( grayImage, corners, nfeatures, qualityLevel, minDistance, mask,
if (_image.isUMat())
{
UMat ugrayImage;
if( _image.type() != CV_8U )
cvtColor( _image, ugrayImage, COLOR_BGR2GRAY );
else
ugrayImage = _image.getUMat();
goodFeaturesToTrack( ugrayImage, corners, nfeatures, qualityLevel, minDistance, _mask,
blockSize, useHarrisDetector, k ); blockSize, useHarrisDetector, k );
}
else
{
Mat image = _image.getMat(), grayImage = image;
if( image.type() != CV_8U )
cvtColor( image, grayImage, COLOR_BGR2GRAY );
goodFeaturesToTrack( grayImage, corners, nfeatures, qualityLevel, minDistance, _mask,
blockSize, useHarrisDetector, k );
}
keypoints.resize(corners.size()); keypoints.resize(corners.size());
std::vector<Point2f>::const_iterator corner_it = corners.begin(); std::vector<Point2f>::const_iterator corner_it = corners.begin();
std::vector<KeyPoint>::iterator keypoint_it = keypoints.begin(); std::vector<KeyPoint>::iterator keypoint_it = keypoints.begin();
for( ; corner_it != corners.end(); ++corner_it, ++keypoint_it ) for( ; corner_it != corners.end(); ++corner_it, ++keypoint_it )
{
*keypoint_it = KeyPoint( *corner_it, (float)blockSize ); *keypoint_it = KeyPoint( *corner_it, (float)blockSize );
}
} }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
...@@ -157,8 +191,10 @@ DenseFeatureDetector::DenseFeatureDetector( float _initFeatureScale, int _featur ...@@ -157,8 +191,10 @@ DenseFeatureDetector::DenseFeatureDetector( float _initFeatureScale, int _featur
{} {}
void DenseFeatureDetector::detectImpl( const Mat& image, std::vector<KeyPoint>& keypoints, const Mat& mask ) const void DenseFeatureDetector::detectImpl( InputArray _image, std::vector<KeyPoint>& keypoints, InputArray _mask ) const
{ {
Mat image = _image.getMat(), mask = _mask.getMat();
float curScale = static_cast<float>(initFeatureScale); float curScale = static_cast<float>(initFeatureScale);
int curStep = initXyStep; int curStep = initXyStep;
int curBound = initImgBound; int curBound = initImgBound;
...@@ -271,9 +307,9 @@ public: ...@@ -271,9 +307,9 @@ public:
}; };
} // namepace } // namepace
void GridAdaptedFeatureDetector::detectImpl( const Mat& image, std::vector<KeyPoint>& keypoints, const Mat& mask ) const void GridAdaptedFeatureDetector::detectImpl( InputArray _image, std::vector<KeyPoint>& keypoints, InputArray _mask ) const
{ {
if (image.empty() || maxTotalKeypoints < gridRows * gridCols) if (_image.empty() || maxTotalKeypoints < gridRows * gridCols)
{ {
keypoints.clear(); keypoints.clear();
return; return;
...@@ -281,6 +317,8 @@ void GridAdaptedFeatureDetector::detectImpl( const Mat& image, std::vector<KeyPo ...@@ -281,6 +317,8 @@ void GridAdaptedFeatureDetector::detectImpl( const Mat& image, std::vector<KeyPo
keypoints.reserve(maxTotalKeypoints); keypoints.reserve(maxTotalKeypoints);
int maxPerCell = maxTotalKeypoints / (gridRows * gridCols); int maxPerCell = maxTotalKeypoints / (gridRows * gridCols);
Mat image = _image.getMat(), mask = _mask.getMat();
cv::Mutex kptLock; cv::Mutex kptLock;
cv::parallel_for_(cv::Range(0, gridRows * gridCols), cv::parallel_for_(cv::Range(0, gridRows * gridCols),
GridAdaptedFeatureDetectorInvoker(detector, image, mask, keypoints, maxPerCell, gridRows, gridCols, &kptLock)); GridAdaptedFeatureDetectorInvoker(detector, image, mask, keypoints, maxPerCell, gridRows, gridCols, &kptLock));
...@@ -298,8 +336,9 @@ bool PyramidAdaptedFeatureDetector::empty() const ...@@ -298,8 +336,9 @@ bool PyramidAdaptedFeatureDetector::empty() const
return !detector || detector->empty(); return !detector || detector->empty();
} }
void PyramidAdaptedFeatureDetector::detectImpl( const Mat& image, std::vector<KeyPoint>& keypoints, const Mat& mask ) const void PyramidAdaptedFeatureDetector::detectImpl( InputArray _image, std::vector<KeyPoint>& keypoints, InputArray _mask ) const
{ {
Mat image = _image.getMat(), mask = _mask.getMat();
Mat src = image; Mat src = image;
Mat src_mask = mask; Mat src_mask = mask;
......
...@@ -54,8 +54,10 @@ bool DynamicAdaptedFeatureDetector::empty() const ...@@ -54,8 +54,10 @@ bool DynamicAdaptedFeatureDetector::empty() const
return !adjuster_ || adjuster_->empty(); return !adjuster_ || adjuster_->empty();
} }
void DynamicAdaptedFeatureDetector::detectImpl(const Mat& image, std::vector<KeyPoint>& keypoints, const Mat& mask) const void DynamicAdaptedFeatureDetector::detectImpl(InputArray _image, std::vector<KeyPoint>& keypoints, InputArray _mask) const
{ {
Mat image = _image.getMat(), mask = _mask.getMat();
//for oscillation testing //for oscillation testing
bool down = false; bool down = false;
bool up = false; bool up = false;
...@@ -98,7 +100,7 @@ FastAdjuster::FastAdjuster( int init_thresh, bool nonmax, int min_thresh, int ma ...@@ -98,7 +100,7 @@ FastAdjuster::FastAdjuster( int init_thresh, bool nonmax, int min_thresh, int ma
min_thresh_(min_thresh), max_thresh_(max_thresh) min_thresh_(min_thresh), max_thresh_(max_thresh)
{} {}
void FastAdjuster::detectImpl(const Mat& image, std::vector<KeyPoint>& keypoints, const Mat& mask) const void FastAdjuster::detectImpl(InputArray image, std::vector<KeyPoint>& keypoints, InputArray mask) const
{ {
FastFeatureDetector(thresh_, nonmax_).detect(image, keypoints, mask); FastFeatureDetector(thresh_, nonmax_).detect(image, keypoints, mask);
} }
...@@ -133,7 +135,7 @@ StarAdjuster::StarAdjuster(double initial_thresh, double min_thresh, double max_ ...@@ -133,7 +135,7 @@ StarAdjuster::StarAdjuster(double initial_thresh, double min_thresh, double max_
min_thresh_(min_thresh), max_thresh_(max_thresh) min_thresh_(min_thresh), max_thresh_(max_thresh)
{} {}
void StarAdjuster::detectImpl(const Mat& image, std::vector<KeyPoint>& keypoints, const Mat& mask) const void StarAdjuster::detectImpl(InputArray image, std::vector<KeyPoint>& keypoints, InputArray mask) const
{ {
StarFeatureDetector detector_tmp(16, cvRound(thresh_), 10, 8, 3); StarFeatureDetector detector_tmp(16, cvRound(thresh_), 10, 8, 3);
detector_tmp.detect(image, keypoints, mask); detector_tmp.detect(image, keypoints, mask);
...@@ -167,7 +169,7 @@ SurfAdjuster::SurfAdjuster( double initial_thresh, double min_thresh, double max ...@@ -167,7 +169,7 @@ SurfAdjuster::SurfAdjuster( double initial_thresh, double min_thresh, double max
min_thresh_(min_thresh), max_thresh_(max_thresh) min_thresh_(min_thresh), max_thresh_(max_thresh)
{} {}
void SurfAdjuster::detectImpl(const Mat& image, std::vector<KeyPoint>& keypoints, const cv::Mat& mask) const void SurfAdjuster::detectImpl(InputArray image, std::vector<KeyPoint>& keypoints, InputArray mask) const
{ {
Ptr<FeatureDetector> surf = FeatureDetector::create("SURF"); Ptr<FeatureDetector> surf = FeatureDetector::create("SURF");
surf->set("hessianThreshold", thresh_); surf->set("hessianThreshold", thresh_);
......
...@@ -283,10 +283,11 @@ FastFeatureDetector::FastFeatureDetector( int _threshold, bool _nonmaxSuppressio ...@@ -283,10 +283,11 @@ FastFeatureDetector::FastFeatureDetector( int _threshold, bool _nonmaxSuppressio
: threshold(_threshold), nonmaxSuppression(_nonmaxSuppression), type((short)_type) : threshold(_threshold), nonmaxSuppression(_nonmaxSuppression), type((short)_type)
{} {}
void FastFeatureDetector::detectImpl( const Mat& image, std::vector<KeyPoint>& keypoints, const Mat& mask ) const void FastFeatureDetector::detectImpl( InputArray _image, std::vector<KeyPoint>& keypoints, InputArray _mask ) const
{ {
Mat grayImage = image; Mat image = _image.getMat(), mask = _mask.getMat(), grayImage = image;
if( image.type() != CV_8U ) cvtColor( image, grayImage, COLOR_BGR2GRAY ); if( image.type() != CV_8U )
cvtColor( image, grayImage, COLOR_BGR2GRAY );
FAST( grayImage, keypoints, threshold, nonmaxSuppression, type ); FAST( grayImage, keypoints, threshold, nonmaxSuppression, type );
KeyPointsFilter::runByPixelsMask( keypoints, mask ); KeyPointsFilter::runByPixelsMask( keypoints, mask );
} }
......
...@@ -891,21 +891,25 @@ Ptr<DescriptorMatcher> BFMatcher::clone( bool emptyTrainData ) const ...@@ -891,21 +891,25 @@ Ptr<DescriptorMatcher> BFMatcher::clone( bool emptyTrainData ) const
return matcher; return matcher;
} }
bool BFMatcher::ocl_match(InputArray query, InputArray _train, std::vector< std::vector<DMatch> > &matches, int dstType) static bool ocl_match(InputArray query, InputArray _train, std::vector< std::vector<DMatch> > &matches, int dstType)
{ {
UMat trainIdx, distance; UMat trainIdx, distance;
if(!ocl_matchSingle(query, _train, trainIdx, distance, dstType)) return false; if (!ocl_matchSingle(query, _train, trainIdx, distance, dstType))
if(!ocl_matchDownload(trainIdx, distance, matches)) return false; return false;
if (!ocl_matchDownload(trainIdx, distance, matches))
return false;
return true; return true;
} }
bool BFMatcher::ocl_knnMatch(InputArray query, InputArray _train, std::vector< std::vector<DMatch> > &matches, int k, int dstType, bool compactResult) static bool ocl_knnMatch(InputArray query, InputArray _train, std::vector< std::vector<DMatch> > &matches, int k, int dstType, bool compactResult)
{ {
UMat trainIdx, distance; UMat trainIdx, distance;
if (k != 2) if (k != 2)
return false; return false;
if (!ocl_knnMatchSingle(query, _train, trainIdx, distance, dstType)) return false; if (!ocl_knnMatchSingle(query, _train, trainIdx, distance, dstType))
if( !ocl_knnMatchDownload(trainIdx, distance, matches, compactResult) ) return false; return false;
if (!ocl_knnMatchDownload(trainIdx, distance, matches, compactResult) )
return false;
return true; return true;
} }
...@@ -1033,12 +1037,14 @@ void BFMatcher::knnMatchImpl( InputArray _queryDescriptors, std::vector<std::vec ...@@ -1033,12 +1037,14 @@ void BFMatcher::knnMatchImpl( InputArray _queryDescriptors, std::vector<std::vec
} }
} }
bool BFMatcher::ocl_radiusMatch(InputArray query, InputArray _train, std::vector< std::vector<DMatch> > &matches, static bool ocl_radiusMatch(InputArray query, InputArray _train, std::vector< std::vector<DMatch> > &matches,
float maxDistance, int dstType, bool compactResult) float maxDistance, int dstType, bool compactResult)
{ {
UMat trainIdx, distance, nMatches; UMat trainIdx, distance, nMatches;
if(!ocl_radiusMatchSingle(query, _train, trainIdx, distance, nMatches, maxDistance, dstType)) return false; if (!ocl_radiusMatchSingle(query, _train, trainIdx, distance, nMatches, maxDistance, dstType))
if(!ocl_radiusMatchDownload(trainIdx, distance, nMatches, matches, compactResult)) return false; return false;
if (!ocl_radiusMatchDownload(trainIdx, distance, nMatches, matches, compactResult))
return false;
return true; return true;
} }
...@@ -1076,14 +1082,14 @@ void BFMatcher::radiusMatchImpl( InputArray _queryDescriptors, std::vector<std:: ...@@ -1076,14 +1082,14 @@ void BFMatcher::radiusMatchImpl( InputArray _queryDescriptors, std::vector<std::
_queryDescriptors.type() == CV_32FC1 && _queryDescriptors.offset() == 0 && trainDescOffset == 0 && _queryDescriptors.type() == CV_32FC1 && _queryDescriptors.offset() == 0 && trainDescOffset == 0 &&
trainDescSize.width == _queryDescriptors.size().width && masks.size() == 1 && masks[0].total() == 0 ) trainDescSize.width == _queryDescriptors.size().width && masks.size() == 1 && masks[0].total() == 0 )
{ {
if(trainDescCollection.empty()) if (trainDescCollection.empty())
{ {
if(ocl_radiusMatch(_queryDescriptors, utrainDescCollection[0], matches, maxDistance, normType, compactResult) ) if(ocl_radiusMatch(_queryDescriptors, utrainDescCollection[0], matches, maxDistance, normType, compactResult) )
return; return;
} }
else else
{ {
if(ocl_radiusMatch(_queryDescriptors, trainDescCollection[0], matches, maxDistance, normType, compactResult) ) if (ocl_radiusMatch(_queryDescriptors, trainDescCollection[0], matches, maxDistance, normType, compactResult) )
return; return;
} }
} }
......
...@@ -1284,8 +1284,9 @@ void MSER::operator()( const Mat& image, std::vector<std::vector<Point> >& dstco ...@@ -1284,8 +1284,9 @@ void MSER::operator()( const Mat& image, std::vector<std::vector<Point> >& dstco
} }
void MserFeatureDetector::detectImpl( const Mat& image, std::vector<KeyPoint>& keypoints, const Mat& mask ) const void MserFeatureDetector::detectImpl( InputArray _image, std::vector<KeyPoint>& keypoints, InputArray _mask ) const
{ {
Mat image = _image.getMat(), mask = _mask.getMat();
std::vector<std::vector<Point> > msers; std::vector<std::vector<Point> > msers;
(*this)(image, msers, mask); (*this)(image, msers, mask);
......
...@@ -943,9 +943,9 @@ void ORB::operator()( InputArray _image, InputArray _mask, std::vector<KeyPoint> ...@@ -943,9 +943,9 @@ void ORB::operator()( InputArray _image, InputArray _mask, std::vector<KeyPoint>
} }
} }
void ORB::detectImpl( const Mat& image, std::vector<KeyPoint>& keypoints, const Mat& mask) const void ORB::detectImpl( InputArray image, std::vector<KeyPoint>& keypoints, InputArray mask) const
{ {
(*this)(image, mask, keypoints, noArray(), false); (*this)(image.getMat(), mask.getMat(), keypoints, noArray(), false);
} }
void ORB::computeImpl( const Mat& image, std::vector<KeyPoint>& keypoints, Mat& descriptors) const void ORB::computeImpl( const Mat& image, std::vector<KeyPoint>& keypoints, Mat& descriptors) const
......
...@@ -426,9 +426,9 @@ StarDetector::StarDetector(int _maxSize, int _responseThreshold, ...@@ -426,9 +426,9 @@ StarDetector::StarDetector(int _maxSize, int _responseThreshold,
{} {}
void StarDetector::detectImpl( const Mat& image, std::vector<KeyPoint>& keypoints, const Mat& mask ) const void StarDetector::detectImpl( InputArray _image, std::vector<KeyPoint>& keypoints, InputArray _mask ) const
{ {
Mat grayImage = image; Mat image = _image.getMat(), mask = _mask.getMat(), grayImage = image;
if( image.type() != CV_8U ) cvtColor( image, grayImage, COLOR_BGR2GRAY ); if( image.type() != CV_8U ) cvtColor( image, grayImage, COLOR_BGR2GRAY );
(*this)(grayImage, keypoints); (*this)(grayImage, keypoints);
......
...@@ -87,7 +87,7 @@ public: ...@@ -87,7 +87,7 @@ public:
std::vector<KeyPoint>& keypoints ) const; std::vector<KeyPoint>& keypoints ) const;
protected: protected:
void detectImpl( const Mat& image, std::vector<KeyPoint>& keypoints, const Mat& mask = Mat() ) const; void detectImpl( InputArray image, std::vector<KeyPoint>& keypoints, InputArray mask = noArray() ) const;
void computeImpl( const Mat& image, std::vector<KeyPoint>& keypoints, Mat& descriptors ) const; void computeImpl( const Mat& image, std::vector<KeyPoint>& keypoints, Mat& descriptors ) const;
CV_PROP_RW int nfeatures; CV_PROP_RW int nfeatures;
...@@ -143,7 +143,7 @@ public: ...@@ -143,7 +143,7 @@ public:
protected: protected:
void detectImpl( const Mat& image, std::vector<KeyPoint>& keypoints, const Mat& mask = Mat() ) const; void detectImpl( InputArray image, std::vector<KeyPoint>& keypoints, InputArray mask = noArray() ) const;
void computeImpl( const Mat& image, std::vector<KeyPoint>& keypoints, Mat& descriptors ) const; void computeImpl( const Mat& image, std::vector<KeyPoint>& keypoints, Mat& descriptors ) const;
}; };
......
...@@ -818,9 +818,9 @@ void SIFT::operator()(InputArray _image, InputArray _mask, ...@@ -818,9 +818,9 @@ void SIFT::operator()(InputArray _image, InputArray _mask,
} }
} }
void SIFT::detectImpl( const Mat& image, std::vector<KeyPoint>& keypoints, const Mat& mask) const void SIFT::detectImpl( InputArray image, std::vector<KeyPoint>& keypoints, InputArray mask) const
{ {
(*this)(image, mask, keypoints, noArray()); (*this)(image.getMat(), mask.getMat(), keypoints, noArray());
} }
void SIFT::computeImpl( const Mat& image, std::vector<KeyPoint>& keypoints, Mat& descriptors) const void SIFT::computeImpl( const Mat& image, std::vector<KeyPoint>& keypoints, Mat& descriptors) const
......
...@@ -979,9 +979,9 @@ void SURF::operator()(InputArray _img, InputArray _mask, ...@@ -979,9 +979,9 @@ void SURF::operator()(InputArray _img, InputArray _mask,
} }
void SURF::detectImpl( const Mat& image, std::vector<KeyPoint>& keypoints, const Mat& mask) const void SURF::detectImpl( InputArray image, std::vector<KeyPoint>& keypoints, InputArray mask) const
{ {
(*this)(image, mask, keypoints, noArray(), false); (*this)(image.getMat(), mask.getMat(), keypoints, noArray(), false);
} }
void SURF::computeImpl( const Mat& image, std::vector<KeyPoint>& keypoints, Mat& descriptors) const void SURF::computeImpl( const Mat& image, std::vector<KeyPoint>& keypoints, Mat& descriptors) const
......
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