* mask Mask specifying where to look for keypoints (optional). Must be a char
* matrix with non-zero values in the region of interest.
*/
- CV_WRAP void detect( const Mat& image, CV_OUT std::vector<KeyPoint>& keypoints, const Mat& mask=Mat() ) const;
+ CV_WRAP void detect( InputArray image, CV_OUT std::vector<KeyPoint>& keypoints, InputArray mask=noArray() ) const;
/*
* Detect keypoints in an image set.
* keypoints Collection of keypoints detected in an input images. keypoints[i] is a set of keypoints detected in an images[i].
* masks Masks for image set. masks[i] is a mask for images[i].
*/
- void detect( const std::vector<Mat>& images, std::vector<std::vector<KeyPoint> >& keypoints, const std::vector<Mat>& masks=std::vector<Mat>() ) const;
+ void detect( InputArrayOfArrays images, std::vector<std::vector<KeyPoint> >& keypoints, InputArrayOfArrays masks=noArray() ) const;
// Return true if detector object is empty
CV_WRAP virtual bool empty() const;
CV_WRAP static Ptr<FeatureDetector> create( const String& detectorType );
protected:
- virtual void detectImpl( const Mat& image, std::vector<KeyPoint>& keypoints, const Mat& mask=Mat() ) const = 0;
+ virtual void detectImpl( InputArray image, std::vector<KeyPoint>& keypoints, InputArray mask=noArray() ) const = 0;
/*
* Remove keypoints that are not in the mask.
* Helper function, useful when wrapping a library call for keypoint detection that
* does not support a mask argument.
*/
- static void removeInvalidPoints( const Mat& mask, std::vector<KeyPoint>& keypoints );
+ static void removeInvalidPoints( const Mat & mask, std::vector<KeyPoint>& keypoints );
};
protected:
void computeImpl( const Mat& image, std::vector<KeyPoint>& keypoints, Mat& descriptors ) const;
- 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 computeKeypointsNoOrientation(InputArray image, InputArray mask, std::vector<KeyPoint>& keypoints) const;
void computeDescriptorsAndOrOrientation(InputArray image, InputArray mask, std::vector<KeyPoint>& keypoints,
protected:
void computeImpl( const Mat& image, std::vector<KeyPoint>& keypoints, Mat& descriptors ) const;
- 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;
CV_PROP_RW int nfeatures;
CV_PROP_RW double scaleFactor;
AlgorithmInfo* info() const;
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;
int delta;
int minArea;
AlgorithmInfo* info() const;
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;
int maxSize;
int responseThreshold;
AlgorithmInfo* info() const;
protected:
- virtual void detectImpl( const Mat& image, std::vector<KeyPoint>& keypoints, const Mat& mask=Mat() ) const;
+ virtual void detectImpl( InputArray image, std::vector<KeyPoint>& keypoints, InputArray mask=noArray() ) const;
int threshold;
bool nonmaxSuppression;
AlgorithmInfo* info() const;
protected:
- virtual void detectImpl( const Mat& image, std::vector<KeyPoint>& keypoints, const Mat& mask=Mat() ) const;
+ virtual void detectImpl( InputArray image, std::vector<KeyPoint>& keypoints, InputArray mask=noArray() ) const;
int nfeatures;
double qualityLevel;
double confidence;
};
- virtual void detectImpl( const Mat& image, std::vector<KeyPoint>& keypoints, const Mat& mask=Mat() ) const;
+ virtual void detectImpl( InputArray image, std::vector<KeyPoint>& keypoints, InputArray mask=noArray() ) const;
virtual void findBlobs(const Mat &image, const Mat &binaryImage, std::vector<Center> ¢ers) const;
Params params;
AlgorithmInfo* info() const;
protected:
- virtual void detectImpl( const Mat& image, std::vector<KeyPoint>& keypoints, const Mat& mask=Mat() ) const;
+ virtual void detectImpl( InputArray image, std::vector<KeyPoint>& keypoints, InputArray mask=noArray() ) const;
double initFeatureScale;
int featureScaleLevels;
AlgorithmInfo* info() const;
protected:
- virtual void detectImpl( const Mat& image, std::vector<KeyPoint>& keypoints, const Mat& mask=Mat() ) const;
+ virtual void detectImpl( InputArray image, std::vector<KeyPoint>& keypoints, InputArray mask=noArray() ) const;
Ptr<FeatureDetector> detector;
int maxTotalKeypoints;
virtual bool empty() const;
protected:
- virtual void detectImpl( const Mat& image, std::vector<KeyPoint>& keypoints, const Mat& mask=Mat() ) const;
+ virtual void detectImpl( InputArray image, std::vector<KeyPoint>& keypoints, InputArray mask=noArray() ) const;
Ptr<FeatureDetector> detector;
int maxLevel;
virtual bool empty() const;
protected:
- virtual void detectImpl( const Mat& image, std::vector<KeyPoint>& keypoints, const Mat& mask=Mat() ) const;
+ virtual void detectImpl( InputArray image, std::vector<KeyPoint>& keypoints, InputArray mask=noArray() ) const;
private:
DynamicAdaptedFeatureDetector& operator=(const DynamicAdaptedFeatureDetector&);
virtual Ptr<AdjusterAdapter> clone() const;
protected:
- virtual void detectImpl( const Mat& image, std::vector<KeyPoint>& keypoints, const Mat& mask=Mat() ) const;
+ virtual void detectImpl( InputArray image, std::vector<KeyPoint>& keypoints, InputArray mask=noArray() ) const;
int thresh_;
bool nonmax_;
virtual Ptr<AdjusterAdapter> clone() const;
protected:
- virtual void detectImpl( const Mat& image, std::vector<KeyPoint>& keypoints, const Mat& mask=Mat() ) const;
+ virtual void detectImpl(InputArray image, std::vector<KeyPoint>& keypoints, InputArray mask=noArray() ) const;
double thresh_, init_thresh_, min_thresh_, max_thresh_;
};
virtual Ptr<AdjusterAdapter> clone() const;
protected:
- virtual void detectImpl( const Mat& image, std::vector<KeyPoint>& keypoints, const Mat& mask=Mat() ) const;
+ virtual void detectImpl( InputArray image, std::vector<KeyPoint>& keypoints, InputArray mask=noArray() ) const;
double thresh_, init_thresh_, min_thresh_, max_thresh_;
};
*/
// Find one best match for each query descriptor (if mask is empty).
CV_WRAP void match( InputArray queryDescriptors, InputArray trainDescriptors,
- CV_OUT std::vector<DMatch>& matches, InputArray mask=Mat() ) const;
+ CV_OUT std::vector<DMatch>& matches, InputArray mask=noArray() ) const;
// Find k best matches for each query descriptor (in increasing order of distances).
// compactResult is used when mask is not empty. If compactResult is false matches
// vector will have the same size as queryDescriptors rows. If compactResult is true
// matches vector will not contain matches for fully masked out query descriptors.
CV_WRAP void knnMatch( InputArray queryDescriptors, InputArray trainDescriptors,
CV_OUT std::vector<std::vector<DMatch> >& matches, int k,
- InputArray mask=Mat(), bool compactResult=false ) const;
+ InputArray mask=noArray(), bool compactResult=false ) const;
// Find best matches for each query descriptor which have distance less than
// maxDistance (in increasing order of distances).
void radiusMatch( InputArray queryDescriptors, InputArray trainDescriptors,
std::vector<std::vector<DMatch> >& matches, float maxDistance,
- InputArray mask=Mat(), bool compactResult=false ) const;
+ InputArray mask=noArray(), bool compactResult=false ) const;
/*
* Group of methods to match descriptors from one image to image set.
* See description of similar methods for matching image pair above.
*/
CV_WRAP void match( InputArray queryDescriptors, CV_OUT std::vector<DMatch>& matches,
- const std::vector<Mat>& masks=std::vector<Mat>() );
+ const std::vector<Mat>& masks=std::vector<Mat>() );
CV_WRAP void knnMatch( InputArray queryDescriptors, CV_OUT std::vector<std::vector<DMatch> >& matches, int k,
- const std::vector<Mat>& masks=std::vector<Mat>(), bool compactResult=false );
+ const std::vector<Mat>& masks=std::vector<Mat>(), bool compactResult=false );
void radiusMatch( InputArray queryDescriptors, std::vector<std::vector<DMatch> >& matches, float maxDistance,
- const std::vector<Mat>& masks=std::vector<Mat>(), bool compactResult=false );
+ const std::vector<Mat>& masks=std::vector<Mat>(), bool compactResult=false );
// Reads matcher object from a file node
virtual void read( const FileNode& );
// that the class object has been trained already. Public match methods call these methods
// after calling train().
virtual void knnMatchImpl( InputArray queryDescriptors, std::vector<std::vector<DMatch> >& matches, int k,
- InputArrayOfArrays masks=std::vector<Mat>(), bool compactResult=false ) = 0;
+ InputArrayOfArrays masks=noArray(), bool compactResult=false ) = 0;
virtual void radiusMatchImpl( InputArray queryDescriptors, std::vector<std::vector<DMatch> >& matches, float maxDistance,
- InputArrayOfArrays masks=std::vector<Mat>(), bool compactResult=false ) = 0;
+ InputArrayOfArrays masks=noArray(), bool compactResult=false ) = 0;
static bool isPossibleMatch( const Mat& mask, int queryIdx, int trainIdx );
static bool isMaskedOut( const std::vector<Mat>& masks, int queryIdx );
AlgorithmInfo* info() const;
protected:
virtual void knnMatchImpl( InputArray queryDescriptors, std::vector<std::vector<DMatch> >& matches, int k,
- InputArrayOfArrays masks=std::vector<Mat>(), bool compactResult=false );
+ InputArrayOfArrays masks=noArray(), bool compactResult=false );
virtual void radiusMatchImpl( InputArray queryDescriptors, std::vector<std::vector<DMatch> >& matches, float maxDistance,
- InputArrayOfArrays masks=std::vector<Mat>(), bool compactResult=false );
-
- bool ocl_knnMatch(InputArray query, InputArray train, std::vector< std::vector<DMatch> > &matches,
- int k, int dstType, bool compactResult=false);
- bool ocl_radiusMatch(InputArray query, InputArray train, std::vector< std::vector<DMatch> > &matches,
- float maxDistance, int dstType, bool compactResult=false);
- bool ocl_match(InputArray query, InputArray train, std::vector< std::vector<DMatch> > &matches, int dstType);
+ InputArrayOfArrays masks=noArray(), bool compactResult=false );
int normType;
bool crossCheck;
std::vector<std::vector<DMatch> >& matches );
virtual void knnMatchImpl( InputArray queryDescriptors, std::vector<std::vector<DMatch> >& matches, int k,
- InputArrayOfArrays masks=std::vector<Mat>(), bool compactResult=false );
+ InputArrayOfArrays masks=noArray(), bool compactResult=false );
virtual void radiusMatchImpl( InputArray queryDescriptors, std::vector<std::vector<DMatch> >& matches, float maxDistance,
- InputArrayOfArrays masks=std::vector<Mat>(), bool compactResult=false );
+ InputArrayOfArrays masks=noArray(), bool compactResult=false );
Ptr<flann::IndexParams> indexParams;
Ptr<flann::SearchParams> searchParams;
#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
keypoints.clear();
if (image.channels() == 3)
cvtColor(image, grayscaleImage, COLOR_BGR2GRAY);
else
- grayscaleImage = image;
+ grayscaleImage = image.getMat();
std::vector < std::vector<Center> > centers;
for (double thresh = params.minThreshold; thresh < params.maxThreshold; thresh += params.thresholdStep)
Mat binarizedImage;
threshold(grayscaleImage, binarizedImage, thresh, 255, THRESH_BINARY);
-#ifdef DEBUG_BLOB_DETECTOR
- // Mat keypointsImage;
- // cvtColor( binarizedImage, keypointsImage, CV_GRAY2RGB );
-#endif
-
std::vector < Center > curCenters;
findBlobs(grayscaleImage, binarizedImage, curCenters);
std::vector < std::vector<Center> > newCenters;
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;
for (size_t j = 0; j < centers.size(); j++)
{
}
}
if (isNew)
- {
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));
-
-#ifdef DEBUG_BLOB_DETECTOR
- // imshow("binarized", keypointsImage );
- //waitKey();
-#endif
}
for (size_t i = 0; i < centers.size(); i++)
KeyPoint kpt(sumPoint, (float)(centers[i][centers[i].size() / 2].radius));
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
}
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
CV_Assert(srcimg.cols / 2 == dstimg.cols);
CV_Assert(srcimg.rows / 2 == dstimg.rows);
- // handle non-SSE case
+ // handle non-SSE case
resize(srcimg, dstimg, dstimg.size(), 0, 0, INTER_AREA);
}
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();
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() );
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 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;
- goodFeaturesToTrack( grayImage, corners, nfeatures, qualityLevel, minDistance, mask,
- blockSize, useHarrisDetector, k );
+
+ 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 );
+ }
+ 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());
std::vector<Point2f>::const_iterator corner_it = corners.begin();
std::vector<KeyPoint>::iterator keypoint_it = keypoints.begin();
for( ; corner_it != corners.end(); ++corner_it, ++keypoint_it )
- {
*keypoint_it = KeyPoint( *corner_it, (float)blockSize );
- }
+
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
{}
-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);
int curStep = initXyStep;
int curBound = initImgBound;
};
} // 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();
return;
keypoints.reserve(maxTotalKeypoints);
int maxPerCell = maxTotalKeypoints / (gridRows * gridCols);
+ Mat image = _image.getMat(), mask = _mask.getMat();
+
cv::Mutex kptLock;
cv::parallel_for_(cv::Range(0, gridRows * gridCols),
GridAdaptedFeatureDetectorInvoker(detector, image, mask, keypoints, maxPerCell, gridRows, gridCols, &kptLock));
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_mask = mask;
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
bool down = false;
bool up = false;
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);
}
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);
detector_tmp.detect(image, keypoints, mask);
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");
surf->set("hessianThreshold", thresh_);
: 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;
- if( image.type() != CV_8U ) cvtColor( image, grayImage, COLOR_BGR2GRAY );
+ Mat image = _image.getMat(), mask = _mask.getMat(), grayImage = image;
+ if( image.type() != CV_8U )
+ cvtColor( image, grayImage, COLOR_BGR2GRAY );
FAST( grayImage, keypoints, threshold, nonmaxSuppression, type );
KeyPointsFilter::runByPixelsMask( keypoints, mask );
}
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;
- if(!ocl_matchSingle(query, _train, trainIdx, distance, dstType)) return false;
- if(!ocl_matchDownload(trainIdx, distance, matches)) return false;
+ if (!ocl_matchSingle(query, _train, trainIdx, distance, dstType))
+ return false;
+ if (!ocl_matchDownload(trainIdx, distance, matches))
+ return false;
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;
if (k != 2)
return false;
- if (!ocl_knnMatchSingle(query, _train, trainIdx, distance, dstType)) return false;
- if( !ocl_knnMatchDownload(trainIdx, distance, matches, compactResult) ) return false;
+ if (!ocl_knnMatchSingle(query, _train, trainIdx, distance, dstType))
+ return false;
+ if (!ocl_knnMatchDownload(trainIdx, distance, matches, compactResult) )
+ return false;
return true;
}
}
}
-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)
{
UMat trainIdx, distance, nMatches;
- if(!ocl_radiusMatchSingle(query, _train, trainIdx, distance, nMatches, maxDistance, dstType)) return false;
- if(!ocl_radiusMatchDownload(trainIdx, distance, nMatches, matches, compactResult)) return false;
+ if (!ocl_radiusMatchSingle(query, _train, trainIdx, distance, nMatches, maxDistance, dstType))
+ return false;
+ if (!ocl_radiusMatchDownload(trainIdx, distance, nMatches, matches, compactResult))
+ return false;
return true;
}
_queryDescriptors.type() == CV_32FC1 && _queryDescriptors.offset() == 0 && trainDescOffset == 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) )
return;
}
else
{
- if(ocl_radiusMatch(_queryDescriptors, trainDescCollection[0], matches, maxDistance, normType, compactResult) )
+ if (ocl_radiusMatch(_queryDescriptors, trainDescCollection[0], matches, maxDistance, normType, compactResult) )
return;
}
}
}
-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;
(*this)(image, msers, mask);
}
}
-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 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 );
(*this)(grayImage, keypoints);
std::vector<KeyPoint>& keypoints ) const;
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;
CV_PROP_RW int nfeatures;
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 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 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