now all the samples and opencv_contrib compile!

This commit is contained in:
Vadim Pisarevsky
2014-10-16 16:34:22 +04:00
parent 5e667ee53a
commit d017faa06c
9 changed files with 197 additions and 157 deletions

View File

@@ -197,6 +197,10 @@ public:
CV_WRAP virtual int detectAndLabel( InputArray image, OutputArray label,
OutputArray stats=noArray() ) = 0;
CV_WRAP virtual void detectAndStore( InputArray image,
std::vector<std::vector<Point> >& msers,
OutputArray stats=noArray() ) = 0;
};
//! detects corners using FAST algorithm by E. Rosten

View File

@@ -301,6 +301,9 @@ public:
};
int detectAndLabel( InputArray _src, OutputArray _labels, OutputArray _bboxes );
void detectAndStore( InputArray image,
std::vector<std::vector<Point> >& msers,
OutputArray stats );
void detect( InputArray _src, vector<KeyPoint>& keypoints, InputArray _mask );
void preprocess1( const Mat& img, int* level_size )
@@ -955,6 +958,35 @@ int MSER_Impl::detectAndLabel( InputArray _src, OutputArray _labels, OutputArray
return (int)bboxvec.size();
}
void MSER_Impl::detectAndStore( InputArray image,
std::vector<std::vector<Point> >& msers,
OutputArray stats )
{
vector<Rect> bboxvec;
Mat labels;
int i, x, y, nregs = detectAndLabel(image, labels, bboxvec);
msers.resize(nregs);
for( i = 0; i < nregs; i++ )
{
Rect r = bboxvec[i];
vector<Point>& msers_i = msers[i];
msers_i.clear();
for( y = r.y; y < r.y + r.height; y++ )
{
const int* lptr = labels.ptr<int>(y);
for( x = r.x; x < r.x + r.width; x++ )
{
if( lptr[x] == i+1 )
msers_i.push_back(Point(x, y));
}
}
}
if( stats.needed() )
Mat(bboxvec).copyTo(stats);
}
void MSER_Impl::detect( InputArray _image, vector<KeyPoint>& keypoints, InputArray _mask )
{
vector<Rect> bboxes;