# ImageClassifier

## Brief Description

Performs a classification of the input image according to a model file.

## Tags

Learning

## Long Description

This application performs an image classification based on a model file produced by the TrainImagesClassifier application. Pixels of the output image will contain the class labels decided by the classifier (maximal class label = 65535). The input pixels can be optionally centered and reduced according to the statistics file produced by the ComputeImagesStatistics application. An optional input mask can be provided, in which case only input image pixels whose corresponding mask value is greater than 0 will be classified. The remaining of pixels will be given the label 0 in the output image.

## Parameters

- [param] -in <string> The input image to classify.. Mandatory: True. Default Value: ""
- [param] -mask <string> The mask allows restricting classification of the input image to the area where mask pixel values are greater than 0.. Mandatory: False. Default Value: ""
- [param] -model <string> A model file (produced by TrainImagesClassifier application, maximal class label = 65535).. Mandatory: True. Default Value: ""
- [param] -imstat <string> A XML file containing mean and standard deviation to center and reduce samples before classification (produced by ComputeImagesStatistics application).. Mandatory: False. Default Value: ""
- [param] -out <string> Output image containing class labels. Mandatory: True. Default Value: ""
- [param] -confmap <string> Confidence map of the produced classification. The confidence index depends on the model : - LibSVM : difference between the two highest probabilities (needs a model with probability estimates, so that classes probabilities can be computed for each sample) - OpenCV * Boost : sum of votes * DecisionTree : (not supported) * GradientBoostedTree : (not supported) * KNearestNeighbors : number of neighbors with the same label * NeuralNetwork : difference between the two highest responses * NormalBayes : (not supported) * RandomForest : Confidence (proportion of votes for the majority class). Margin (normalized difference of the votes of the 2 majority classes) is not available for now. * SVM : distance to margin (only works for 2-class models) . Mandatory: False. Default Value: ""
- [param] -ram <int32> Available memory for processing (in MB). Mandatory: False. Default Value: "128"
- [param] -inxml <string> Load otb application from xml file. Mandatory: False. Default Value: ""
- [param] -outxml <string> Save otb application to xml file. Mandatory: False. Default Value: ""

## Limitations

The input image must have the same type, order and number of bands than the images used to produce the statistics file and the SVM model file. If a statistics file was used during training by the TrainImagesClassifier, it is mandatory to use the same statistics file for classification. If an input mask is used, its size must match the input image size.

## Authors

OTB-Team

## See Also

TrainImagesClassifier, ValidateImagesClassifier, ComputeImagesStatistics

## Example of use

- in: QB_1_ortho.tif

- imstat: EstimateImageStatisticsQB1.xml

- model: clsvmModelQB1.svm

- out: clLabeledImageQB1.tif