1. An apparatus usable in an image encoding and decoding system, comprising: a segmentation unit to divide an image into one or more blocks, to segment the blocks of the image into a binary mask layer of a foreground and a background according to a cost optimized function and a feature vector of the respective blocks, so as to generate an segmentation image.