# Pansharpening¶

The panchromatic band is a single spectral band that usually expands at least two or more visible and/or near infrared bands. As a result, panchromatic band provides the opportunity to enhance the spatial resolution of multispectral bands by using pan-sharpening techniques.

Image fusion, also called pansharpening, is a technique used to integrate the geometric detail of a high-resolution panchromatic image and the color information of a low-resolution multispectral image to produce a high-resolution multispectral image. See http://scenesharp.com/wp-content/uploads/2016/11/Pub_2_Highlight_Article.pdf.

The pansharpening is commonly used for visualization, allowing small details to be observed on multispectral images. Pansharpening procedure refers to the fusion of a panсhromatic and multispectral images simultaneously acquired over the same area.

The spectral bands of Landsat 7 and 8 have a resolution of 30 meters per pixel, while the panchromatic band has a resolution of 15 meters per pixel. Unlike other bands, panchromatic band captures a much wider wavelength range of reflected light, allowing it to be significantly sharper. Thus, panchromatic imagery is twice as detailed as the individual spectral bands.

## Algorithms¶

### Weighted Brovey transform¶

The Brovey transformation is based on spectral modeling and was developed to increase the visual contrast in the high and low ends of the data’s histogram, such as shadows, water and high reflectance areas. It uses a method that multiplies each resampled, multispectral pixel by the ratio of the corresponding panchromatic pixel intensity to the sum of all the multispectral intensities. It assumes that the spectral range spanned by the panchromatic image is the same as that covered by the multispectral channels. The basic procedure of the Brovey transform first multiplies each multispectral band by the high-resolution panchromatic band, and then divides each product by the sum of the multispectral bands.

$DN_{fused1} = \frac{DN_{b1}}{DN_{b1} + DN_{b2} + DN_{b3}}DN_{highres}$

where:

$$DN_{b1}$$ - Digital numbers (DN) of one of multispectral bands.

$$DN_{b1} + DN_{b2} + DN_{b3}$$ - Sum of multispectral bands DN.

$$DN_{highres}$$ - DN of high-resolution panchromatic band.

$$DN_{fused1}$$ - DN of resulting pansharpened band.

However, introducing different band weights as contributions of each spectral band can improve resulting image. Thus the Brovey transform is limited to three bands as we have constant suitable weights only for Landsat 8 OLI R, G and B bands (0.52, 0.25, 0.23 respectively) In other cases resulting image will have color distortions due to the mismatch between the spectral range of the panchromatic band and the lower resolution multispectral bands.

### Pixelwise Weighted pansharpening¶

Due to its limitations Brovey transform is useless in case of pansharpening single band or calculated index of image. In addition, there are no constant weights for RGB-composites derived from Landsat 7 ETM+ sensor data. Pixelwise Weighted pansharpening algorithm is developed to overcome these drawbacks. Its main idea is calculation and usage of weights for each pixel of an image. Thereby this algorithm has wider range of applications than highly specialized algorithms and is essentially independent of the data source. It needs only matrices with pixel values for fusion. The algorithm step by step:

1.Downsampling panchromatic image to dimensions of multispectral one.
2.Weights calculation by dividing the original multispectral by an average of the original multispectral and the result of step 1.
3.Upsampling the result of step 1 to dimensions of panchromatic. Calculation of pan-rescaling weights by dividing the original panchromatic image by the upsampled image.
4.Upsampling multispectral to dimensions of panchromatic.
5.Upsample weights from step 2 to dimensions of panchromatic.

6.The final weights calculation as multiplication of weights from step 5 and weights from step 3

7.Acquisition of weighted average pixel value of resulting image, using upsampled multispectral from step 4, original panchromatic and final weights from step 6

Pixelwise weighted pansharpening algorithm is highly dependent on resampling method used. Available options are: near, bilinear, cubic, cubicspline, lanczos, average, mode, max, min, med, q1, q3. Experiments show high applicability of cubic and cubicspline resampling methods.

### Implementation features of pansharpening algorithms¶

Pansharpening is implemented for Landsat 7 and Landsat 8 scenes as they have high-resolution panchromatic bands.

The Weighted Brovey transform algorithm is used for RGB composite of Landsat 8 with constant weights 0.52, 0.25, 0.23 for first, second and third bands in request respectively. Pixelwise Weighted pansharpening algorithm is used for single band, three-band composites and virtual band of Landsat 7, for single band and virtual band and for other composites except RGB of Landsat 8.

## How to use¶

Pansharpening can be evoked in two different ways, depending on the requested data: the pattern, like PS:B4:B3:B2:B8, and the query parameter PANSHARPENING. Note, that algorithms used do not depend on evocation method, only data as stated in Implementation features of pansharpening algorithms (for Landsat 8 composite Brovey transform is used, in other cases - Pixelwise Weighted pansharpening).

If data is composite of bands one can use both:

GET /L8/LC80110312016028LGN00/PS:B4:B3:B2:B8/13/2501/3051
GET /L7/LE07_L1TP_042032_20170710_20170710_01_RT/B5,B2,B1/15/5638/12346?PANSHARPENING=1
GET /L7/LE07_L1TP_042032_20170710_20170710_01_RT/PS:B3:B2:B1:B8/11/351/773
GET /L8/LC80110312016028LGN00/B4,B3,B2/13/2501/3051?PANSHARPENING=1


When requesting single band, three-band composite or virtual band web tiles from EOS API the query parameter PANSHARPENING is used (see Image tile),

Examples:
GET /L8/LC08_L1TP_040030_20171024_20171107_01_T1/B3/14/3011/6033?PANSHARPENING=1
GET /L7/LE07_L1TP_019036_20170709_20170709_01_RT/B3,B2,B1/13/2176/3248?PANSHARPENING=1
GET /L8/LC08_L1TP_040030_20171024_20171107_01_T1/(B5-B4)/(B5+B4)/14/3011/6033?PANSHARPENING=1
GET /L7/LE07_L1TP_019036_20170709_20170709_01_RT/sqrt(B4/B3)/13/2176/3248?PANSHARPENING=True


## Pansharpening for index images¶

Pansharpening for indices is slightly different from ordinary pansharpening: it uses greater contribution of panchromatic channel to result index image, but it’s internal process in EOS API. Usage is the same as described in How to use - user can define index as alias (RECI, NDVI, NDSI or NDWI) or as virtual band formula.

Examples:
GET /L7/LE07_L1TP_019036_20170709_20170709_01_RT/ndvi/13/2176/3248?PANSHARPENING=True
GET /L8/LC08_L1TP_040030_20171024_20171107_01_T1/(B5-B4)/(B5+B4)/14/3011/6033?PANSHARPENING=1