title: Implementing bwmorph(image,'thin','inf') then finding number of branchpoints in c++ using opencv
body: <p>I would like to implement the following Matlab code for a given image in c++, which calculates the number of branch points in a medial axis skeleton representation of an image:</p>
  
  <pre><code>skelImg   = bwmorph(imageName, 'thin', 'inf');
  branchImg = bwmorph(skelImg, 'branchpoints');
  [row, column] = find(branchImg);
  branchPts     = [row column];
  cNumBranchPoints = length(branchPts);
  </code></pre>
  
  <p>I have seen this example: <a href="https://stackoverflow.com/questions/22058485/how-to-implement-an-function-equivalent-to-bwmorph-matlab-function-in-opencv">How to implement an function equivalent to bwmorph Matlab function in OpenCV</a> which is similar in nature, although slightly different, in that I do not want to 'clean' the image, but rather 'thin' it. I also want to determine the number of <em>branch points</em>, not <em>end points</em>, as in the aforementioned example.</p>
  
  <p>Anyone have an idea as to how I can do this in c++?</p>
  
  <p>Best,</p>
  
  <p>Ben</p>