title: Camera Preview and OCR
body: <p>I am new to android development - I'm using Xamarin.</p>
  
  <p>I am trying to write an application that initiates the camera preview, and then constantly scans the incoming frames for text (I am using Xamarin.Tesseract from NuGet).</p>
  
  <p>In other words, I don't want to make the user take a photo and then do the OCR analysis, instead I want them to just point the video camera at some paper with text on it, i'll continually do the OCR analysis until I detect the specific text I'm searching for) at which point I'll give a big thumbs up to the user.</p>
  
  <p>This is the approach I have gone down so far:</p>
  
  <ol>
  <li><p>Initialise the camera and set a preview callback</p>
  
  <pre>
  _Camera = Android.Hardware.Camera.Open();          
  _Camera.SetPreviewCallback(this); 
  _Camera.StartPreview();              
  </pre></li>
  <li><p>In the Callback, take the bytes representing the current frame and pass this as the input image bytes for Xamarin.Tesseract</p>
  
  <pre>
  public void OnPreviewFrame(byte[] data, Android.Hardware.Camera camera)
  {        
  await _TesseractApi.SetImage(data); /// this hangs                
  string text = _Api.Text;
  return text;          
  } 
  
  </pre></li>
  </ol>
  
  <p>This currently hangs when passing the byte[] into the Tesseract API. I'm pretty sure it's going to be because the Bytes in the array are either the wrong encoding, or, i'm fundamentally not understanding the Camera api!</p>
  
  <p>Can anyone give me a nudge in the write direction?</p>