title: MATLAB: Segment individual letters from a binary image
body: <p>I'm working on an optical character recognition project where I am trying to create a program which will recognize alphabetic letters from an image. I'm following the tutorial located on Mathworks(<a href="http://www.mathworks.com/help/vision/examples/digit-classification-using-hog-features.html" rel="nofollow noreferrer" title="Digit Classification">Digit Classification</a>). In their example, their training images are already separated. Unfortunately, I was provided with training images which contain hundreds of letters in a single file. </p>
  
  <p>Here is a sample:<br>
  <img src="https://i.gyazo.com/0ca8d4416a52b8bc3401da0b71a527fd.gif" alt=""> </p>
  
  <p>I need an efficient way to segment each individual letter into an image, so I would have a 26Xn array where 26 is each letter in the alphabet and n is n image data variables containing individual letters. It would be extremely tedious to manually segment letters from each training image or attempt to segment letters by a specified length since the separation between letters isn't always equal. </p>
  
  <p>Does anyone know of a MATLAB function or a simple way where I can identify the height and length of every continuous white colored object and store all the individual white objects with their black background in the 26Xn array described above (or at least stored in some type of array so I can later process it into the 26xn array)?</p>