Does R have a bell or skeletonization algorithm for raster objects similar to the GIS thinning algorithm (for example, r.thin, GRASS GIS)?

I know that I can execute r.thin from GRASS GIS in the rgrass7 package, but I do not want to create a gis grass environment for this task. So are there other solutions in R?

For a small example, the desired output would be a black line:

library(raster)
#create synthetic raster
values<-c(1:10000)
r <- raster(ncol=100, nrow=100, xmn=0, xmx=100, ymn=0, ymx=100)
r[]<-0
r[]<-ifelse(values>4500 & values<5501,1,0)
plot(r)
lines(c(0,100),c(50,50),col="black")
+4
source share

Source: https://habr.com/ru/post/1619991/


All Articles