title: Using Leptonica for Character Segmentation
body: <p>I'm trying to figure out how to use the segmenter provided by the Leptonica library for document analysis. I've been looking at pageseg.c but I don't think I completely understand it :(!</p>
  
  <p>If I take an image and load it as a PIX datatype, do I call pixGetRegionsBinary() to find where each symbol is? And then do I use the textblock mask to extract each symbol separately?</p>
  
  <p>If I understand correctly I would have code like this:</p>
  
  <pre><code>Pix* page = pixRead("myImage.tif");
  
  Pix** halftone;
  Pix** textline;
  Pix** textblock;
  
  if ( pixGetRegionsBinary( page, halftone, textline, textblock, 0 ) )
  {
       //..error message
  }
  </code></pre>
  
  <p>Now is textblock all of the characters or am I using the wrong segmentation method :)? Also how would I know when the textblock "array" ends?</p>
  
  <p>Thanks in advance!!</p>
  
  <p><strong>Edit 26/11/2013</strong></p>
  
  <p>For anyone interested - <a href="http://tpgit.github.io/Leptonica/livre__pageseg_8c_source.html" rel="nofollow"> Leptonica Doxygen Documentation - Page Segmentation </a> is a good example of full page segmentation!</p>