Image segmentation and classification based on discriminatively-trained Markov random fields