Fix for MSER::detectRegions crash on images with either dimension less than 3

This commit is contained in:
Vitaly Tuzov 2016-08-11 20:20:36 +03:00
parent 44bda8fbb7
commit 9db93d773d
2 changed files with 2 additions and 3 deletions

View File

@ -355,7 +355,7 @@ public:
/** @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 bboxes resulting bounding boxes
*/

View File

@ -1020,12 +1020,11 @@ extractMSER_8uC3( const Mat& src,
void MSER_Impl::detectRegions( InputArray _src, vector<vector<Point> >& msers, vector<Rect>& bboxes )
{
Mat src = _src.getMat();
size_t npix = src.total();
msers.clear();
bboxes.clear();
if( npix == 0 )
if( src.rows < 3 || src.cols < 3 )
return;
Size size = src.size();