TrainVectorClassifier train a supervised classifier from an input layer. each element of the input layer needs to contain :
- An integer class field : in your case it could be 0 for vegetation or 1 for non vegetation. The name of the field is set in the application with the parameter
- Training features : The list of values that should be used for training the model. It can be set with the
If I understand correctly, you are trying to perform the classification on the result of a segmentation. You have to add the fields mentioned above to your layer before calling
For the training features an option is to use for each geometry the mean of the radiometry in the geometry (for each band of the input image). This can be done with the
ZonalStatistics application (since OTB 7.0).
For the class field you could use the mean of the class, if you have a ground truth image.
If you don’t have ground truth, you can perform unsupervised learning instead. There is only one unsupervised algorithm in
TrainVectorClassifier, a kmean clustering (sharkkm option).
The VectorClassifier will not filter its input, the processed layer will contain the same geometries as the input, with an additional class field containing the integer result.
Hope that helps.