Text this: Nonparametric estimation of the number of classes with different average brightness in thermal images