提交 b12588f7 编写于 作者: M Maria Dimashova

fixed MserFeatureDetector

上级 c8e93da0
......@@ -202,19 +202,18 @@ void MserFeatureDetector::detect( const Mat& image, vector<KeyPoint>& keypoints,
{
vector<vector<Point> > msers;
Mat grayImage = image;
if( image.type() != CV_8U ) cvtColor( image, grayImage, CV_BGR2GRAY );
mser(grayImage, msers, mask);
mser(image, msers, mask);
keypoints.resize( msers.size() );
keypoints.clear();
vector<vector<Point> >::const_iterator contour_it = msers.begin();
vector<KeyPoint>::iterator keypoint_it = keypoints.begin();
for( ; contour_it != msers.end(); ++contour_it, ++keypoint_it )
for( ; contour_it != msers.end(); ++contour_it )
{
// TODO check transformation from MSER region to KeyPoint
RotatedRect rect = fitEllipse(Mat(*contour_it));
*keypoint_it = KeyPoint( rect.center, sqrt(rect.size.height*rect.size.width), rect.angle);
float diam = sqrt(rect.size.height*rect.size.width);
if( diam > std::numeric_limits<float>::epsilon() )
keypoints.push_back( KeyPoint( rect.center, diam, rect.angle) );
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册