From 165f2520c9b42f5c76ffe06af36e4ce394789c12 Mon Sep 17 00:00:00 2001 From: Maria Dimashova Date: Mon, 7 Jun 2010 09:05:48 +0000 Subject: [PATCH] fixed sift wrapper --- modules/features2d/src/sift.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/features2d/src/sift.cpp b/modules/features2d/src/sift.cpp index 22fbd75917..3134e86cc4 100644 --- a/modules/features2d/src/sift.cpp +++ b/modules/features2d/src/sift.cpp @@ -2006,13 +2006,16 @@ SIFT::SIFT( const CommonParams& _commParams, inline KeyPoint vlKeypointToOcv( const VL::Sift::Keypoint& vlKeypoint, float angle ) { - return KeyPoint(vlKeypoint.x, vlKeypoint.y, 3*vlKeypoint.sigma, angle, 0, vlKeypoint.o, 0 ); + return KeyPoint( vlKeypoint.x, vlKeypoint.y, + SIFT::DescriptorParams::GET_DEFAULT_MAGNIFICATION()*vlKeypoint.sigma*5 /* 5==NBP+1 */, + angle, 0, vlKeypoint.o, 0 ); } inline void ocvKeypointToVl( const KeyPoint& ocvKeypoint, const VL::Sift& vlSift, - VL::Sift::Keypoint& vlKeypoint ) + VL::Sift::Keypoint& vlKeypoint, int magnification ) { - vlKeypoint = vlSift.getKeypoint(ocvKeypoint.pt.x, ocvKeypoint.pt.y, ocvKeypoint.size/3); + vlKeypoint = vlSift.getKeypoint( ocvKeypoint.pt.x, ocvKeypoint.pt.y, + ocvKeypoint.size/(magnification*5) /* 5==NBP+1 */ ); } float computeKeypointOrientations( VL::Sift& sift, const VL::Sift::Keypoint& keypoint, int angleMode ) @@ -2100,7 +2103,7 @@ void SIFT::operator()(const Mat& img, const Mat& mask, for( int pi = 0 ; iter != keypoints.end(); ++iter, pi++ ) { VL::Sift::Keypoint vlkpt; - ocvKeypointToVl( *iter, vlsift, vlkpt ); + ocvKeypointToVl( *iter, vlsift, vlkpt, descriptorParams.magnification ); float angleVal = iter->angle*CV_PI/180.0; if( descriptorParams.recalculateAngles ) {