rsbivand/rgrass

error with segmentation.grass()

LBorgers opened this issue · 2 comments

I'm trying to segment a tif-file using grass and the following code:

initGRASS("E:/GRASS GIS 7.8", tempdir(), override=TRUE) #path to GRASS windows PC
##LINUX
#initGRASS("/usr/lib/grass78", home = tempdir(), gisDbase = tempdir(), location = "xtagle(tempfile())", mapset = "user1(tempfile())", override = TRUE) #path to GRASS Linux cluster

#LOAD IMAGE AND VECTOR TO GRASS
load.to.grass("./data/Cropped_droneIMG.tif", "RGB")

#SET REGION PARAMETER TO MATCH RGB
execGRASS("g.region", parameters= list(raster="RGB.1"))
execGRASS("g.region",flags="p")

#MAKE GROUP (needed for segmentation)
make.group.grass(c("RGB.1", "RGB.2","RGB.3"),"group-1")

##PERFORM SEGMENTATION
segments<-segmentation.grass(group="group-1",ext=NA,min.size=50,threshold=0.05) #min.size: grouping of pixels, threshold: similarity, higher values bigger segments

at first the segmentation seems to work but in the end returns an error:
image

This seems similar to this problem: #27

I've tried to run grass in R with OSgeo4w but it did not work.

Cheers,
Leendert

Please only raise strictly rgrass7 issues here, and always provide sessionInfo() output. The failing function is not from this package. Please provide a minimal reproducible example without unknown packages or functions. Please do not use images to report problems, they are often illegible. Please repeat outside RStudio.

It may be the proj.db version issue, but running rgrass7::getLocationProj() by itself would check that, and I assume you are running 0.2-6, which was believed to resolve that problem.

Thank you, and my apologies for the bad problem description. I thought segmentation.grass was a grass function but that was an imported function. Running segmentation in my own script works!