Example #1
0
int
main (int argc, char *argv[])
{
  ho_pixbuf *pix = NULL;
  ho_string *text = NULL;
  int progress;

  /* load the pnm picture pointed to by argv[1] */
  /* NOTE: this function only load pnm images, you can use the hocr-gtk
   * functions to load other image types */
  pix = ho_pixbuf_pnm_load (argv[1]);

  /* get a new text buffer */
  text = ho_string_new ();

  /* do ocr on picture */
  /* NOTE: we do not use the progress indicator in this program. to use it,
   * create a new thread and sample the value of progress periodically */
  hocr_do_ocr (pix, text, 0, 0, 0, &progress);

  /* print out the text */
  printf ("%s\n", text->string);

  /* free picture */
  ho_pixbuf_free (pix);

  /* free string */
  ho_string_free (text);

  return 0;
}
Example #2
0
ho_pixbuf *
ho_pixbuf_pnm_load_path (const char *filename) {
  ho_pixbuf *pix = NULL;
  FILE *file = NULL;

  file = fopen (filename, "r");
  if (!file)
    return NULL;

  pix = ho_pixbuf_pnm_load (file);
  fclose (file);

  return pix;
}