accuracy of image overlay / MeshSubdivider

classic Classic list List threaded Threaded
1 message Options
ShaderMan ShaderMan
Reply | Threaded
Open this post in threaded view
|

accuracy of image overlay / MeshSubdivider

Hi!

I'm trying to display an image on the globe using ImageOverlay but i ran into accuracy issues:


left : qgis screenshot : right: osgearth with imageoverlay
the image i was loading in osgearth was 720x720 px and 90°x90°

you can see on the left that there are two lone pixels between the coast of england and france , on the osgearth side they are not touching the coast , they are located higher in latitude
the bigger the image i load, the bigger the error is:

for a 16 x 16 px image on a 4x4° overlay the middle pixel is offset by 33m
for a 32 x 32 px image on a 8x8° overlay the middle pixel is offset by 150m
for a 64 x 64 px image on a 16x16° overlay the middle pixel is offset by 609m

i tried to play with the overlay setGeometryResolution but it only worsen the issue.

here is the code i was using:

    osgEarth::Annotation::ImageOverlay* overlay = new osgEarth::Annotation::ImageOverlay(mapNode);

    overlay->setGeometryResolution(osgEarth::Distance(0.25, osgEarth::Units::DEGREES));<

    overlay->setImage(seq.get());

    overlay->setBounds(osgEarth::Bounds(startLon, startLat, endLon, endLat));

    overlay->setDraped(true);

    overlay->setMagFilter(osg::Texture::NEAREST);


So i tried to peek into imageoverlay.cpp and i saw that the geometry was created by calling MeshSubdivider on the vertices and i guess the texture coordinates too.

Do i see these errors because of some issue in MeshSubdivider or am i hitting the accuracy limits of the texture coordinate?

Do you see any mitigation option other than trying to do a dynamic tile system with image overlays?

I need to use image overlay because it's the only way i found to locate an image anywhere between two vector layers.

Thanks,
Regards

ShaderMan