question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to use irregular image pyramids? IIIF

See original GitHub issue

My underlying images are irregular image pyramids. E.g., a typical image has following IIIF structure:

{ 
"profile" : ["http://iiif.io/api/image/2/level2.json", {
    "supports": ["canonicalLinkHeader", "profileLinkHeader", "mirroring", "rotationArbitrary", "sizeAboveFull", "regionSquare"],
    "qualities" : ["default", "bitonal", "gray", "color"],
    "formats" : ["jpg", "png", "gif", "webp"]
}],
"tiles" : [{
    "width" : 512,
    "scaleFactors" : [1, 4.0001689138501408, 16.002226468764611] 
    }],
"protocol" : "http://iiif.io/api/image",
"sizes" : [{
    "width" : 61917,
    "height" : 43923
    }, {
    "width" : 15479,
    "height" : 10980
    }, {
    "width" : 3869,
    "height" : 2745
    }],
"height" : 43923,
"width" : 61917,
"@context" : "http://iiif.io/api/image/2/context.json",
"@id" : "http://imageserver/image.jp2"
}

The scaling is not smooth at 1, 4, 16, but 1, 4.0001689138501408, 16.002226468764611.

Still, OSD will as me for tiles of a regular pyramid with sizes at the power of 2. Typical requests are:

/imageserver/image.jp2/49152,40960,8192,2963/512,/0/default.jpg
/imageserver/image.jp2/0,32768,8192,8192/512,/0/default.jpg
/imageserver/image.jp2/0,0,8192,8192/512,/0/default.jpg
/imageserver/image.jp2/0,40960,8192,2963/512,/0/default.jpg
/imageserver/image.jp2/57344,0,4573,8192/286,/0/default.jpg
/imageserver/image.jp2/57344,40960,4573,2963/286,/0/default.jpg
/imageserver/image.jp2/24576,16384,4096,4096/512,/0/default.jpg
/imageserver/image.jp2/20480,16384,4096,4096/512,/0/default.jpg
/imageserver/image.jp2/40960,26624,2048,2048/512,/0/default.jpg

resulting in a lot of rescaling work since e.g. when OSD asks for a 8192 wide region with a 512 size, the downsample is exactly 16.

The “best level for downsample” is in this case the orginal level 1 (with downsample 4.000169) which is then of course way too large and has to be downscaled.

Level 2 is not suitable, since it has the downscale factor 16.0022, and this would lead in a slightly to small patch which would have to be upscaled.

In any case, downscaling or upscaling is involved, slowing the image server down. Therefore, I have two related questions:

  • Why is OSD asking for a 8192 sized tile (downsample 16), and not for a 8193 sized tile (downsample 16.0020) which would better fit the provided scaling factor?

  • What is your recommendation for this kind of irregular image pyramids?

Thanks for your thoughts!

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
azaroth42commented, Nov 16, 2017

It’s not a valid IIIF Image API implementation, as scalefactors are required to be integers, not floats. There is a feature request for 3.0 that the OP should submit their use cases to: https://github.com/IIIF/api/issues/447 The issue is currently closed, as we lack use cases to support its inclusion.

0reactions
iangilmancommented, Jun 7, 2018

I actually don’t know if that’s the case. The LegacyTileSource certainly allows you to give it non-power-of-two tiles. I don’t know if it’s somehow translating them to powers of two internally. A quick look at the code for it hasn’t really enlightened me; have you taken a look at it?

At any rate, the other side to look from TiledImage._updateViewport, and see how it handles levels.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Hierarchical image analysis using irregular tessellations
In Section II we introduce the graph formulation of irregular tessellations and the concept of a stochastic image pyramid. In Sections III and...
Read more >
XPMap-Based Irregular Pyramids for Image Segmentation
Image segmentation is one of the first and most important steps in the analysis of image ... For every level of an irregular...
Read more >
File formats · IIIF Online Workshop - IIIF Training
The JPEG2000 and Pyramid Tiff format have these tiles and levels pre-generated into the file format. A Image server just needs to read...
Read more >
Parallel line grouping in irregular curve pyramids - OpenReview
Parallel Line Grouping in Irregular Curve Pyramids*. Walter G, Kl'O)Jat.sch and Dider ... are made of image fpat,lJl'es that art' ''',/Jniji('(wtiy T'r.
Read more >
Edge-preserving Texture Transfer Using the Laplacian Pyramid
mids – an input image pyramid and a texture image pyramid. ... ing irregular shapes whose familiarity to the viewer would cause any...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found