fieldSegment in R - error

33 views
Skip to first unread message

Marcelo Barbosa

unread,
Aug 28, 2024, 2:20:31 PM8/28/24
to FIELDimageR: A R package to analyze orthomosaic images from field trials.
Hi everybody,

I'm getting an error when trying to segment a multispectral orthomosaic. I've drawn the polygons representing the plant and soil classes, respectively. Also, I can see the created points in the variable "training_sam"  (200 for each class). But I get an error when I try to use the fieldSegment function.

soil<-fieldView(mosaic = ortho1, editor = TRUE)
soil<-st_as_sf(st_sample(soil, 200))
soil$class<-'soil'

plants<-fieldView(mosaic = ortho1, editor = TRUE)
plants<-st_as_sf(st_sample(plants, 200))
plants$class<-'plants'

training_sam<-rbind(soil,plants)


classification <- fieldSegment(mosaic = ortho1, trainDataset = training_sam)

[1] "Starting supervised classification ..."
Error in predict.randomForest(modelFit, newdata) :
  variables in the training data missing in newdata

Could somebody please help me with this?
Reply all
Reply to author
Forward
0 new messages