mittagessen / kraken

OCR engine for all the languages
http://kraken.re
Apache License 2.0
751 stars 131 forks source link

Failure to read varying text sizes in a Newspaper page #624

Open sinairusinek opened 4 months ago

sinairusinek commented 4 months ago

The zip includes the model, the code and the resulting HTML. The problem is that the get.text works well for a specific size of letters and fails on others. There is very high diversity in font sizes and image resolutions in this corpus.

dstoekl commented 4 months ago

Hi sinai. I am afraid there is no imagefile or alto in the archive.zip. In order to see what is going wrong we need to see the input data.

sinairusinek commented 4 months ago

FullPg04 Document.zip Sorry, here they are. No standard Alto but the legacy files from NLI which the code is accessing for the structural information. [Uploading pdf-images.zip…]()

sinairusinek commented 4 months ago

Correcting what I asked above: a solution that will take into account the size of the fonts should be adapted to each line, not to each block, because the variance in font size happens also inside blocks, especially in Advertisements.

dstoekl commented 4 months ago

there should not be any issue with font size if the font size is the same over 1 line and the height of an average aleph is bigger than a minimum. lines are normalized to 120 px. it does not matter if your line has a height of 20k pixels or 2k or 200. if it is 20 px it would be too small. and if there are very big letters and very small letters in the same line, then there can be a problem with the SMALL letters due to the normalization, but not with the big letters.

dstoekl commented 4 months ago

to me your problem is not kraken related but rather rooted in an imperfect conversion of the underlying legacy xmls which are your local project task. the structure is too complex to dive into it from the outside without further explanations. it is even hard for me to understand which XML belongs to which image.

dstoekl commented 4 months ago

please join me on gitter as this is not kraken related.

dstoekl commented 4 months ago

on a private channel on gitter