Image Segmentation and Compression Using Hidden Markov Models