warp2 | R Documentation |
Register two images by warping a "moving" image to align with the "fixed" image.
# Transformation-based registration
warp2_trans(x, y, control = list(),
trans = c("rigid", "similarity", "affine"),
metric = c("cor", "mse", "mi"), nbins = 64L,
scale = TRUE, dimout = dim(y))
# Mutual information
mi(x, y, n = 64L)
x , y |
Images to be aligned by warping |
control |
A list of optimization control parameters. Passed to |
trans |
The type of transformation allowed: "rigid" means translation and rotation, "similarity" means translation, rotation, and scaling, and "affine" means a general affine transformation. |
metric |
The metric to optimize. |
nbins , n |
The number of histogram bins to use when calculating mutual information. |
scale |
Should the images be normalized to have the same intensity range? |
dimout |
The dimensions of the returned matrix. |
warp2_trans()
performs a simple transformation-based registration using optim
for optimization.
A numeric vector the same length as y
with the warped x
.
Kylie A. Bemis
trans2d
,
optim
set.seed(1)
x <- matrix(0, nrow=32, ncol=32)
x[9:24,9:24] <- 10
x <- x + runif(length(x))
xt <- trans2d(x, rotate=15, translate=c(-5, 5))
xw <- warp2_trans(xt, x)
par(mfcol=c(1,3))
image(x, col=hcl.colors(256), main="original")
image(xt, col=hcl.colors(256), main="transformed")
image(xw, col=hcl.colors(256), main="registered")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.