Converts a binary matrix to an sf polygon
Examples
matrixR <- matrix(c(
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 1, 1, 1, 1, 0, 0, 0,
0, 1, 1, 0, 0, 1, 1, 0, 0,
0, 1, 1, 0, 0, 1, 1, 0, 0,
0, 1, 1, 1, 1, 1, 0, 0, 0,
0, 1, 1, 0, 1, 1, 0, 0, 0,
0, 1, 1, 0, 0, 1, 1, 0, 0,
0, 1, 1, 0, 0, 1, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0
), nrow = 9, byrow = TRUE)
polyR <- binaryImageToSF(matrixR, xmin = 0, xmax = 1, ymin = 0, ymax = 1)
plot(polyR)