features2d
This commit is contained in:
@@ -140,7 +140,7 @@ const Mat& BOWImgDescriptorExtractor::getVocabulary() const
|
||||
return vocabulary;
|
||||
}
|
||||
|
||||
void BOWImgDescriptorExtractor::compute( const Mat& image, std::vector<KeyPoint>& keypoints, Mat& imgDescriptor,
|
||||
void BOWImgDescriptorExtractor::compute( InputArray image, std::vector<KeyPoint>& keypoints, InputOutputArray imgDescriptor,
|
||||
std::vector<std::vector<int> >* pointIdxsOfClusters, Mat* descriptors )
|
||||
{
|
||||
imgDescriptor.release();
|
||||
@@ -170,7 +170,7 @@ int BOWImgDescriptorExtractor::descriptorType() const
|
||||
return CV_32FC1;
|
||||
}
|
||||
|
||||
void BOWImgDescriptorExtractor::compute( const Mat& keypointDescriptors, Mat& imgDescriptor, std::vector<std::vector<int> >* pointIdxsOfClusters )
|
||||
void BOWImgDescriptorExtractor::compute( InputArray keypointDescriptors, InputOutputArray _imgDescriptor, std::vector<std::vector<int> >* pointIdxsOfClusters )
|
||||
{
|
||||
CV_Assert( vocabulary.empty() != false );
|
||||
|
||||
@@ -187,7 +187,10 @@ void BOWImgDescriptorExtractor::compute( const Mat& keypointDescriptors, Mat& im
|
||||
pointIdxsOfClusters->resize(clusterCount);
|
||||
}
|
||||
|
||||
imgDescriptor = Mat( 1, clusterCount, descriptorType(), Scalar::all(0.0) );
|
||||
Mat( 1, clusterCount, descriptorType(), Scalar::all(0.0) ).copyTo(_imgDescriptor);
|
||||
|
||||
Mat imgDescriptor = _imgDescriptor.getMat();
|
||||
|
||||
float *dptr = (float*)imgDescriptor.data;
|
||||
for( size_t i = 0; i < matches.size(); i++ )
|
||||
{
|
||||
@@ -201,7 +204,7 @@ void BOWImgDescriptorExtractor::compute( const Mat& keypointDescriptors, Mat& im
|
||||
}
|
||||
|
||||
// Normalize image descriptor.
|
||||
imgDescriptor /= keypointDescriptors.rows;
|
||||
imgDescriptor /= keypointDescriptors.size().height;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -163,8 +163,9 @@ void SimpleBlobDetector::write( cv::FileStorage& fs ) const
|
||||
params.write(fs);
|
||||
}
|
||||
|
||||
void SimpleBlobDetector::findBlobs(const cv::Mat &image, const cv::Mat &binaryImage, std::vector<Center> ¢ers) const
|
||||
void SimpleBlobDetector::findBlobs(InputArray _image, InputArray _binaryImage, std::vector<Center> ¢ers) const
|
||||
{
|
||||
Mat image = _image.getMat(), binaryImage = _binaryImage.getMat();
|
||||
(void)image;
|
||||
centers.clear();
|
||||
|
||||
|
||||
@@ -61,8 +61,9 @@ inline int smoothedSum(const Mat& sum, const KeyPoint& pt, int y, int x)
|
||||
+ sum.at<int>(img_y - HALF_KERNEL, img_x - HALF_KERNEL);
|
||||
}
|
||||
|
||||
static void pixelTests16(const Mat& sum, const std::vector<KeyPoint>& keypoints, Mat& descriptors)
|
||||
static void pixelTests16(InputArray _sum, const std::vector<KeyPoint>& keypoints, OutputArray _descriptors)
|
||||
{
|
||||
Mat sum = _sum.getMat(), descriptors = _descriptors.getMat();
|
||||
for (int i = 0; i < (int)keypoints.size(); ++i)
|
||||
{
|
||||
uchar* desc = descriptors.ptr(i);
|
||||
@@ -71,8 +72,9 @@ static void pixelTests16(const Mat& sum, const std::vector<KeyPoint>& keypoints,
|
||||
}
|
||||
}
|
||||
|
||||
static void pixelTests32(const Mat& sum, const std::vector<KeyPoint>& keypoints, Mat& descriptors)
|
||||
static void pixelTests32(InputArray _sum, const std::vector<KeyPoint>& keypoints, OutputArray _descriptors)
|
||||
{
|
||||
Mat sum = _sum.getMat(), descriptors = _descriptors.getMat();
|
||||
for (int i = 0; i < (int)keypoints.size(); ++i)
|
||||
{
|
||||
uchar* desc = descriptors.ptr(i);
|
||||
@@ -82,8 +84,9 @@ static void pixelTests32(const Mat& sum, const std::vector<KeyPoint>& keypoints,
|
||||
}
|
||||
}
|
||||
|
||||
static void pixelTests64(const Mat& sum, const std::vector<KeyPoint>& keypoints, Mat& descriptors)
|
||||
static void pixelTests64(InputArray _sum, const std::vector<KeyPoint>& keypoints, OutputArray _descriptors)
|
||||
{
|
||||
Mat sum = _sum.getMat(), descriptors = _descriptors.getMat();
|
||||
for (int i = 0; i < (int)keypoints.size(); ++i)
|
||||
{
|
||||
uchar* desc = descriptors.ptr(i);
|
||||
@@ -155,12 +158,12 @@ void BriefDescriptorExtractor::write( FileStorage& fs) const
|
||||
fs << "descriptorSize" << bytes_;
|
||||
}
|
||||
|
||||
void BriefDescriptorExtractor::computeImpl(const Mat& image, std::vector<KeyPoint>& keypoints, Mat& descriptors) const
|
||||
void BriefDescriptorExtractor::computeImpl(InputArray image, std::vector<KeyPoint>& keypoints, OutputArray descriptors) const
|
||||
{
|
||||
// Construct integral image for fast smoothing (box filter)
|
||||
Mat sum;
|
||||
|
||||
Mat grayImage = image;
|
||||
Mat grayImage = image.getMat();
|
||||
if( image.type() != CV_8U ) cvtColor( image, grayImage, COLOR_BGR2GRAY );
|
||||
|
||||
///TODO allow the user to pass in a precomputed integral image
|
||||
@@ -173,7 +176,7 @@ void BriefDescriptorExtractor::computeImpl(const Mat& image, std::vector<KeyPoin
|
||||
//Remove keypoints very close to the border
|
||||
KeyPointsFilter::runByImageBorder(keypoints, image.size(), PATCH_SIZE/2 + KERNEL_SIZE/2);
|
||||
|
||||
descriptors = Mat::zeros((int)keypoints.size(), bytes_, CV_8U);
|
||||
Mat(Mat::zeros((int)keypoints.size(), bytes_, CV_8U)).copyTo(descriptors);
|
||||
test_fn_(sum, keypoints, descriptors);
|
||||
}
|
||||
|
||||
|
||||
@@ -757,7 +757,7 @@ BRISK::detectImpl( InputArray image, std::vector<KeyPoint>& keypoints, InputArra
|
||||
}
|
||||
|
||||
void
|
||||
BRISK::computeImpl( const Mat& image, std::vector<KeyPoint>& keypoints, Mat& descriptors) const
|
||||
BRISK::computeImpl( InputArray image, std::vector<KeyPoint>& keypoints, OutputArray descriptors) const
|
||||
{
|
||||
(*this)(image, Mat(), keypoints, descriptors, true);
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace cv
|
||||
DescriptorExtractor::~DescriptorExtractor()
|
||||
{}
|
||||
|
||||
void DescriptorExtractor::compute( const Mat& image, std::vector<KeyPoint>& keypoints, Mat& descriptors ) const
|
||||
void DescriptorExtractor::compute( InputArray image, std::vector<KeyPoint>& keypoints, OutputArray descriptors ) const
|
||||
{
|
||||
if( image.empty() || keypoints.empty() )
|
||||
{
|
||||
@@ -68,8 +68,11 @@ void DescriptorExtractor::compute( const Mat& image, std::vector<KeyPoint>& keyp
|
||||
computeImpl( image, keypoints, descriptors );
|
||||
}
|
||||
|
||||
void DescriptorExtractor::compute( const std::vector<Mat>& imageCollection, std::vector<std::vector<KeyPoint> >& pointCollection, std::vector<Mat>& descCollection ) const
|
||||
void DescriptorExtractor::compute( InputArrayOfArrays _imageCollection, std::vector<std::vector<KeyPoint> >& pointCollection, OutputArrayOfArrays _descCollection ) const
|
||||
{
|
||||
std::vector<Mat> imageCollection, descCollection;
|
||||
_imageCollection.getMatVector(imageCollection);
|
||||
_descCollection.getMatVector(descCollection);
|
||||
CV_Assert( imageCollection.size() == pointCollection.size() );
|
||||
descCollection.resize( imageCollection.size() );
|
||||
for( size_t i = 0; i < imageCollection.size(); i++ )
|
||||
@@ -106,7 +109,7 @@ Ptr<DescriptorExtractor> DescriptorExtractor::create(const String& descriptorExt
|
||||
}
|
||||
|
||||
|
||||
CV_WRAP void Feature2D::compute( const Mat& image, CV_OUT CV_IN_OUT std::vector<KeyPoint>& keypoints, CV_OUT Mat& descriptors ) const
|
||||
CV_WRAP void Feature2D::compute( InputArray image, CV_OUT CV_IN_OUT std::vector<KeyPoint>& keypoints, CV_OUT OutputArray descriptors ) const
|
||||
{
|
||||
DescriptorExtractor::compute(image, keypoints, descriptors);
|
||||
}
|
||||
@@ -157,8 +160,9 @@ struct KP_LessThan
|
||||
const std::vector<KeyPoint>* kp;
|
||||
};
|
||||
|
||||
void OpponentColorDescriptorExtractor::computeImpl( const Mat& bgrImage, std::vector<KeyPoint>& keypoints, Mat& descriptors ) const
|
||||
void OpponentColorDescriptorExtractor::computeImpl( InputArray _bgrImage, std::vector<KeyPoint>& keypoints, OutputArray descriptors ) const
|
||||
{
|
||||
Mat bgrImage = _bgrImage.getMat();
|
||||
std::vector<Mat> opponentChannels;
|
||||
convertBGRImageToOpponentColorSpace( bgrImage, opponentChannels );
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace cv
|
||||
/*
|
||||
* Functions to draw keypoints and matches.
|
||||
*/
|
||||
static inline void _drawKeypoint( Mat& img, const KeyPoint& p, const Scalar& color, int flags )
|
||||
static inline void _drawKeypoint( InputOutputArray img, const KeyPoint& p, const Scalar& color, int flags )
|
||||
{
|
||||
CV_Assert( !img.empty() );
|
||||
Point center( cvRound(p.pt.x * draw_multiplier), cvRound(p.pt.y * draw_multiplier) );
|
||||
@@ -88,7 +88,7 @@ static inline void _drawKeypoint( Mat& img, const KeyPoint& p, const Scalar& col
|
||||
}
|
||||
}
|
||||
|
||||
void drawKeypoints( const Mat& image, const std::vector<KeyPoint>& keypoints, Mat& outImage,
|
||||
void drawKeypoints( InputArray image, const std::vector<KeyPoint>& keypoints, InputOutputArray& outImage,
|
||||
const Scalar& _color, int flags )
|
||||
{
|
||||
if( !(flags & DrawMatchesFlags::DRAW_OVER_OUTIMG) )
|
||||
@@ -120,26 +120,30 @@ void drawKeypoints( const Mat& image, const std::vector<KeyPoint>& keypoints, Ma
|
||||
}
|
||||
}
|
||||
|
||||
static void _prepareImgAndDrawKeypoints( const Mat& img1, const std::vector<KeyPoint>& keypoints1,
|
||||
const Mat& img2, const std::vector<KeyPoint>& keypoints2,
|
||||
Mat& outImg, Mat& outImg1, Mat& outImg2,
|
||||
static void _prepareImgAndDrawKeypoints( InputArray img1, const std::vector<KeyPoint>& keypoints1,
|
||||
InputArray img2, const std::vector<KeyPoint>& keypoints2,
|
||||
InputOutputArray _outImg, Mat& outImg1, Mat& outImg2,
|
||||
const Scalar& singlePointColor, int flags )
|
||||
{
|
||||
Size size( img1.cols + img2.cols, MAX(img1.rows, img2.rows) );
|
||||
Mat outImg;
|
||||
Size img1size = img1.size(), img2size = img2.size();
|
||||
Size size( img1size.width + img2size.width, MAX(img1size.height, img2size.height) );
|
||||
if( flags & DrawMatchesFlags::DRAW_OVER_OUTIMG )
|
||||
{
|
||||
outImg = _outImg.getMat();
|
||||
if( size.width > outImg.cols || size.height > outImg.rows )
|
||||
CV_Error( Error::StsBadSize, "outImg has size less than need to draw img1 and img2 together" );
|
||||
outImg1 = outImg( Rect(0, 0, img1.cols, img1.rows) );
|
||||
outImg2 = outImg( Rect(img1.cols, 0, img2.cols, img2.rows) );
|
||||
outImg1 = outImg( Rect(0, 0, img1size.width, img1size.height) );
|
||||
outImg2 = outImg( Rect(img1size.width, 0, img2size.width, img2size.height) );
|
||||
}
|
||||
else
|
||||
{
|
||||
outImg.create( size, CV_MAKETYPE(img1.depth(), 3) );
|
||||
_outImg.create( size, CV_MAKETYPE(img1.depth(), 3) );
|
||||
outImg = _outImg.getMat();
|
||||
outImg = Scalar::all(0);
|
||||
outImg1 = outImg( Rect(0, 0, img1.cols, img1.rows) );
|
||||
outImg2 = outImg( Rect(img1.cols, 0, img2.cols, img2.rows) );
|
||||
|
||||
outImg1 = outImg( Rect(0, 0, img1size.width, img1size.height) );
|
||||
outImg2 = outImg( Rect(img1size.width, 0, img2size.width, img2size.height) );
|
||||
printf("%d %d\n", _outImg.size().width, _outImg.size().height);
|
||||
if( img1.type() == CV_8U )
|
||||
cvtColor( img1, outImg1, COLOR_GRAY2BGR );
|
||||
else
|
||||
@@ -154,15 +158,15 @@ static void _prepareImgAndDrawKeypoints( const Mat& img1, const std::vector<KeyP
|
||||
// draw keypoints
|
||||
if( !(flags & DrawMatchesFlags::NOT_DRAW_SINGLE_POINTS) )
|
||||
{
|
||||
Mat _outImg1 = outImg( Rect(0, 0, img1.cols, img1.rows) );
|
||||
Mat _outImg1 = outImg( Rect(0, 0, img1size.width, img1size.height) );
|
||||
drawKeypoints( _outImg1, keypoints1, _outImg1, singlePointColor, flags + DrawMatchesFlags::DRAW_OVER_OUTIMG );
|
||||
|
||||
Mat _outImg2 = outImg( Rect(img1.cols, 0, img2.cols, img2.rows) );
|
||||
Mat _outImg2 = outImg( Rect(img1size.width, 0, img2size.width, img2size.height) );
|
||||
drawKeypoints( _outImg2, keypoints2, _outImg2, singlePointColor, flags + DrawMatchesFlags::DRAW_OVER_OUTIMG );
|
||||
}
|
||||
}
|
||||
|
||||
static inline void _drawMatch( Mat& outImg, Mat& outImg1, Mat& outImg2 ,
|
||||
static inline void _drawMatch( InputOutputArray outImg, InputOutputArray outImg1, InputOutputArray outImg2 ,
|
||||
const KeyPoint& kp1, const KeyPoint& kp2, const Scalar& matchColor, int flags )
|
||||
{
|
||||
RNG& rng = theRNG();
|
||||
@@ -174,7 +178,7 @@ static inline void _drawMatch( Mat& outImg, Mat& outImg1, Mat& outImg2 ,
|
||||
|
||||
Point2f pt1 = kp1.pt,
|
||||
pt2 = kp2.pt,
|
||||
dpt2 = Point2f( std::min(pt2.x+outImg1.cols, float(outImg.cols-1)), pt2.y );
|
||||
dpt2 = Point2f( std::min(pt2.x+outImg1.size().width, float(outImg.size().width-1)), pt2.y );
|
||||
|
||||
line( outImg,
|
||||
Point(cvRound(pt1.x*draw_multiplier), cvRound(pt1.y*draw_multiplier)),
|
||||
@@ -182,9 +186,9 @@ static inline void _drawMatch( Mat& outImg, Mat& outImg1, Mat& outImg2 ,
|
||||
color, 1, LINE_AA, draw_shift_bits );
|
||||
}
|
||||
|
||||
void drawMatches( const Mat& img1, const std::vector<KeyPoint>& keypoints1,
|
||||
const Mat& img2, const std::vector<KeyPoint>& keypoints2,
|
||||
const std::vector<DMatch>& matches1to2, Mat& outImg,
|
||||
void drawMatches( InputArray img1, const std::vector<KeyPoint>& keypoints1,
|
||||
InputArray img2, const std::vector<KeyPoint>& keypoints2,
|
||||
const std::vector<DMatch>& matches1to2, InputOutputArray outImg,
|
||||
const Scalar& matchColor, const Scalar& singlePointColor,
|
||||
const std::vector<char>& matchesMask, int flags )
|
||||
{
|
||||
@@ -211,9 +215,9 @@ void drawMatches( const Mat& img1, const std::vector<KeyPoint>& keypoints1,
|
||||
}
|
||||
}
|
||||
|
||||
void drawMatches( const Mat& img1, const std::vector<KeyPoint>& keypoints1,
|
||||
const Mat& img2, const std::vector<KeyPoint>& keypoints2,
|
||||
const std::vector<std::vector<DMatch> >& matches1to2, Mat& outImg,
|
||||
void drawMatches( InputArray img1, const std::vector<KeyPoint>& keypoints1,
|
||||
InputArray img2, const std::vector<KeyPoint>& keypoints2,
|
||||
const std::vector<std::vector<DMatch> >& matches1to2, InputOutputArray outImg,
|
||||
const Scalar& matchColor, const Scalar& singlePointColor,
|
||||
const std::vector<std::vector<char> >& matchesMask, int flags )
|
||||
{
|
||||
|
||||
@@ -229,9 +229,9 @@ void FREAK::buildPattern()
|
||||
}
|
||||
}
|
||||
|
||||
void FREAK::computeImpl( const Mat& image, std::vector<KeyPoint>& keypoints, Mat& descriptors ) const
|
||||
void FREAK::computeImpl( InputArray _image, std::vector<KeyPoint>& keypoints, OutputArray _descriptors ) const
|
||||
{
|
||||
|
||||
Mat image = _image.getMat();
|
||||
if( image.empty() )
|
||||
return;
|
||||
if( keypoints.empty() )
|
||||
@@ -297,7 +297,8 @@ void FREAK::computeImpl( const Mat& image, std::vector<KeyPoint>& keypoints, Mat
|
||||
if( !extAll )
|
||||
{
|
||||
// extract the best comparisons only
|
||||
descriptors = cv::Mat::zeros((int)keypoints.size(), FREAK_NB_PAIRS/8, CV_8U);
|
||||
Mat(cv::Mat::zeros((int)keypoints.size(), FREAK_NB_PAIRS/8, CV_8U)).copyTo(_descriptors);
|
||||
Mat descriptors = _descriptors.getMat();
|
||||
#if CV_SSE2
|
||||
__m128i* ptr= (__m128i*) (descriptors.data+(keypoints.size()-1)*descriptors.step[0]);
|
||||
#else
|
||||
@@ -415,7 +416,8 @@ void FREAK::computeImpl( const Mat& image, std::vector<KeyPoint>& keypoints, Mat
|
||||
}
|
||||
else // extract all possible comparisons for selection
|
||||
{
|
||||
descriptors = cv::Mat::zeros((int)keypoints.size(), 128, CV_8U);
|
||||
Mat(cv::Mat::zeros((int)keypoints.size(), 128, CV_8U)).copyTo(_descriptors);
|
||||
Mat descriptors = _descriptors.getMat();
|
||||
std::bitset<1024>* ptr = (std::bitset<1024>*) (descriptors.data+(keypoints.size()-1)*descriptors.step[0]);
|
||||
|
||||
for( size_t k = keypoints.size(); k--; )
|
||||
@@ -474,13 +476,14 @@ void FREAK::computeImpl( const Mat& image, std::vector<KeyPoint>& keypoints, Mat
|
||||
}
|
||||
|
||||
// simply take average on a square patch, not even gaussian approx
|
||||
uchar FREAK::meanIntensity( const cv::Mat& image, const cv::Mat& integral,
|
||||
uchar FREAK::meanIntensity( InputArray _image, InputArray _integral,
|
||||
const float kp_x,
|
||||
const float kp_y,
|
||||
const unsigned int scale,
|
||||
const unsigned int rot,
|
||||
const unsigned int point) const
|
||||
{
|
||||
Mat image = _image.getMat(), integral = _integral.getMat();
|
||||
// get point position in image
|
||||
const PatternPoint& FreakPoint = patternLookup[scale*FREAK_NB_ORIENTATION*FREAK_NB_POINTS + rot*FREAK_NB_POINTS + point];
|
||||
const float xf = FreakPoint.x+kp_x;
|
||||
|
||||
@@ -1617,9 +1617,11 @@ GenericDescriptorMatcher::GenericDescriptorMatcher()
|
||||
GenericDescriptorMatcher::~GenericDescriptorMatcher()
|
||||
{}
|
||||
|
||||
void GenericDescriptorMatcher::add( const std::vector<Mat>& images,
|
||||
void GenericDescriptorMatcher::add( InputArrayOfArrays _images,
|
||||
std::vector<std::vector<KeyPoint> >& keypoints )
|
||||
{
|
||||
std::vector<Mat> images;
|
||||
_images.getMatVector(images);
|
||||
CV_Assert( !images.empty() );
|
||||
CV_Assert( images.size() == keypoints.size() );
|
||||
|
||||
@@ -1651,8 +1653,8 @@ void GenericDescriptorMatcher::clear()
|
||||
void GenericDescriptorMatcher::train()
|
||||
{}
|
||||
|
||||
void GenericDescriptorMatcher::classify( const Mat& queryImage, std::vector<KeyPoint>& queryKeypoints,
|
||||
const Mat& trainImage, std::vector<KeyPoint>& trainKeypoints ) const
|
||||
void GenericDescriptorMatcher::classify( InputArray queryImage, std::vector<KeyPoint>& queryKeypoints,
|
||||
InputArray trainImage, std::vector<KeyPoint>& trainKeypoints ) const
|
||||
{
|
||||
std::vector<DMatch> matches;
|
||||
match( queryImage, queryKeypoints, trainImage, trainKeypoints, matches );
|
||||
@@ -1662,7 +1664,7 @@ void GenericDescriptorMatcher::classify( const Mat& queryImage, std::vector<KeyP
|
||||
queryKeypoints[matches[i].queryIdx].class_id = trainKeypoints[matches[i].trainIdx].class_id;
|
||||
}
|
||||
|
||||
void GenericDescriptorMatcher::classify( const Mat& queryImage, std::vector<KeyPoint>& queryKeypoints )
|
||||
void GenericDescriptorMatcher::classify( InputArray queryImage, std::vector<KeyPoint>& queryKeypoints )
|
||||
{
|
||||
std::vector<DMatch> matches;
|
||||
match( queryImage, queryKeypoints, matches );
|
||||
@@ -1672,10 +1674,11 @@ void GenericDescriptorMatcher::classify( const Mat& queryImage, std::vector<KeyP
|
||||
queryKeypoints[matches[i].queryIdx].class_id = trainPointCollection.getKeyPoint( matches[i].trainIdx, matches[i].trainIdx ).class_id;
|
||||
}
|
||||
|
||||
void GenericDescriptorMatcher::match( const Mat& queryImage, std::vector<KeyPoint>& queryKeypoints,
|
||||
const Mat& trainImage, std::vector<KeyPoint>& trainKeypoints,
|
||||
void GenericDescriptorMatcher::match( InputArray queryImage, std::vector<KeyPoint>& queryKeypoints,
|
||||
InputArray _trainImage, std::vector<KeyPoint>& trainKeypoints,
|
||||
std::vector<DMatch>& matches, const Mat& mask ) const
|
||||
{
|
||||
Mat trainImage = _trainImage.getMat();
|
||||
Ptr<GenericDescriptorMatcher> tempMatcher = clone( true );
|
||||
std::vector<std::vector<KeyPoint> > vecTrainPoints(1, trainKeypoints);
|
||||
tempMatcher->add( std::vector<Mat>(1, trainImage), vecTrainPoints );
|
||||
@@ -1683,10 +1686,11 @@ void GenericDescriptorMatcher::match( const Mat& queryImage, std::vector<KeyPoin
|
||||
vecTrainPoints[0].swap( trainKeypoints );
|
||||
}
|
||||
|
||||
void GenericDescriptorMatcher::knnMatch( const Mat& queryImage, std::vector<KeyPoint>& queryKeypoints,
|
||||
const Mat& trainImage, std::vector<KeyPoint>& trainKeypoints,
|
||||
void GenericDescriptorMatcher::knnMatch( InputArray queryImage, std::vector<KeyPoint>& queryKeypoints,
|
||||
InputArray _trainImage, std::vector<KeyPoint>& trainKeypoints,
|
||||
std::vector<std::vector<DMatch> >& matches, int knn, const Mat& mask, bool compactResult ) const
|
||||
{
|
||||
Mat trainImage = _trainImage.getMat();
|
||||
Ptr<GenericDescriptorMatcher> tempMatcher = clone( true );
|
||||
std::vector<std::vector<KeyPoint> > vecTrainPoints(1, trainKeypoints);
|
||||
tempMatcher->add( std::vector<Mat>(1, trainImage), vecTrainPoints );
|
||||
@@ -1694,11 +1698,12 @@ void GenericDescriptorMatcher::knnMatch( const Mat& queryImage, std::vector<KeyP
|
||||
vecTrainPoints[0].swap( trainKeypoints );
|
||||
}
|
||||
|
||||
void GenericDescriptorMatcher::radiusMatch( const Mat& queryImage, std::vector<KeyPoint>& queryKeypoints,
|
||||
const Mat& trainImage, std::vector<KeyPoint>& trainKeypoints,
|
||||
void GenericDescriptorMatcher::radiusMatch( InputArray queryImage, std::vector<KeyPoint>& queryKeypoints,
|
||||
InputArray _trainImage, std::vector<KeyPoint>& trainKeypoints,
|
||||
std::vector<std::vector<DMatch> >& matches, float maxDistance,
|
||||
const Mat& mask, bool compactResult ) const
|
||||
{
|
||||
Mat trainImage = _trainImage.getMat();
|
||||
Ptr<GenericDescriptorMatcher> tempMatcher = clone( true );
|
||||
std::vector<std::vector<KeyPoint> > vecTrainPoints(1, trainKeypoints);
|
||||
tempMatcher->add( std::vector<Mat>(1, trainImage), vecTrainPoints );
|
||||
@@ -1706,7 +1711,7 @@ void GenericDescriptorMatcher::radiusMatch( const Mat& queryImage, std::vector<K
|
||||
vecTrainPoints[0].swap( trainKeypoints );
|
||||
}
|
||||
|
||||
void GenericDescriptorMatcher::match( const Mat& queryImage, std::vector<KeyPoint>& queryKeypoints,
|
||||
void GenericDescriptorMatcher::match( InputArray queryImage, std::vector<KeyPoint>& queryKeypoints,
|
||||
std::vector<DMatch>& matches, const std::vector<Mat>& masks )
|
||||
{
|
||||
std::vector<std::vector<DMatch> > knnMatches;
|
||||
@@ -1714,7 +1719,7 @@ void GenericDescriptorMatcher::match( const Mat& queryImage, std::vector<KeyPoin
|
||||
convertMatches( knnMatches, matches );
|
||||
}
|
||||
|
||||
void GenericDescriptorMatcher::knnMatch( const Mat& queryImage, std::vector<KeyPoint>& queryKeypoints,
|
||||
void GenericDescriptorMatcher::knnMatch( InputArray queryImage, std::vector<KeyPoint>& queryKeypoints,
|
||||
std::vector<std::vector<DMatch> >& matches, int knn,
|
||||
const std::vector<Mat>& masks, bool compactResult )
|
||||
{
|
||||
@@ -1730,7 +1735,7 @@ void GenericDescriptorMatcher::knnMatch( const Mat& queryImage, std::vector<KeyP
|
||||
knnMatchImpl( queryImage, queryKeypoints, matches, knn, masks, compactResult );
|
||||
}
|
||||
|
||||
void GenericDescriptorMatcher::radiusMatch( const Mat& queryImage, std::vector<KeyPoint>& queryKeypoints,
|
||||
void GenericDescriptorMatcher::radiusMatch( InputArray queryImage, std::vector<KeyPoint>& queryKeypoints,
|
||||
std::vector<std::vector<DMatch> >& matches, float maxDistance,
|
||||
const std::vector<Mat>& masks, bool compactResult )
|
||||
{
|
||||
@@ -1792,10 +1797,11 @@ VectorDescriptorMatcher::VectorDescriptorMatcher( const Ptr<DescriptorExtractor>
|
||||
VectorDescriptorMatcher::~VectorDescriptorMatcher()
|
||||
{}
|
||||
|
||||
void VectorDescriptorMatcher::add( const std::vector<Mat>& imgCollection,
|
||||
void VectorDescriptorMatcher::add( InputArrayOfArrays _imgCollection,
|
||||
std::vector<std::vector<KeyPoint> >& pointCollection )
|
||||
{
|
||||
std::vector<Mat> descriptors;
|
||||
std::vector<Mat> imgCollection, descriptors;
|
||||
_imgCollection.getMatVector(imgCollection);
|
||||
extractor->compute( imgCollection, pointCollection, descriptors );
|
||||
|
||||
matcher->add( descriptors );
|
||||
@@ -1820,7 +1826,7 @@ bool VectorDescriptorMatcher::isMaskSupported()
|
||||
return matcher->isMaskSupported();
|
||||
}
|
||||
|
||||
void VectorDescriptorMatcher::knnMatchImpl( const Mat& queryImage, std::vector<KeyPoint>& queryKeypoints,
|
||||
void VectorDescriptorMatcher::knnMatchImpl( InputArray queryImage, std::vector<KeyPoint>& queryKeypoints,
|
||||
std::vector<std::vector<DMatch> >& matches, int knn,
|
||||
const std::vector<Mat>& masks, bool compactResult )
|
||||
{
|
||||
@@ -1829,7 +1835,7 @@ void VectorDescriptorMatcher::knnMatchImpl( const Mat& queryImage, std::vector<K
|
||||
matcher->knnMatch( queryDescriptors, matches, knn, masks, compactResult );
|
||||
}
|
||||
|
||||
void VectorDescriptorMatcher::radiusMatchImpl( const Mat& queryImage, std::vector<KeyPoint>& queryKeypoints,
|
||||
void VectorDescriptorMatcher::radiusMatchImpl( InputArray queryImage, std::vector<KeyPoint>& queryKeypoints,
|
||||
std::vector<std::vector<DMatch> >& matches, float maxDistance,
|
||||
const std::vector<Mat>& masks, bool compactResult )
|
||||
{
|
||||
|
||||
@@ -948,7 +948,7 @@ void ORB::detectImpl( InputArray image, std::vector<KeyPoint>& keypoints, InputA
|
||||
(*this)(image.getMat(), mask.getMat(), keypoints, noArray(), false);
|
||||
}
|
||||
|
||||
void ORB::computeImpl( const Mat& image, std::vector<KeyPoint>& keypoints, Mat& descriptors) const
|
||||
void ORB::computeImpl( InputArray image, std::vector<KeyPoint>& keypoints, OutputArray descriptors) const
|
||||
{
|
||||
(*this)(image, Mat(), keypoints, descriptors, true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user