Image Encoding and Segmentation