Motion Estimation and region Segmentation via Functional Optimization