Learn R Programming

SSIMmap (version 0.1.1)

ssim_raster: The SSIM index for raster images.

Description

This function calculates the SSIM, a measure of similarity between two raster images

Usage

ssim_raster(img1, img2, global = TRUE, w = 3, k1 = NULL, k2 = NULL)

Value

If global is TRUE, returning the global average of SSIM, SIM, SIV, and SIP. If the option is FALSE, a terra raster brick containing the SSIM, SIM, SIV, and SIP for each cell is returned.

Arguments

img1

A terra raster object representing the first image.

img2

A terra raster object representing the second image.

global

If global is TRUE, returning the global average of SSIM, SIM, SIV, and SIP. If the option is FALSE, a terra raster brick containing the SSIM, SIM, SIV, and SIP for each cell is returned.Default is TRUE.

w

Integer specifying the window size for the local neighborhood. Default is 3.

k1

The constant used in the SSIM calculation. Default is NULL, in which case it is computed from the maximum value of the images.

k2

The constant used in the SSIM calculation. Default is NULL, in which case it is computed from the maximum value of the images.

Details

This function computes the SSIM index for two raster images.

Examples

Run this code
single<-system.file("/ex/single2nm.tif", package="SSIMmap")
group<-system.file("/ex/groups2nm.tif", package="SSIMmap")
whale_single<-terra::rast(single)
whale_groups<-terra::rast(group)
ssim_raster(whale_single,whale_groups)
result_raster<-ssim_raster(whale_single,whale_groups,global=FALSE)

Run the code above in your browser using DataLab