title: OpenCV 3.0.0 MSER Binary Mask
body: <p>I am trying to use MSER algorithm in OpenCV 3.0.0 beta to extract text regions from an image. At the end I need a binary mask with the detected MSER regions, but the algorithm only provides contours. I tried to draw these contours but I don't get the expected result.</p>
  
  <p>This is the code I use:</p>
  
  <pre><code>void mserExtractor (const Mat&amp; image, Mat&amp; mserOutMask){
      Ptr&lt;MSER&gt; mserExtractor  = MSER::create();
  
      vector&lt;vector&lt;cv::Point&gt;&gt; mserContours;
      vector&lt;cv::Rect&gt; mserBbox;
      mserExtractor-&gt;detectRegions(image, mserContours, mserBbox);
  
      for( int i = 0; i&lt;mserContours.size(); i++ )
      {
          drawContours(mserOutMask, mserContours, i, Scalar(255, 255, 255), 4);
      }
  }
  </code></pre>
  
  <p>This is the result:
  <img src="https://i.stack.imgur.com/hF536.jpg" alt="OPENCV MSER"></p>
  
  <p>The problem is that non-convex regions are filled by lines crossing the actual MSER region. I would like just the list of pixels in the region like I get from MATLAB <code>detectMSERFeatures</code>:
  <img src="https://i.stack.imgur.com/FZpdW.jpg" alt="MATLAB MSER"></p>
  
  <p>Any ideas how to get the filled region from the contours (or to get the MSER mask in other ways)?</p>