On-Chip Ego-Motion Estimation Based on Optical Flow