Real-time wavefront reconstruction from intensity measurements