GNU Astronomy Utilities

Next: , Previous: , Up: Arithmetic operators   [Contents][Index] Interpolation operators

Interpolation is the process of removing blank pixels from a dataset (by giving them a value based on the non-blank neighbors).


Interpolate the blank elements of the second popped operand with the median of nearest non-blank neighbors to each. The number of the nearest non-blank neighbors used to calculate the median is given by the first popped operand.

The distance of the nearest non-blank neighbors is irrelevant in this interpolation. The neighbors of each blank pixel will be parsed in expanding circular rings (for 2D images) or spherical surfaces (for 3D cube) and each non-blank element over them is stored in memory. When the requested number of non-blank neighbors have been found, their median is used to replace that blank element. For example the line below replaces each blank element with the the median of the nearest 5 pixels.

$ astarithmetic image.fits 5 interpolate-medianngb

When you want to interpolate blank regions and you want each blank region to have a fixed value (for example the centers of saturated stars) this operator is not good. Because the pixels used to interpolate various parts of the region differ. For such scenarios, you may use interpolate-maxofregion or interpolate-inofregion (described below).


Similar to interpolate-medianngb, but will fill the blank values of the dataset with the minimum value of the nearest neighbors.


Similar to interpolate-medianngb, but will fill the blank values of the dataset with the maximum value of the nearest neighbors. One useful implementation of this operator is to fill the saturated pixels of stars in images.


Interpolate all blank regions (consisting of many blank pixels that are touching) in the second popped operand with the minimum value of the pixels that are immediately bordering that region (a single value). The first popped operand is the connectivity (see description in connected-components).

For example with the command below all the connected blank regions of image.fits will be filled. Its an image (2D dataset), so a 2 connectivity means that the independent blank regions are defined by 8-connected neighbors. If connectivity was 1, the regions would be defined by 4-connectivity: blank regions that may only be touching on the corner of one pixel would be identified as separate regions.

$ astarithmetic image.fits 2 interpolate-minofregion

Similar to interpolate-minofregion, but the maximum is used to fill the blank regions.

This operator can be useful in filling saturated pixels in stars for example. Recall that the interpolate-maxngb operator looks for the maximum value with a given number of neighboring pixels and is more useful in small noisy regions. Therefore as the blank regions become larger, interpolate-maxngb can cause a fragmentation in the connected blank region because the nearest neighbor to one part of the blank region, may not fall within the pixels searched for the other regions. With this option, the size of the blank region is irrelevant: all the pixels bordering the blank region are parsed and their maximum value is used for the whole region.

Next: Dimensionality changing operators, Previous: Filtering (smoothing) operators, Up: Arithmetic operators   [Contents][Index]