qurator-spk / dinglehopper

An OCR evaluation tool
Apache License 2.0
62 stars 15 forks source link

Display image #10

Open mikegerber opened 4 years ago

mikegerber commented 4 years ago

The tool should display an image corresponding to the text line/OCR error selected.

I'll probably use the local images to display, not IIIF as this seems more general.

cneud commented 4 years ago

I may be missing sth, but those are actually all reasons for using IIIF ;)

I could probably think of more reasons pro IIIF.

mikegerber commented 4 years ago

Reasons I am contemplating only working with local files:

Not the last word spoken, but I tend to work with local files. Even TIFF support looks doable.

mikegerber commented 4 years ago

CSS experiments:

https://qurator-data.de/~mike.gerber/experiments/image-cropping-using-css/image-cropping-using-css.html

This means:

cneud commented 4 years ago

https://qurator-data.de/~mike.gerber/experiments/image-cropping-using-css/image-cropping-using-css.html

Based on your example, here is how this can also be done serverside just with the pixel information you already have in the OCR and an awesome API.

E.g. the IIIF-URL for your example looks like this:

{baseurl}/{identifier}/{x,y,w,h}/{size}/{rotation}/default.{jpg|png|tif}

https://content.staatsbibliothek-berlin.de/dc/PPN77164308X-00000001/149,450,1244,228/1200,/0/default.jpg

50% scaled:

https://content.staatsbibliothek-berlin.de/dc/PPN77164308X-00000001/149,450,1244,228/600,/0/default.jpg

Or get PNG

https://content.staatsbibliothek-berlin.de/dc/PPN77164308X-00000001/149,450,1244,228/600,/0/default.png

Even TIF! - except it wont render in any web browser ;)

https://content.staatsbibliothek-berlin.de/dc/PPN77164308X-00000001/149,450,1244,228/600,/0/default.tif

If you replace {baseurl}{identifier} with those of any other institution that implements the IIIF Image API, this will always work.

See just a few example (different documents of course)

BSB https://api.digitale-sammlungen.de/iiif/image/v2/bsb00103155_00013/149,450,1244,228/1200,/0/default.jpg https://api.digitale-sammlungen.de/iiif/image/v2/bsb00103155_00013/149,450,1244,228/600,/0/default.jpg https://api.digitale-sammlungen.de/iiif/image/v2/bsb00103155_00013/full/full/0/default.jpg

ÖNB https://iiif.onb.ac.at/images/ABO/Z165851607/00000001/149,450,1244,228/1200,/0/default.jpg https://iiif.onb.ac.at/images/ABO/Z165851607/00000001/149,450,1244,228/600,/0/default.jpg https://iiif.onb.ac.at/images/ABO/Z165851607/00000001/full/full/0/default.jpg

BnF Gallica https://gallica.bnf.fr/iiif/ark:/12148/btv1b9055204k/f1/149,450,1244,228/1200,/0/default.jpg https://gallica.bnf.fr/iiif/ark:/12148/btv1b9055204k/f1/149,450,1244,228/600,/0/default.jpg https://gallica.bnf.fr/iiif/ark:/12148/btv1b9055204k/f1/full/full/0/default.jpg

There are a few hundred libraries, museums and archives worldwide that implement this, and growing.

There are Python libraries for it:

Bottom line - IIIF is fun ;)

mikegerber commented 4 years ago

The problem is: How do I know the IIIF URL?

  1. In my example (https://qurator-data.de/~mike.gerber/experiments/image-cropping-using-css/PPN77164308X/mets.xml) there are IIIF URLs in the BEST file group. Not because they were in the original, but because I put them there using ppn2ocr.
  2. How do I know these are IIIF URLs other than guessing?

Thinking about it, the first idea is following

To be honest, if the browsers would support TIFF I would not consider IIIF at all because cropping an image is trivial and supporting IIIF here just adds complexity by requiring a IIIF URL etc.