2014-12-20 2 views
0

힌디어 언어에 대한 내 tesseract를 훈련하고 싶습니다. 나는 특정 글꼴로 된 많은 '힌디어'텍스트 이미지를 가지고 있으며 그 이미지들에 대해 tesseract ocr을 교육하고 싶습니다. 몇 번이나이 링크를 사용하여 tesseract를 시도했습니다. https://code.google.com/p/tesseract-ocr/wiki/TrainingTesseract3. makebox 명령을 실행하면 상자 파일이 추출되지만 영어 문자처럼 인식됩니다. 나는 이것이 왜 일어나는 지 이해하지 못한다. 힌디어로 tesseract ocr을 훈련시키는 것을 도와주세요. 다음 링크에서 샘플 이미지를 확인할 수 있습니다. sample file힌디어 언어 tesseract

답변

0

저는 몇 자의 캐릭터 세트를 훈련시키고 싶었고, 먼저 정보를 수집했습니다. 어쩌면이 정보는 당신에게도 유용 할 것입니다.

은이 문서를 읽었다 : 문자 중 어느 것도 인식되지 않는 경우

http://blog.cedric.ws/how-to-train-tesseract-301

당신이 모든 문자를 양성하는 것입니다, 난 두려워. 그러나 중요한 단계가 될 것 같다 :

  • 가 makebox 명령 줄에서 언어 ('ENG')의 표시를 포함 (이것은 아마도 귀하의 경우 '힌'을 것

  • 을 인식. 정팔 포체의 버전. 내가 훈련 과정은 지난 버전에서 변경되었다는 인상을 가지고있다.의

0

샘플 프로그램은 이미지에서 Hindi 문자를 인식하고 각각의 경계 상자 값과 각각의 힌디어 문자를 저장 ~에 저장하다 ne 파일.

/* 
* Char_OCR.cpp 
* 
* Created on: Jun 23, 2016 
*  Author: pratik 
*/ 

#include <opencv2/opencv.hpp> 
#include <tesseract/baseapi.h> 
#include <leptonica/allheaders.h> 
#include <iostream> 
#include <fstream> 

using namespace std; 
using namespace cv; 

void dumpIntoFile(const char *ocrResult , ofstream &myfile1 ,int x1, int y1, 
     int x2, int y2, int &); 

int main(int argc ,char **argv) 
{ 

    Pix *image = pixRead(argv[1]); 

    if (image == 0) { 
     cout << "Cannot load input file!\n"; 
    } 

    tesseract::TessBaseAPI tess; 


    if (tess.Init("/usr/share/tesseract/tessdata", "hin")) { 
      fprintf(stderr, "Could not initialize tesseract.\n"); 
      exit(1); 
     } 

    tess.SetImage(image); 
    tess.Recognize(0); 

    tesseract::ResultIterator *ri = tess.GetIterator(); 
    tesseract::PageIteratorLevel level = tesseract::RIL_SYMBOL; 

    cout << ri << endl; 

    ofstream myfile1("Word.txt"); 

    myfile1 << "ID" << '\t' << "CORD_X" << '\t' << "CORD_Y" << '\t' << 
      "CORD_W" << '\t' << "CORD_H" << '\t' << "STRING" << endl; 

    int i=1; 

    if(ri!=0) 
    { 
     do { 
      const char *word = ri->GetUTF8Text(level); 
//   cout << word << endl; 

      //float conf = ri->Confidence(level); 
      int x1, y1, x2, y2; 
      ri->BoundingBox(level, &x1, &y1, &x2, &y2); 

      dumpIntoFile(word, myfile1, x1, y1, x2, y2, i); 

      delete []word; 

     } while (ri->Next(level)); 

     delete []ri; 
    } 

} 

void dumpIntoFile(const char *ocrResult , ofstream &myfile1 ,int x1, int y1, 
     int x2, int y2,int &i) 
{ 

      int length = strlen(ocrResult); 

       myfile1 << i++ << '\t' << x1 << '\t' << y1 << '\t' << 
         x2 << '\t' << y2 << '\t' ; 

       //cout << "in the string (" << length << ") ::"; 
       for(int j = 0; j < length && ocrResult[j] != '\n'; j++) 
       { 
        myfile1 << ocrResult[j]; 
       } 

       myfile1 << endl; 

} 
+0

이보다 더 정확하게하려면 pixeRead()에 OTSU 임계 값 이미지를 전달할 수 있습니다. pixRead()에서 정상적인 이미지를 전달 중입니다. OTSU 통과 임계 값 이미지. 나는 그것을위한 알고리즘을 개발했다. . 아무도 원하면 알려줘. –

관련 문제