Sub-pixel Reprojection

When reprojecting images, a direct sub-pixel reprojection option appears in the Method box of the Reproject Component dialog.  It enables computation of coordinate system transformations for images to conversion accuracy even more detailed than the size of a single pixel, producing better quality reprojected images than the standard method used by default to reproject images.   The better quality may be important in some use cases when a single original pixel during warping / georegistration expands to more than one pixel in the new image, or vice versa.

 

 

The Method box in the dialog allows us to choose the reprojection method:

 

 

When we choose direct sub-pixel as the Method, a Pixel Divisions box appears that allows us to specify the number of pixel divisions.   

 

 

One division splits each pixel into four quarters for computation.  Two divisions splits each pixel into nine sections.

 

 

Consider the image above, a zoomed in view of an aerial photography image provided by the state of Indiana showing Indianapolis.  Each pixel covers a 6-inch (15 cm) square.   The image is in NAD83 / Indiana East (ftUS) (EPSG:2965) projection.

 

We zoom further into the monument near the center of the view, using View - Zoom to Native so that each pixel in the image fills one pixel on screen.

 

 

Zooming even further, we begin to see individual pixels in the image.   The illustration above is contrived using graphics editing software, since Manifold will automatically smooth and interpolate pixels when zooming further into views, instead of growing pixels into blocks.

 

 

Zooming even further, we have marked a single pixel in the center of the display with a black box.    Using the

 

 

The default pixel division of 1 splits each pixel into four quarters, each of which can be computed independently in the coordinate system transformation.  A pixel division of 2 would split the pixel further into nine sections.

A Thought Example

We can imagine how the process works by considering a thought example, using nine pixels from the center of the display above.

 

 

We start with the original image pixels, shown above.  

 

We can image that the reprojection process of converting to a new coordinate system resizes, warps and repositions each of the pixels into a new position and shape, as seen below.

 

 

The standard method works with whole pixels, as seen above, to resize, warp and reposition them into a new coordinate system.

 

 

Pixels in images are an array of adjacent rectangles of the specified X and Y size, not warped rhomboid shapes with spaces in between, so the result image (represented by the grid above) creates pixels by interpolating pixel values, whatever those values represent, such as height or colors, from our thought experiment pixel shapes.   

 

When we use the direct sub-pixel method, we can imagine that each individual starting pixel is sub-divided into smaller units, each of which can be independently converted into the new coordinate system.

 

 

The direct sub-pixel method works with smaller subunits, as seen above.  We can imagine how using many more, smaller sections allows the coordinate transformation mathematics to apply more accurate and detailed transformations, instead of averaging out the calculations to the full size of the original pixels.

 

 

The resulting image is still going to consist of the same size pixels as if we had used the standard method, but each result pixel can be interpolated from a greater number of contributing parts.  This provides a more accurate result from the coordinate transformation and interpolation.

 

While the direct sub-pixel method provides more accurate results of coordinate system transformations, the standard method is still very good, and in many uses there will be no visible difference between the two.

Comparison:  Pseudo Mercator Projection

We can see the differences between the standard and the direct sub-pixel methods by re-projecting our sample image from NAD83 / Indiana East projection it uses into Pseudo Mercator.

 

In the examples that follow, the standard method examples use the non-default nearest neighbor interpolation method, which in this particular image does the best job of producing jagged, pixelated edges.  We deliberately use the worst choice in interpolation method to emphasize the difference between standard and direct sub-pixel, since the difference using bilinear is so subtle it can be difficult to see in zoomed out illustrations like those used in this documentation.

 

 

We start with a zoomed in view of the base of the monument and surrounding walkway.   

 

We reproject to Pseudo Mercator using the standard method to create the image at left below, and then we reproject to Pseudo Mercator using the direct sub-pixel method, using 1 pixel division, to create the image at right below.

 

 

The magenta arrow in the illustration at left shows how the standard method resulted in a slightly jagged edge to the walkway, while the direct sub-pixel method resulted in a smoother, better interpolated edge.  

 

 

We can again reproject to Pseudo Mercator using the direct sub-pixel method, using 2 pixel divisions, to create the image at above right.  The 1 pixel division result is repeated at above left, for easy comparison.  For this image, there is no evident difference between using 1 and 2 pixel divisions.

 

 

We can compare the visual effect of smoother interpolation by zooming into both the standard and the 1 division windows.    Complicating the view is automatic interpolation Manifold is doing when we zoom so far into a display that individual pixels would appear as blocks without interpolation on the fly during display.

 

 

The 2 divisions view shows no evident difference from the 1 division view.

Comparison:  Sinusoidal Projection

The more radically different the new coordinate system, the more we will normally see a difference between using the standard method and the direct sub-pixel method.    

 

The Sinusoidal projection is a particularly inappropriate projection for realistic views of downtown Indianapolis because of the distortion it causes in that region, so we will use that as an example.

 

 

We start with a zoomed in view of the base of the monument and surrounding walkway.   

 

We reproject to Sinusoidal using the standard method to create the image at left below, and then we reproject to Sinusoidal using the direct sub-pixel method, using 1 pixel division, to create the image at right below.

 

 

The image is very distorted in Sinusoidal, with a jagged edge to the walkway visible when using the standard method. The direct sub-pixel method, using 1 pixel division, provides a visibly smoother result.

 

 

Comparing the 1 division result at left with the 2 divisions result at right there is no evident gain using 2 pixel divisions.

Differences between Standard Interpolation Methods

The standard choice for method uses bilinear as the default choice of Interpolation, with optional choice of bicubic or nearest neighbor interpolation.  Depending on the particular image, the differences between interpolation methods may be visible or not visible at all.  Generally, we choose the interpolation based on the data as well, for example, when reprojecting rasters that show abstract scientific data, where we may want to know for sure the specific interpolation method used in a coordinate system transformation.

 

 

Comparing the original image at left above with the result of a reprojection using the default, standard bilinear interpolation method at above right, we see bilinear interpolation produces very good results, in some places smoother than the original.

 

 

Comparing default bilinear interpolation to bicubic interpolation, we see that for this particular raster, we see few visible differences, with possibly slightly better contrast using bicubic interpolation for the edges of steps surrounding the monument.

 

 

Comparing default bilinear interpolation to nearest neighbor interpolation, we see that nearest neighbor results in stronger pixelation effects on the edges of pavement surrounding the monument.

Notes

Sample imagery - The image of Indianapolis used in this topic is part of the 6-inch (15 cm) resolution 2013 IndianaMap Data, RGBI Orthophotography data set available for free download in GeoTIFF form from the Indiana University website.   The specific tile used is in2013_01871645_06.zip   The zip file unzips into a GeoTIFF with .aux and .tfw sidecar files.  The GeoTIFF provides correct georeferencing information, but the two sidecar files provide bogus information to override the coordinate system information in the GeoTIFF.  To import the file into Manifold, first delete the aux and .tfw sidecar files.  The .tif will then be imported with the GeoTIFF coordinate system information and will be accurately georegistered.

 

See Also

Info Pane

 

Coordinates

 

Projections

 

Assign Initial Coordinate System

 

Repair Initial Coordinate System

 

Sub-pixel Reprojection

 

Map Projection

 

Coordinate System

 

Coordinate System Metrics

 

Base Coordinate System

 

Favorite Coordinate Systems

 

Favorite Base Coordinate Systems

 

Reprojection Creates a New Image - Why changing the projection of an image creates a new image.

 

Example: Detecting and Correcting a Wrong Projection - A lengthy example exploring projection dialogs and a classic projection problem.  We save a drawing into projected shapefiles and then show on import how a projection can be quickly and easily checked and corrected if it is wrong.

 

SQL Example: List Transformation Grids - In this example we use a few snippets of easy SQL to list NTv2 and NADCON transformation grids that are available within the grids.dat compressed collection of transformation grid files.   Grid transformation files can be used when creating custom base coordinate systems, for NADCON / HARN / HPGN and NTv2 high accuracy transformations that use grid files.

 

About Coordinate Systems

 

Projections Tutorial

 

Latitude and Longitude are Not Enough

 

Example: Convert a 0 to 360 Degree Projection - We often encounter data, both images and drawings, using latitude and longitude degrees that appears to be in Latitude / Longitude projection but which has longitude values from 0 degrees to 360 degrees and latitude values from 0 degrees to 180 degrees, instead of the usual arrangement of -180 degrees to 180 degrees for longitude centered on the Prime Meridian, and -90 degrees to 90 degrees for latitude centered on the Equator.  This example shows how to utilize such data by assigning the correct projection.

 

Example: Assign Initial Coordinate System - Use the Info pane to manually assign an initial coordinate system when importing from a format that does not specify the coordinate system.

 

Example: Reproject a Drawing - An essential example on changing the projection of a drawing, either within the drawing itself, or by changing the projection of a map window that shows the drawing and on the fly reprojects the drawing for display.

 

Example: Change Projection of an Image - Use the Reproject Component command to change the projection of an image, raster data showing terrain elevations in a region of Florida, from Latitude / Longitude to Orthographic centered on Florida.

 

Example: Adding a Favorite Coordinate System - Step by step example showing how to add a frequently used coordinate system to the Favorites system.

 

Example: Change the Pixel Size of a Terrain Elevation Image - Use the Reproject Component dialog to change the pixel size of a terrain elevation image, reducing the total number of pixels used.  This process is also called resampling.