Merge pull request #7094 from terfendail:MSER_fix

pull/7135/head
Alexander Alekhin 9 years ago
commit 185fe7aa1b
  1. 2
      modules/features2d/include/opencv2/features2d.hpp
  2. 5
      modules/features2d/src/mser.cpp

@ -355,7 +355,7 @@ public:
/** @brief Detect %MSER regions /** @brief Detect %MSER regions
@param image input image (8UC1, 8UC3 or 8UC4) @param image input image (8UC1, 8UC3 or 8UC4, must be greater or equal than 3x3)
@param msers resulting list of point sets @param msers resulting list of point sets
@param bboxes resulting bounding boxes @param bboxes resulting bounding boxes
*/ */

@ -1020,13 +1020,12 @@ extractMSER_8uC3( const Mat& src,
void MSER_Impl::detectRegions( InputArray _src, vector<vector<Point> >& msers, vector<Rect>& bboxes ) void MSER_Impl::detectRegions( InputArray _src, vector<vector<Point> >& msers, vector<Rect>& bboxes )
{ {
Mat src = _src.getMat(); Mat src = _src.getMat();
size_t npix = src.total();
msers.clear(); msers.clear();
bboxes.clear(); bboxes.clear();
if( npix == 0 ) if( src.rows < 3 || src.cols < 3 )
return; CV_Error(Error::StsBadArg, "Input image is too small. Expected at least 3x3");
Size size = src.size(); Size size = src.size();

Loading…
Cancel
Save