This article is a follow up to “The Bag of Words model in OpenCV 2.2” in which I explained how to use the BoW classes in OpenCV to create BoW representations for images. Here I will explain how to use the Normal Bayes Classifier -which is also implemented in OpenCV- to categorize images.
In this article we treat image categorization as a supervised learning task. For those who don’t know what supervised learning is I will not try to give an introduction here. Please have a look at wikipedia.
The Normal Bayes Classifier is a very simple classifier which assumes that the class-conditional distribution of the data is normal. Consequently, what the classifier does, is estimate the covariance matrices and means per class. To classify an instance, it chooses the class under whose class-conditional density the instance has the highest probability. Continue reading →