Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix word coordinates when using textequiv_level = "word" #60

Closed
sven-nm opened this issue Feb 24, 2021 · 3 comments
Closed

Fix word coordinates when using textequiv_level = "word" #60

sven-nm opened this issue Feb 24, 2021 · 3 comments

Comments

@sven-nm
Copy link

sven-nm commented Feb 24, 2021

Hi all,

When using ocrd-calamary-recognize with textequiv_level word, pc:Word-spans appear to have wrong y-coordinates in the Coords-spans. It looks like all words are lowered to the bottom of the text region they belong to.

For instance :
When drawing the line polygons, the coords are right :
Capture d’écran 2021-02-24 à 16 03 32

But when drawing the word polygons, the coords are wrong :
Capture d’écran 2021-02-24 à 16 03 06

I am using cv2 to draw the polygons, but I double-checked in the PAGE xml file, and words of a text-region (sometimes the entire page) all have the same y-coordinates.

Here is the entire code used to generate the OCR :

docker run --rm -u $(id -u) -v $PWD:/data -w /data -- ocrd/all:maximum ocrd process \
  "cis-ocropy-binarize -I OCR-D-IMG -O OCR-D-BIN" \
  "anybaseocr-crop -I OCR-D-BIN -O OCR-D-CROP" \
  "skimage-binarize -I OCR-D-CROP -O OCR-D-BIN2 -P method li" \
  "skimage-denoise -I OCR-D-BIN2 -O OCR-D-BIN-DENOISE -P level-of-operation page" \
  "tesserocr-deskew -I OCR-D-BIN-DENOISE -O OCR-D-BIN-DENOISE-DESKEW -P operation_level page" \
  "cis-ocropy-segment -I OCR-D-BIN-DENOISE-DESKEW -O OCR-D-SEG -P level-of-operation page" \
  "cis-ocropy-dewarp -I OCR-D-SEG -O OCR-D-SEG-LINE-RESEG-DEWARP" \
  "calamari-recognize -I OCR-D-SEG-LINE-RESEG-DEWARP -O OCR-D-OCR -P checkpoint /data/calamari_model/\*.ckpt.json -P textequiv_level word"
@kba
Copy link
Member

kba commented Feb 24, 2021

Looks like a duplicate of #57, fixed in v1.0.2 0869386. This is not yet in ocrd_all, though, I'll make a new ocrd_all release this week.

@mikegerber
Copy link
Collaborator

mikegerber commented Mar 1, 2021

This is fixed in v1.0.2, and the update is also in ocrd_call since last week, as @kba announced here!

@sven-nm I'll close this, please re-open if you still have the issue after updating!

@mikegerber
Copy link
Collaborator

mikegerber commented Mar 1, 2021

@sven-nm Please note that glyph support in ocrd_calamari is not super useful for image based use cases¹, you might want to explore what ocrd_tesserocr has to offer in this regard.

¹ I implemented it to produce glyph alternatives, but the CTC based coordinates are not suitable for e.g. image extraction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants