added c++ interface for cvPyrMeanShiftFiltering; added sample on meanshift segmentation
This commit is contained in:
@@ -333,7 +333,7 @@ void RandomizedTree::train(std::vector<BaseKeypoint> const& base_set,
|
||||
Size patchSize(PATCH_SIZE, PATCH_SIZE);
|
||||
for (keypt_it = base_set.begin(); keypt_it != base_set.end(); ++keypt_it, ++class_id) {
|
||||
for (int i = 0; i < views; ++i) {
|
||||
make_patch( Mat(keypt_it->image), Point(keypt_it->y, keypt_it->x ), patch, patchSize, rng );
|
||||
make_patch( Mat(keypt_it->image), Point(keypt_it->x, keypt_it->y ), patch, patchSize, rng );
|
||||
IplImage iplPatch = patch;
|
||||
addExample(class_id, getData(&iplPatch));
|
||||
}
|
||||
|
||||
@@ -653,6 +653,11 @@ CV_EXPORTS void equalizeHist( const Mat& src, Mat& dst );
|
||||
//! segments the image using watershed algorithm
|
||||
CV_EXPORTS void watershed( const Mat& image, Mat& markers );
|
||||
|
||||
//! filters image using meanshift algorithm
|
||||
CV_EXPORTS void pyrMeanShiftFiltering( const Mat& src, Mat& dst,
|
||||
double sp, double sr, int maxLevel=1,
|
||||
TermCriteria termcrit=TermCriteria(TermCriteria::MAX_ITER+TermCriteria::EPS,5,1) );
|
||||
|
||||
//! class of the pixel in GrabCut algorithm
|
||||
enum { GC_BGD = 0, //!< background
|
||||
GC_FGD = 1, //!< foreground
|
||||
|
||||
@@ -526,3 +526,14 @@ cvPyrMeanShiftFiltering( const CvArr* srcarr, CvArr* dstarr,
|
||||
}
|
||||
}
|
||||
|
||||
void cv::pyrMeanShiftFiltering( const Mat& src, Mat& dst,
|
||||
double sp, double sr, int maxLevel,
|
||||
TermCriteria termcrit )
|
||||
{
|
||||
if( src.empty() )
|
||||
return;
|
||||
|
||||
dst.create( src.size(), src.type() );
|
||||
CvMat _src = src, _dst = dst;
|
||||
cvPyrMeanShiftFiltering( &_src, &_dst, sp, sr, maxLevel, termcrit );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user