I want to pan sharpen my Landsat8 scene (according to FIHS algorithm, see here).

According to the paper the following equation should do the pansharpening:

MS_high <- MS_low + (pan - I)

"MS_high" is the pansharpened MS band and "MS_low" the original MS band.

The I image is intended to be a simulated image of the Pan band at the spatial resolution of the MS bands. Spatial details from Pan are obtained by subtracting the lower resolution I band from the higher resolution Pan band.

When doing the substraction (Pan - I) the following output occurs:

Error in compareRaster(e1, e2, extent = FALSE, rowcol = FALSE, crs = TRUE, : different resolution

Does anyone used the FIHS pansharpening algorithm in R so far?

Any suggestions are welcome.

  • 1
    Do the two rasters (Pan and I) have the same resolution? I.e. did you properly resample the I channel first? Oct 6, 2015 at 14:07
  • Thanks for your quick reply. So you think I should do the following steps: 1. resample I to 15m with function resample(I, pan) and then do in a second step the substraction pan (15m resolution) - I (15m resolution)?
    – Seb
    Oct 6, 2015 at 14:12
  • 1
    That's what reading the error message : different resolution suggests. Oct 6, 2015 at 15:45

1 Answer 1


Have a look at panSharp from the satellite package. The function works with regular 'RasterLayer' objects (refer to the second example in ?panSharp, which is also shown below) and supports inputs of different spatial resolution, i.e. internally performs raster::resample. The only arguments panSharp requires are a target layer (x) and the panchromatic channel (pan).

## sample data
path <- system.file("extdata", package = "satellite")
files <- list.files(path, pattern = glob2rx("LC8*.tif"), full.names = TRUE)
sat <- satellite(files)

# target channel
rst_b001n <- getSatDataLayer(sat, "B001n")
# panchromatic channel
rst_panch <- getSatDataLayer(sat, getSatBCDEFromType(sat, type = "PCM"))

## pan-sharpen target layer
rst_b001n_ps <- panSharp(rst_b001n, rst_panch)


  • Is panSharp available in the latest version of "satellite"? Feb 12, 2021 at 11:00
  • Pansharpening and histogram matching have been moved to satelliteTools a while ago. You can install it via remotes::install_github("environmentalinformatics-marburg/satelliteTools").
    – fdetsch
    Feb 15, 2021 at 6:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.