Learn R Programming

ImageFusion (version 0.0.1)

imagefusion_task: Perform time-series image fusion

Description

The main function of the ImageFusion Package, intended for the fusion of images based on a time-series of inputs.

Usage

imagefusion_task(
  ...,
  filenames_high,
  filenames_low,
  dates_high,
  dates_low,
  dates_pred,
  filenames_pred = NULL,
  singlepair_mode = "ignore",
  method = "starfm",
  high_date_prediction_mode = "ignore",
  verbose = FALSE,
  output_overview = FALSE,
  out_dir = NULL
)

Arguments

...

Further arguments specific to the chosen method. See the documentation of the methods for a detailed description.

filenames_high

A character vector of the filenames of the high resolution input images.

filenames_low

A character vector of the filenames of the low resolution input images.

dates_high

Numeric. An integer vector of the dates associated with the filenames_high. Must match filenames_high in length and order.

dates_low

Numeric. An integer vector of the dates associated with the filenames_low. Must match filenames_low in length and order.

dates_pred

Numeric. An integer vector dates for which an output should be generated.

filenames_pred

(Optional) A character vector of the filenames for the predicted images. If unspecified, filenames will be created from out_dir and pred_dates.

singlepair_mode

(Optional) How should singlepair predictions (those dates_pred, which do not lie between two dates with a high&low pair) be handled?

  • ignore: No prediction will be performed for those dates. This is the default.

  • mixed: Use doublepair mode where possible, and singlepair mode otherwise (only supported for method fitfc and starfm)

  • all: Predict all dates in singlepair mode, using the closest pair date if between pairs (only supported for method fitfc and starfm)

method

(Optional) The algorithm which is used for the fusion.

  • starfm: STARFM stands for spatial and temporal adaptive reflectance fusion model. It requires a relatively low amount of computation time for prediction. Supports singlepair and doublepair modes. See starfm_job.

  • estarfm: ESTARFM stands for enhanced spatial and temporal adaptive reflectance fusion model so it claims to be an enhanced STARFM. It can yield better results in some situations. Only supports doublepair mode. See estarfm_job.

  • fitfc: Fit-FC is a three-step method consisting of regression model fitting (RM fitting), spatial filtering (SF) and residual compensation (RC). It requires a relatively low amount of computation time for prediction. Supports singlepair or a pseudo-doublepair mode(For predictions between two pair dates, predictions will be done twice, once for each of the pair dates). See fitfc_job. This is the default algorithm.

high_date_prediction_mode

(Optional) How to proceed for predictions on those dates which have high resolution images available?

  • ignore: Output nothing for those dates. This is the default.

  • copy: Directly copy the high resolution input images to the output path.

  • force: Use the chosen algorithm to predicts the high resolution input images on themselves. This takes additional computation time, but ensures that the outputs are consistent with the genuinely predicted outputs.

verbose

(Optional) Output additional intermediate progress reports? Default is "false".

output_overview

(Optional) Should a summary of the task be printed to console, and a ggplot overview be returned? Default is "false".

out_dir

(Optional) A directory in which the predicted images will be saved. Will be created if it does not exist. By default, creates a directory "Outputs" in the R temp directory (see tempdir).

Value

A ggplot overview of the tasks (If output_overview is "true")

Details

The function firstly seeks among the inputs for pair dates, which are dates for which have both a high resolution image and a low resolution image are available. It then splits the task into a number of self-contained jobs which handle the fusion between these pair dates using the paired images as anchors. These jobs can also be called directly via their respective functions, see method.

References

Gao, Feng, et al. "On the blending of the Landsat and MODIS surface reflectance: Predicting daily Landsat surface reflectance." IEEE Transactions on Geoscience and Remote sensing 44.8 (2006): 2207-2218.

Wang, Qunming, and Peter M. Atkinson. "Spatio-temporal fusion for daily Sentinel-2 images." Remote Sensing of Environment 204 (2018): 31-42.

Zhu, X., Chen, J., Gao, F., Chen, X., & Masek, J. G. (2010). An enhanced spatial and temporal adaptive reflectance fusion model for complex heterogeneous regions. Remote Sensing of Environment, 114(11), 2610-2623.

Examples

Run this code
# NOT RUN {
# Load required libraries
library(ImageFusion)
library(raster)
# Get filesnames of high resolution images
landsat <- list.files(
  system.file("landsat/filled",
              package = "ImageFusion"),
  ".tif",
  recursive = TRUE,
  full.names = TRUE
)

# Get filesnames of low resolution images
modis <- list.files(
  system.file("modis",
              package = "ImageFusion"),
  ".tif",
  recursive = TRUE,
  full.names = TRUE
)
# Create output directory in temporary folder
out_dir <- file.path(tempdir(),"Outputs")
if(!dir.exists(out_dir)) dir.create(out_dir, recursive = TRUE)
# Run the fusion on the entire time series
imagefusion_task(filenames_high = landsat,
                 dates_high = c(68,77,93,100),
                 filenames_low = modis,
                 dates_low = 68:93,
                 dates_pred = c(65,85,95),
                 out_dir = out_dir)
# remove the output directory
unlink(out_dir,recursive = TRUE)


# }

Run the code above in your browser using DataLab