dbmdz / mirador-textoverlay

Text Overlay plugin for Mirador 3
https://mirador-textoverlay.netlify.com/
MIT License
50 stars 12 forks source link

Looking for IIIF 3.0 annotation example #186

Open joesong168 opened 2 years ago

joesong168 commented 2 years ago

I've tried following annotationPage with no luck

{
    "id": "https://api.dev.etu.wiki/c/3/9a2febe6-8569-4ab3-b4e1-19e0ad53cbd8/ap/c",
    "type": "AnnotationPage",
    "items": [
        {
            "id": "https://api.dev.etu.wiki/c/3/9a2febe6-8569-4ab3-b4e1-19e0ad53cbd8/ap/c/a/043a7bb7-d77b-44bd-9517-71bf6f551a1a",
            "type": "Annotation",
            "motivation": "supplementing",
            "body": {
                "type": "TextualBody",
                "value": "authorA",
                "format": "text/plain",
                "language": "zh-Hants"
            },
            "target": "https://api.dev.etu.wiki/c/3/9a2febe6-8569-4ab3-b4e1-19e0ad53cbd8#xywh=958,5101,493,493"
        },
        {
            "id": "https://api.dev.etu.wiki/c/3/9a2febe6-8569-4ab3-b4e1-19e0ad53cbd8/ap/c/a/24453f8f-9c8b-4c82-8ae9-ffa8a779f8a6",
            "type": "Annotation",
            "motivation": "supplementing",
            "body": {
                "type": "TextualBody",
                "value": "authorB",
                "format": "text/plain",
                "language": "zh-Hants"
            },
            "target": "https://api.dev.etu.wiki/c/3/9a2febe6-8569-4ab3-b4e1-19e0ad53cbd8#xywh=968,4544,490,462"
        }
    ],
    "@context": "http://iiif.io/api/p/3/context.json"
}
jbaiter commented 2 years ago

Thanks for reporting,I think I've only really tested it with v2 annotations so far, although the code already has paths for v3 support. Should probably be only a question of fixing some small bugs/inconsistencies. Can you also provide a Manifest URL for your fixture so I can test it end-to-end?

HenryH09 commented 2 years ago

Hello Have you had the time to take a look into this ? I am having some issues as well with the Presentation API V3 semantics for the OCR data (supplementing annotation) => nothing is displayed not even the textoverlay tool box. You can find a complete manifest example in the official IIIF cookbook : https://iiif.io/api/cookbook/recipe/0068-newspaper/newspaper_issue_1-manifest.json (https://iiif.io/api/cookbook/recipe/0068-newspaper/)

jbaiter commented 2 years ago

Thanks for providing the full manifest, I'll try to find time to work on this, this week or next.

sauterl commented 2 years ago

Hi There

With the hope to help @jbaiter to find and fix the culprits faster, here are some findings we had debugging what goes wrong when using IIIF 3.0:

sauterl commented 2 years ago

I'm not entirely sure whether this is proper IIIF v3 usage, please bare with me, but adding a seeAlso on each canvas with an id pointing towards an external OCR resource (i.e. hOcr or ALTO) the plugin works as intended with some fixes as outlined in my previous comment.

Particularly what did the trick for our use case and manifest is really to tweak the IIIF v3 condition.

@stone12379 For your use case, I guess the findings from the previous comment should already help a lot. However, as far as I can tell, for a more robust IIIF v3 support, processTextsFromAnnotations (as written above), needs a stricter condition in order to filter out external OCR resources (which it currently does not).

jbaiter commented 2 years ago

So, some long overdue updates on this front, sorry it took so long, thanks to everybody for the feedback!

The example from the IIIF Cookbook now renders the annotations, but:

For comparison, here are two screenshots, one showing the text rendering from the ALTO and one with the annotations:

ALTO text ![image](https://user-images.githubusercontent.com/608610/174956683-0fad5dec-39e5-4573-aea6-5d3d166a6070.png)
Annotation text ![image](https://user-images.githubusercontent.com/608610/174956789-8e4cc128-0acc-4e1d-b694-0aac3ca8272e.png)

I have pushed my changes to the iiifv3 branch, could you please test this version with your manifests @sauterl @joesong168?

glenrobson commented 11 months ago

Hi @jbaiter, we've recently updated the Newspaper recipe with the following changes:

Let us know if you spot any further problems.

Also would it be possible to add a iiif-content parameter to your demo so that we can pass in a manifest and include a link from the cookbook to your plugin? For info Mirador uses the following:

https://projectmirador.org/embed/?iiif-content=https://iiif.io/api/cookbook/recipe/0068-newspaper/newspaper_title-collection.json

jbaiter commented 11 months ago

Thanks for letting me know! I've updated the code to also look at rendering to discover referenced OCR files and fixed some other IIIF3 stuff related to annotations along the way. The iiif-content parameter is now included in the demo as well.

The ALTO from the Cookbook example, however, doesn't fully match up with the Canvas anymore, something's off:

grafik

https://iiifv3--mirador-textoverlay.netlify.app/?iiif-content=https://iiif.io/api/cookbook/recipe/0068-newspaper/newspaper_issue_2-manifest.json

glenrobson commented 11 months ago

Thanks for including the iiif-content link and looking at the rendering! Ill see if I can figure what is going on with the ALTO. It was generated using tesseract but maybe I used the wrong sized image or something.

jbaiter commented 11 months ago

Found the problem: There's a mismatch between the Canvas size and the Image and OCR size:

glenrobson commented 11 months ago

That is weird! but thank you Ill look at updating the ALTO (and annotations).