Fast adaptive frame preprocessing for 3D reconstruction