In general, first you have to prepare the training and testing datasets with proper features and true labels. You can optionally perform feature extraction and selection for better performance. Then, choose a classifer such as SVM to train and test the samples.