Encoding and decoding depth from images by controlling statistics and spatial coherence