mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +04:00
Instrumentation for OpenCV API regions and IPP functions;
This commit is contained in:
@@ -7940,6 +7940,8 @@ static void OAST_9_16(InputArray _img, std::vector<KeyPoint>& keypoints, int thr
|
||||
|
||||
void AGAST(InputArray _img, std::vector<KeyPoint>& keypoints, int threshold, bool nonmax_suppression)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
AGAST(_img, keypoints, threshold, nonmax_suppression, AgastFeatureDetector::OAST_9_16);
|
||||
}
|
||||
|
||||
@@ -7952,6 +7954,8 @@ public:
|
||||
|
||||
void detect( InputArray _image, std::vector<KeyPoint>& keypoints, InputArray _mask )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
Mat mask = _mask.getMat(), grayImage;
|
||||
UMat ugrayImage;
|
||||
_InputArray gray = _image;
|
||||
@@ -8007,6 +8011,7 @@ Ptr<AgastFeatureDetector> AgastFeatureDetector::create( int threshold, bool nonm
|
||||
|
||||
void AGAST(InputArray _img, std::vector<KeyPoint>& keypoints, int threshold, bool nonmax_suppression, int type)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
std::vector<KeyPoint> kpts;
|
||||
|
||||
|
||||
@@ -167,6 +167,8 @@ namespace cv
|
||||
OutputArray descriptors,
|
||||
bool useProvidedKeypoints)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
Mat img = image.getMat();
|
||||
if (img.channels() > 1)
|
||||
cvtColor(image, img, COLOR_BGR2GRAY);
|
||||
|
||||
@@ -89,6 +89,8 @@ BOWKMeansTrainer::BOWKMeansTrainer( int _clusterCount, const TermCriteria& _term
|
||||
|
||||
Mat BOWKMeansTrainer::cluster() const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CV_Assert( !descriptors.empty() );
|
||||
|
||||
Mat mergedDescriptors( descriptorsCount(), descriptors[0].cols, descriptors[0].type() );
|
||||
@@ -106,6 +108,8 @@ BOWKMeansTrainer::~BOWKMeansTrainer()
|
||||
|
||||
Mat BOWKMeansTrainer::cluster( const Mat& _descriptors ) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
Mat labels, vocabulary;
|
||||
kmeans( _descriptors, clusterCount, labels, termcrit, attempts, flags, vocabulary );
|
||||
return vocabulary;
|
||||
@@ -139,6 +143,8 @@ const Mat& BOWImgDescriptorExtractor::getVocabulary() const
|
||||
void BOWImgDescriptorExtractor::compute( InputArray image, std::vector<KeyPoint>& keypoints, OutputArray imgDescriptor,
|
||||
std::vector<std::vector<int> >* pointIdxsOfClusters, Mat* descriptors )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
imgDescriptor.release();
|
||||
|
||||
if( keypoints.empty() )
|
||||
@@ -168,6 +174,8 @@ int BOWImgDescriptorExtractor::descriptorType() const
|
||||
|
||||
void BOWImgDescriptorExtractor::compute( InputArray keypointDescriptors, OutputArray _imgDescriptor, std::vector<std::vector<int> >* pointIdxsOfClusters )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CV_Assert( !vocabulary.empty() );
|
||||
|
||||
int clusterCount = descriptorSize(); // = vocabulary.rows
|
||||
|
||||
@@ -190,6 +190,8 @@ void SimpleBlobDetectorImpl::write( cv::FileStorage& fs ) const
|
||||
|
||||
void SimpleBlobDetectorImpl::findBlobs(InputArray _image, InputArray _binaryImage, std::vector<Center> ¢ers) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
Mat image = _image.getMat(), binaryImage = _binaryImage.getMat();
|
||||
(void)image;
|
||||
centers.clear();
|
||||
@@ -304,6 +306,8 @@ void SimpleBlobDetectorImpl::findBlobs(InputArray _image, InputArray _binaryImag
|
||||
|
||||
void SimpleBlobDetectorImpl::detect(InputArray image, std::vector<cv::KeyPoint>& keypoints, InputArray)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
//TODO: support mask
|
||||
keypoints.clear();
|
||||
Mat grayscaleImage;
|
||||
|
||||
@@ -91,6 +91,8 @@ static inline void _drawKeypoint( InputOutputArray img, const KeyPoint& p, const
|
||||
void drawKeypoints( InputArray image, const std::vector<KeyPoint>& keypoints, InputOutputArray outImage,
|
||||
const Scalar& _color, int flags )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
if( !(flags & DrawMatchesFlags::DRAW_OVER_OUTIMG) )
|
||||
{
|
||||
if( image.type() == CV_8UC3 )
|
||||
|
||||
@@ -179,6 +179,8 @@ void EllipticKeyPoint::calcProjection( const Mat_<double>& H, EllipticKeyPoint&
|
||||
|
||||
void EllipticKeyPoint::convert( const std::vector<KeyPoint>& src, std::vector<EllipticKeyPoint>& dst )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
if( !src.empty() )
|
||||
{
|
||||
dst.resize(src.size());
|
||||
@@ -194,6 +196,8 @@ void EllipticKeyPoint::convert( const std::vector<KeyPoint>& src, std::vector<El
|
||||
|
||||
void EllipticKeyPoint::convert( const std::vector<EllipticKeyPoint>& src, std::vector<KeyPoint>& dst )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
if( !src.empty() )
|
||||
{
|
||||
dst.resize(src.size());
|
||||
@@ -456,6 +460,8 @@ void cv::evaluateFeatureDetector( const Mat& img1, const Mat& img2, const Mat& H
|
||||
float& repeatability, int& correspCount,
|
||||
const Ptr<FeatureDetector>& _fdetector )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
Ptr<FeatureDetector> fdetector(_fdetector);
|
||||
std::vector<KeyPoint> *keypoints1, *keypoints2, buf1, buf2;
|
||||
keypoints1 = _keypoints1 != 0 ? _keypoints1 : &buf1;
|
||||
@@ -492,6 +498,8 @@ void cv::computeRecallPrecisionCurve( const std::vector<std::vector<DMatch> >& m
|
||||
const std::vector<std::vector<uchar> >& correctMatches1to2Mask,
|
||||
std::vector<Point2f>& recallPrecisionCurve )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CV_Assert( matches1to2.size() == correctMatches1to2Mask.size() );
|
||||
|
||||
std::vector<DMatchForEvaluation> allMatches;
|
||||
@@ -526,6 +534,8 @@ void cv::computeRecallPrecisionCurve( const std::vector<std::vector<DMatch> >& m
|
||||
|
||||
float cv::getRecall( const std::vector<Point2f>& recallPrecisionCurve, float l_precision )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
int nearestPointIndex = getNearestPoint( recallPrecisionCurve, l_precision );
|
||||
|
||||
float recall = -1.f;
|
||||
@@ -538,6 +548,8 @@ float cv::getRecall( const std::vector<Point2f>& recallPrecisionCurve, float l_p
|
||||
|
||||
int cv::getNearestPoint( const std::vector<Point2f>& recallPrecisionCurve, float l_precision )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
int nearestPointIndex = -1;
|
||||
|
||||
if( l_precision >= 0 && l_precision <= 1 )
|
||||
|
||||
@@ -331,6 +331,8 @@ static bool ocl_FAST( InputArray _img, std::vector<KeyPoint>& keypoints,
|
||||
|
||||
void FAST(InputArray _img, std::vector<KeyPoint>& keypoints, int threshold, bool nonmax_suppression, int type)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
if( ocl::useOpenCL() && _img.isUMat() && type == FastFeatureDetector::TYPE_9_16 &&
|
||||
ocl_FAST(_img, keypoints, threshold, nonmax_suppression, 10000))
|
||||
@@ -360,6 +362,8 @@ void FAST(InputArray _img, std::vector<KeyPoint>& keypoints, int threshold, bool
|
||||
|
||||
void FAST(InputArray _img, std::vector<KeyPoint>& keypoints, int threshold, bool nonmax_suppression)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
FAST(_img, keypoints, threshold, nonmax_suppression, FastFeatureDetector::TYPE_9_16);
|
||||
}
|
||||
|
||||
@@ -373,6 +377,8 @@ public:
|
||||
|
||||
void detect( InputArray _image, std::vector<KeyPoint>& keypoints, InputArray _mask )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
Mat mask = _mask.getMat(), grayImage;
|
||||
UMat ugrayImage;
|
||||
_InputArray gray = _image;
|
||||
|
||||
@@ -60,6 +60,8 @@ void Feature2D::detect( InputArray image,
|
||||
std::vector<KeyPoint>& keypoints,
|
||||
InputArray mask )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
if( image.empty() )
|
||||
{
|
||||
keypoints.clear();
|
||||
@@ -73,6 +75,8 @@ void Feature2D::detect( InputArrayOfArrays _images,
|
||||
std::vector<std::vector<KeyPoint> >& keypoints,
|
||||
InputArrayOfArrays _masks )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
vector<Mat> images, masks;
|
||||
|
||||
_images.getMatVector(images);
|
||||
@@ -102,6 +106,8 @@ void Feature2D::compute( InputArray image,
|
||||
std::vector<KeyPoint>& keypoints,
|
||||
OutputArray descriptors )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
if( image.empty() )
|
||||
{
|
||||
descriptors.release();
|
||||
@@ -114,6 +120,8 @@ void Feature2D::compute( InputArrayOfArrays _images,
|
||||
std::vector<std::vector<KeyPoint> >& keypoints,
|
||||
OutputArrayOfArrays _descriptors )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
if( !_descriptors.needed() )
|
||||
return;
|
||||
|
||||
@@ -141,6 +149,8 @@ void Feature2D::detectAndCompute( InputArray, InputArray,
|
||||
OutputArray,
|
||||
bool )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CV_Error(Error::StsNotImplemented, "");
|
||||
}
|
||||
|
||||
|
||||
@@ -75,6 +75,8 @@ public:
|
||||
|
||||
void detect( InputArray _image, std::vector<KeyPoint>& keypoints, InputArray _mask )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
std::vector<Point2f> corners;
|
||||
|
||||
if (_image.isUMat())
|
||||
|
||||
@@ -110,6 +110,8 @@ namespace cv
|
||||
OutputArray descriptors,
|
||||
bool useProvidedKeypoints)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
cv::Mat img = image.getMat();
|
||||
if (img.channels() > 1)
|
||||
cvtColor(image, img, COLOR_BGR2GRAY);
|
||||
|
||||
@@ -567,6 +567,8 @@ void DescriptorMatcher::train()
|
||||
void DescriptorMatcher::match( InputArray queryDescriptors, InputArray trainDescriptors,
|
||||
std::vector<DMatch>& matches, InputArray mask ) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
Ptr<DescriptorMatcher> tempMatcher = clone(true);
|
||||
tempMatcher->add(trainDescriptors);
|
||||
tempMatcher->match( queryDescriptors, matches, std::vector<Mat>(1, mask.getMat()) );
|
||||
@@ -576,6 +578,8 @@ void DescriptorMatcher::knnMatch( InputArray queryDescriptors, InputArray trainD
|
||||
std::vector<std::vector<DMatch> >& matches, int knn,
|
||||
InputArray mask, bool compactResult ) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
Ptr<DescriptorMatcher> tempMatcher = clone(true);
|
||||
tempMatcher->add(trainDescriptors);
|
||||
tempMatcher->knnMatch( queryDescriptors, matches, knn, std::vector<Mat>(1, mask.getMat()), compactResult );
|
||||
@@ -585,6 +589,8 @@ void DescriptorMatcher::radiusMatch( InputArray queryDescriptors, InputArray tra
|
||||
std::vector<std::vector<DMatch> >& matches, float maxDistance, InputArray mask,
|
||||
bool compactResult ) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
Ptr<DescriptorMatcher> tempMatcher = clone(true);
|
||||
tempMatcher->add(trainDescriptors);
|
||||
tempMatcher->radiusMatch( queryDescriptors, matches, maxDistance, std::vector<Mat>(1, mask.getMat()), compactResult );
|
||||
@@ -592,6 +598,8 @@ void DescriptorMatcher::radiusMatch( InputArray queryDescriptors, InputArray tra
|
||||
|
||||
void DescriptorMatcher::match( InputArray queryDescriptors, std::vector<DMatch>& matches, InputArrayOfArrays masks )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
std::vector<std::vector<DMatch> > knnMatches;
|
||||
knnMatch( queryDescriptors, knnMatches, 1, masks, true /*compactResult*/ );
|
||||
convertMatches( knnMatches, matches );
|
||||
@@ -623,6 +631,8 @@ void DescriptorMatcher::checkMasks( InputArrayOfArrays _masks, int queryDescript
|
||||
void DescriptorMatcher::knnMatch( InputArray queryDescriptors, std::vector<std::vector<DMatch> >& matches, int knn,
|
||||
InputArrayOfArrays masks, bool compactResult )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
if( empty() || queryDescriptors.empty() )
|
||||
return;
|
||||
|
||||
@@ -637,6 +647,8 @@ void DescriptorMatcher::knnMatch( InputArray queryDescriptors, std::vector<std::
|
||||
void DescriptorMatcher::radiusMatch( InputArray queryDescriptors, std::vector<std::vector<DMatch> >& matches, float maxDistance,
|
||||
InputArrayOfArrays masks, bool compactResult )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
matches.clear();
|
||||
if( empty() || queryDescriptors.empty() )
|
||||
return;
|
||||
@@ -1080,6 +1092,8 @@ void FlannBasedMatcher::clear()
|
||||
|
||||
void FlannBasedMatcher::train()
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
if( !flannIndex || mergedDescriptors.size() < addedDescCount )
|
||||
{
|
||||
// FIXIT: Workaround for 'utrainDescCollection' issue (PR #2142)
|
||||
@@ -1332,6 +1346,8 @@ void FlannBasedMatcher::convertToDMatches( const DescriptorCollection& collectio
|
||||
void FlannBasedMatcher::knnMatchImpl( InputArray _queryDescriptors, std::vector<std::vector<DMatch> >& matches, int knn,
|
||||
InputArrayOfArrays /*masks*/, bool /*compactResult*/ )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
Mat queryDescriptors = _queryDescriptors.getMat();
|
||||
Mat indices( queryDescriptors.rows, knn, CV_32SC1 );
|
||||
Mat dists( queryDescriptors.rows, knn, CV_32FC1);
|
||||
@@ -1343,6 +1359,8 @@ void FlannBasedMatcher::knnMatchImpl( InputArray _queryDescriptors, std::vector<
|
||||
void FlannBasedMatcher::radiusMatchImpl( InputArray _queryDescriptors, std::vector<std::vector<DMatch> >& matches, float maxDistance,
|
||||
InputArrayOfArrays /*masks*/, bool /*compactResult*/ )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
Mat queryDescriptors = _queryDescriptors.getMat();
|
||||
const int count = mergedDescriptors.size(); // TODO do count as param?
|
||||
Mat indices( queryDescriptors.rows, count, CV_32SC1, Scalar::all(-1) );
|
||||
|
||||
@@ -1040,6 +1040,8 @@ extractMSER_8uC3( const Mat& src,
|
||||
|
||||
void MSER_Impl::detectRegions( InputArray _src, vector<vector<Point> >& msers, vector<Rect>& bboxes )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
Mat src = _src.getMat();
|
||||
|
||||
msers.clear();
|
||||
@@ -1076,6 +1078,8 @@ void MSER_Impl::detectRegions( InputArray _src, vector<vector<Point> >& msers, v
|
||||
|
||||
void MSER_Impl::detect( InputArray _image, vector<KeyPoint>& keypoints, InputArray _mask )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
vector<Rect> bboxes;
|
||||
vector<vector<Point> > msers;
|
||||
Mat mask = _mask.getMat();
|
||||
|
||||
@@ -957,6 +957,8 @@ void ORB_Impl::detectAndCompute( InputArray _image, InputArray _mask,
|
||||
std::vector<KeyPoint>& keypoints,
|
||||
OutputArray _descriptors, bool useProvidedKeypoints )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CV_Assert(patchSize >= 2);
|
||||
|
||||
bool do_keypoints = !useProvidedKeypoints;
|
||||
|
||||
Reference in New Issue
Block a user