trajectory based 3d reconstruction using sum of square