tesseract-ocr / tesseract-ocr/tesseract

Recognize result difference in "view debug mode" and in "API"

Open
#1,663 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

accuracy
Dominant language
C++
Stars
76.6k
Forks
10.8k
Avg merge
3d 15h
Merged PRs (30d)
7

Description

Environment
  • Tesseract Version:
    tesseract 4.0.0-beta.1-232-g45a6
    leptonica-1.74.4
    libjpeg 8d : libpng 1.2.50 : libtiff 4.0.8 : zlib 1.2.8

  • Platform:
    Linux debian 4.9.0-6-amd64 #1 SMP Debian 4.9.88-1+deb9u1 (2018-05-07) x86_64 GNU/Linux

Current Behavior:

The result in view debug mode difference of my program that used libtesseract.

I run view debug mode use: tesseract input.jpg output -l chi_tra --psm 5 segmode inter

I was trained the chi_tra.traineddata my self, about used 46 types chinese fonts, the training text is chi_tra.training_text in langdata project.

even use tessdata_best/chi_tra.traineddata, the result also different.

For example:

  • input image
    0001-300dpi-w400

  • View debug mode output

tin this mode, i select a blob from image, the result is correct. ( "事" is the correct char)

2018-06-13 13-29-51

  • part of source code in my program

      api->SetPageSegMode(tesseract::PageSegMode::PSM_SINGLE_CHAR);
      // i corped a single char block from input image.
      api->SetImage(pix_char);
      api->SetSourceResolution(300);
      api->SetRectangle(0, 0, w, h);
    
      string ocr_result;
      if (api->Recognize(0) == 0) {
          ocr_result = (std::string) api->GetUTF8Text();
          cout << ocr_result;
      }
    

in my own program, the result is "蟬", not only this char, most of char in my program was wrong

But, most of char in view debug mode is correct!!

So, I Dont know that's my fault or tesseract's bug.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the discrepancy with the supplied image, chi_tra.traineddata, and the tesseract ... --psm 5 segmode inter command. Compare that path with the program's SetPageSegMode(PSM_SINGLE_CHAR), SetImage, SetSourceResolution, SetRectangle, and Recognize calls. Done means identifying why the outputs differ and fixing or documenting the cause.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
api, computer-vision
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.