Autor Thema: Fixing Seams in Raster Data  (Gelesen 3348 mal)

Offline gregory

  • Insight Map Creator
  • *
  • Beiträge: 844
Fixing Seams in Raster Data
« am: 07 Oktober 2014, 16:20:01 »
Summary

The Insight Map Creator performs it's interpolation a bit differently than most GIS applications.  The traditional method for image interpolation is to perform it one image at a time and extend the interpolation a half pixel past the reference points to create the clipped images.  This method produces visual artifacts on the final product when upsampling the image since interpolation is only performed from a single side of the image boundaries.

The Insight Map Creator works by attempting to stitch all images with the same offset and the same resolution into a single image before performing the interpolation.  The Insight Map Creator also makes a number of adjustments to aid common issues with image positioning.

This resolves interpolation issues but has a few caveats for it's usage:
  • All images must share the exact same resolution.  In order to stitch the images together into a single image, there must be a common resolution for that image.
  • Images must not be rotated.  In order to stitch the images together, it's preferable that all images be facing the same direction.
  • Images must be positioned at either an even pixel interval or a 1/2 pixel offset from the 0,0 origin of the projection.  This means that if you divide the position by the resolution, both numbers should be very close to ending in either .0 or .5
  • All images must use a world file for positioning.  Tie points make stitching difficult and can easily add rotation into the image.  For this reason, tie points are ignored.

What happens if I don't do this?

Not following the above rules can cause a number of issues with the raster processing. 

An image without a world file or with rotation in the world file will be ignored creating a giant hole in the output.

An image that isn't evenly offset from the origin of the projection will causing shifting up to .75 pixel in one direction and .25 pixel in the other direction as it attempts to position it to an offset position.

Mismatches in the resolution may cause gapping between images because the source images can not be stitched into a single work image and the interpolation is not extended beyond the reference points.

Common Causes

There's things to do that can help fix these issues.  Some are because of improper methodology and some are techniques to reduce rounding error and make imagery more consistent.

Attempt to end your clipped blocks on a reasonably even pixel.  Double precision values for binary representation like powers of 2 (1/4, 1/2, 1, 2, 4, 8, etc.).  String storage like world files can handle powers of 2 up to a certain level (.125, .25, .5, etc.) without loss of precision.  When working with applications that will calculate a resolution independently for each image rather than using the stored value, it's important that the calculation does not add a rounding error.  Making the grid extents at well represented values and making the resolutions at well represented values works well to remove any inconsistencies.

There's a recent common theme of performing reprojections on extents but not interpolating the image to compensate for distortion.  Often times, online imagery is represented in World Mercator (Spherical Mercator based on the WGS84 semi-major axis).  At the same time, the extents of a KML file expects the imagery to be represented in Geographic WGS84.  A lot of applications perform this conversion by taking the extents of the image and converting them from World Mercator to Geographic WGS84.  Since Mercator projections have a logarithmic relationship to Geographic's N-S while maintaining a linear relationship to Geographic's E-W, this adds distortion to the image.  All pixels will visually shift towards the equator with this conversion and will be more noticable the more distant the extents of the image and the further your image is from the equator.  Doing this will also change the resolution of your image's N-S axis because the same amount of pixels are used to represent a differing extent.  Going back to the rules above, this will create gapping in your output image because your images can't be stitched.  When performing this conversion, always interpolate your image rather than just converting the extents.

When possible, adding a buffer (row/column to the bottom and right, for example) can reduce the chance of a gap when images are not stitched.  The Insight Map Creator can handle these when they are found.