# Simple uninteresting example for the R robots.
x <- y <- matrix(0, 20, 40)
x[ 12:18, 2:3 ] <- 1
y[ 13:19, 5:6 ] <- 1
xycoords <- cbind(rep(1:20, 40), rep(1:40, each = 20))
tmp <- rigider(x1 = x, x0 = y, p0 = xycoords)
tmp
plot(tmp)
# Rotate a coordinate system.
data( "geom000" )
loc <- cbind(rep(1:601, 501), rep(1:501, each = 601))
# Rotate the coordinates by pi / 4.
th <- c(0, 0, pi / 4)
names(th) <- c("x", "y", "rotation")
cen <- colMeans(loc[ geom000 > 0, ])
loc2 <- rigidTransform(theta = th, p0 = loc, cen = cen)
geom101 <- Fint2d(X = geom000, Ws = loc2, s = loc, method = "round")
if (FALSE) {
image.plot(geom101)
# Try to find the optimal rigid transformation.
# First, allow a translation as well as rotation.
tmp <- rigider(x1 = geom101, x0 = geom000, p0 = loc,
rotate = TRUE, verbose = TRUE)
tmp
plot(tmp)
# Now, only allow rotation, which does not work as
# well as one would hope.
tmp <- rigider(x1 = geom101, x0 = geom000, p0 = loc,
translate = FALSE, rotate = TRUE, verbose = TRUE)
tmp
plot(tmp)
# Using correlation.
tmp <- rigider(x1 = geom101, x0 = geom000, p0 = loc,
rotate = TRUE, loss = "QcorrRigid", verbose = TRUE)
tmp
summary(tmp)
plot(tmp)
##
## Examples from ICP phase 1.
##
## Geometric cases.
##
data( "geom001" )
data( "geom002" )
data( "geom003" )
data( "geom004" )
data( "geom005" )
tmp <- rigider(x1 = geom001, x0 = geom000, p0 = loc, verbose = TRUE)
tmp
plot(tmp)
tmp <- rigider(x1 = geom002, x0 = geom000, p0 = loc, verbose = TRUE)
tmp
plot(tmp)
tmp <- rigider(x1 = geom003, x0 = geom000, p0 = loc, verbose = TRUE)
tmp
plot(tmp)
tmp <- rigider(x1 = geom004, x0 = geom000, p0 = loc, verbose = TRUE)
tmp
plot(tmp)
# Note: Above is a scale error rather than a rotation, but can we
# approximate it with a rotation?
tmp <- rigider(x1 = geom004, x0 = geom000, p0 = loc, rotate = TRUE,
verbose = TRUE)
tmp
plot(tmp)
# Ok, maybe need to give it better starting values? Or, run it again
# with just the translation.
tmp <- rigider(x1 = geom005, x0 = geom000, p0 = loc, verbose = TRUE)
tmp
plot(tmp)
}
Run the code above in your browser using DataLab