title: How to obtain Hierarchical component tree of MSER in Matlab?
body: <p>Maximally Stable Extremal Regions  (MSERs) are found from an image in Matlab using <a href="http://www.mathworks.in/help/vision/ref/detectmserfeatures.html" rel="noreferrer">detectMSERFeatures</a>.</p>
  
  <p>Is there any patch or method to get the <strong>hierarchical MSER component tree</strong> from Matlab? </p>
  
  <p>This tree is anyways being generated when Matlab calculates the regions - it returns only the most "stable" component from each region's tree. Since this tree is already present, I am searching for ways to expose this to user code from the Matlab libraries, which keeps this part hidden and provides only the final "maximally stable" regions.</p>
  
  <p>Anything would be acceptable - modifications of the Matlab inbuilt code, patches, hacks whatever. (I realize OpenCV has such a patch, however I am trying to avoid porting to OpenCV as most of the other procedures are written in Matlab).</p>
  
  <p><strong>EDIT:</strong> (from the original <a href="http://www.cs.bris.ac.uk/Publications/Papers/2001440.pdf" rel="noreferrer">hierarchical MSER paper</a>)</p>
  
  <p><img src="https://i.stack.imgur.com/iIsw8.png" alt="detected MSERs">                    <img src="https://i.stack.imgur.com/vezFH.png" alt="MSER tree"></p>
  
  <p><code>Detected MSERs</code>(left),    <code>MSER Tree</code>(right)</p>