registerBand3: Single Band-to-Band Registration (Rotation and Translation)

View source: R/registerBand3.R

registerBand3R Documentation

Single Band-to-Band Registration (Rotation and Translation)

Description

Hyperspectral image acquisition normaly causes spatial misalignment between the spectral bands (layers) due to both equipment (such as band-to-band recording delay) and external factors (e.g. sensor vibrations). In this case, a geometric correction is necessary for remote sensing applications such as combining/merging spectral bands. This function uses the HOG (Histogram of Oriented Gradient) descriptor in order to find the optimal rotation angle and translation (xy shift) on a 'slave' band to be spatially align with a 'master' (reference) band.

Usage

registerBand3(slave, master, ncells = 24, orient = 8, start_affine)

Arguments

slave

An object of class RasterLayer (from package raster).

master

An object of class RasterLayer (from package raster).

ncells

An integer giving the number of cells to compute the oriented gradients of the HOG descriptor. Default is 24. See OpenImageR::HOG().

orient

An integer giving the number of orientations to compute the oriented gradients of the HOG descriptor. Default is 8. See OpenImageR::HOG().

start_affine

A numeric vector containing the starting values for the affine parameters to be optimized, i.e., the shift in x and y and the rotation angle (in degrees). Example: start_affine = c(1, 0, -2), which indicates a shift of 1 in the x-axis, 0 in the y-axis and a clockwise (negative values) angle of 2 degrees. See more in affineBrick().

Details

This should be used carefully, as rotation affects the spatial dimensions. It is recommended to try registerBand() first.

The affine parameters are estimated using a general optimization algorithm.

Value

An object of the same classe as the input slave, with the fixed extent. An additional attribute called 'affine_pars' is stored, containing the rotation angle (degrees) and the shift in x and y in the same unit as the spatial extent of the image.

See Also

OpenImageR::HOG(), registerBrick(), registerBand()

Examples

p <- system.file('exdata', 'soybean.tif', package = 'hyperbrick')
im <- brick(p)
print(im)

# see how layer 1 is misregistered
plot(im[[3]], col = gray.colors(20), asp = 0)
plot(im[[1]], add = TRUE, legend = FALSE,
     col = adjustcolor(terrain.colors(20), 0.6))

# remove the #s to run
# b1_reg <- registerBand3(slave = im[[1]], master = im[[3]],
#                         start_affine = c(0, 0, -2.5))
# attr(b1_reg, "affine_pars")

# plot(im[[3]], col = gray.colors(20), asp = 0)
# plot(b1_reg, add = TRUE, legend = FALSE,
#      col = adjustcolor(terrain.colors(20), 0.6))



hyperbrick documentation built on April 1, 2022, 9:07 a.m.