Method and system for coding segmented images and corresponding decoding method and system