Joint estimation of segmentation and structure from motion