This commit is contained in:
Maria Dimashova 2010-06-21 10:40:32 +00:00
parent f2392f2e2f
commit 4606638bb3

View File

@ -2032,18 +2032,18 @@ SIFT::SIFT( const CommonParams& _commParams,
descriptorParams = _descriptorParams; descriptorParams = _descriptorParams;
} }
inline KeyPoint vlKeypointToOcv( const VL::Sift::Keypoint& vlKeypoint, float angle ) inline KeyPoint vlKeypointToOcv( const VL::Sift& vlSift, const VL::Sift::Keypoint& vlKeypoint, float angle )
{ {
return KeyPoint( vlKeypoint.x, vlKeypoint.y, float size = SIFT::DescriptorParams::GET_DEFAULT_MAGNIFICATION()*vlKeypoint.sigma*4 /*4==NBP*/
SIFT::DescriptorParams::GET_DEFAULT_MAGNIFICATION()*vlKeypoint.sigma*5 /* 5==NBP+1 */, / vlSift.getOctaveSamplingPeriod(vlKeypoint.o);
angle, 0, vlKeypoint.o, 0 ); return KeyPoint( vlKeypoint.x, vlKeypoint.y, size, angle, 0, vlKeypoint.o, 0 );
} }
inline void ocvKeypointToVl( const KeyPoint& ocvKeypoint, const VL::Sift& vlSift, inline void ocvKeypointToVl( const VL::Sift& vlSift, const KeyPoint& ocvKeypoint,
VL::Sift::Keypoint& vlKeypoint, int magnification ) VL::Sift::Keypoint& vlKeypoint, int magnification )
{ {
vlKeypoint = vlSift.getKeypoint( ocvKeypoint.pt.x, ocvKeypoint.pt.y, float sigma = ocvKeypoint.size*vlSift.getOctaveSamplingPeriod(ocvKeypoint.octave) / (magnification*4) /*4==NBP*/;
ocvKeypoint.size/(magnification*5) /* 5==NBP+1 */ ); vlKeypoint = vlSift.getKeypoint( ocvKeypoint.pt.x, ocvKeypoint.pt.y, sigma);
} }
float computeKeypointOrientations( VL::Sift& sift, const VL::Sift::Keypoint& keypoint, int angleMode ) float computeKeypointOrientations( VL::Sift& sift, const VL::Sift::Keypoint& keypoint, int angleMode )
@ -2097,7 +2097,7 @@ void SIFT::operator()(const Mat& img, const Mat& mask,
float angleVal = computeKeypointOrientations( vlsift, *iter, commParams.angleMode ); float angleVal = computeKeypointOrientations( vlsift, *iter, commParams.angleMode );
if( angleVal >= 0 ) if( angleVal >= 0 )
{ {
keypoints.push_back( vlKeypointToOcv(*iter, angleVal*180.0/CV_PI) ); keypoints.push_back( vlKeypointToOcv(vlsift, *iter, angleVal*180.0/CV_PI) );
} }
} }
} }
@ -2131,7 +2131,7 @@ void SIFT::operator()(const Mat& img, const Mat& mask,
for( int pi = 0 ; iter != keypoints.end(); ++iter, pi++ ) for( int pi = 0 ; iter != keypoints.end(); ++iter, pi++ )
{ {
VL::Sift::Keypoint vlkpt; VL::Sift::Keypoint vlkpt;
ocvKeypointToVl( *iter, vlsift, vlkpt, descriptorParams.magnification ); ocvKeypointToVl( vlsift, *iter, vlkpt, descriptorParams.magnification );
float angleVal = iter->angle*CV_PI/180.0; float angleVal = iter->angle*CV_PI/180.0;
if( descriptorParams.recalculateAngles ) if( descriptorParams.recalculateAngles )
{ {