data(bot)
coo <- bot@coo[[1]]
chc <- pix2chc(coo)
coo.plot(chc2pix(chc))
# Illustration of chain coding
plot(NA, xlim=c(0, 3), ylim=c(0, 3), axes=FALSE, ann=FALSE, xaxs="i", yaxs="i")
title("Position of the next pixel and corresponding chain-code")
abline(h=0:3, v=0:3)
rect(1, 1, 2, 2, col="grey80")
text(1.5, 1.5, "Starting
pixel", cex=2)
text(x=c(2.5, 2.5, 1.5, rep(0.5, 3), 1.5, 2.5),
y=c(1.5, rep(2.5, 3), 1.5, rep(0.5, 3)), labels=0:7, cex=2)
Run the code above in your browser using DataLab