View source: R/registerBand3.R
registerBand3 | R Documentation |
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.
registerBand3(slave, master, ncells = 24, orient = 8, start_affine)
slave |
An object of class |
master |
An object of class |
ncells |
An integer giving the number of cells to compute the oriented
gradients of the HOG descriptor. Default is 24. See |
orient |
An integer giving the number of orientations to compute the
oriented gradients of the HOG descriptor. Default is 8. See |
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: |
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.
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.
OpenImageR::HOG()
, registerBrick()
, registerBand()
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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.