Type In this topic we 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.
There are two ways in Manifold to resize an image by changing the size of pixels:
The data set used in this topic is an image showing terrain elevation in Florida centered on the Lake Wales Ridge, which includes the highest parts of what is a relatively flat state. It was downloaded in ESRI ArcGrid .adf format within a file called USGS_NED_13_n28w082_ArcGrid.zip from a USGS FTP site.
We use a terrain elevation raster image from the 1/3 Arc Second National Elevation Dataset (NED), which provides resolution with pixels approximately 10 meters in X and Y size.
The image is shown above as a layer in a map, styled with hill shading and using the CB Spectral palette where lower regions are blue and higher regions are colored red.
Zooming into the hilly region on the Northwest shore of Lake Lemore, we can see the good resolution provided by the 1/3 Arc Second data set, where the raised railroad line is clearly visible between the base of the hill and the lake.
We can learn more about the image by taking a look with the Reproject Component dialog. We reach that dialog through the Component tab of the Info pane.
In the Component tab of the Info pane we click the coordinate system picker button and choose Reproject Component in the dropdown menu.
The dialog reports the image is 10765 by 10765 pixels in size, totalling to over 442 MB.
The Local scales values tell us the size of the pixels, in degrees, since that is the unit of measure for the Latitude / Longitude projection the image uses.
Dealing with Degrees as a Unit of Measure: Degrees can be sloppy as a unit of measure, because the linear size of a "degree" is different depending on the bearing being measured, such as along lines of latitude or lines of longitude or a bearing in between, and the position on Earth, such as nearer the Equator or nearer the poles. One degree moving directly East or West along the Equator is about 111 kilometers, but one degree moving directly East or West at the latitude of our data set in Florida (about 27 degrees North) is only about 99 kilometers.
When resampling images, it is usually easier to understand what is going on by first reprojecting the image into a projection that uses linear units (like meters or feet) as a unit of measure, and, ideally, a projection which also minimizes scale distortion in the area of interest. The values then which appear in the Local scales boxes will also be more understandable, since they will not be small fractions of unwieldy, large units like degrees, which cover a hundred kilometers or so in a region where each pixel is only about ten meters in size. It is a lot easier to understand what size a pixel is when we see 10 meters in the Local scales boxes instead of a value like 9.3e-05 degrees.
But since the NED data set has published this image in a Latitude / Longitude, using degrees, we may as well learn to work with degrees.
Uncheck the Auto box, to enable the Local scales boxes.
Local scales when working with degrees can involve many digits or numbers best represented using scientific notation. That is one annoying side effect of using degrees as units. If we are not familiar with scientific notation, we can see what the numbers mean in the Local scales values by unchecking the Auto box, to enable the Local scales boxes. We can then by trial and error enter different values using ordinary decimal notation to see how Manifold updates the image size, which it will do dynamically as we change values.
Scientific notation with a minus sign to the exponential value (the -05 part) indicates a decimal fraction. We can try our luck by entering .93 and see what that does. Right away, Manifold reports that works out to two pixels by 10765 pixels. That tells us right away .93 is way bigger than what 9.3e-05 means.
We add two more zeros, for a value of .0093 degrees. That results in an image that is 108 pixels wide by 10765 pixels tall. OK.
Adding two more zeros for a value of .000093, we see that results in an image 10765 pixels wide by 10765 pixels tall. Through trial and error we have learned that 9.3e-05 in scientific notation simply means .000093 in ordinary decimal notation.
If we think about that for a bit, since a degree at the latitude of Florida is about 100 kilometers, .000093 * 100 km = .0093 km. That's roughly ten meters, which is the pixel size that a 1/3 arc second data set is supposed to have, quoted at the equator, with pixels slightly smaller at the latitude of Florida.
To reduce the size of the data set, instead of having pixels that are ten meters in size, we will use pixels that are four times bigger: 4 x .000093 = .000372, so that is what we will use. Using pixels that are four times bigger will result in an image that covers the same region using only 2692 x 2692 pixels, for a total size of 27.6 MB, a much smaller image than the original 442 MB.
We press Add Component. Manifold swings into action and creates a new, resampled image called Florida 2.
Adding the new Florida 2 image to the map, at left above, we Style it to match the original Florida image by copying the StylePixel property from the Florida image and pasting it into a new StylePixel property for the Florida 2 image. We then use the Style dialog Options tab to adjust the hill shading Z scale for the Florida 2 image to .25, one fourth the value used for Z scale in the Florida image. Since the pixels are four times bigger in Florida 2, the same height for hill shading is one fourth the scale factor.
We can see from the illustrations above that the Florida 2 image is a lower resolution version of the original, seen at right above. The pixels in the Florida 2 image are approximately 40 meters in size, not the more detailed approximately 10 meter pixels in the original image. Some smaller details have been interpolated away.
Zoomed far out, the loss of detail in Florida 2, at left above, is not noticeable compared to the original Florida image, at right above. That is one reason to resample an image into larger pixels (giving lower resolution and less detail), to reduce the size of the image for uses where the loss of detail will not be noticed. If all we are displaying is a zoomed out view, for example, on a web site, there is no need to use a 442 MB image when 27 MB will do just as well.
When we reproject to bigger pixels, as in this example, the system must interpolate more detailed data into less detailed data. When one pixel larger pixel covers the same region formerly covered by four smaller pixels, the larger pixel takes on an averaged value of the four former pixels. In the new image that is created, the more detailed information formerly within four separate pixels is lost, replaced only by the averaged value in the new, larger pixel.
Since Manifold does not discard or alter the original image when it creates a new, resampled image, if we need original detail we can always work with the original image. However, if that original image is lost or discarded, the higher detail it contains will be lost with that image. We cannot somehow get that detail back from a lower resolution image that we create.
If we have an image that covers a region with pixels that are 100 meters in size we cannot resample that image to pixels of 1 meter in size to somehow bring out details, such as swimming pools that are five meters in size, which cannot be seen in the more fuzzy image that uses pixels 100 meters in size. This is not a limitation of Manifold but a basic consequence of science, where information cannot be conjured up out of nothing.
If a picture is painted with great big dabs of paint as big as a hand, dividing that picture into smaller dabs of paint will not add detail that is not there in the first place. All that will happen is that a region of color formerly painted with one big dab of paint will be painted in exactly the same color covering exactly the same region, but just made up of many small dabs.
We can see that using an extreme example as a thought experiment:
Consider the two paintings shown above. At left is Kazimir Malevich's Black Square, painted in 1915. At right is a slightly zoomed in view of Johannes Vermeer's Girl With a Balance, painted before 1663.
The Black Square is 80 cm by 80 cm in size, four times the size of the approximately 40 cm by 40 cm Vermeer, yet the Black Square basically consists of one, very large pixel, while the Vermeer is painted with such a fine brush and such multi-layer oil paint smoothing that it requires a resolution of around 40 dots per centimeter (100 DPI, in printer terms) to capture as an image, using millions of pixels. 40 pixels per centimeter over an 80 cm by 80 cm region (the size of the Black Square) is over 10 million pixels.
If we resampled the Black Square from one pixel to ten million pixels, we would not get the Vermeer painting. We would simply have a Black Square painting where millions of pixels are used to cover the same region one giant pixel formerly covered, painting a single, large black square. There is nothing about a single, large, black pixel that contains more detailed information on what should be displayed within the single pixel instead of a sea of black, if that single large pixel was resampled into millions of very small pixels. There is no way to get a Vermeer from the Black Square.
Just so, if we have a satellite image with pixels that are 30 meters in size, where a large swimming pool may be a single blue pixel, we cannot resample to divide that big pixel into many smaller pixels to somehow see crisp edges of the pool and people swimming in it. Just like there is no Vermeer in the Black Square, there are no finer details in the 30 meter per pixel image.
Original image is retained - When we press the Add Component button, Manifold creates a new, resampled image in addition to the original image. The system does not throw away the original image, nor is that original image altered "in place." In this topic, for example, a new Florida 2 image was created without altering or discarding the Florida image with which we started.
Hill shading and resampled images - In the Style dialog Options tab, the Z scale parameter for hill shading depends not only upon the elevation of the terrain, but also upon the X and Y dimensions of the pixels. If we use a Z scale of 1 to achieve a given effect for the original Florida image, when we resample the image to make the pixels four times larger in the Florida 2 image we will have to reduce Z scale by approximately four times, to a value of 0.25, to get a similar shading effect.
Is the Black Square a big deal? - In modern art circles, yes. An abstract painting, Suprematist Composition, by Malevich, which includes a number of blue, green, red, black, and mustard colored rectangles sold for $85.8 million in 1918. No doubt the Black Square would sell for more, if it ever came up for sale. The first Vermeer to come up for sale in 80 years, Young Woman Seated At The Virginals, sold for a mere $30 million in 2004, while an atypical, small, signed and dated Vermeer, Saint Praxedis, sold for barely over $8 million in 2014.
Info Pane: Component
Edit - Merge - Merge Drawings
Example: Merge Images - A step-by-step example using the Merge Images command showing how to merge dozens of images showing SRTM terrain elevation data into one image, with various tricks for faster workflow as an experienced Manifold user would do the job. After creating the new image we style it with a palette and use hill shading to better show terrain elevation.
Example: Resize an Image using Merge - We can change the size of an image while maintaining georegistration by using the Merge Images command. This example shows how to take an image that is 3,038 x 4,334 pixels in size, using approximately 36 meter pixels, and to create a re-sampled image that is 1,115 x 1,590 pixels in size, using 100 meter pixels.
SQL Example: Re-tile an Image using a Different Tile Size - Starting with an image that uses a tile size of 128 x 128 pixels this SQL example creates a copy of the image using 500 x 500 pixel tiles.