From 60019422e83744a401a4f9451274a7a5408d2329 Mon Sep 17 00:00:00 2001 From: Maria Dimashova Date: Fri, 21 May 2010 17:36:36 +0000 Subject: [PATCH] fixed gftt wrapper, update testdata --- .../include/opencv2/features2d/features2d.hpp | 33 ------------------- modules/features2d/src/detectors.cpp | 5 +-- modules/features2d/src/sift.cpp | 4 +-- .../cv/src/adetectordescriptor_evaluation.cpp | 4 +-- 4 files changed, 7 insertions(+), 39 deletions(-) diff --git a/modules/features2d/include/opencv2/features2d/features2d.hpp b/modules/features2d/include/opencv2/features2d/features2d.hpp index 8c59a604e9..8178196d4f 100644 --- a/modules/features2d/include/opencv2/features2d/features2d.hpp +++ b/modules/features2d/include/opencv2/features2d/features2d.hpp @@ -1323,39 +1323,6 @@ protected: SURF surf; }; -/*template -class CV_EXPORTS CalonderDescriptorExtractor : public DescriptorExtractor -{ -public: - CalonderDescriptorExtractor( const string& classifierFile ) - { - classifier.read(classifierFile.c_str()); - } - - virtual void compute( const Mat& image, vector& keypoints, Mat& descriptors) const - { - // Cannot compute descriptors for keypoints on the image border. - removeBorderKeypoints(keypoints, image.size(), BORDER_SIZE); - - // TODO Check 16-byte aligned - descriptors.create( keypoints.size(), classifier.classes(), DataType::type ); - PatchGenerator patchGen; - RNG rng; - - for( size_t i = 0; i < keypoints.size(); i++ ) - { - Mat patch; - patchGen( image, keypoints[i].pt, patch, Size(PATCH_SIZE, PATCH_SIZE), rng ); - IplImage ipl = patch; - classifier.getSignature( &ipl, descriptors.ptr(i)); - } - } - -protected: - static const int BORDER_SIZE = 16; - RTreeClassifier classifier; -};*/ - /****************************************************************************************\ * Distance * \****************************************************************************************/ diff --git a/modules/features2d/src/detectors.cpp b/modules/features2d/src/detectors.cpp index a0288d473e..b2ab08a317 100644 --- a/modules/features2d/src/detectors.cpp +++ b/modules/features2d/src/detectors.cpp @@ -102,7 +102,7 @@ void GoodFeaturesToTrackDetector::detectImpl( const Mat& image, const Mat& mask, vector::iterator keypoint_it = keypoints.begin(); for( ; corner_it != corners.end(); ++corner_it, ++keypoint_it ) { - *keypoint_it = KeyPoint( *corner_it, 1.f ); + *keypoint_it = KeyPoint( *corner_it, blockSize ); } } @@ -127,8 +127,9 @@ void MserFeatureDetector::detectImpl( const Mat& image, const Mat& mask, vector< vector::iterator keypoint_it = keypoints.begin(); for( ; contour_it != msers.end(); ++contour_it, ++keypoint_it ) { + // TODO check transformation from MSER region to KeyPoint RotatedRect rect = fitEllipse(Mat(*contour_it)); - *keypoint_it = KeyPoint( rect.center, min(rect.size.height, rect.size.width), rect.angle); + *keypoint_it = KeyPoint( rect.center, sqrt(rect.size.height*rect.size.width), rect.angle); } } diff --git a/modules/features2d/src/sift.cpp b/modules/features2d/src/sift.cpp index de32eb175a..22fbd75917 100644 --- a/modules/features2d/src/sift.cpp +++ b/modules/features2d/src/sift.cpp @@ -2006,13 +2006,13 @@ SIFT::SIFT( const CommonParams& _commParams, inline KeyPoint vlKeypointToOcv( const VL::Sift::Keypoint& vlKeypoint, float angle ) { - return KeyPoint(vlKeypoint.x, vlKeypoint.y, vlKeypoint.sigma, angle, 0, vlKeypoint.o, 0 ); + return KeyPoint(vlKeypoint.x, vlKeypoint.y, 3*vlKeypoint.sigma, angle, 0, vlKeypoint.o, 0 ); } inline void ocvKeypointToVl( const KeyPoint& ocvKeypoint, const VL::Sift& vlSift, VL::Sift::Keypoint& vlKeypoint ) { - vlKeypoint = vlSift.getKeypoint(ocvKeypoint.pt.x, ocvKeypoint.pt.y, ocvKeypoint.size); + vlKeypoint = vlSift.getKeypoint(ocvKeypoint.pt.x, ocvKeypoint.pt.y, ocvKeypoint.size/3); } float computeKeypointOrientations( VL::Sift& sift, const VL::Sift::Keypoint& keypoint, int angleMode ) diff --git a/tests/cv/src/adetectordescriptor_evaluation.cpp b/tests/cv/src/adetectordescriptor_evaluation.cpp index 5ffa3521bb..ef4626f56a 100644 --- a/tests/cv/src/adetectordescriptor_evaluation.cpp +++ b/tests/cv/src/adetectordescriptor_evaluation.cpp @@ -278,7 +278,7 @@ void transformToEllipticKeyPoints( const vector& src, vector& src, vector { Size_ axes = src[i].axes; float rad = sqrt(axes.height*axes.width); - dst[i] = KeyPoint(src[i].center, rad ); + dst[i] = KeyPoint(src[i].center, 2*rad ); } } }