A novel grating matching method for 3D reconstruction