tesseract: Page numbers not detected in various cases

Environment

  • Tesseract Version: Various, 4.1.1, 5.0.0 v20201231
  • Platform: Linux, 64 bit

Current Behavior:

In some cases, Tesseract fully automatic page segmentation does not pick up page numbers that are quite visible. Here is an example (as hocr result viewer):

https://archive.org/services/hocr-view/view?identifier=sim_architectural-record_1931-12_70_6&pageno=27

I have taken the liberty of hosting some images with this problem here (and can attempt to surface more if that is helpful):

https://archive.org/~merlijn/tesseract-pagenumbers/

I don’t believe that the problem is related to binarisation. I’ve tried to run the Java viewer (https://tesseract-ocr.github.io/tessdoc/ViewerDebugging.html) to look at the results, but didn’t become much wiser, as it simply shows the page numbers not being picked up.

Expected Behavior:

Tesseract picks up the page number as well.

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 30 (18 by maintainers)

Most upvoted comments

I made some progress. It looks like in the example of https://archive.org/~merlijn/tesseract-pagenumbers/sim_biblical-theology-bulletin_spring-1990_20_1_0004.jpg with default segmentation - the ‘3’ is never accepted as a blob that is text. I found out that this is the case because the blob disappears after the call to TidyBlobs():

image

In particular, the call to block->DeleteUnownedNoise(); is what removes the 3. Commenting that call makes the ‘3’ visible in the blobs, but of course this doesn’t help since it wasn’t detected by the column finder, per the hint in that function:

// Deletes noise blobs from all lists where not owned by a ColPartition.

So somehow it is not picked up by the page segmentation. The “Image blobs” window shows this:

image

void TO_BLOCK::plot_noise_blobs(ScrollView *win) {
  BLOBNBOX::PlotNoiseBlobs(&noise_blobs, ScrollView::RED, ScrollView::RED, win);
  BLOBNBOX::PlotNoiseBlobs(&small_blobs, ScrollView::RED, ScrollView::RED, win);
  BLOBNBOX::PlotNoiseBlobs(&large_blobs, ScrollView::RED, ScrollView::RED, win);
  BLOBNBOX::PlotNoiseBlobs(&blobs, ScrollView::RED, ScrollView::RED, win);
}

And:

void BLOBNBOX::PlotNoiseBlobs(BLOBNBOX_LIST *list, ScrollView::Color body_colour,
                              ScrollView::Color child_colour, ScrollView *win) {
  BLOBNBOX_IT it(list);
  for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
    BLOBNBOX *blob = it.data();
    if (blob->DeletableNoise()) {
      blob->plot(win, body_colour, child_colour);
    }
  }
}

So red indicates it is seen as noise, indeed. Deletetable noise looks as follows:

bool DeletableNoise() const {
  return owner() == nullptr && region_type() == BRT_NOISE;
}

So this means the ‘3’ both doesn’t have an “owner” (presumably the ColPartition mentioned earlier) and also has region type noise. There are several places in the code that set the BRT_NOISE value, so going over those seems like the next logical step.