1 2 Previous Next 20 Replies Latest reply on Jul 15, 2015 5:28 PM by CMata_Intel

    Help! Ocr - tesseract c++ (galileo 2 )

    Heshamnouby

      Hello

      I use ocr of google " tesseract"

      And download open source of it and edit it on visual studio for iot !

      But when i debug the app , it doesnt work

      Plz help

      / Main.cpp : Defines the entry point for the console application.

      //

       

       

      #include "stdafx.h"

      #include "arduino.h"

      #include <tesseract\baseapi.h>

      #include <leptonica\allheaders.h>

      #include <iostream>

      #include <fstream>

       

       

       

       

       

       

      int _tmain(int argc, _TCHAR* argv[])

      {

          return RunArduinoSketch();

      }

       

       

       

       

       

       

      void setup()

      {

       

          // TODO: Add your code here

       

       

      }

       

       

      // the loop routine runs over and over again forever:

      void loop()

      {

       

       

       

       

       

        char *outText;

       

       

        tesseract::TessBaseAPI *api = new tesseract::TessBaseAPI();

        // Initialize tesseract-ocr with English, without specifying tessdata path

        if (api->Init(NULL, "eng")) {

        fprintf(stderr, "Could not initialize tesseract.\n");

        exit(1);

        }

       

       

        // Open input image with leptonica library

        Pix *image = pixRead("2.png");

        api->SetImage(image);

        // Get OCR result

        outText = api->GetUTF8Text();

        printf("OCR output:\n%s", outText);

        using std::fstream;

        fstream file;

        file.open("test.txt", fstream::out);

        file << outText;

        file.close();

       

       

       

       

      }

      my code :/

        1 2 Previous Next